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
    • Register
    • Login

    Get All Nodes inside an Xpresso Tag?

    Cinema 4D SDK
    2023 python
    2
    3
    479
    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
      bentraje
      last edited by

      Hi,

      Is there a way to get all nodes inside the xpresso tag?
      I tried checking the documentation and the forum and I don't get any relevant hits.

      It's for the workaround on this thread (https://developers.maxon.net/forum/topic/12246/how-do-i-return-the-connected-port-from-the-input-port/1)

      Regards,
      Ben

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

        Ah my bad. It's just the same for objects in object manager.
        Here is the code for reference:

        import c4d 
        
        def GetAllNodes(gvNode=None, nodeList=None):
                if nodeList is None:
                    nodeList = list()
                    gvNode = nodemaster.GetRoot()
        
                while gvNode:
                    nodeList.append(gvNode)
                    GetAllNodes(gvNode.GetDown(), nodeList)
                    gvNode = gvNode.GetNext()
        
                if len(nodeList) > 1: 
                    nodeList = nodeList[1:] # Remove the Xgroup
                    
                return nodeList
        
        geo_obj = doc.SearchObject("Cube")
        exp_tag = geo_obj.GetTag(1001149) #Get Expresso
        nodemaster = exp_tag.GetNodeMaster()
        node_list = GetAllNodes()
        
        1 Reply Last reply Reply Quote 1
        • M
          m_adam
          last edited by

          Hi yes, GvNode are BaseList2D and GeListNode, like material, object, tags.
          There is the same discussion going on, so you may find it interesting Issue collecting all the shaders in a material.

          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

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