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

    How to find an object quickly?

    Cinema 4D SDK
    python s22
    4
    10
    1.4k
    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.
    • chuanzhenC
      chuanzhen
      last edited by

      Hi,
      If there are multiple objects with the same name and the same type in the object manager, what is the unique identification of each object.
      Thanks for any help!

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        Try BaseObject.GetGUID().

        chuanzhenC 1 Reply Last reply Reply Quote 0
        • chuanzhenC
          chuanzhen
          last edited by chuanzhen

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • chuanzhenC
            chuanzhen @Cairyn
            last edited by

            @Cairyn
            Thanks,useful!
            Is there a way to directly obtain the object using this uniquely identified ID?

            CairynC 1 Reply Last reply Reply Quote 0
            • CairynC
              Cairyn @chuanzhen
              last edited by

              @chuanzhen Not that I know of, since these are not links from some internal cache. You may need to write your own function to traverse the tree and compare manually.
              Unless some Maxon person knows a better way.

              chuanzhenC 1 Reply Last reply Reply Quote 0
              • chuanzhenC
                chuanzhen @Cairyn
                last edited by

                @Cairyn
                It seems I should try some other solutions.Thanks for your help.

                1 Reply Last reply Reply Quote 0
                • r_giganteR
                  r_gigante
                  last edited by

                  Hi @chuanzhen thanks for reaching out us.

                  With regard to your question, I warmly recommend also thinking of using FindUniqueID and looking at the section BaseList2D Manual::Unique ID or to make good use of BaseLink.

                  Finally with regard to get the object, either you traverse and compare again the unique ID or, by keeping your BaseLink list updated when add/deletion operations take place, you can look into the list and retrieve desired C4DAtom.

                  Cheers, R

                  chuanzhenC 1 Reply Last reply Reply Quote 0
                  • CairynC
                    Cairyn
                    last edited by

                    Considering that a UniqueID has to be registered with Maxon, this may not be the way to identify arbitrary objects within the object tree?
                    Seems to depend on the actual usecase. What is the final purpose here?

                    ferdinandF 1 Reply Last reply Reply Quote 0
                    • ferdinandF
                      ferdinand @Cairyn
                      last edited by ferdinand

                      Hi @Cairyn,

                      @Cairyn said in How to find an object quickly?:

                      Considering that a UniqueID has to be registered with Maxon, this may not be the way to identify arbitrary objects within the object tree?
                      Seems to depend on the actual usecase. What is the final purpose here?

                      This only does apply to the case when one wants to add custom markers. Nodes are being automatically marked with MAXON_CREATOR_ID upon instantiation by Cinema 4D. The advantage of FindUniqueID is that it is a member of C4DAtom, i.e., far more versatile than BaseObject.GetGUID. I have used MAXON_CREATOR_ID in some of my posting here on Plugin Café and there were also a few threads covering it on the old forum; looking at these might clarify the usage.

                      Cheers,
                      Ferdinand

                      MAXON SDK Specialist
                      developers.maxon.net

                      1 Reply Last reply Reply Quote 0
                      • chuanzhenC
                        chuanzhen @r_gigante
                        last edited by

                        @r_gigante Thanks for your help!

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