Notifications
Clear all

[Closed] scripted expressions problem

hi all

i’m trying to script an expression. the only thing is i cant get
it to add the vector target. the error reads when i try add a vertorTarget

– Runtime error: IExprCtrl::AddVectorTarget – Target needs to be
controller or subAnim, got: $Bone:Bone29 @ [1.955015,1.674374,4.940584]

i guess its asking for the none transform node or the Subanim base
object. but i dont know how to feed it that object vias script. i
thought it might be $Bone29[4] which is subanim: Boneobject. all i’m
trying to do is get it to read the objects position in space. done by
hand its the node above the transform in the trackwiew pick diologue.

here is what i have it adds the expression but no the vector target.


 mybone = $bone16
 Vecobj = $Bone29
 myexp = MyBone.transform.controller.FK_Sub_Control.controller.Position.controller.Zero_Pos_XYZ.controller.X_Position.controller=Float_Expression()
 
 myexp.AddVectorTarget "MyVec" Vecobj
 
 

any insights would be extremely helpfull

cheers

john

3 Replies

hi,
you need to pass a point3 controller through subanim

e.g.

if you have a bone you could pass $bone01[3][1]
as this is the subanim for transform[3] position[1]

hope this helps

mark

Ok well i tried what you mention but that dosent work with the expression i have. anyway here is my script i’m trying to make a squash and stretch limb the Paul Neale way so i have this script so that automates the setup.

when the vector is added via the script and i select it in the expression editor to read it it reads.

Assigned to:$point02.transform.controller.position
this is using what you suggested $point02[3][1] in the script
the problem with this is it dosent work with the “lenght” expression in the expression editor.

what i really want it to read is

Assigned to:$point02
this is what it looks like if i pick it manually.
also if i undo my manual operation in the undo window by right clicking on the undo button it has “Blend Euler as Quat” in the window.

mybone = $bone16
ANobj = $bone29[3][1]
ThObj = $point02[3][1]
THbone = $bone30
shinbone = $bone12

myexp = MyBone.transform.controller.FK_Sub_Control.controller.Position.controller.Zero_Pos_XYZ.controller.X_Position.controller = Float_Expression ()


myexp.AddVectorTarget "an" ANobj
myexp.AddVectorTarget "th" THobj

dist1 = distance ThBone shinbone
dist2 = distance shinbone Mybone
mynum = dist1 + dist2 

myexp.AddScalarConstant "Con" mynum

myexp.SetExpression "if ((length (an-th)-Con)/2>0,
(length (an-th)-Con)/2,0)"

Update

anyway there has to be a away to do this if it can be done manually but i cant seem to find the Subanim that its suposed to be.

if you have any insights please let me know.

cheers

john vdz

the bigest fool.

i belavie i needed to use the “AddVectorNode” not the [b][b]AddVectortarget.

wow what a timeburner that small mistake was.

anyway just thought id clear it up.

cheers

john

[/b][/b]