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

    Move objects in the hierarchy

    Cinema 4D SDK
    python
    1
    2
    614
    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.
    • KantroninK
      Kantronin
      last edited by

      Hi,

      With a script, I create a large number of objects in my scene.
      In the hierarchy, they are presented in the form of a list, which becomes difficult to read because it's too long.
      So I want to put the names of the child objects under the name of the root object.
      How can I do this ?

      def hierarchie_organise(doc, object_root, list_object):
      	# document name: doc
      	# object root: object_root
      	# child objects: list_object 
      
      	# checking (exclusion of the root object if it's in the list of child objects)
      	list_child = []
      	for object in list_object:
      		if object != object_root:
      			list_child.append(object)
      
      	# positioning of list_child objects under the object_root object
      	...
      	...
      	...
      
      	return 
      

      Truepic1.png

      1 Reply Last reply Reply Quote 0
      • KantroninK
        Kantronin
        last edited by

        I found the solution on https://plugincafe.maxon.net/
        It was enough in the for loop to add the following line of code:

        for object in list_object:
        if object != object_root:
        object.InsertUnder(object_root)
        c4d.EventAdd()

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