Prevent multiple instances of my tag?



  • 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?



  • 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



  • 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.



  • 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



  • 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?


Log in to reply