Notifications
Clear all

[Closed] Rollout

How do you close (not remove) rollouts in maxscript? I’ve RTFM and I can’t find anything!

Thanks.

Edit: Nevermind, got a bit confused, one half of TFM says .open is read-only and the other half doesn’t.

10 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Uhm, rollouts in MAXScript are used in multiple ways in many places – in RolloutFloaters, in Utilities, in Dialogs, in Scripted Plugins… What EXACTLY are you trying to do, and where are the errors in TFM you mentioned. How about reporting a bug so TFWOTFM can fix it?

“tfwotfm”
Rofl

Tito Fuentes wrote TFM?

hy,bonjour, it’s my first post here

i have a problem with rollout and create panel in max.
i create an scripted utilities which create a dialogfloater. but when i select create tab in the modify panel ( i m not sure of the name , the right toolbar .) max crash.

so if you have an idea?

The F* Writer Of The F* Manual?

I just want to rollup, -down certain rollouts when users hit certain buttons in my script. Got that figured though.

As for the “inconsistency” consider the following:
“Utility and Rollout Properties, Methods, and Event Handlers”
says you can .open.

“Rollout Floater Windows” and “Rollout Floaters and Dialogs Position and Size Handling Fixed” says .open is read-only.

jdaou: I don’t have a clue what’s happening in your script. Can you post it up somehwere so we can have a look at it?

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Exactly That Writer

Ok, there is NO inconsistency. The first topic handles ROLLOUTs.
The other two topics handle ROLLOUTFLOATERs/Rollouts as Dialogs. A RolloutFloater is the floater you put rollouts into. The “…Handling Fixed” topic discusses the fact that Dialogs (which are MADE OF rollouts) and RolloutFloaters now both have a read-only .open property.
When a rollout is used in CreateDialog method to create a dialog, its .open property is read-only (as you cannot close the dialog by setting that property to false) and will return true if the dialog is visible. In the case of RolloutFloaters, the .open property of the floater will return true if the floater is open (displayed). The .open property of rollouts INSIDE that floater will be read/write though.

As far as I can see, the description in the documentation is consistent… I might be wrong, but I would be very surprised!

 eek

Can you do it the same way as adding to a rollout via maxscript? By using the ” Redifine’ method?(thx Aearon)

For example:

 
  --add new slider to existing set (as to not break animation)
  
  --add new slider
  
  
  attrHolder = $base.modifiers[1]
    
    -- get the current attribute definition
    oldDef = custAttributes.getDef attrHolder 1
    
    -- define new definition
    musclecontrol=attributes FaceControls
    Redefine:oldDef -- this line is really all you need to do what you want
    (
  	parameters params rollout:musclechange
  	(
  	  pucker Type:#float ui:puckerSL
  	  added Type:#float ui: addedSL
  	
  	)
  	
  	rollout musclechange "Face Controls"
  	(
  	  slider puckerSL "Pucker" type:#float Range:[0,100,0]
  	  slider addedSL "Added" type:#float Range:[0,100,0]
  	
  	)
    )	
  
  
  
  • so just take out the ones you dont want from you sliders.
    eek

Wahooney… you trying to close (roll-up) rollouts or are you trying to close floaters?

I’m trying to close a floater in one of my scripts… do any of you guys know how to do that?

(sorry for hijacking your thread )

Just rolling them up. But I resolved that about 2 minutes after posting thr first post. So you can hijack away, for a price :deal:

Is it a floating dialog or a rollout floater?

Floating Dialog (created with createDialog myFloater):
destroyDialog myFloater
.

Rollout Floater (created with newRolloutFloater myFloater and addRollout myRollout):
closeRolloutFloater myFloater.

Hope this helps.

There are some variable scoping issues that are important…

Generally, it is a good idea to make the rolloutFloater’s or dialog rollout’s variable a global variable to be able to close a previously existing floater or rollout.

A floater that is open will generally return a rolloutFloater value, when it is closed the value becomes undefined.

So you can go like


 
 (--start local scope (could be the body of a macroScript...)
 global myFloaterLongDescriptiveName --declare a global var. with a very unique name
 rollout myRollout "Test"
 (
 button myButton "Press Me"
  on myButton pressed do closeRolloutFloater myFloaterLongDescriptiveName
 )
 
 if myFloaterLongDescriptiveName != undefined do closeRolloutFloater myFloaterLongDescriptiveName
 myFloaterLongDescriptiveName= newRolloutFloater "My Floater" 200 200
  addRollout myRollout myFloaterLongDescriptiveName
 )--end local scope
  

On the other hand, if a rollout is assigned to a global variable, the variable will always return a rollout value, even if the rollout is NOT in a dialog at the moment.
This is why the best strategy to open and close dialogs is the following:


 (--start local scope (could be the body of a macroScript...)
 global myDialog --declare the variable to store the rollout for the dialog
 try(destroyDialog myDialog)catch() --try to destroy a dialog from previous session
 rollout myDialog "Dialog" --define the content of the dialog's rollout 
 (
 button myButton "Press Me!"
  on myButton pressed do destroyDialog myDialog
 )
 
 createDialog myDialog 200 200
 )--end local scope
  

Of course, you can use the try()catch() context for the closeRolloutFloater in the first example, too (it is faster to type in, slower to execute).
These are just guidelines, there are more ways to do it.