View Full Version : nested rollouts questions
01 January 2008, 07:57 PM
I've got two questions concerning rollouts...
Question 1. Here's a short test script for a utility:
utility test3 "Test3"
rollout r1 "panel A"
spinner spn_r1 "spinner 1 "
on spn_r1 changed value do
(v = spn_r1.value)
rollout r2 "panel B"
spinner spn_r2 "spinner 2 "
on spn_r2 changed value do
(spn_r2.value = v)
on test3 open do
on test3 close do
Here's the question...
Question 2: Can rollouts be nested within another rollout? I guess a better way of phrasing that is, can a variable be assigned locally on the RolloutFloater level such that it will be read by added rollouts? Here's what I'm getting at...
rollout one "One"
button btn_1 "First Button"
rollout two "Two"
button btn_2 "Second Button"
rf = newRolloutFloater "Floater" 200 300
(button btn_f "Floater Button")
addRollout one rf
addRollout two rf
In the above I tried to add a "Floater" button on the floater level, to be followed the two rollouts. When I run it, there's no button on the floater level.
Many thanks in advance.
01 January 2008, 10:46 PM
I don't know if this will help, but you might want to take a look at the subrollout class.
It allows you to group rollouts into a single UI element
01 January 2008, 10:57 PM
Nope, you are using a scripted Utility which was introduced back in Max 2 and became obsolete around Max 3. It was the way it worked, with the additional rollouts placed behind the main body of the Utility that had the Close button added automatically. I know the Help still shows you how to use it and it is rather simple to script so it is a good starter material, but don't expect too much control over formatting from it, as it was part of the "first baby steps" of MAXScript and is barely used nowadays.
Take a look at Rollouts in Floaters or as Dialogs and, as already suggested, Subrollouts to design your own tools in any shape and size with exactly the order and formatting you want.
01 January 2008, 12:26 AM
Thanks, both Rusty and Bobo. I've been playing with the subRollouts since the first post in this thread. I'm stymied by whether a variable local to the parent rollout can be referenced in the subrollouts. Here's an example I pulled whole-hog from the MAXScript Reference and threw in a local and global variable:
rollout test "test" height:200
-- here I added a local and a global variable
local L = 25.0
global G = 37.0
subrollout test1 "test1"
subrollout test2 "test2"
rollout test1a "test1a"
( spinner test1as "test1as"
-- the following throws an "undefined to type:Float" error
on test1as changed value do
(test1as.value = L)
rollout test1b "test1b"
( spinner test1bs "test1bs"
-- this works; the spinner displays the global value
on test1bs changed value do
(test1bs.value = G)
AddSubRollout test.test1 test1a
AddSubRollout test.test1 test1b
test.test1.height += 100
test.test2.pos += [0,100]
rollout test2a "test2a"
( spinner test2as "test2as"
AddSubRollout test.test2 test2a
test.test2.height += 50
Is it possible to access a variable from the parent rollout? I'm thinking of, for instance, of Array elements. When I tried this in the (antiquated) Utilities format, both parent-local and global were identified. Many thanks!
01 January 2008, 01:49 AM
L has local context only within the Test rollout. That means, within Test you can access the variable without it's context prefix. Because G is global, it can accessed anywhere.
To access the local variable within the rollout, you need to prefix it's parent context...ie Test.L
Using that information, you should be able to(test1as.value = test.L)Works...
01 January 2008, 01:49 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.