generated object passed to Message()



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

    On 26/09/2009 at 04:59, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    Hi everyone, I have another question.
    I use a MessageData plugin to send a message to Tag plugin when the geometry needs updating.
    As long as the polygon object is not under a hypernurbs this works.
    However if I put it under a hypernurb the message that is sent to the Tag plugin also gets send for the generated hypernurbs.
    This was not what I expected, can anyone shed some light on this behaviour?
    Here are some relevant code snippets:
    This is from the TagData::Execute

        
        
        
        
        if (blnEnableSym&&blnSymmetryDirty)  
        { if (lngAction==450000012)  
         { // Slide  
          blnSlide=true;  
         }  
         GePrint("Send MESSAGE_UPDATE_TS_ID from execute");  
         SpecialEventAdd(MESSAGE_UPDATE_TS_ID, 1, 0);  
        }
        
        
        
    

    This is from the CoreMessage of the MessageData

        
        
        
        
        class TrueSymmetryMessage : public MessageData  
        { public:    
          virtual Bool CoreMessage(LONG id, const BaseContainer& bc)    
          {   switch(id)      
           {    case MESSAGE_UPDATE_TS_ID:       
             LONG lngI;  
             if (taglist)  
             { LONG  tCnt = taglist->GetCount();  
              for(lngI=0; lngI<tCnt; lngI++)  
              { BaseTag *tag = static_cast<BaseTag*>(taglist->GetIndex(lngI));  
               GePrint("SendMessage from MessageData " + LongToString(lngI) );  
               tag->Message(MESSAGE_UPDATE_TS_ID);  
              }  
             }  
           }      
           return TRUE;    
          }  
        };
        
        
        
    

    And this is from TagData::Message

        
        
        
        
        if (type==MESSAGE_UPDATE_TS_ID)  
        {   
         BaseTag* tag = (BaseTag* )node;  
         BaseObject* obj = tag->GetObject();  
         PolygonObject* objPoly;  
         objPoly=(PolygonObject* )obj;
        
        
        
        
         GePrint("MESSAGE_UPDATE_TS_ID PolyCount " + LongToString(objPoly->GetPointCount()) );  
         if (blnSymmetryDirty)  
         { if (!MaintainSymmetry(obj,bc))  
          { bc->SetBool(ENABLE_SYMMETRY, false);  
          }  
         }  
        } 
        
        
        
    

    If I do a modelling command on the polygon object this is what the console tells me what is happening:
    Send MESSAGE_UPDATE_TS_ID from execute
    SendMessage from MessageData 0
    MESSAGE_UPDATE_TS_ID PolyCount 97
    SendMessage from MessageData 1
    MESSAGE_UPDATE_TS_ID PolyCount 97
    That the message is sent more than once from the MessageData is because the plugin get's added in the Init to the taglist.
    But in the drawing pipeline the corresponding Free is not called so you end up with more than one reference in the taglist.
    I would like to improve this so that there is only one reference in the taglist but that is not the problem right now.
    If I put the polygon object under a hypernurb the following happens:
    Send MESSAGE_UPDATE_TS_ID from execute
    SendMessage from MessageData 0
    MESSAGE_UPDATE_TS_ID PolyCount 96
    SendMessage from MessageData 1
    MESSAGE_UPDATE_TS_ID PolyCount 97
    SendMessage from MessageData 2
    MESSAGE_UPDATE_TS_ID PolyCount 97
    SendMessage from MessageData 3
    MESSAGE_UPDATE_TS_ID PolyCount 1146
    The last call to the TagData::Message is done with the hypernurbs generated polygon object as far as I can tell.
    I looked at the points array of this object and these points do correspond with positions on hypernurbs surface.
    So long story, here is what I would like to know:
    Is this behaviour by design and is there a way to safely determine when the generated object get's passed to the TagData::Message?
    Cheers,
    Nebu



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

    On 26/09/2009 at 05:21, xxxxxxxx wrote:

    Forgot to fill in the User Information:
    Cinema 4D Version:   10.5 ;
    Platform:      Windows;
    Language(s) :     C++  ;



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

    On 27/09/2009 at 07:13, xxxxxxxx wrote:

    Ok I have found a solution, that has the added benefit that there is only one instance of the tag in the list.
    I have moved the code to add the the tag to the list from the Init to the Execute member and added a check to see if the tag is already in the list.
    That seems to have solved my problems.
    Cheers,
    Nebu


Log in to reply