Ease in/out keyframes created with Python?
-
On 26/02/2018 at 10:40, xxxxxxxx wrote:
I have successfully created a function to make a keyframe on the selected object (Position or Rotation) but I don't know if is it possible to adjust ease in/out keyframe values? What line should I insert to the code? Thanks in advance
def MakeKeyframe(obj, PSR, XYZ) :
doc = c4d.documents.GetActiveDocument()
if PSR == "Position":
DescLevel = c4d.ID_BASEOBJECT_REL_POSITION
elif PSR == "Rotation":
DescLevel = c4d.ID_BASEOBJECT_REL_ROTATION
# elif here when scaling neededif XYZ == "X":
SelectedVector = c4d.VECTOR_X
elif XYZ == "Y":
SelectedVector = c4d.VECTOR_Y
else:
SelectedVector = c4d.VECTOR_ZActiveTrack = obj.FindCTrack (c4d.DescID(c4d.DescLevel(DescLevel,c4d.DTYPE_VECTOR,0), c4d.DescLevel(SelectedVector,c4d.DTYPE_REAL,0)))
if not ActiveTrack:
ActiveTrack = c4d.CTrack (obj, c4d.DescID(c4d.DescLevel(DescLevel,c4d.DTYPE_VECTOR,0), c4d.DescLevel(SelectedVector,c4d.DTYPE_REAL,0)))
obj.InsertTrackSorted (ActiveTrack)Curve = ActiveTrack.GetCurve()
CurrTime = doc.GetTime()
CurrFrame = CurrTime.GetFrame(60)
KeyDict = Curve.AddKey (c4d.BaseTime(CurrFrame, 60))
ActiveTrack.FillKey (doc, obj, KeyDict["key"])c4d.EventAdd()
-
On 27/02/2018 at 07:29, xxxxxxxx wrote:
Hi,
you can define the tangents of a keyframe by using SetValueLeft(), SetValueRight(), SetTimeLeft() and SetTimeRight(). Together with SetInterpolation() this should do the trick.
Even if we are in the Python subforum, maybe the Overview and Manuals about Animation our C++ docs can also help with this topic.
-
On 27/02/2018 at 07:42, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Hi,
you can define the tangents of a keyframe by using SetValueLeft(), SetValueRight(), SetTimeLeft() and SetTimeRight(). Together with SetInterpolation() this should do the trick.
Even if we are in the Python subforum, maybe the Overview and Manuals about Animation our C++ docs can also help with this topic.
I appreciate your kind help really much Thanks!
-
On 09/03/2018 at 21:38, xxxxxxxx wrote:
Sorry but I'm a little bit noob and all this track/curve/key stuff is so confusing, especially without any real use scenario examples on these pages in the documentation. After a few hours of experimenting without any results it begins to drive me crazy Even Google can't find any useful and more detailed instructions, and have absolutely no idea where to put these SetTime... commands in my code.
-
On 12/03/2018 at 03:54, xxxxxxxx wrote:
Well, those SetTimeX() and SetValueX() functions simply set attributes of a keyframe (CKey), but I guess, that far you already figured it our yourself.
If the linked manual doesn't help, I'd say, it's probably best, if you provide us with an updated code snippet more closely resembling your current state and then please describe in more detail what is or is not working.