Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Create Xpresso Python node

    Cinema 4D SDK
    python 2024
    2
    3
    545
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Brakusha
      last edited by

      Hi. I ask you to forgive me for my English. I have to use a translator. My problem is this: I'm trying to create a Xpresso Python node in my script, using a command GvNodeMaster.CreateNode. I`m use node ID_OPERATOR_COFFEE. The node appears in the editor window, but for some reason it is dead, and its title is red. Once created, I can't do anything with the node. Can't fill the script window or anything. I'm creating this node because there was already advice here: to create a Python node, contact the coffee operator. What am I doing wrong?

      Sample code:

      from typing import Optional
      import c4d
      
      doc: c4d.documents.BaseDocument  # The active document
      op: Optional[c4d.BaseObject]  # The active object, None if unselected
      
      def main() -> None:
      
      
          tag = op.GetTag(c4d.Texpresso)
          nodemaster = tag.GetNodeMaster()
          noderoot = nodemaster.GetRoot()
          mynode = nodemaster.CreateNode(noderoot, c4d.ID_OPERATOR_COFFEE, None, 0, 0)
      
          c4d.EventAdd()
      
      if __name__ == '__main__':
          main()
      
      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi you can create it this way:

        from typing import Optional
        import c4d
        
        doc: c4d.documents.BaseDocument  # The active document
        op: Optional[c4d.BaseObject]  # The active object, None if unselected
        
        def main() -> None:
            tag = op.GetTag(c4d.Texpresso)
            nodemaster = tag.GetNodeMaster()
            noderoot = nodemaster.GetRoot()
            mynode = nodemaster.CreateNode(noderoot, c4d.GVpython, None, 0, 0)
            print(mynode.GetOperatorID() == c4d.GVpython)
        
            c4d.EventAdd()
        
        if __name__ == '__main__':
            main()
        

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • B
          Brakusha
          last edited by

          WOW!!! It turns out that there is a node specifically for python. But in the documentation, in the list GV Node Types, it is not indicated. This fact forced me to look for workarounds. Thanks for the help

          1 Reply Last reply Reply Quote 0
          • First post
            Last post