0
$\begingroup$

I'm trying to Replicate the "G" key for transforming a keyframe in the Dopesheet/Timeline. However, with my script I get no feedback (no errors, no movement, nothing):

import bpy, os

# ---------------    
#    Key Move
# ---------------    

class keyMove(bpy.types.Operator):
    """Transform Keys in Timeline"""
    bl_idname = "action.keymove"
    bl_label = "Tranform Keys"
    bl_options = {'REGISTER', 'UNDO'}    


    def execute(self, context):
#    def invoke(self, context, event):

    bpy.ops.transform.transform(mode='TIME_TRANSLATE')
    
    
    return {'FINISHED'} 

I also don't get any enum property in the Keymap section within Preferences. I was expecting a "Mode: Time Translate" option. Enum missing

I've tried other Key menu items with the above script, like Copy Keyframes, Paste Keyframes, and they work fine. I also looked at this Topic, but it seems overcomplicated for what I'm going for, and appears to be doing this in the Graph Editor, if I'm not mistaken.

$\endgroup$
5
  • $\begingroup$ just to clarify it: timeline, graph editor and dopesheet are just "views" of the same data. So whenever you move the "data" regardless of using (ops) operators or moving the coordinates of the keyframes - you will see the changes in all of this views (timeline, graph editor, dopesheet) at the same time (if you have opened them all). It's like you have two viewports open and you move the object: moving the object changes the data, but in both views you will see that change. $\endgroup$
    – Chris
    Commented Nov 12, 2022 at 6:06
  • $\begingroup$ @Chris Thanks. I don't see however how that fact is stopping my script from working $\endgroup$
    – Increality
    Commented Nov 13, 2022 at 3:57
  • 1
    $\begingroup$ that's why i wrote it as comment - it's of course neither a solution nor an answer. But because of your one sentence "and appears to be doing this in the Graph Editor" i assumed that you didn't know that these are just "views" on the same data - sorry if my assumption was wrong. $\endgroup$
    – Chris
    Commented Nov 13, 2022 at 8:42
  • $\begingroup$ True, same data, but manipulation of the two (Graph Editor vs Node Editor) are treated differently with Python from my understanding. The Graph Editor uses transform.translate() for instance, to move a keyframe, but this throws an error if used with the Node Editor $\endgroup$
    – Increality
    Commented Nov 14, 2022 at 0:24
  • $\begingroup$ I think the problem is, when attempting this with python, Blender is expecting a value to be put in place with python as well (same case for Graph Editor). Trying to have essentially the menu item ("Move" in this case) activated via the hotkey so that the user can move the keyframes where desired, which is what I'm trying to achieve, doesn't seem to work. Again, it doesn't make sense to me why it's possible to do it with copy or paste, but not Move, Slide, etc. $\endgroup$
    – Increality
    Commented Nov 14, 2022 at 0:50

0

You must log in to answer this question.

Browse other questions tagged .