Marking a tag



  • On 12/03/2013 at 07:50, xxxxxxxx wrote:

    Hey Everyone,

    Thanks to you guys I've gotten pretty far in the creation of my plugin, so thanks for that!
    I'm now trying to mark a compositing tag (or it's host, since it can only have one compositing tag anyway) so that i can later on delete all those compositing tags again that were created by the plugin. But those compositing tags that were already on some objects (hence not marked) previous to the plugins execution should remain untouched.

    How can that be achieved?

    Any help is much appreciated!

    Aurel



  • On 12/03/2013 at 07:57, xxxxxxxx wrote:

    Hi Amadeo,

    if you run the adding and removing of the tags in the same execution pipeline, you can simply
    store a list of all tags you have created. After you're done, you can iterate over each item in the
    list and remove it.

    In case you can not communicate between the adding and removing procedures, you can obtain
    a unique ID from the plugincafe and store a boolean value in the tags you have created. When
    removing, you can check if 1. the ID exists and 2. the value is True (checking twice is better) and
    then remove the tag.

    I_CREATED_THAT_TAG = 1002350 # Must be a unique ID from the plugincafe!
      
    for tag in tags: # iterate over tags
        bc = tag.GetDataInstance()
        if bc.FindIndex(I_CREATED_THAT_TAG) >= 0 and bc.GetBool(I_CREATED_THAT_TAG) :
            tag.Remove()
    

    -Niklas



  • On 12/03/2013 at 08:14, xxxxxxxx wrote:

    Thanks a lot! I will try that  Smile

    Aurel


Log in to reply