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

    Getting a tag ID

    SDK Help
    0
    3
    282
    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
      Helper
      last edited by

      On 11/03/2013 at 08:40, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   13 
      Platform:   Windows  ;   
      Language(s) :       PYTHON  ;

      ---------
      User Information:
      Cinema 4D Version:   13 
      Platform:   Windows  ;   
      Language(s) :       PYTHON  ;

      ---------

      Hey Everyone,

      I'm writing a plugin for cinema in python.
      I'm trying to add a composite Tag to an object, but only in case it doesn't allready have one. In order to do that, i want to compare the Tag IDs:

        
        
      tagID = 5637  
        
      if  c4d.documents.GetActiveDocument().GetSelection()[0].GetTags()[0].GetGUID() != tagID:  
              hostObject.InsertTag(c4d.BaseTag(tagID))  
        
      

      It works up to GetGUID which is apparently not an attribute of c4d.BaseObject (same goes for GetID).

      The only attributes i can find in the docs are

      .GetObject()
      .GetOrigin()

      And they both give me the Object the tag belongs to (in this case a simple Cube)

      And just out of curiosity: How come that if i call .GetObject , which gives me the cube and its memory adress, the memory adress changes with every call?

      Thanks a lot,

      Aurel

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

        On 11/03/2013 at 09:09, xxxxxxxx wrote:

        You know there is a Python Subforum on this Forum, and that this Subforum is related to the
        C++ SDK?

        You should use symbols instead of hardcoded integral numbers, like c4d.Tcomposite.  You can
        check if the object already has a composite tag via op.GetTag(c4d.Tcomposite).

        The memory address changes since the Python objects only wrap C++ objects internall. While
        the address of the Python object changes from time to time, the memory address it is wrapping
        does not change (assuming you're comparing exactly the same C4D entities).

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

          On 11/03/2013 at 10:05, xxxxxxxx wrote:

          Thank you!

          No i did not know that, sorry - I falsely assumed that python "developement" was referring to actual implementation of python into cinema... as in developing python for cinema... It sounds silly now 😉

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