DeformCache changes



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

    On 07/09/2003 at 02:23, xxxxxxxx wrote:

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

    ---------
    Hi
    i work on a deformer that uses another data from other objects. Similar to the Spline Deformer.
    I wanted to access the DeformCache of this object, so the deformer works also if the object is deformed itself.But i can't determine when the DeformCache has changed. Here is the code

        
        
        
        
         BaseContainer* data = op->GetDataInstance();  
         UVWTag *deftag = (UVWTag* )data->GetBaseLink(DEFUVW)->GetLink(doc,Tuvw);  
         BaseObject *defop = deftag->GetObject();  
           
         if(    defop->GetDeformCache()   
          && defop->GetDeformCache()->IsInstanceOf(Opolygon))  
         {  
          GePrint("checksum: "+LongToString(defop->GetDeformCache()->GetDirty(DIRTY_DATA | DIRTY_MATRIX)));   // this doesn't change when the defop is deformed  
          if(defop->GetDeformCache()->GetDirty(DIRTY_DATA | DIRTY_MATRIX) != defop_checksum)  
          {  
           op->SetDirty(DIRTY_DATA);  
           defop_checksum = defop->GetDeformCache()->GetDirty(DIRTY_DATA | DIRTY_MATRIX);  
          }  
         }  
         else if(defop->GetDirty(DIRTY_MATRIX | DIRTY_DATA) != defop_checksum) {  
          op->SetDirty(DIRTY_DATA);  
          defop_checksum = defop->GetDirty(DIRTY_MATRIX | DIRTY_DATA);  
         }
        
        
        
    

    defop_checksum is a member variable of my object class
     
    best regards
    Michael



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

    On 08/09/2003 at 02:09, xxxxxxxx wrote:

    DIRTY_DATA covers the container and DIRTY_MATRIX covers the matrix. They don't check the point data afaiu.



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

    On 08/09/2003 at 03:03, xxxxxxxx wrote:

    hmm... using GetDirty(DIRTY_DATA) works fine for the defop. I get all the changes. e.g. if i move some points in the editor.  
    If i print out defop->GetDirty(DIRTY_DATA), can see that it is incremented for every change. It also checks points. ( i believe that Node::Message(...) increments it, if you pass MSG_UPDATE as flag )
    .. so why does this work for a normal object, but not for cache objects ???
    .. maybe the cache object is destroyed and rebuild completely on every change. So the "dirty checksum" is alwas initilised to the same starting number ??!!!
    if so, then i guess i have no chance of finding out if the cache changed :-(



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

    On 08/09/2003 at 03:12, xxxxxxxx wrote:

    Sorry, you're right. And I think you're on target with the explanation as well. What you could do is to calculate a checksum of the point array yourself.



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

    On 08/09/2003 at 04:34, xxxxxxxx wrote:

    good idea. but how would i do that? I am thinking of casting all Reals to ULONG and adding them.  I guess it could work in most cases.
    What do you think ? Do you have any reference to more clever algorithms?



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

    On 08/09/2003 at 07:45, xxxxxxxx wrote:

    just tried. The simple sum is good enought  :-)



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

    On 14/11/2003 at 08:20, xxxxxxxx wrote:

    I thought some more about it.  I don't like calcualting a checksum myself.
    Look at the instance object for example. It also needs to know if a object changed in any way. Do you know how the instance does it ?



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

    On 21/11/2003 at 09:06, xxxxxxxx wrote:

    Always use the original object to track changes. If the original object changed then (and only then) the deformed state will be different also.


Log in to reply