use expose transform distance var for AddScalar Target

use expose transform distance var for AddScalar Target

Anonymous
Not applicable
634 Views
1 Reply
Message 1 of 2

use expose transform distance var for AddScalar Target

Anonymous
Not applicable

im wanting to make a script that will set up a float expression script for bone stretch.  

i have a bone where i add a ScaleXYZ controller with a float expression assigned to Z scale. theres an expose transform tracking the distance of 2 helpers where the bone is in between.  the distance is used to stretch the bone.

$[2].distance is not acceptable for the AddScalerTarget.  how can i have the distance variable of the expose transform be accepted into the function?  

 

$[1] is the bone selection where the script will be placed

$[2] is the expose transform

	on addStretchScript pressed do
(
		etDistance = $[2].distance as string
		dExpression = "dist/" + etDistance
		$[1].scale.controller = ScaleXYZ ()
		$[1].scale.controller.Z_Scale.controller = Float_Expression ()	
		$[1].scale.controller.Z_Scale.controller.AddScalarTarget "dist" $[2].distance
		$[1].scale.controller.Z_Scale.controller.setExpression dExpression 
	)

 

0 Likes
Accepted solutions (1)
635 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

i figured out as follows.  

	on addStretchScript pressed do
(
		if selection.count == 2 then
		(
			etDistance = $[2].distance as string
			dExpression = "dist/" + etDistance
			etDist = $[2]
			$[1].scale.controller = ScaleXYZ ()
			$[1].scale.controller.Z_Scale.controller = Float_Expression ()	
			$[1].scale.controller.Z_Scale.controller.AddScalarTarget  "dist" etDist[4][17]
			$[1].scale.controller.Z_Scale.controller.setExpression dExpression 
		)
	)

etDist[4] = #Object__ExposeTransformHelper

[17] = SubAnim:Distance  (this is what the function requires)

 

0 Likes