Opening and closing rollouts

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2003   #1
Opening and closing rollouts

Hi guys,

Whats the best way of handling this in a floater with multiple rollouts?

I've attached a test file which illustrates the problem. It tries to access the rolledUp property of the second rollout before it is defined.

Is there a preferred way of dealing with this for say 5-6 rollouts in a floater - ie. a scalable solution - which steps through each rollout opening and closing them one at a time?

When is it better to just open new floaters rather than rollouts?
Attached Files
File Type: ms rollout opener test.ms (428 Bytes, 17 views)
__________________
Alex Morris
Architectural Visualisation
www.amv-cgi.com
 
Old 06 June 2003   #2
Lightbulb

Simple modifcation to get your script to work - declare your second rollout as a global at the start of your script by adding this line at the top;
global r2


Unfortunately, I don't think there is any 'generic' way to do this without hard coding it all because you need to know the rollout object names and I don't think you can get those via MAXScript if don't already know them...
 
Old 06 June 2003   #3
The script you attached executes without problems on my computer..

What you might want to do, is to declare each rollout at the top of your script, like this:


-- start local scope. this is needed to be able to define local variables
(

-- declare rollout variables
local r1, r2

-- start of your script..
rollout r1 "r1" width:160 height:40
..
..
..
nr = newRolloutFloater "Test" 172 100
addRollout r1 nr
addRollout r2 nr rolledup:true
-- end of your script..

)-- end local scope



good luck

[edit]

Like Baldrick said, using globals is also an option, but personally I tend to avoid them. just to keep things nice and clean

[/edit]

Last edited by magicm : 06 June 2003 at 12:54 PM.
 
Old 06 June 2003   #4
thanks guys

I'll give that a whirl - probably using locals
Any ideas on swapping out rollout interactively?
__________________
Alex Morris
Architectural Visualisation
www.amv-cgi.com
 
Old 06 June 2003   #5
Quote: Originally posted by Alex Morris
Any ideas on swapping out rollout interactively?


AFAIK.. not possible unless you create the rollouts dynamically (using strings and the <b>execute</b> function).. There's also a script that lets you create rollouts dynamically, which can be found in:

3dsmax5\stdplugs\stdscripts\baseLib\rolloutCreator .ms..

Another thing that pops to mind; you possibly could use the removeRollout[b] / [b]addRollout functions to close rollouts and put them back again in a specific order.. not sure if this works though
 
Old 06 June 2003   #6
yeah,

removeRollout Rolloutname RolloutFloatername

You need to remove all the rollouts below the one you are changing the then add them again.

If you've three Rollouts on one floater

ROF= newRolloutFloater "Test" 200 200
addRollout Rolly01 ROF
addRollout Rolly02 ROF
addRollout Rolly03 ROF

Add you want to change / Replace Rolly02 then you need to

removeRollout Rolly03 ROF
removeRollout Rolly02 ROF
addRollout Rolly02Different ROF
addRollout Rolly03 ROF

Creating them dynamically is well worth the effort to learn and it's not that hard. Then your controls can be tied to any set of data.

Something like:

myName = #("Bone", "Control", "Dummy","fool", "work","Silly")
RolloutString= "\nrollout ss_roll \"Test Checkboxs \"\n(\n"
for i = 1 to MyName.count do
(
RolloutString=RolloutString +("checkbox " + myname[i] + "_enabled " + "\"" + myname[i] + "\"\n")
)
RolloutString=RolloutString+")\n"
format "%\n" RolloutString
execute RolloutString

When the execute command runs it evaluates the string as if it where maxscript you had created and ss_roll becomes a valid Rollout value. This rollout does little more than create checkbox's however. You would create a second loop to write the part of the rollout that would add functionality to the checkboxs. the format command in there will let you "see" the rollout before it's executed. I develop the rollout with just the format command so it just prints in the listener. When it looks good in the listener, then dash out the format and go for the execute command.

Good Luck

Keith Morrison
 
Old 01 January 2006   #7
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:37 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.