Rig GUI question

Hello everyone, I'm currently working on a GUI for a rig that I'm building and am having some trouble getting a rollout in a floating dialog box to update with the changing of a custom attribute. Below is an example of my current setup, but I'd like to be able to set the rollout: and ui: of the Custom Attributes to the floatingGUI_rollout spinners, or achieve a similar result so that I can animate the custom attributes and have the GUI update to display the correct values.

I currently have a rollout stored in the CA that displays a single button that launches the GUI, and then the GUI rollout made within that. Any help is greatly appreciated, thanks!

Example_CA = attributes Example
(	
    parameters ExampleGUI_param --rollout:(I'd like this to feed into floatingGUI_rollout)
    (
        Weight_right type:#integer animatable:true default:100 --ui:(I'd like this to feed into spn_RWeight)
	Weight_left type:#integer animatable:true default:100 --ui:(I'd like this to feed into spn_LWeight)
    )
 
    rollout LaunchGUI_rollout "Launch GUI"
    (
	button btn_LaunchGUI "Launch GUI"
 
	rollout floatingGUI_rollout "Floating GUI"
	(
             spinner spn_RWeight "Right Weight"
             spinner spn_LWeight "Left Weight"
        )
 
        on btn_LaunchGUI pressed do
	(
	     createDialog floatingGUI_rollout 300 380
	)
   )
)
 
custattributes.add $ControlNode.modifiers[1] Example_CA
 

Comments

Comment viewing options

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

hehe, yes I haven't thought

hehe, yes I haven't thought of it first ... it would be even better if we can say no to add it by default because with a lot of rollout it may cause some flicker, I haven't tested this yet :-)

Martin

Anubis's picture

Cool ! I miss to thought of

Cool ! I miss to thought of removerollout :)

my recent MAXScripts RSS (archive here)

MarTroYx's picture

I've found a much cleaner

I've found a much cleaner way while playing with it and it allow you to bind it to the parameters :-)

Example_CA = attributes Example (
	--//--
	local floatingGUI_rollout, LaunchGUI_rollout
	--//--
    parameters ExampleGUI_param rollout:floatingGUI_rollout (
        Weight_right type:#integer animatable:true default:100 ui:spn_RWeight
		Weight_left type:#integer animatable:true default:100 ui:spn_LWeight
		)
	--//--
	rollout floatingGUI_rollout "Floating GUI" (
		spinner spn_RWeight "Right Weight" range:[0, 1000, 1] type:#integer
		spinner spn_LWeight "Left Weight"	range:[0, 1000, 1] type:#integer
		)	
	--//--
    rollout LaunchGUI_rollout "Launch GUI" (
		button btn_LaunchGUI "Launch GUI"
		--//--
        on btn_LaunchGUI pressed do (
			createDialog floatingGUI_rollout 300 380
			)
		--//--
		on LaunchGUI_rollout open  do (
			removerollout floatingGUI_rollout
			)
		--//--
		)
	--//--
	)
 --//--
custattributes.add $ControlNode.modifiers[1] Example_CA

Martin

MarTroYx's picture

floatingGUI_rollout can also

floatingGUI_rollout can also be local if you want :

Example_CA = attributes Example (
	--//--
    parameters ExampleGUI_param (
        Weight_right type:#integer animatable:true default:100
		Weight_left type:#integer animatable:true default:100
		)
	--//--
    rollout LaunchGUI_rollout "Launch GUI" (
		button btn_LaunchGUI "Launch GUI"
		--//--
        on btn_LaunchGUI pressed do (
			global g_param = this	-->we send this to the global space so that new rollout can access it!
			--//--
			rollout floatingGUI_rollout "Floating GUI" (
				spinner spn_RWeight "Right Weight" 		range:[0, 1000, g_param.Weight_right] 	type:#integer
				spinner spn_LWeight "Left Weight"			range:[0, 1000, g_param.Weight_left] 		type:#integer
				--//--
				on spn_RWeight changed val do g_param.Weight_right = val
				on spn_LWeight changed val do g_param.Weight_left = val
				)
			createDialog floatingGUI_rollout 300 380
			)
		--//--
		)
	--//--
	)
 
custattributes.add $ControlNode.modifiers[1] Example_CA
MarTroYx's picture

this is the instance of the

this is the instance of the plugins, so if you have many object with different rollout you need to open this var will be replaced to point to the right parameters.

I destroy the dialog in case it was already open to make sure we don't get duplicate.

as for the idea itself, well it's not that bad, sure you have to manually reflect the change of every parameters...but like you said, I don't think you can bind it externally :-)

Martin

edit : I also destroy the dialog in case you have on close stuff to do, but in this case that not absolutely necessary.

Anubis's picture

Hmm, is not very useful

Hmm, is not very useful idea... make both rollouts global to can reflect changes - ok, but finally parameters block not wired to them.

my recent MAXScripts RSS (archive here)

br0t's picture

hey cool it works :D but I

hey cool it works :D but I don't fully understand why. Can you explain what this part exactly does:

global g_param = this    -->we send this to the global space so that new rollout can access it!
global floatingGUI_rollout
try (destroydialog floatingGUI_rollout) catch()

What is "this" doing? And why destroy the dialog?
Thanks for your help!

Never get low & slow & out of ideas

MarTroYx's picture

require some trick, but that

require some trick, but that sould work :-)

<code>

Example_CA = attributes Example
(    
parameters ExampleGUI_param --rollout:(I'd like this to feed into floatingGUI_rollout)
(
Weight_right type:#integer animatable:true default:100 --ui:(I'd like this to feed into spn_RWeight)
Weight_left type:#integer animatable:true default:100 --ui:(I'd like this to feed into spn_LWeight)
)

rollout LaunchGUI_rollout "Launch GUI" (
button btn_LaunchGUI "Launch GUI"
--//--
on btn_LaunchGUI pressed do (
global g_param = this    -->we send this to the global space so that new rollout can access it!
global floatingGUI_rollout
try (destroydialog floatingGUI_rollout) catch()
--//--
rollout floatingGUI_rollout "Floating GUI" (
spinner spn_RWeight "Right Weight"         range:[0, 1000, g_param.Weight_right]
spinner spn_LWeight "Left Weight"            range:[0, 1000, g_param.Weight_left]
--//--
on spn_RWeight changed val do g_param.Weight_right = val
on spn_LWeight changed val do g_param.Weight_left = val
)
createDialog floatingGUI_rollout 300 380
)
--//--
)

)

custattributes.add $ControlNode.modifiers[1] Example_CA

</code>

Martin Dufour

edit :found it, hum no not quite , what's the easy way to remove hmtl tag from ?

 edit: ho well, I give up :-)

 

Zahmbie's picture

I've been house sitting

I've been house sitting without internet the past couple weeks, so sorry I posted this and then wasn't active on it. But I wanted to thank you guys for the replies, it's helping a lot to get this control setup the way I'd like it to!

Anubis's picture

Seems impossible to be on

Seems impossible to be on the floating dialog.

Example_CA = attributes Example
(	
    parameters main rollout:params
    (
        Weight_right type:#integer animatable:true \
		default:100 ui:spn_RWeight
		Weight_left type:#integer animatable:true \
		default:100 ui:spn_LWeight
    )
 
	-- rollout inside is OK
	rollout params "Floating GUI"
	(
		spinner spn_RWeight "Right Weight"
		spinner spn_LWeight "Left Weight"
	)
 
    rollout ro_LaunchGUI "Launch GUI"
    (
		button btn_LaunchGUI "Launch GUI"
		on btn_LaunchGUI pressed do
		(
			createDialog params 300 380 -- do nothing ...
		)
	)
)
custattributes.add $ControlNode.modifiers[1] Example_CA

my recent MAXScripts RSS (archive here)

Comment viewing options

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