HOW TO Turn off the auto tangent checkbox on keyframes using python API
-
Hi, I'd like to know how to turn off the Auto Tangents and Remove Overshooting checkbox on keys in C4D using the python API. I wrote a tool to bring keyframe data from C4D to other applications but with Auto Tangents and Remove Overshooting on, I'm getting differences in my tangents. Once I turn them off and run my tool again, I'm getting the correct results.
There is the
CKey.SetAutomaticTangentMode
but it does nothing for me. Is there a way to do this with the API? I've attached an image to show the checkboxes I'm referring to.
Thanks in advance.
-
Hi,
These can be used for doing so.CKey.ChangeNBit(c4d.NBIT_CKEY_AUTO, False) CKey.ChangeNBit(c4d.NBIT_CKEY_REMOVEOVERSHOOT, False)
By the way, if you want to get correct value of tangents, CCurve.GetTangents() should work correctly, instead of using CKey.GetTimeLeft, etc.
-
Hi @heytraile ,
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.
About your First Question
Function c4d.SetAutomaticTangentMode() is meant to change the value of the "Angle" attribute and in my opinion is just poorly named.
What you actually need to do is to execute function ChangeNBit() (@kng_ito, thank you for providing fast answer). However, the usage kng_ito showed above is not 100% correct. Namely, you'd need to use one of the NBITCONTROL values. In case you want to remove these checkboxes, the code would be:
key.ChangeNBit(c4d.NBIT_CKEY_AUTO, c4d.NBITCONTROL_CLEAR) key.ChangeNBit(c4d.NBIT_CKEY_REMOVEOVERSHOOT, c4d.NBITCONTROL_CLEAR)
You can also find some code examples on how to work with animation related data in our repository, e.g. CTrack Create Keys
Cheers,
Ilia -
@i_mazlov Thanks much for explanation.