Solved CKey left/right Python methods

Could someone please enlighten me: what exactly do these Python CKey left/right methods do? The documentation is somewhat... vague :-) (the text below is taken directly from Maxon's Python API documentation pages).

CKey.GetTimeLeft(self) : "Get the left time of this key"
CKey.GetTimeRight(self) : "Get the left time of this key"
CKey.GetValueLeft(self) : "Get the value of this key"
CKey.GetValueRight(self) : "Get the right of this key"

CKey.SetValueLeft(self, seq, v) : "Set the left value of this key"
CKey.SetValueRight(self, seq, v) : "Set the right value of this key"
CKey.SetTimeLeft(self, seq, t) : "Set the left time of this key"
CKey.SetTimeRight(self, seq, t) : "Set the right time of this key"

(as I've suggested before: Maxon should really REALLY put more resources in the API documentation quality)

I guess this means what curve.GetKey(key_id) is for. Range starts at 0 and ends with curve.GetKeyCount()-1 (inclusive).

I tried inserting a key through the GUI, and it appears in the correct (time) sequence, no matter whether I use the curve's key index or the GetNext method.

These are times and values of the right and left tangents of the keys. See the C++ documentation:
https://developers.maxon.net/docs/Cinema4DCPPSDK/html/page_manual_ckey.html#page_manual_ckey_edit_tangents

Yeah, it would be fairly helpful if the word "tangent" would be mentioned in the Python docs...

Thank you, Cairyn. When you document method "SplurgeMiddlePhalange()" with "this method splurges your middle phalange", you're not really helping anyone... :-)

A followup question: is there a way to get the time and/or value of previous/next keyframe of a CKey (on the same track)? I was hoping these mysterious left/right methods would do that, but apparently not.

@heilei Yeah, there is quite a bit of that "self-evidently documented" stuff in the C4D docs. But I'm not working for Maxon, I'm just the nagging guy :smiley_cat:

CKey is derived from GeListNode which has the GetNext() / GetPrev() methods. So theoretically it may be possible to walk through the key list of a track by using these. But actually I see only examples where the keys are iterated by GetKey() on the curve.

When I look at the GetNext() keys on a normal curve, it seems to be correct:

        curve = track.GetCurve()
        if curve is None:
            continue

        for key_id in range(curve.GetKeyCount()):
            key = curve.GetKey(key_id)
            print ("This:", key, 
                        key.GetTime().GetFrame(doc.GetFps()), 
                        key.GetValue())
            if key.GetNext() != None:
                print ("Next:", key.GetNext(), 
                               key.GetNext().GetTime().GetFrame(doc.GetFps()), 
                               key.GetNext().GetValue())

I haven't done all that much with keys though, so maybe there is a reason not to do it by the GeListNode functions. I will leave the answer to that question to the Maxon crew.

CTrack documentation talks about ”index” a lot, when referring to keys, but I haven’t yet found any definite specification for it. Are the keys indexed in what order? Time? Order of insert? Random? Does the index start from 0 or 1?

I guess this means what curve.GetKey(key_id) is for. Range starts at 0 and ends with curve.GetKeyCount()-1 (inclusive).

I tried inserting a key through the GUI, and it appears in the correct (time) sequence, no matter whether I use the curve's key index or the GetNext method.

Ok, thanks for the clarification.