Actions on tag deletion



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

    On 11/11/2004 at 21:58, xxxxxxxx wrote:

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

    ---------
    I want to perform an action when one of my plugin tags is deleted from the document. There do not seem to be any Messages sent to the TagData when deletion occurs, so I stuck some code in Free() as shown below:

      
    void MorphMixerTag::Free(GeListNode *node)  
    {  
         GePrint("MorphMixerTag.Free");  
         // Ask user whether or not to reset morphs on delete  
         if (QuestionDialog(IDS_MMT_QUESTION))  
         {  
              // Get Polygonal Object receiving morphs, return if not  
              opBC = ((BaseTag* )node)->GetDataInstance();  
              lastIndex = opBC->GetLong(MORPHMIXER_LASTINDEX);  
              // Set slider to 0.0  
              for (index = MORPHMIXER_MORPHOFFSET; index != lastIndex; index++)  
              {  
                   opBC->SetReal(index, 0.0);  
                   DirectlyMorph();  
              }  
         }  
      
         if (morphs) GeFree(morphs);  
         if (desc) Description::Free(desc);  
    }  
    

    The operation after a TRUE QuestionDialog return doesn't appear to be performed and I get several more QuestionDialogs when exiting C4D. My suspicion is that these are from Undo copies being deleted since there is only one having been deleted (?).

    Is this possible? If not, I already have alternative methods in place.

    Thanks,
    Robert



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

    On 12/11/2004 at 12:08, xxxxxxxx wrote:

    Hmm, seems to work fine for me here. The code after the questiondialog is executed for me.

    void TestTag::Free(GeListNode* node)
    {
         if(QuestionDialog("test"))
         {
              GePrint("hallo");
         }
    }



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

    On 12/11/2004 at 14:42, xxxxxxxx wrote:

    I wasn't getting any effect (reset of sliders). It's possible that by this stage, the node's BaseContainer or other data is no longer valid, so best to scrap this idea.

    I have gone the alternate route for several reasons. The first is that this would cause complications when removing all the tags (getting a dialog for each one unless somehow circumvented). The second is that closing document issue. Third is that deleting the selection with a button avoids these issues and makes it more user-friendly.

    Thanks,
    Robert



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

    On 14/11/2004 at 10:52, xxxxxxxx wrote:

    As you've noticed, doing stuff in the Free() function is not recommended since you have no control over how many instances of your class that are created beside the instances in the document. So your alternate route sounds good.


Log in to reply