Setting numeric parameter as an expression

   516   1   1
User Avatar
Member
1 posts
Joined: Oct. 2020
Offline
Hello there!

I'm creating a camera rig tool that I want to activate from a python shelf tool.

I've run into an issue with setParms where I'm trying to set the parameter of a transform node to have an expression.

I either get a syntax error or “Cannot set a numeric parm to a non-numeric value”

ch(“../../Controller/tx”) is the expression I want to insert. The errors only occur when I add the setParms line. setParms has been working for all of the other nodes in my code.

Version 1
—————–
Rig = obj.createNode(“geo”, node_name = “Camera_Jib”)
j_transform_01 = Rig.createNode(“xform”, node_name = “j_transform_01”)
j_transform_01.setParms({“tx”: ('ch(“../../Controller/tx”)')})

Version 2
—————–
Rig = obj.createNode(“geo”, node_name = “Camera_Jib”)
j_transform_01 = Rig.createNode(“xform”, node_name = “j_transform_01”)
j_transform_01.setParms({“tx”“ch(”../../Controller/tx“)”)})

Sorry if this is a simple fix, I'm quite new to Python.

Thanks! :-)
User Avatar
Member
191 posts
Joined: Oct. 2018
Offline
You'll need setParmExpressions instead.

j_transform_01.setParmExpressions({"tx": 'ch("../../Controller/tx")'})
  • Quick Links