Notifications
Clear all

[Closed] Ui default value as variable ?

Is it possible to do that correctly ?because the default value becomes the variable not the float number.

StretchDist type:#float ui:StrDist default:ArmLength

when opening a scene contains these parameters and rollout, it looks at “ArmLength” as an undeclared variable. I want it to be a float number instead of “ArmLength” but at the same time it is a variable that measure some distance at the time of creating the rollout, I need it to be:

StretchDist type:#float ui:StrDist default:40

or

StretchDist type:#float ui:StrDist default:60

depends on the distance

4 Replies
 PEN

Have you tried string the value in the on open event handler for the rollout?

I’m not really sure what you are asking how ever as it is not clear. Providing full code always helps.

It is a CA for a rig in an auto rig script , an arm to be specific, the default value of a stretch distance must be the length of the arm which changes according to the guide points

 UpArmLength=Distance gdarr[2] gdarr[4]
 	LwArmLength=Distance gdarr[4] gdarr[6]
 	ArmLength=UpArmLength+LwArmLength
 		
 				ArmCustomAttrs= attributes ArmCtrls
 					(
 						parameters main rollout:IkRollout
 						(
 							CntNode type:#maxobject 
 							IkFk type:#float ui:IkFkSld default:100
 							FkStretch type:#float ui:FkStr default:100
 							IkStretch type:#float ui:IkStr default:100
 							StretchDist type:#float ui:StrDist default:ArmLength
 							shld type:#float ui:shldS default:0
 						)
 						rollout IkRollout "IkControls" width:168 height:350
 						(
 							groupBox Ikgrp "IkContols" pos:[5,10] width:152 height:300
 								button Fkbtn "FK" pos:[15,24] width:64 height:24
 								button Ikbtn "IK" pos:[85,24] width:64 height:24
 							
 								spinner IkFkSld "FK/IK Blend" type:#float range:[0,100,100] scale:0.5
 								spinner FkStr "FkStretch" type:#float range:[0,999999,100] scale:0.5
 								spinner IkStr "IkStretch"  type:#float range:[0,100,100] scale:0.5
 								spinner StrDist "StretchDist" type:#float range:[0,999999,100] scale:0.5
 								slider shldS "Shoulder Lock" type:#float range:[0,100,0]   
 					  )
 						......etc
 					 )

the result when opening a scene containing the rig:

I tried the event but it doesn’t matter because it errors at opening the scene not the rollout.
I also tried to assign the value “ArmLength” using

SwtchCtrl.modifiers[1].IkRollout.StrDist.value=ArmLength	

to the spinner after creating the CA and before any wiring to this parameter to act as it is its default value but it causes problems later but I can’t know why.

SwtchCtrl.modifiers[1].ArmCtrls.StretchDist=ArmLength

This worked fine for me without using a default value at all but I cant find the difference between assigning a value to the ui and to the parameter since they are connected?

thanks