rollout.controls property?! Can't make it work!

Does anyone know how the rollout.controls property works? The help file says it'll return an array of all the controls in the rollout but I can't get it to recognize any of my rollouts.

In this code I'd like to collect all the controls in the rollout called eyeLidL but every time I try something like print eyeLidL.controls to access the property of the rollout it tells me that .controls is an unknown property of "undefined". But I thought eyeLidL was defined by rollout:eyeLidL? What gives?

Can anyone give me an example of how to use this property and how to get access to the rollout?

Here's my code just for reference:

attributes LeftEye
(
	function ModifyOtherSpinners my_index val old_values spinners checks =
	(
		diff = val-old_values[my_index]
 
		for i = 1 to old_values.count do
		(	
			if i != my_index do
			(
				if checks[i].checked do spinners[i].value = spinners[i].value + diff			
			)
		)
 
		old_values[my_index] = val		
	)
 
	parameters eyeLidL rollout:eyeLidL
	(
		topLid_test3 type:#float UI:topLidSp_test3
		topLid_test4 type:#float UI:topLidSp_test4
		compress_test1 type:#float UI:compressSp_test1
	)
 
		rollout eyeLidL "Left Eye Lids" 
		(
			checkbutton topLidCh3 "" highlightColor:[255,217,7] height:16 width:16 align:#left offset:[-14,0] across:3
			spinner topLidSp_test3 "" range:[-1,1,0] scale:0.1 align:#left offset:[-45,0] fieldWidth:30 
			label label1a "Top Open Close" align:#left offset:[-47,0]
 
			checkbutton topLidCh4 "" highlightColor:[255,217,7] height:16 width:16 align:#left offset:[-14,-5] across:3
			spinner topLidSp_test4 "" range:[-1,1,0] scale:0.1 align:#left offset:[-45,-5] fieldWidth:30 across:2
			label label2a "Bottom Open Close" align:#left offset:[-47,-5]
 
			checkbutton topLidCh5 "" highlightColor:[255,217,7] height:16 width:16 align:#left offset:[-14,-5] across:3
			spinner compressSp_test1 "" range:[-1,1,0] scale:0.1 align:#left offset:[-45,-5] fieldWidth:30 height:30 across:2
			label label3a "Compress" align:#left offset:[-47,-5]
 
			local old_values = #( 0.0, 0.0, 0.0 )
			local spinners = #( topLidSp_test3, topLidSp_test4, compressSp_test1 )
			local checks = #( topLidCh3, topLidCh4, topLidCh5 )
 
			on topLidSp_test3 changed val do ModifyOtherSpinners 1 val old_values spinners checks
			on topLidSp_test4 changed val do ModifyOtherSpinners 2 val old_values spinners checks
			on compressSp_test1 changed val do ModifyOtherSpinners 3 val old_values spinners checks
	)
)

Thanks for any help. I've been struggling with this all week!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pacermike's picture

Awesome, these examples are

Awesome, these examples are super useful. Thanks again!

Anubis's picture

Hi Pacermike and Marry

Hi Pacermike and Marry Christmas!
You found yet, but im sure in the reference has topic about, rollout.controls realy returns an array, see axample below.

rollout test "test"
(
	label L01 "Hello World!"
	button B01 "Show It!"
)
 
test.controls
--> #(LabelControl:L01, ButtonControl:B01)
 
cNames = for i in test.controls collect i.name
--> #("L01", "B01")
 
classOf test.L01 --> LabelControl
classOf test.B01 --> ButtonControl
superClassOf test.L01 --> RolloutControl
superClassOf test.B01 --> RolloutControl
test.L01.name --> "L01"
test.L01.text --> "Hello World!"

my recent MAXScripts RSS (archive here)

pacermike's picture

Holy smokes! I GOT IT, it's

Holy smokes! I GOT IT, it's a Christmas miracle!!!

The answer was here:

http://www.scriptspot.com/forums/3ds-max/general-scripting/update-button...

Thank you Anubis!

attributes LeftEye
(
	local contArray -- I had to declare it as a local here
 
	function ModifyOtherSpinners my_index val old_values spinners checks =
	(
		diff = val-old_values[my_index]
 
		for i = 1 to old_values.count do
		(	
			if i != my_index do
			(
				if checks[i].checked do spinners[i].value = spinners[i].value + diff			
			)
		)
 
		old_values[my_index] = val		
 
	)
 
	parameters eyeLidL rollout:eyeLidL
	(
		topLid_test3 type:#float UI:topLidSp_test3
		topLid_test4 type:#float UI:topLidSp_test4
		compress_test1 type:#float UI:compressSp_test1
	)
 
		rollout eyeLidL "Left Eye Lids" 
		(
			checkbutton topLidCh3 "" highlightColor:[255,217,7] height:16 width:16 align:#left offset:[-14,0] across:3
			spinner topLidSp_test3 "" range:[-1,1,0] scale:0.1 align:#left offset:[-45,0] fieldWidth:30 
			label label1a "Top Open Close" align:#left offset:[-47,0]
 
			checkbutton topLidCh4 "" highlightColor:[255,217,7] height:16 width:16 align:#left offset:[-14,-5] across:3
			spinner topLidSp_test4 "" range:[-1,1,0] scale:0.1 align:#left offset:[-45,-5] fieldWidth:30 across:2
			label label2a "Bottom Open Close" align:#left offset:[-47,-5]
 
			checkbutton topLidCh5 "" highlightColor:[255,217,7] height:16 width:16 align:#left offset:[-14,-5] across:3
			spinner compressSp_test1 "" range:[-1,1,0] scale:0.1 align:#left offset:[-45,-5] fieldWidth:30 height:30 across:2
			label label3a "Compress" align:#left offset:[-47,-5]
 
			local old_values = #( 0.0, 0.0, 0.0 )
			local spinners = #( topLidSp_test3, topLidSp_test4, compressSp_test1 )
			local checks = #( topLidCh3, topLidCh4, topLidCh5 )
 
			on topLidSp_test3 changed val do ModifyOtherSpinners 1 val old_values spinners checks
			on topLidSp_test4 changed val do ModifyOtherSpinners 2 val old_values spinners checks
			on compressSp_test1 changed val do ModifyOtherSpinners 3 val old_values spinners checks
 
			on eyeLidL open do -- and then I got it to execute here!
			(
				contArray = eyeLidL.controls
				print contArray
			)
	)
)

So, this is not what I wanted the array for at least now I know how to access it. Sweet!

This is what it returned:

CheckButtonControl:topLidCh3
SpinnerControl:topLidSp_test3
LabelControl:label1a
CheckButtonControl:topLidCh4
SpinnerControl:topLidSp_test4
LabelControl:label2a
CheckButtonControl:topLidCh5
SpinnerControl:compressSp_test1
LabelControl:label3a

OK

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.