How to Update per frame
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/10/2011 at 17:33, xxxxxxxx wrote:
hey everyone. i was wondering how one would go about updating a python plugin by checking for a frame change? any help is greatly appreciated. im running into trouble because when i have the object cache optimization turned on, i cant seem to update or check for anything once the cache has been built. how to i get it to update the cache on a frame by frame basis?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/10/2011 at 04:43, xxxxxxxx wrote:
Hi avd007, in your case turn of the "Optimize Cache" attribute of your Python Generator so
it will be triggered on all events. To avoid a massive slowdown of your generator for complexe
geometry add the two lines #1, #2 to your generator which do the same as "Optimize Cache".
But now you can add custom conditions when you return the cache of your object.import c4d #Welcome to the world of Python def main() : dirty = op.CheckCache(hh) or op.IsDirty(c4d.DIRTY_DATA) #1 if dirty is False and not framechanged and ... : return op.GetCache(hh) #2 return c4d.BaseObject(c4d.Ocube)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/10/2011 at 06:00, xxxxxxxx wrote:
You could also check if the frame did really change.
prev = type("", (), {})() # create a new empty type and instantiate it prev.frame = 0 prev.cache = None def **main** () : frame = doc.GetTime().GetFrame(doc.GetFps()) if frame != prev.frame: prev.frame = frame # continue .. prev.cache = objectToReturn return objectToReturn else: return prev.cache
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/10/2011 at 16:16, xxxxxxxx wrote:
word! thanks for the quick response guys! they both work great!