Xims Posted February 14, 2013 Share Posted February 14, 2013 Hi, I'm a total noob at python and I need a little help I'm trying to set an expression on a channel in a node, but the problem is that I need to get this result: point("../Rot", 0, "t", 0) Where the(Rot) can change depending on the Node that is created. so if it creates a Rot1 I need it to set the expression to: point("../Rot1", 0, "t", 0) Can anyone help ? Below is just an example not a working version hou = hou.node("obj") Rot = hou.createNode("geo",node_name = "Rot") transform2 = hou.node("obj/DormerMesh/xform3") transform2.parm("tx").setExpression() Quote Link to comment Share on other sites More sharing options...
graham Posted February 14, 2013 Share Posted February 14, 2013 Something like this should work. I also modified it slightly to point to the display node of your target node, since in this case you can't access information from an Object with a point expression. node = hou.node("/obj").createNode("geo", "Rot") xform = hou.node("/obj/DormerMesh/xform3") expr = 'point("{0}", 0, "t", 0)'.format(xform.relativePathTo(node.displayNode())) xform.parm("tx").set(expr) Quote Link to comment Share on other sites More sharing options...
Xims Posted February 15, 2013 Author Share Posted February 15, 2013 Something like this should work. I also modified it slightly to point to the display node of your target node, since in this case you can't access information from an Object with a point expression. node = hou.node("/obj").createNode("geo", "Rot") xform = hou.node("/obj/DormerMesh/xform3") expr = 'point("{0}", 0, "t", 0)'.format(xform.relativePathTo(node.displayNode())) xform.parm("tx").set(expr) thanks this works perfect Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.