CGTalk > Software Specific Forums > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 06-10-2003, 10:59 AM   #1
Alex Morris
veteran
 
Alex Morris's Avatar
CGSociety Member
Alex Morris
Architect and Illustrator
Alex Morris Visualisation
London, United Kingdom
 
Join Date: Apr 2003
Posts: 220
Send a message via ICQ to Alex Morris
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-10-2003, 12:51 PM   #2
Baldrick
Veteran
Matt Clementson
Cardiff, United Kingdom
 
Join Date: Mar 2002
Posts: 56
Send a message via ICQ to Baldrick Send a message via AIM to Baldrick Send a message via MSN to Baldrick Send a message via Yahoo to Baldrick
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;
Code:
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-10-2003, 12:52 PM   #3
magicm
Maxscript Generator
 
magicm's Avatar
CGSociety Member
portfolio
Martijn van Herk
VFX Technical Director
Freelance
Rotterdam, Netherlands
 
Join Date: Jun 2002
Posts: 1,139
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-10-2003 at 12:54 PM.
 
Old 06-10-2003, 05:36 PM   #4
Alex Morris
veteran
 
Alex Morris's Avatar
CGSociety Member
Alex Morris
Architect and Illustrator
Alex Morris Visualisation
London, United Kingdom
 
Join Date: Apr 2003
Posts: 220
Send a message via ICQ to Alex Morris
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-10-2003, 09:07 PM   #5
magicm
Maxscript Generator
 
magicm's Avatar
CGSociety Member
portfolio
Martijn van Herk
VFX Technical Director
Freelance
Rotterdam, Netherlands
 
Join Date: Jun 2002
Posts: 1,139
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-11-2003, 03:24 PM   #6
Kramsurfer
Don't Know-it-All.
 
Kramsurfer's Avatar
portfolio
Keith R Morrison
Custom Tools Developer
Focus360
San Diego, USA
 
Join Date: Sep 2002
Posts: 426
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-15-2006, 10:00 AM   #7
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:56 PM.


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