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 add a tag to an object

    SDK Help
    0
    5
    365
    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 01/06/2013 at 21:13, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R14 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      How do I add a tag to an object? I have no problems cloning tags, like this.

      BaseTag* tagFound = someObject->GetFirstTag();
      BaseTag* newTag = (BaseTag* )tagFound->GetClone(COPYFLAGS_0, NULL);
      anotherObject->InsertTag(newTag, NULL);
      

      But how do I 
      a) Insert one of the C4D built in tags, like the Constraint tag
      b) Insert one of my own tags.
      For (a) I just do not know. For (b) I get error messages. Mainly because my tags are

      class MySpecialTag : public TagData
      

      and I get complaints about  MySpecialTag not being a BaseTag*.

      Any ideas?

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

        On 02/06/2013 at 00:11, xxxxxxxx wrote:

        a)

          
        BaseTag* tag = BaseTag::Alloc(Tcaconstraint);  
        if (tag) obj->InsertTag(tag, NULL);  
        

        You will need to include the modules/ca/res in your search path and include "Tcaconstraint.h" in order to have the enumeration.

        b)

          
        BaseTag* tag = BaseTag::Alloc(MYPLUGIN_ID);  
        if (tag) obj->InsertTag(tag, NULL);  
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 02/06/2013 at 02:48, xxxxxxxx wrote:

          You can have it even easier:

            
          BaseTag *tag = obj->MakeTag(Tcaconstraint);   
          

          This will allocate and insert the tag in one single call. Don't forget to check the result for NULL, though.

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

            On 02/06/2013 at 03:45, xxxxxxxx wrote:

            Well, I think that I have had issues with adding undos using MakeTag().  But if that behavior has changed, by all means use that instead.

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

              On 02/06/2013 at 03:49, xxxxxxxx wrote:

              Thanks a whole bunch! I will test it out, as soon as I have sorted out a few other issues. And Undo is important, yes.

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