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

    Getting a list of objects at a given hierarchy

    Cinema 4D SDK
    2
    2
    408
    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.
    • N
      nicholas_yue
      last edited by

      Hi,

      I have been using GetNext() and GetDown() to perform depth first visit of the scene. That works fine.

      I wish to now perform some operations a a given hierarchy level.

      Is there some GetNodeListsAtCurrentLevel() type of methods ?

      I am using the Python API with R21

      Cheers

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi @nicholas_yue there is nothing builtin but the most optimized way I think will be

        import c4d
        
        def GetNodeListsAtCurrentLevel(bl2D):
            parent = bl2D.GetUp()
            if parent is None:
                parent = bl2D.GetListHead()
        
            return parent.GetChildren()
        
        def main():
            print GetNodeListsAtCurrentLevel(doc.GetActiveTag())
        
        # Execute main()
        if __name__=='__main__':
            main()
        

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

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