16
$\begingroup$

I want to be able to cycle through the frames I set markers on (I have cameras bound to each marker so these are usually the first frame in a shot). Is there a hot-key for this?

$\endgroup$
3
  • 1
    $\begingroup$ well, there was in 2.4x (Pgup and Pgdown) however, this doesn't work in 2.68. $\endgroup$
    – gandalf3
    Oct 12 '13 at 2:34
  • $\begingroup$ I am not sure if you mean key frames or not but that would be arrow key up and down. $\endgroup$
    – user320
    Oct 12 '13 at 16:36
  • $\begingroup$ One option is to write your own operator in python which would get the frame of the next marker, and set the current frame to that frame. (you could then write another one to do the same for the previous marker) Then you could assign shortcuts to them. $\endgroup$
    – gandalf3
    Oct 12 '13 at 18:56
4
$\begingroup$

Jumping between markers has now been included in trunk as of r60881 with CtrlShift+/ (left/right arrows)

$\endgroup$
3
  • 4
    $\begingroup$ Note that this was reverted, and is no longer in master. developer.blender.org/… $\endgroup$
    – gandalf3
    Sep 21 '14 at 0:18
  • 1
    $\begingroup$ This is not there in blender 2.7 and 2.8 b. probably removed $\endgroup$
    – ashwin
    Sep 21 '16 at 17:14
  • 1
    $\begingroup$ @ Greg Zaal addon is working great. $\endgroup$
    – ashwin
    Sep 21 '16 at 17:19
13
$\begingroup$

While @gandalf3's solution worked, I found it a little awkward to set up (user preferences that rely on scripts that need to be in your project, if I understood correctly), and I found that there's now a built-in shortcut adding feature on the menu:

  • In the timeline viewport menu, click Marker
  • Right-click on "Jump to Previous Marker"
  • Click on "Add Shortcut"
  • Hover over the pop-up "A" box, so that it turns into "Press a Key"
  • Hit your target combination, eg "Alt-Left"
  • (repeat for "Jump to Next")

I might be missing something the scripts in @gandalf3's answer provide, please let me know if so!

$\endgroup$
2
  • 3
    $\begingroup$ This is the best answer. $\endgroup$ Dec 15 '16 at 1:16
  • 2
    $\begingroup$ Great! However, I managed to left-click (mouse) while in the "Press a Key" dialog. Now the shortcut is set to left mouse button and I can't set it again... $\endgroup$
    – birgersp
    Mar 27 '17 at 8:49
7
$\begingroup$

AFAIK, there is currently no shortcut in 2.68 to do this. (there was in 2.4x) However, you can create your own operator to do this using blenders python API:

I am not very experienced in python, but I came up with two scripts for jumping to the next and previous markers: (pardon my bad python)

Jump_to_next.py:

import bpy
#jump to next marker

class MoveOperator(bpy.types.Operator):  
    bl_idname = "marker.jump_to_next"  
    bl_label = "Jump to next marker" 

    def execute(self, context):  
        frm=0
        frm_close=0
        frm_first = bpy.context.scene.frame_end
        def switchcam():
            if markname:
                if camname != markname:
                    for area in bpy.context.screen.areas:
                        if area.type == 'VIEW_3D':
                            for space in area.spaces:
                                if space.type == 'VIEW_3D':
                                    if space.region_3d.view_perspective == 'CAMERA':
                                        override = {'window': bpy.context.window, 'screen': bpy.context.screen, 'area': area, 'scene': bpy.context.scene, 'region': bpy.context.region, 'space': space}
                                        bpy.ops.view3d.viewnumpad(override, type='CAMERA')
                                        bpy.ops.view3d.viewnumpad(override, type='CAMERA')
                                    else:
                                        print ("not in camera view")
                                else:
                                    print ("space is not a 3D view")
                        else:
                            print ("area is not a VIEW_3D")
                else:
                    print ("camera bound to next marker is already active")
            else:
                print ("marker is not bound to a camera")

        # get some vars:
        now = bpy.context.scene.frame_current
        cam = bpy.context.scene.camera
        if cam:
            camname = cam.name
        frm_close = bpy.context.scene.frame_end

        # Loop through markers and test how close to the current frame they are:
        for TimelineMarker in bpy.context.scene.timeline_markers:
            frm = TimelineMarker.frame
            if frm > now:
                if frm < frm_close:
                    frm_close = frm
                    markname = TimelineMarker.camera
                    if markname:
                        markname = TimelineMarker.camera.name
            if frm < frm_first:
                frm_first = frm
        #Test if there is a marker that met requirements:
        if frm_close != bpy.context.scene.frame_end:
            #set scene frame to the frame of closest marker:
            bpy.context.scene.frame_set(frm_close)
            switchcam()
        else:
            if frm_first != bpy.context.scene.frame_end:
                self.report({'INFO'}, 'No more markers to jump to in this direction, skipping to first')
                bpy.context.scene.frame_set(frm_first)
            else:
                self.report({'WARNING'}, 'No markers found')
        return {'FINISHED'}
bpy.utils.register_class(MoveOperator)

Jump_to_prev.py:

import bpy
#jump to previous marker

class MoveOperator(bpy.types.Operator):  
    bl_idname = "marker.jump_to_prev"  
    bl_label = "Jump to previous marker" 

    def execute(self, context):  
        frm=0
        frm_close=0
        frm_first=0
        def switchcam():
            if markname:
                if camname != markname:
                    for area in bpy.context.screen.areas:
                        if area.type == 'VIEW_3D':
                            for space in area.spaces:
                                if space.type == 'VIEW_3D':
                                    if space.region_3d.view_perspective == 'CAMERA':
                                        override = {'window': bpy.context.window, 'screen': bpy.context.screen, 'area': area, 'scene': bpy.context.scene, 'region': bpy.context.region, 'space': space}
                                        bpy.ops.view3d.viewnumpad(override, type='CAMERA')
                                        bpy.ops.view3d.viewnumpad(override, type='CAMERA')
                                    else:
                                        print ("not in camera view")
                                else:
                                    print ("space is not a 3D view")
                        else:
                            print ("area is not a VIEW_3D")
                else:
                    print ("camera bound to next marker is already active")
            else:
                print ("marker is not bound to a camera")

        # get some vars:
        now = bpy.context.scene.frame_current
        cam = bpy.context.scene.camera
        if cam:
            camname = cam.name

        # Loop through markers and test how close to the current frame they are:
        for TimelineMarker in bpy.context.scene.timeline_markers:
            frm = TimelineMarker.frame
            if frm < now:
                if frm > frm_close:
                    frm_close = frm
                    markname = TimelineMarker.camera
                    if markname:
                        markname = TimelineMarker.camera.name
            if frm > frm_first:
                frm_first = frm
        #Test if there is a marker that met requirements:
        if frm_close != 0:
            #set scene frame to the frame of closest marker:
            bpy.context.scene.frame_set(frm_close)
            switchcam()
        else:
            if frm_first != 0:
                self.report({'INFO'}, 'No more markers to jump to in this direction, skipping to last')
                bpy.context.scene.frame_set(frm_first)
            else:
                self.report({'WARNING'}, 'No markers found')
        return {'FINISHED'}
bpy.utils.register_class(MoveOperator)

You can make these into shortcuts by

  1. Paste into the text editor and check the Register option in the header:

    enter image description here

  2. In User Preferences (CtrlAltU)> Input, scroll down to the context you want to use the shortcut in (e.g. Timeline), expand it and click Add new.

  3. Type in the operator name (marker.jump_to_next or marker.jump_to_prev) and set the shortcut to whatever you want (e.g. Page Up):

    enter image description here

  4. Save the default .blend. (CtrlU) This is necessary to save the python script so the operator marker.jump_to_next exists. Be careful when saving the default .blend, this will save information such as geometry, screen layout, User preferences, etc.

Note that you will have to do steps 1-3 twice, once for each operator. (jump_to_next and jump_to_prev)

$\endgroup$
14
  • $\begingroup$ Awesome. This works great. Only thing I did differently was I set the hot-key up under the Screen (Global) section so it works everywhere. Now just need to get this into Blender trunk! $\endgroup$ Oct 13 '13 at 2:45
  • $\begingroup$ One more request actually. Normally when you switch markers and you're in camera view, it also switches to the active camera for that marker, but this script doesn't seem to be doing that. $\endgroup$ Oct 13 '13 at 3:09
  • $\begingroup$ @Consideringthepickle Does it switch now? $\endgroup$
    – gandalf3
    Oct 14 '13 at 3:09
  • 2
    $\begingroup$ I created a little addon for someone on IRC a while ago doing exactly this. It is also bad code: dropbox.com/s/jvzlcnobfw6hebc/marker_jumping.py Hotkeys: ',' and '.' for Previous and Next marker. $\endgroup$
    – Greg Zaal
    Oct 15 '13 at 13:07
  • 1
    $\begingroup$ @Consideringthepickle I fixed that bug again, (hopefully for real) and made it loop back to the first/last marker. I also reported the camera draw bug on the tracker. There are still some issues when using multiple 3D views, I'll see if I can work some of those out.. $\endgroup$
    – gandalf3
    Oct 15 '13 at 20:50

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.