0
$\begingroup$

It is not clear to me how to access the fcurve of these keyframes, it is not very clear to me with regards to the nodes, I have found examples of objects. If anyone had any idea how to access it I would be happy with that.

    import bpy

    def myFunction(self,context):

        start = context.scene.frame_start
        end = context.scene.frame_end
        current = context.scene.frame_current


        for n in context.scene.world.node_tree.nodes:

            if n.name == 'My_mapping_node':

                n.translation[0] = 0
                n.keyframe_insert('translation',frame=start)
                n.translation[0] = 1
                n.keyframe_insert('translation',frame=end)

            #### This obviously shows an error, 
            #### but it is only to indicate +/- what I would like to do    

            #for curve in context.scene.world.node_tree.animation_data.action.fcurves:
                #curve.interpolation='LINEAR'
            ##############################################

I would like to have a linear interpolation between those 2 specific keyframes

Edit:

I found a way to access the "interpolation" route. The problem is that it doesn't give me a name and I need to be sure that the keyframe is the one you want because they are listed as a numbered list [0] [1] etc. The problem is how to find the right keyframe

bpy.context.scene.world.node_tree.animation_data.action.fcurves[0].keyframe_points[0]

$\endgroup$
  • $\begingroup$ I hadn't expected console python code in this question but what's the code look like with Linear Interpolation for keyframes of movement along just the X-axis? I wonder if the answer of how to access it is in one axis instead of a matrix of XYZ? $\endgroup$ – HelloHiHola Sep 24 '19 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.