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

    Prevent multiple instances of my tag?

    SDK Help
    0
    5
    387
    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 21/11/2013 at 13:47, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R13-R14 
      Platform:   Windows  ;   
      Language(s) :

      ---------
      What I want is this:
      If MyTag already sits on a node, or any of its children, the user cannot add it. In other words, I want just one instance of the tag I am writing, for the whole hierarchy of objects.
      Yes, I understand it gets complicated if the user wants to group stuff, and I have to deal with that too. But in general, are there built in mechanisms in the SDK for this wish of mine, or mechanisms related to my wish?

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

        On 21/11/2013 at 21:49, xxxxxxxx wrote:

        You could use the TAG_MULTIPLE flag in RegisterTagPlugin to prevent it to be added to the same object multiple times.
        If you need to check the whole hierarchy you might perhaps be able to do it in MSG_MENUPREPARE

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

          On 25/11/2013 at 13:56, xxxxxxxx wrote:

          This is what I need, both works. I just need to figer out one additional thing: How do I prevent a tag from being added, using code written inside the tag in question? So that is sort of "kills" itself, preferably allowing me to give the user a message?
          It is when the MSG_MENUPREPARE comes down the pipeline, that I want to do this.

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

            On 26/11/2013 at 06:27, xxxxxxxx wrote:

            Originally posted by xxxxxxxx

            This is what I need, both works. I just need to figer out one additional thing: How do I prevent a tag from being added, using code written inside the tag in question? So that is sort of "kills" itself, preferably allowing me to give the user a message?
            It is when the MSG_MENUPREPARE comes down the pipeline, that I want to do this.

            Could you reformulate this for me please? You should be able to check if there is another instance
            of your tag on the object in MSG_MENUPREPARE or any other message and react respectively.

            Best,
            -Niklas

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

              On 26/11/2013 at 11:43, xxxxxxxx wrote:

              Hi Niklas,
              > Could you reformulate this for me please? 
              Ok:
              > You should be able to check if there is another instance
              Absolutely no problem
              > and react respectively.
              This is what it is all about. How do I exit "gracefully"? How do I prevent the tag from being added? How do I "bail out" so to say, "abort the insertion" of the tag?

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