PDA

View Full Version : Utility Plug-in: Remove Rollout on load?


Mr-BlueSummers
02-22-2008, 09:26 PM
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 define 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 thisButton "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?

ChemiKhazi
02-23-2008, 03:19 AM
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.

Mr-BlueSummers
02-23-2008, 04:04 AM
Would that work with Param blocks too?

Zbuffer
02-23-2008, 08:44 AM
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
)
)
)

Mr-BlueSummers
02-23-2008, 05:34 PM
Super cool, Zbuffer! That kept it from loading immediatly.
Think there's a way to get a param block to work on it too?

Mr-BlueSummers
02-26-2008, 01:46 PM
Any thoughts fellas? Rollouts lose a lot of appeal if their variables dry up every time you swap them out. :sad:

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?

Mr-BlueSummers
02-29-2008, 02:54 AM
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. (http://area.autodesk.com/index.php/forums/member/154343/)


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
)
)

CGTalk Moderation
02-29-2008, 02:54 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.