On FrameChange?



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

    On 16/08/2004 at 16:37, xxxxxxxx wrote:

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

    ---------
    Hi,

    Im making an ObjectData plugin and need to update the object only when a frame has changed.

    I have done it but Im just wondering if there is a better/easier way.

    My current method consists of keeping a copy of the current frame in the ObjectData::Draw() method, and checking if that frame number does not equal the current frame. It works, but it seems an ugly hack way at doing it.

    My current code is something like...

      
    LONG gOldFrame=0;  
      
    ObjectData::Draw(...)  
    {  
    LONG CurrentFrame = GetCurrentFrame();  
      
    if(CurrentFrame != gOldFrame)  
    {  
        // A Frame has changed!  
        gOldFrame = CurrentFrame  
    }  
    }  
    

    Just wondering if there is some sort of message that I can check that indicates when a frame has changed. ::Draw Gets called much to often than what I need.



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

    On 18/08/2004 at 00:47, xxxxxxxx wrote:

    No, there's no such message. Your hack sounds relatively safe, though why can't you do it in GetVirtualHierarchy() with the dirty variable? What kind of object plugin is it? Also, I hope that gOldFrame is a member variable, not global as it looks above.



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

    On 18/08/2004 at 02:45, xxxxxxxx wrote:

    Hi Mikael,
    Yes that is a member variable :) I only made global in the above example to simplify things.

    I'm not familiar with GetVirtualHierarchy(), infact I don't see it anywhere in the SDK docs, perhaps you mean GetVirtualObjects()?

    My ObjectData is generating a few vectors per frame (like the particle emitter) and I am displaying them in ObjectData::Draw() but I am also generating those vectors in ObjectData::Draw() too (because my frame change routine is in there).

    It works perfect as it is, and doesn't require changing (as I always say, and never follow - If it aint broke, dont fix it). I was just hoping there was a 'cleaner' way to detect if a frame has changed


Log in to reply