I am playing with scripted controllers . According to the help files I am able to set the text input of a textobject by adding a scripted controller to the kerning controller of said textobject
b=box name: "ControlBox" wirecolor:blue t=text name: "ControlledText" wirecolor:red t.baseobject.renderable=true --set the shape to renderable theCtrl = float_script() --create a float script controller theCtrl.addNode "TheText" t --add a variable, connect to theText node theCtrl.addNode "TheBox" b --add a variable, connect to the Box node --Set the expression to assign the height of the box as string to the --.text property of the text shape, then return 0 on the next line: theCtrl.SetExpression "TheText.text = TheBox.height as string\n0" t.kerning.controller=theCtrl --assign the controller to the kerning
So far so good, this all works as explained.
However, when I try to control the points of a spline by adding a float_script() to one of the variables, say the angle controller of the spline, and then reference the spline itself in this script to set the points I get an “Illegal self reference in scripted controller” warning. See code and variables below.
knotCount = numknots cableObject 1 for i=1 to knotCount do ( knotPos = pointA.pos + (((pointB.pos - pointA.pos)/(knotCount-1))*i-1) setknotPoint cableObject 1 i knotPos ) updateShape cableObject )
where the variables in the script controller are:
cableObject = my line pointA = 1st helper pointB = 2nd helper
Not very surprising you would say, but why does that message not show up on the textobject example? A similar self reference is made there in the line 5 and 10!
I’ve been playing with this for two hours now, but I cannot seem to get it working properly. I can accept the self reference limitation, and I can work around that I’m sure. But if there is an explanation or a loophole somewhere I would love to know about it