Struct initialize inside a variable
When I launch the script the first time I have this error: "Unknown property: "p_cbox" in undefined". But when I launch again the script I have no problem.
Can someone help me to initialize correctly p_cbox ?
struct MyStructure ( p_cbox = true, function fn_PropertiesUi = ( try(destroydialog rol_Properties)catch() rollout rol_Properties " Properties" ( checkbox cbox "try me" width:200 checked:p_cbox on cbox changed state do ( cbox.checked = state ui.p_cbox = cbox.checked print ui.p_cbox ) ) rol_Properties ), function fn_MainUi = ( rollout rol_Main "" ( button btn "test" on btn pressed do ( print ui.p_cbox ) ) rol_Main ), function fn_Run = ( mainRollout = fn_MainUi() Createdialog mainRollout propertiesRollout = fn_PropertiesUi() Createdialog propertiesRollout ) ) ui = MyStructure() ui.fn_Run()
Comments
Thank you again !
It works perfectly now ! Very nice and impressive level !
Ps: Do you have your own website ? It would be great for us to know you more. I would follow your work. ;)
Rodman
...
:)
Thanks man.
I prepare my website but recently I'm very busy with my current job (architecture and industrial design not mxs). MXS is just a hobby.Also U can find me on CGTalk forum
(member name "gazybara").
Cheers!
Branko
bga
Let me know when you release
Let me know when you release your website. I found you already on CGTalk forum. I'm not on it but Google brought me here sometimes and your name appeared more than once. Autodesk can be thankful to have you sharing your knowledge to it community. You bring some lights to the darkest part of Maxscript.
Keep up the good work Branko ! And thanks again !
Rodman
...
U need to declare your struct as global variable
bga
Thanks Barigazy for your help ! :)
But I still have the problem after a restart of 3ds Max ! :(
Also, I want to avoid as much as possible to declare a variable as Gloabal. In this case is it totally safe to use it ?
Rodman
...
Using the global in this case is best solution because this variable hold struct ei. all struct members (fn's, variables, rollouts etc.)
bga