Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    On FrameChange?

    SDK Help
    0
    3
    287
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post