Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 23/06/2017 at 05:14, xxxxxxxx wrote:
User Information: Cinema 4D Version: r18 Platform: Windows ; Language(s) : C.O.F.F.E.E ; PYTHON ;
--------- Hi, Im really struggling to find a way to pull off the following in both Python and COFFEE:
I want to be able to take the active object and set all tracks to be 'After: Repeat' 'Repetitions: 20' other than position Z, which I want to set to 'After: Offset Repeat' 'Repetitions: 20'.
I want to be able to create this script so that I can automate creating looping run cycles for a lot of different characters as currently there's a fair few steps whilst doing it manually.
Has anyone any idea how I can affect these attributes through Python or COFFEE?
Ive trawled through the documentation and found that i should be using CLOOP_REPEAT and CLOOP_OFFSETREPEAT but Im obviously using these in the wrong way as Im getting syntax errors.
Thanks in advance!
Keith
On 26/06/2017 at 07:39, xxxxxxxx wrote:
Hi Keith,
welcome to the Plugin Café forums
The animation parameters you want to modify are part of a CTrack, which is stored on an animated object for each animated parameter. Parameters are identified by so called DescID.
In the C++ SDK Docs we have a manual about animation further detailing CTrack, CCurve and CKey. I think it works quite well to explain the basic concepts for Python developers as well. There's also a manual on DescID.
In order to get you going quickly, here's a small script, roughly doing what you want:
import c4d def main() : if op is None: # if no object selected return # Construct a DescID for the animation track which will be handled differently descidPosZ = c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_REL_POSITION), c4d.DescLevel(c4d.VECTOR_Z)) # Iterate all CTracks of the active object ct = op.GetFirstCTrack() while ct is not None: descid = ct.GetDescriptionID() if descid == descidPosZ: ct[c4d.ID_CTRACK_AFTER] = c4d.CLOOP_OFFSETREPEAT ct[c4d.ID_CTRACK_AFTER_CNT] = 42 else: ct[c4d.ID_CTRACK_AFTER] = c4d.CLOOP_REPEAT ct[c4d.ID_CTRACK_AFTER_CNT] = 20 ct = ct.GetNext() c4d.EventAdd() if __name__=='__main__': main()
Also I'd like to suggest to stick with Python instead of COFFEE. It's way more powerful than COFFEE.
Final note, I have moved this thread to the Python sub-forum.