PDA

View Full Version : Portrait control not appearing on sheet until it is populated



Varsuuk
March 29th, 2018, 08:07
I finally got the top part of the character sheet looking like I want it (and learned more about anchoring and guesstimating ;))

Basically, while learning I created a "blank" ruleset to which I have been adding the graphic/strings/etc elements from AD&D Core that I want to set up my initial fugly Character Sheet so I can get to the fun Lua functionality coding parts.
I didn't copy many whole xml files from AD&D Core, because I didn't want to have parts I wasn't directly using so I could learn as I added them as well as keeping it clean up misleading information (things in project I did not in fact use.)

So, that said - I could have messed up in close to innumerable ways :)


Problem:
When I create a new character, the Portrait and Token controls are empty. However, while I see the little circle on the right, the portrait box on the left is not visible. If I were to click where it should be, the popup for the select a bag for portraits pops up and I can select one which immediately also populates the token.

Why am I not seeing the "background" vague picture we normally see when unset. It appears on the character select popup but that's expected as I didn't much about with the CoreRPG default behavior/files yet.


I tried, as normally do, to look for the templates/resources/xml in my project that start with "portait_char" and I backtrace up the template etc trail searching for those names in AD&D Core and CoreRPG if not in the former. It does not appear that AD&D Core has anything done differently for that control but obviously I did something incorrect.

Ideas? Where should I look/trace?

pindercarl
March 29th, 2018, 16:07
The portraits use a background image that is defined in graphics_portraits.xml. This image is drawn when no portrait is selected. If there is a portrait to draw, then that image is scaled to match the portrait mask and drawn over the portrait base. If there is no portrait base for the character sheet, then it would appear empty until a portrait was drawn.

When you assign a portrait, can you see the edges of the base image behind it? If not, then look to see if the base image is defined and exists. In CoreRPG, I think it's charlist_base.

Varsuuk
March 29th, 2018, 17:33
You sir Rock. I had started with the portrait_char and portrait_charlocal tracing its inheritance path to look for where it sets the background. Didn’t see anything. Eventually thought maybe it’s some oninit.

I had found the icon and seen reference to it but it didn’t occur to me. The damn GENERICCONTROL that was the first in the trio of controls defined (other two mentioned above) - so to see the background you need to explicitly place it as a control on the page. It isn’t like some other things like charsheet where you give the window itself a background. I get it now and why.

Yeah, so much late night staring too 15 seconds after redone by the search for the charlist_base lil so easy yet so overlooked. Thank you.

And so, I continue onward!

pindercarl
March 29th, 2018, 21:33
You were in luck that I was recently looking at the portrait code for FGU.

Varsuuk
March 30th, 2018, 17:45
Indeed!

Wow, I am really enjoying this. While I am really not skilled at rendering UIs or even matching my shirt and pants when going to work (true story, wife double checks ... I can never seem to memorize valid color combos even, it’s weird) the layout tools once you get the hang of the anchoring makes it a dream to adjust and move things around by moving single anchor, or a couple if they are encapsulated in sections.

I have only gotten through the main screen, classes & levels and attributes + attribute bonuses and various enclosing frames... loving this and I haven’t even gotten to the stuff I will really enjoy - coding the guts in lua. Not sure will love the pattern matching regex work but hey, have plenty of examples to draw on.

Good stuff, wish had less coding at office time so could code this. I may actually start taking lunch away from desk and actually not work during lunch so can work on my laptop on this instead ;)