Time Shift. Python tag.
-
Windows 10
Cinema 4d 2023.2.1Good afternoon. I'm trying to figure out how I can transfer data between objects with a time offset using the "Python" tag. Specifically I have a number of cubes. I want to achieve a behavior where if I move the first cube, the second cube will repeat its movement but after a certain amount of time, like 2 seconds, and then the 3rd cube will do the same and so on. I know that xpresso has a "memory" node, and it does roughly what I need, but my whole scene is based on code in a single "Python" tag, and I don't want to add xpresso just for one purpose. I would be very grateful for your help.
-
Hello @ll2pakll,
Thank you for reaching out to us. It depends a bit on what you want to do exactly.
- You want to look n units back into the past of the key-frame animation of a node. This is possible, but when the effect should be general, you will have to do quite a bit of legwork yourself. If it is just a specific parameter whose animation you want to clone (which an offset), things are a bit easier as you then do not have to discover all the thingw which are animated first. In both cases you will then access the CTrack of that animation with FindCTrack to access its
CCurve
. Then you can call CCurve.GetValue to get a value in this interpolation at any point of time you desire. - You want to look n units back into the past of anything that is not keyframed such as simulations, particle systems, or the user just scrubbing the position of an object for example. All this is uncached, or the caches are at least not public and there is also no unified cache interface for them. In most cases you would have to do your own caching and even then require initmate knowledge of non-public or only semi-public parts of the API.
Cheers,
Ferdinand - You want to look n units back into the past of the key-frame animation of a node. This is possible, but when the effect should be general, you will have to do quite a bit of legwork yourself. If it is just a specific parameter whose animation you want to clone (which an offset), things are a bit easier as you then do not have to discover all the thingw which are animated first. In both cases you will then access the CTrack of that animation with FindCTrack to access its
-
@ferdinand Thank you very much for your reply. I only need to animate one parameter and I have already written something similar to this parameter cache myself, you saw it in a previous question and advised me to change the location of the cache for more reliability. I will take your advice in the future to avoid reinventing the wheel. Thanks again for your help.