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
    • Recent
    • Tags
    • Users
    • Login

    Object-Referencing without Names

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 378 Views
    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.
    • H Offline
      Helper
      last edited by

      On 14/07/2013 at 10:22, xxxxxxxx wrote:

      Hey guys,

      i was wondering if there's any way of referencing a specific object inside the document without it's actual name but rather by it's ID.

      So that i can generate a lot of objects together with a single python tag referencing all of them and doing it's thing.
      At the moment I'm using a list of all the object-names, but if the user wants to rename one of the objects, the link will break. This is exactly what I want to prevent by using IDs.

      I already found a GetUniqueIP()-function but all it returns is 0 for every object.

      Any ideas?

      greetings
      phsn

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 14/07/2013 at 10:59, xxxxxxxx wrote:

        Why not just use a Link Box or In/Exclude list? This does not also prevent the loss of the link
        to the object, but is also a whole lot faster than searching for the object by name in the object
        tree.

        -Nik

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 14/07/2013 at 11:41, xxxxxxxx wrote:

          as niklas has already pointed out, c4d is strictly oo when it comes to object references. objects are meant to be referenced by the gui elements niklas mentioned or as child/parent of xyz. however in r14 a ID system has been introduced to generate IDs and IPs for objects. IPs have to be set by yourself ( so that you can 'mark' objects ), while IDs are automatically generated .

          BaseObject.GetUniqueIP()
          BaseObject.SetUniqueIP()
          BaseObject.GetGUID() <- that is the one you are looking for

          the subject does come up here on a regular basis and although it is possible now, you should be aware of the fact the identifying objects with their id is a rather uncommon approach in the c4d api.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 14/07/2013 at 12:39, xxxxxxxx wrote:

            Thanks a lot for the answers! You helped me out 🙂

            An In/Exclude-List solved my problem. I attached it via Script to the Python-Tag itself, also generated by the Script, so its not even very disturbing for the user in the end, since it's kind of an "internal list"

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