<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cannot set the right derivative of a keyframe (KeySetRightDerivative) in FBX Forum</title>
    <link>https://forums.autodesk.com/t5/fbx-forum/cannot-set-the-right-derivative-of-a-keyframe/m-p/9714584#M810</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I managed to resolve my problem. You cannot set the right derivative for a key if the curve does not have keys after. To fix this, I just did a loop where I created the keys and set their values. In a second loop, I go through all the keys in the curve and add their left and right derivatives.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Aug 2020 08:55:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-08-27T08:55:47Z</dc:date>
    <item>
      <title>Cannot set the right derivative of a keyframe (KeySetRightDerivative)</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/cannot-set-the-right-derivative-of-a-keyframe/m-p/9611932#M808</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having issues when setting the right derivative of a &lt;SPAN class="label"&gt;FbxAnimCurveKey.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="label"&gt;I use the following code to create a simple animation curve. Its interpolation type is cubic, and the tangent mode is eTangentBreak. I set specific derivative values for each key of the curve , for the left and the right tangent.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import fbx

manager = fbx.FbxManager.Create()
scene = fbx.FbxScene.Create(manager, "My Scene")

anim_stack = fbx.FbxAnimStack.Create(scene, "Anim Stack")
anim_base_layer = fbx.FbxAnimLayer.Create(scene, "Base Layer")
anim_stack.AddMember(anim_base_layer)

anim_curve = fbx.FbxAnimCurve.Create(manager, "Animation Curve")
key = fbx.FbxAnimCurveKey()
t = fbx.FbxTime()
anim_curve.KeyModifyBegin()

# Animation data
nb_kf = 3
kf_timesec = [0.0, 100.0, 200.0]
kf_values = [50.0, 200.0, 0.0]
kf_left_derivatives = [0.0, 30.0, 50.0]
kf_right_derivatives = [0.0, 40.0, 60.0]

# Add the keyframes to the curve
for key_idx in range(nb_kf):
    # Set the time and value of the key
    t.SetSecondDouble(kf_timesec[key_idx])
    key.Set(t, kf_values[key_idx])
    key.SetTangentWeightMode(fbx.FbxAnimCurveDef.eWeightedNone)
    # Add the key to the curve
    anim_curve.KeyAdd(t, key)
    anim_curve.KeySetInterpolation(key_idx, fbx.FbxAnimCurveDef.eInterpolationCubic)
    anim_curve.KeySetTangentMode(key_idx, fbx.FbxAnimCurveDef.eTangentBreak)
    # Update left tangent
    anim_curve.KeySetLeftDerivative(key_idx, kf_left_derivatives[key_idx])
    # Update right tangent
    anim_curve.KeySetRightDerivative(key_idx, kf_right_derivatives[key_idx])

anim_curve.KeyModifyEnd()

# Display derivatives of the curve
for key_idx in range(anim_curve.KeyGetCount()):
    print('---------------')
    print("Derivatives of keyframe #", key_idx)
    print("Expected:", kf_left_derivatives[key_idx], kf_right_derivatives[key_idx])
    print("What we have:", anim_curve.KeyGetLeftDerivative(key_idx), anim_curve.KeyGetRightDerivative(key_idx))
    print('---------------')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This is what I get when running the script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;---------------
Derivatives of keyframe # 0
Expected: 0.0 0.0
What we have: 0.0 0.0
---------------
---------------
Derivatives of keyframe # 1
Expected: 30.0 40.0
What we have: 30.0 0.0
---------------
---------------
Derivatives of keyframe # 2
Expected: 50.0 60.0
What we have: 50.0 50.0
---------------&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The right derivative does not have the value I expected: it is either equal to the value of the left derivative, or equal to zero.&lt;/P&gt;&lt;P&gt;Any tips on how I can solve this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp; the FBX SDK 2020.0.1&lt;/P&gt;&lt;P&gt;FBX Python Bindings: FBX SDK 2020.0.1 Python Linux&lt;/P&gt;&lt;P&gt;Python version: 3.7.6&lt;/P&gt;&lt;P&gt;OS: Linux (Ubuntu 20.04)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 09:41:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/cannot-set-the-right-derivative-of-a-keyframe/m-p/9611932#M808</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-01T09:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot set the right derivative of a keyframe (KeySetRightDerivative)</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/cannot-set-the-right-derivative-of-a-keyframe/m-p/9648549#M809</link>
      <description>&lt;P&gt;I am still searching for a way to set different derivatives for a keyframe's left and right tangents.&lt;/P&gt;&lt;P&gt;I tried to use different tangent modes. According to the documentation, the "FbxAnimCurveDef::eTangentBreak" mode allows having "independent left and right slopes, with next slope at the left equal to slope at the right". I would have preferred the eTangentGenericBreak mode ("independent left and right slopes"), but the documentation indicates that the KeySetRightDerivative method can only be used when the tangent mode is either eTangentUser, eTangentBreak or eTangentAuto.&lt;/P&gt;&lt;P&gt;Am I using the wrong tangent mode? Or does the problem come from somewhere else in my code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 08:41:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/cannot-set-the-right-derivative-of-a-keyframe/m-p/9648549#M809</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-22T08:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot set the right derivative of a keyframe (KeySetRightDerivative)</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/cannot-set-the-right-derivative-of-a-keyframe/m-p/9714584#M810</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I managed to resolve my problem. You cannot set the right derivative for a key if the curve does not have keys after. To fix this, I just did a loop where I created the keys and set their values. In a second loop, I go through all the keys in the curve and add their left and right derivatives.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 08:55:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/cannot-set-the-right-derivative-of-a-keyframe/m-p/9714584#M810</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-27T08:55:47Z</dc:date>
    </item>
  </channel>
</rss>

