[Closed] macroscript UI state saved with maxfile
I’d store it in a CA, as ZeBoxx suggests – pretty easy to access then and it stays with the scene. As to persistency structs fall into that problem too – wish there would be some sort of ‘weak’ struct – other than instancing and hoping someone else has got the same one.
Yeah, this is really meant for rollouts. It relies on the open/close event handler. I’m not sure it has use for macros, unfortunately.
It also works per-rollout and per-file. So any settings you save will be specific to that rollout AND that maxfile (I cull off numbers from the end so iterative versions are considered the same). That said, I love uiMgr, I use it at work in all my scripts, and I cannot possibly imagine coding without it anymore. Having TWO lines of code give you all the rollout memory you need is exactly why I push libraries and reuse in the first place. The work that would be involved in adding memory to every rollout individually (as I used to before uiMgr, which meant very few scripts got it) is just not worth it (globals and persistent globals storing properties, having to declare and reference AND use them in the rollout code. With uiMgr, just two lines of code.).
But I do need to update the TAO version, I forgot to merge in my changes from work! It is uiMgr, not iniMgr. See, I urge people to use this stuff, then when someone does I forget to update it, doh! I’ll do it this weekend.
Polimeno, can you tell me more about that DVD by Bobo. There’s very minimal info about it on the Autodesk site. It doesn’t even say whether it’s C++ or Maxscript or both. It just says:
[ul]
[li]User interface creation[/li][li]Optimal workflows for designing artistic tools[/li][/ul]
i think it was a Master Class he did during siggraph 2008…has about approx 80 min,
seems fast but it´s not dificult to understand.
[ul]
[li]Creating Tool ( 100% MXS, simple way to script a CountfacePolygons tool with some option, etc)[/li][li]Interface for this[/li][li]Adding options and refining the code[/li][li].ini file, template code, workflow, etc[/li][li]Wrap up and finish with good tips n tricks[/li][/ul]
Great!!! Thanks. Downloading it now… Along with all the other things there that might be useful. I had no idea we had access to all this stuff.
After watching some of the DVD from Bobo, I’m in 2 camps at the moment. For the floater position, I’m keen on using the ini file option so the floater pops up in the same position no matter what max file I have open. But for the UI elements, I’m going to use the persistent globals option so the UI settings get saved in each max file.
I have another related question though… Is there a way to iterate thru the UI controls and have them reset to their default?
I know the following to be able to iterate thru but don’t know how to acess the default settings of the UI elements. if it’s possible at all.
for currentControl in pcGraphToolsDialog.controls do
Cheers,
Cg.
What you can do is after a clean first run, get all values in an array from the rollout.controls property, and hardcode those values in the script. I have done a similar thing with hardcoding all position of buttons and such and use those values as base values when I scale my dialog and stuff floats around. A same thing can be done for default values. There’s no way to access the default settings in the script when you have modified settings. So grab it once and hardcode it in the script I say…
-Johan