When to refresh a deformer object?



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

    On 01/03/2011 at 02:37, xxxxxxxx wrote:

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

    ---------
    In the descriptions of my deformer object, I have a link field. Now I want the deformer to be recalculated when the linked object is moved or changed. Currently, nothing happens. ModifyObject() is not called when I do something outside the deformer's hierarchy.

    I would try to add the linked object to a dependence list, but that doesn't work outside GetVirtualObjects().

    Thanks for help!

    Greetings,
    Jack



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

    On 01/03/2011 at 03:09, xxxxxxxx wrote:

    Could you look for MSG_DESCRIPTION_CHECKUPDATE in the Message() and then refresh from there?

    Or maybe continuously check to see if the BaseObject in your link field is not set to NULL, thus looking for a change in the linkfield..

    ~Shawn



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

    On 01/03/2011 at 03:37, xxxxxxxx wrote:

    You can check this in ObjectData::CheckDirty. It's called if the link changes.

    Here an example:

      
    void MyDeformer::CheckDirty(BaseObject *op, BaseDocument *doc)  
    {  
      if (!op || !doc) return;  
      
      BaseContainer *bc = op->GetDataInstance();  
      if (!bc) return;  
      ULONG dirtyness = 0;  
      
      // Get linked object  
      BaseObject    *lop = (BaseObject* )bc->GetLink(MYDEFORMER_LINK, doc, Obase);  
      if (!lop) return;  
      
      dirtyness += lop->GetDirty(DIRTYFLAGS_MATRIX|DIRTYFLAGS_DATA);  
      
      // lastlopdirty is member variable of type ULONG  
      if (dirtyness != lastlopdirty)  
      {  
          lastlopdirty = dirtyness;  
          op->SetDirty(DIRTYFLAGS_DATA);  
      }  
    }  
    

    Compare the dirty count and update accordingly (lastopdirty).

    cheers,
    Matthias



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

    On 01/03/2011 at 03:46, xxxxxxxx wrote:

    That works, thanks Matthias!
    I'll propably add some walking-up-the-hierarchy to check if parent have been moved.

    Cheers,
    Jack


Log in to reply