Jump to content
Sign in to follow this  

Creating XPresso Nodes with Python Script

Recommended Posts

I am currently writing a script that creates an Xpresso tag on a Cube, and then creates a node, of the Cube, on the Xpresso graph view. I would like to access the Object Properties > Size.Y port. I can get to this point, but whenever I create the Cube node with Size.Y port the node turns yellow. I'm not sure why it does this exactly. When I try to create the setup manually everything works fine. Can anyone here give me some advice? Here is my code.


import c4d
def main():
 null = c4d.BaseObject(c4d.Onull)
 cube = c4d.BaseObject(c4d.Ocube)
xtag = c4d.BaseTag(c4d.Texpresso)
 nodemaster = xtag.GetNodeMaster()
print nodemaster.GetOwner().GetName()
node1 = nodemaster.CreateNode(nodemaster.GetRoot(),c4d.ID_OPERATOR_OBJECT,None,100,100)
node1[c4d.GV_OBJECT_OBJECT_ID] = cube
node2 = nodemaster.CreateNode(nodemaster.GetRoot(),c4d.ID_OPERATOR_OBJECT,None,300,100)
node2[c4d.GV_OBJECT_OBJECT_ID] = cube
node1out = node1.AddPort(c4d.GV_PORT_OUTPUT, (c4d.PRIM_CUBE_LEN, c4d.VECTOR_Y))
print node1.GetOperatorContainer()[c4d.GV_OBJECT_OBJECT_ID].GetName()
node2in = node2.AddPort(c4d.GV_PORT_INPUT, (c4d.ID_BASEOBJECT_REL_POSITION, c4d.VECTOR_Y))
 print node2.GetOperatorContainer()[c4d.GV_OBJECT_OBJECT_ID].GetName()
if __name__=='__main__':

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...