[Closed] Can't create rollout with execute in Scripted Material Plugin
I am trying to make a material plugin via the scripted plugin system in MAX.
I have been able to create the basic functionality I need using the standard structure explained in the documentation. However, I want to dynamically add content described in the following example with a for loop, either by creating the rollout with an execute function or via the rolloutcreator tool.
plugin material EasyDecal
name:"Easy Decal"
classID:#(695425,446581)
extends:Standard replaceUI:true version:1
--Place no#1
(
parameters main rollout:params
(
MBdiff type:#texturemap ui:MBdiff
)
--Place no#2
rollout params "Decal Parameters"
(
mapbutton MBdiff pos:[16,16] width:212
)
)
The problem seems to be that you cannot use execute or the rolloutcreator at either location described above.
Here is some examples of some things I have tried:
Place no#1
str = "(
parameters main rollout:params
(
MBdiff type:#texturemap ui:MBdiff
)
rollout params \"Decal Parameters\"
(
mapbutton MBdiff
)
)"
execute str
Place no#2
paramsRCI = rolloutCreator "params" "Decal Parameters"
paramsrci.begin()
paramsRCI.addControl #button #BtnSourceFolder "Show Maps Folder: " paramStr:"align:#left"
paramsRCI.end()
&
str = "rollout params \"Decal Parameters\" (
edittext MapFolderLocation)"
(execute str)
I figure this could just be an issue of scope but I doubt it. I’m guessing that if there is a work around it will be something that isn’t apparent. I am guessing that I will have to define the rollout externally and then call it somehow within the plugin but there doesn’t seem to be any help on how to do that.
Sorry to say but this just isn’t going to work I think. You can’t just generate a rollout in global scope and then add it to a modifier.
If you need a dynamic UI you might want to work with dotNet instead as you can build UI’s inside of a control on the fly as needed.
Here is an example of that just using a listView http://www.penproductions.ca/scripts/poseSaver/
I would have to check again but I think that the materials are prone to the same issues of scope and dotNet that the modifier panel is. I could be wrong on that how ever. This means that you are limited to dotNetControls and not dotNetObjects which is where the real flexibility comes in.
another solution is to use SubRollouts. They can be generated on-fly, and added to main rollout.