There are 3 ways to dynamically modify a MaxScript UI.
One way to to create all the UI elements you need in order to disable and enable them as needed. (This is the most common method)
A similar method is to use their visible property to turn them off and on.
The most complex way is to generate a maxscript on the fly and use the execute command to create the UI elements.
This script has an example of each method:
Martinez_DynamicUI.ms
also do not forget to mention the "rolloutCreator", this is a standard maxscript structure of functions for dynamically creating rollouts.
ReplyDeletethe system behind it is identical as executing a string that describes the rollout.
example :
rci = rolloutCreator "myRollout" "My Rollout"
rci.begin()
rci.addControl #button #myButton "My Button"
rci.addHandler #myButton #pressed filter:on codeStr:"MessageBox @Isn't this cool@ title:@Wow@"
createDialog (rci.end())
Wow thanks, I actually never used that method. Thanks for the tip!
Deletehi, great tips, this what i'm exactly looking for. But when i try to implent this i cannot reach dynamicaly created ui elements. the code is below it throws out an error when i try to reach dropdown list. And it sees everyting dynamicaly created as undefined.
ReplyDeleteDynamicUIRollout = newRolloutFloater "Dynamic UI" 200 300
rollout UIDialogTest "Submaterial Instancer" width:200 height:300
(
local UInum = 1
local multiMat
local nameArray = #(#(),#())
button btnExecute "Pick Material" pos:[5,5]
button btnStart "Start Instancing" pos:[90,5]
on btnExecute pressed do
(
if classof $.mat == multimaterial then
(
multiMat = $.mat
for i = 1 to multiMat.count do
(
nameArray[1][i] = multiMat[i].name
)
nameArray[2] = copy nameArray[1] #nomap
sort nameArray[1]
print nameArray[1]
)
UIcode = "rollout subRoll" + UInum as string + " \"Choose Materials to instance" + "\"\n"
UIcode += "("
UIcode += "dropdownList drop" + i as string + "\"" + "Base Mat" + "\"width:165 height:15 border:false \n"
for i=1 to multiMat.count do
(
UIcode += "checkbox btnMat" + i as string + "\"" + nameArray[1][i] + "\"width:165 height:15 border:false \n"
)
UIcode += ")"
UIcode += "addRollout UIDialogTest" + UInum as string + " DynamicUIRollout"
execute UIcode
UInum += 1
drop.items = nameArray[1]
)
on btnStart pressed do
(
print UIDialogTest.controls[i]
)
)
Good work, Thanks to share your nice information and the blog. Please keep sharing.
ReplyDeletewww.clippingimages.com
informative method.
ReplyDeletewww.clippingpathzone.com
This is really informative post.
ReplyDeletewww.clippingpatharea.com
This is very helpful thanks for sharing this. http://www.clippingserviceindia.com/
ReplyDeleteSo useful and effective blog you have published . Its also informative . Thank you for shared this well blog . Clipping Path | Remove White Background | Product Photo Editing
ReplyDeleteI am so grateful for the sense of purpose and direction I gain from reading your blog thank you for helping me see things more clearly and positively
ReplyDeleteVisit Here: Real Estate Photo Editing Service