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

    Inserting a custom tag & more

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 477 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 13/04/2008 at 15:32, xxxxxxxx wrote:

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

      ---------
      Hi,

      I want to make a command plugin that does the following things.

      1. Insert two objects into the scene
      I already managed to do this. No problem.

      2. Attach a tag to one of the objects
      How do I do this? The tag I want to attach is an Expression Tag plugin that I made myself.

      3. Link the 2nd object in a link field in the 1st object
      The first object (it's a Generator Object plugin that I made myself) has some link fields in its description. I want to link the 2nd object in one of these link fields. How do I do that?

      Once again, thanks in advance!

      Greetings,
      Jack

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 13/04/2008 at 20:20, xxxxxxxx wrote:

        2. Create the tag using BaseObject::MakeTag([insert PluginID here]). If you want to create undos as well, do it this way:

        BaseTag* tag = PluginTag::Alloc([insert PluginID here]);
        if (!tag) // error;
        baseObject->InsertTag(tag);
        baseDocument->AddUndo(UNDO_NEW, tag);

        3. Get the first object's BaseContainer and set the link:

        BaseContainer* bc = obj->GetDataInstance().
        if (bc) bc->SetLink([LINK_ID], secobj);

        Replace [LINK_ID] with the LINK id from the object's res description file.

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 14/04/2008 at 00:04, xxxxxxxx wrote:

          Way cool, thank you very much!

          Just one additional question:
          Can I also create an UNDO for the complete action (create object + create object + create tag + link object)?

          Best regards,
          Jack

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 14/04/2008 at 00:53, xxxxxxxx wrote:

            Btw. you can use MakeTag() to attach tags to objects.

            > \> doc->StartUndo(); \> \> BaseTag \*tag = NULL; \> tag = op->MakeTag(PLUGIN_ID); \> if(!tag) return FALSE; \> \> doc->AddUndo(UNDO_NEW, tag); \> \> doc->AddUndo(UNDO_CHANGE, tag); \> \> BaseContainer \*bc = tag->GetDataInstance(); \> bc->SetLink(LINK_ID, op2); \> \> doc->EndUndo(); \>

            cheers,
            Matthias

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 14/04/2008 at 01:24, xxxxxxxx wrote:

              Perfect. That makes it even easier.

              Thanks!

              Greetings,
              Jack

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