[Closed] Preserving mapButton captions when opening scene?
Hello all,
I can see from the functionality present in the StandardMaterial and BitmapTexture plugins, that when I leave open the Maps rollout and select a bitmap, the button’s caption ext receives both the map name and a parsed “filenameFromPath” string:
This is not hard at all to do. It’s a combination of the parsed map.name property with the aforementioned filenameFromPath() result of the map.filename property.
I have an algorithm for this working perfectly, and I set up my mapButton’s caption to this – I am making an extended StandardMaterial.
The problem is, whenever I save the scene and load it up again with the material editor opened, I can see that my mapButtons’ captions have, in a first glance, something other than what was previously saved (it’s something in the lines of “Map #x ( MyMapName )” – MyMapName being the name of the map class I extended from the BitmapTexture, and “x” being the map’s number).
If I select a different slot in the material editor and then select my material’s slot back again, the captions go back to normal, as I check an open event for the rollout and then update the mapButtons’ captions.
I do keep my mapButtons’ captions in an array inside a parameter block, so the names are preserved when the scene is saved – that open event for the rollout is used to change the mapButton’s captions to the ones in this array.
This should in theory keep the mapButtons’ captions the same even between scene savings and loadings, but it doesn’t. Not for that “first opening”.
The StandardMaterial’s mapButtons, however, do keep their parsed captions even when doing that save\load-again actions AND with the material editor opened (where my mapButtons fail everytime).
I would like to reproduce the same functionality, but no matter what I do inside the “on rollout open” block, for that first time the captions just won’t be correct (whereas the ones from BitmapTextures will). What can I do?
Thank you.