Notifications
Clear all

[Closed] 3 Quick Questions

Hello, I have some questions that I would really appreciate it if any of you pros would help me out on:

  1. I’ve written the following simple rollout:
try (destroyDialog ::Test_Rollout) catch()
   rollout Test_Rollout "Test"
   	(
   		spinner Multiplier_Spinner "Multiplier" range:[0,10000,100]
   		on Multiplier_Spinner changed val do $.multiplier = val
   		function selection_type obj =
   			(
   				if classof $ == VRayLight then Multiplier_Spinner.value = $.multiplier
   			)
   	 on Test_Rollout open do
   		(
   			callbacks.addScript #selectionSetChanged "Test_Rollout.selection_type $" id:#cb1
   			selection_type $
   		)
   	on Test_Rollout close do
   		(
   			callbacks.removescripts #selectionSetChanged id:#cb1
   		)
   	)
   createDialog Test_Rollout

I have the spinner’s value update every time I make a new selection, but I’d also would like to have it update whenever I make a change to the value from the Command Panel. Is that possible to do?

  1. If I have an array filled with some objects, how would I go about checking and seeing if EVERY member of the array has a certain property? Also how would I find the member with the highest specified value?

  2. Bellow is a script that closes and opens all groups in a scene

global group_state
   fn openGroupsAll objs toggle =
   	(
   		group_arr = for o in objs where isValidNode o and isGroupHead o collect o
   		with redraw off
   		(
   			for o in group_arr do
   			(
   				setGroupOpen o toggle
   			)
   		)
   	)
   if group_state == 1 then
   	(
   		group_state = 0
   		openGroupsAll objects false
   	)
   else 
   	(
   		group_state = 1
   		openGroupsAll objects true
   	)

If I have selected a member in an open group and I run the script it closes it fine but it doesn’t select the top-most parent of the group, like it would if I just type “max group close”. How should I modify the code so that it does that?
I tried adding a function to it that looks for the parent of the current selection and selects it after activating it, which worked, but if the selection WAS the parent it just caused this error “Unknown property: “parent” in $selection”

1 Reply

separate your questions into different posts.