[Closed] Utility Plug-in: Remove Rollout on load?
Hey fellas,
Here's an interesting one. I'm creating a plug-in that needs to manage a few rollouts. Unfortunately, when you create a scripted plug and define rollouts, they're automatically added to the body of the UI and it seems there's no way to remove it without an explicit event. My goal is to [i]define[/i] some rollouts without displaying them, and add/remove them as needed. Take a look:
plugin simpleMod Mod1
name:"Mod1"
ClassID:#(0x75e16d7e, 0x236a84d3)
category:"Scripted Primitives"
(
local R1, R2
rollout R1 "Rollout 1"
(
checkbox thisCheckbox "Show Alt Rollout"
-- When checked, make the second rollout available.
on thisCheckbox changed val do
if val then addRollout R2
else removeRollout R2
)
rollout R2 "Rollout 2"
(
button [color=Pink]thisButton [/color]"Clicky!"
-- Display a message to show the button works.
on thisButton pressed do
messageBox "Works!"
)
--on //Startup?// do removeRollout R2
)
I tried reading through the manual, but on load, on postLoad, on Create, and on postCreate all fail to remove the 2nd rollout from the modifier window before the user sees it.
Any thoughts?
Have you tried using RolloutCreator to create the rollouts? I’m not sure but those rollouts might not be added automatically to the scripted plug or if they do you might try deferring the call to rolloutCreator.end until you need the rollout to appear.
Hi,
how about this ?
plugin simpleMod Mod1
name:“Mod1”
ClassID:#(0x75e16d7e, 0x236a84d3)
category:“Scripted Primitives”
(
local R1
local R2=
(
rollout R2 “Rollout 2”
(
button thisButton “Clicky!”
-- Display a message to show the button works.
on thisButton pressed do
messageBox "Works!"
)
)
rollout R1 “Rollout 1”
(
checkbox thisCheckbox “Show Alt Rollout”
– When checked, make the second rollout available.
on thisCheckbox changed val do
(
if val then addRollout R2
else removeRollout R2
)
)
)
Super cool, Zbuffer! That kept it from loading immediatly.
Think there’s a way to get a param block to work on it too?
Any thoughts fellas? Rollouts lose a lot of appeal if their variables dry up every time you swap them out. 🙁
Would it be taboo if I wrote my own variable handler that stored data between rollouts, or is there a way to bind param blocks to rollouts defined like Zbuffer described?
Sweet! Got a reply on Area forums. Turns out you can remove the rollout when the first one loads, and then apply the param block. Special thanks to Claudio Alvaro.
plugin simpleMod Mod1
name:"Mod1"
ClassID:#(0x75e16d7e, 0x236a84d3)
category:"Scripted Primitives"
(
parameters P1 rollout:R1
(
_works type:#boolean ui:thisCheckBox
)
rollout R2 "Rollout 2"
(
button thisButton "Clicky!"
-- Display a message to show the button works.
on thisButton pressed do
messagebox "Works!"
)
rollout R1 "Rollout 1"
(
checkbox thisCheckbox "Show Alt Rollout"
-- On open remove the second rollout
on R1 open do
removeRollout R2
-- When checked, make the second rollout available.
on thisCheckbox changed val do
if val then addRollout R2
else removeRollout R2
)
)