Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. JoelJohera
    3. Posts
    J
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 8
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by JoelJohera

    • RE: Xpresso Object Index can not connect output ports with Python

      Thank you so much

      posted in Cinema 4D SDK
      J
      JoelJohera
    • RE: Xpresso Motion Graphics Data Can not add global matrix and color ports

      Thank you so much

      posted in Cinema 4D SDK
      J
      JoelJohera
    • Xpresso Object Index can not connect output ports with Python

      To whom it may concern,
      I am trying to connect the outputs of an Object Index Node to other nodes. I know it can be done as via the GUI I can do it but I can not do it with Python.
      This is the code I have:

      import c4d
      
      def main():
          doc = c4d.documents.GetActiveDocument()
          null = doc.SearchObject("Null")
          sphere = null.GetDown()
          xtag = c4d.BaseTag(c4d.Texpresso)
          null.InsertTag(xtag)
          gv = xtag.GetNodeMaster()
      
          # Object Index Node
          object_index_node = gv.CreateNode(gv.GetRoot(), c4d.ID_OPERATOR_DETAILS)
          object_index_node_in_instance = object_index_node.GetInPorts()[0]
          object_index_node_out_index = object_index_node.GetOutPorts()[0]
          object_index_node_out_instance = object_index_node.GetOutPorts()[1]
      
          # Sphere Node
          sphere_node = gv.CreateNode(gv.GetRoot(), c4d.ID_OPERATOR_OBJECT)
          sphere_node[c4d.GV_OBJECT_OBJECT_ID] = sphere
          sphere_node_in_object = sphere_node.AddPort(c4d.GV_PORT_INPUT, c4d.GV_OBJECT_OPERATOR_OBJECT_IN)
      
          # Motion Data Node
          motion_data_node = gv.CreateNode(gv.GetRoot(), 1019010)
          motion_data_node_in_index = motion_data_node.GetInPorts()[0]
          motion_data_node_in_object = motion_data_node.GetInPorts()[1]
      
          # Connections
          object_index_node_out_instance.Connect(sphere_node_in_object)
          print(object_index_node_out_instance)
          object_index_node_out_index.Connect(motion_data_node_in_index)
          print(object_index_node_out_index)
      
          c4d.EventAdd()
      
      
      if __name__=='__main__':
          main()
      

      In the console, I get:

      False
      False
      

      I get this:
      e6cc704c-05a4-4952-b135-8b6323a9f8fe-image.png
      And I am looking for this:
      e4a5ba3b-a2c4-4865-851a-8828a9df120e-image.png
      Also I am using c4d.ID_OPERATOR_DETAILS to generate the node as in __init__.py matched the 400001152 number that the node has if it is created via the GUI.
      Thank you for your time.
      Joel Johera

      posted in Cinema 4D SDK python
      J
      JoelJohera
    • Xpresso Motion Graphics Data Can not add global matrix and color ports

      To whom it may concern,
      I am trying to create an Xpresso Motion Graphics Data node and add two ports, a Global Matrix and a Color, with a Python script.
      I have this code:

      import c4d
      
      def main():
          doc = c4d.documents.GetActiveDocument()
          null= doc.SearchObject("Null")
          xtag = c4d.BaseTag(c4d.Texpresso)
          null.InsertTag(xtag)
          gv = xtag.GetNodeMaster()
      
          motion_data_node = gv.CreateNode(gv.GetRoot(), 1019010)
          motion_data_node_in_index = motion_data_node.GetInPorts()[0]
          motion_data_node_in_object = motion_data_node.GetInPorts()[1]
          motion_data_node_out_global_matrix = motion_data_node.AddPort(c4d.GV_PORT_OUTPUT, c4d.GV_OBJECT_OPERATOR_GLOBAL_OUT)
          print(motion_data_node_out_global_matrix)
          motion_data_node_out_color = motion_data_node.AddPort(c4d.GV_PORT_OUTPUT, c4d.ID_BASEOBJECT_COLOR)
          print(motion_data_node_out_color)
      
          c4d.EventAdd()
      
      if __name__=='__main__':
          main()
      

      In the console I get:

      None
      None
      

      And the node:
      3a572591-ee41-418a-a756-320ac1898d61-image.png
      Also, I am using number 1019010 to create the node as I failed to find the name of the motion graphics data node type in Graph View Node Types.

      Thank you for your time.
      Joel Johera

      posted in Cinema 4D SDK python
      J
      JoelJohera
    • RE: Create Xpresso Node with input port Object

      Ok thanks and sorry

      posted in Cinema 4D SDK
      J
      JoelJohera
    • RE: Create Xpresso Node with input port Object

      Thank you so much for the resources. I asked because now I am trying to create a Python node, and I tried to specify the input port as c4d.DTYPE_VECTOR, but it does not work.

      posted in Cinema 4D SDK
      J
      JoelJohera
    • RE: Create Xpresso Node with input port Object

      Thank you for the information.

      Also where I can find all the GV_ options and ID_ options for creating nodes, and ports ?

      posted in Cinema 4D SDK
      J
      JoelJohera
    • Create Xpresso Node with input port Object

      To whom it may concern,
      I am trying to create an Xpresso tag and nodes programmatically with python.
      I can create a Sphere with custom user data, like a link where I will drag another object. I can create the sphere object with output ports for its global position and the link.
      For my application, I need to obtain the global position of the object that will be linked in the link.
      I can create an object node; however, I can not programmatically add the Object Input Port to the object node.
      How is the correct way to add this Input Port Object ? Is there any other way to extract the global position of the link?

      Also, is there a way to set a node name programmatically?

      doc = c4d.documents.GetActiveDocument()
      sphere = c4d.BaseObject(c4d.Osphere)
      doc.InsertObject(sphere)
      
      ud_target = c4d.GetCustomDataTypeDefault(c4d.DTYPE_BASELISTLINK)
      ud_target[c4d.DESC_NAME] = "Target"
      ud_target[c4d.DESC_ANIMATE] = c4d.DESC_ANIMATE_ON
      sphere.AddUserData(ud_target)
      
      xtag = c4d.BaseTag(c4d.Texpresso)
      sphere.InsertTag(xtag)
      gv = xtag.GetNodeMaster()
      
      sphere_node = gv.CreateNode(gv.GetRoot(),c4d.ID_OPERATOR_OBJECT)
      sphere_node[c4d.GV_OBJECT_OBJECT_ID] = sphere
      global_pos_port = sphere_node.AddPort(c4d.GV_PORT_OUTPUT, c4d.ID_BASEOBJECT_GLOBAL_POSITION)
      user_data_container = sphere.GetUserDataContainer()
      target_desc_id = None
      target_port = None
      for desc_id, bc in user_data_container:
         if bc[c4d.DESC_NAME] == "Target":
            target_desc_id = desc_id
            target_port = sphere_node.AddPort(c4d.GV_PORT_OUTPUT, desc_id)
      
      target_node = gv.CreateNode(gv.GetRoot(), c4d.ID_OPERATOR_OBJECT)
      target_object_input = target_node.AddPort(c4d.GV_PORT_INPUT, c4d.GV_OBJECT_OBJECT_ID)
      

      What I get with the above code:
      f869aa4f-f2e0-44ad-aa9e-5bee98bf57ec-image.png
      What I need it to do:
      648b31b6-2bbb-451a-a449-e21c874a1333-image.png

      To later link the target with the object.

      Thank you for your time.
      Joel Johera

      posted in Cinema 4D SDK python
      J
      JoelJohera