creating expression with a script
Hello all.
I am trying to create a float_expression or a float_script with a script. I want to connect the inner amount of a shell modifier to a custom attribute (called "range" in a Custom Attribute modifier. here is what I do:
obj = $Plane02 ctrl = float_expression() obj.modifiers[#Shell].innerAmount.controller = ctrl ctrl.AddScalarTarget "range01" $Point01.modifiers[#Attribute_Holder].Custom_Attributes.range
the 4th line gives me the following error:
-- Runtime error: IExprCtrl::AddScalarTarget - Target needs to be controller or subAnim, got: 11.0
11.0 happens to be the current value of the "range" attribute.
Exactly the same happens when i try to create a float_script like this:
cntrl = float_script() obj.modifiers[#Shell].innerAmount.controller = cntrl cntrl.AddTarget "range01" $Point01.modifiers[#Attribute_Holder].Custom_Attributes.range
only to get the same error... any idea????
update: the expression that i try to create is :
min ((range01/length(objPos - PointAPos) + range02/length(objPos - PointBPos)),2)
however i can not create the necessary variables
Thanks
Comments
controller or subAnim
Hi,
the error said: "Target needs to be controller or subAnim" so...
did you define your 'range' as animatable?
my recent MAXScripts RSS (archive here)
yeap...
thanks for the answer!
I think i get what you mean... following a tip I got from the cgtalk forum I assigned a Bezier_Float() to the custom attribute and it worked... I guess that is the answer to you question? however, when i was doing it manually, i didn't have to...