# Alt Scroll Wheel in time line and jump back to start

is there a way to customize the Alt + Mouse Wheel which works in most editors that when you reach the end frame you can jump back to start?
is it something I don't see in settings or do I need a script for that and how can I do it by script if so .

I'm not looking for other hotkeys to jump to start and end, I wanna use that specific hotkey and move in timeline normally but instead of passing by the end frame, jump back to start or being stuck at the start get back to end frame...
like in a walk cycle animation this way you can easily see the transition between end and starting over

• SHIFT-Left arrow takes you to the start and SHIFT-Right arrow to the end of the timeline. Sep 15 at 8:25
• @JohnEason yeah but for that you need to take one of your hands of the mouse or keyboard . if there was a way to do it just like I said that would be nice Sep 15 at 9:29
• can do most things in blender via a script Please clarify what you do want, not what you don't. Are we talking about scrubbing the time line with the scroll wheel and if it goes past end points reverts to the other? Sep 15 at 15:24
• @batFINGER question is very self explaining . that link you sent helped alot i just need to look up for more stuff to make the script for it Sep 15 at 15:28

Edit the keymap.

As commented by @John Eason these are already mapped to SHIFT and left arrow for go to start, and right to end.

Can search for keymaps by keypress

Or name, if unsure hover over the button that does it

Once found change to suit.

Here I've altered it to ALT + middle mouse click.

Save User Preferences to make change permanent.

• i know i can change the hotkey for that but what im saying is to change the behavior of a specific hotkey when something happens. it is a small change but i guess that way its easier for something like a walk cycle . so this wont be the answer Sep 15 at 14:55
• Clarify any details by editing it into your question. Do you want to match the frame range to current objects action range rather than scene. There are answers relating to that question. Sep 15 at 14:58
• yeah maybe that would work Sep 15 at 15:05
• blender.stackexchange.com/questions/27889/… Sep 15 at 15:13

### Why Even Do this

there are several options to monitor the transitions in frames but in my experience the best way is to use the mouse scroll wheel since you have more control over speed and its easy to use . It's like classic animation when animators flip back and forth paper between their fingers.

but when you are making a cycle animation which is used a lot in game animations, there is one thing that is annoying and its how you cant see the transition from end frame to starting over as easy.

it is a small change but I think it worth it.

So here is a way to make this work
basically we disable the old behavior and make a new one that does the same old behavior and just checks for the end and start frame then does the expected thing

### Disable Default Hotkeys

Edit -> Preferences -> Keymap

1. set the search type to Key-Binding
2. search for "wheel"
3. scroll a bit and find Frames section
4. and disable both Frame Offsets

### How to Make The Script

So to make a function and assign a hotkey to it we need an Operator
which has an execute function where our logic will be
and when we assign a hotkey to the operator ,when the keys are pressed(event happens) this function will be called

we want to make this as an add-on ,so we add some info about it in bl_info

### First Step

as you can see the operator class has some basic properties like an ID , label and more that we can fill in and some more info

bl_info = {
"name": "Better_Scroll_Time",
"blender": (2, 80, 0),
"category": "Object",
}

import bpy
from bpy.props import *

class ScrollWheelTime(bpy.types.Operator):
"""Sets the time in range"""      # Use this as a tooltip for menu items and buttons.
bl_idname = "object.scroll"        # Unique identifier for buttons and menu items to reference.
bl_label = "Better Time Scroll Wheel"         # Display name in the interface.
bl_options = {'REGISTER', 'UNDO'}  # Enable undo for the operator.

def execute(self, context):        # execute() is called when running the operator.
# logic

return {'FINISHED'}            # Lets Blender know the operator finished successfully.



### Execute

direction: IntProperty()  #outside of execute function as a class member

def execute(self, context):
#logic
scn = context.scene
current_frame = scn.frame_current
current_frame+=self.direction
scn.frame_set(current_frame)

if not scn.frame_start <= current_frame <= scn.frame_end:
scn.frame_set(scn.frame_start if self.direction>=1 else scn.frame_end)

return {'FINISHED'}


• so if you look at blender keymaps in Preferences you can find Operations with some properties that we can provide too, with bpy.props functions like IntProperty()
• we need a reference to the scene we are in to access things like start and end frame of the scene
• increase or decrease current frame with the amount of direction which will be set to +1 and -1 based on the shortcut
• if current frame is not between start and end frame of the scene based on the direction we decide where to put the frame cursor
• we tell blender this operation is finished

### Register

addon_keymaps = []                 #outside of function

def register():
bpy.utils.register_class(ScrollWheelTime)
wm = bpy.context.window_manager
if kc:
km = wm.keyconfigs.addon.keymaps.new(name = "Window",space_type='EMPTY', region_type='WINDOW')
km_up = km.keymap_items.new(ScrollWheelTime.bl_idname, type='WHEELUPMOUSE', value='PRESS', alt=True)
km_down = km.keymap_items.new(ScrollWheelTime.bl_idname, type='WHEELDOWNMOUSE', value='PRESS', alt=True)

km_up.properties.direction = -1     # setting the default property value for wheel up
km_down.properties.direction = +1    # setting the default property value for wheel down


• here we register our operation class so we can use if as an addon
• then we make a keymap using wm.keyconfigs.addon.keymaps.new and set its parameters to name = "Window", space_type ='EMPTY', region_type ='WINDOW'
so our hotkey works in all editor windows
• then we assign our shortcuts to the operation class
• we can set a default value to our custom properties that defined as class member using bpy.props
• we save this hotkeys so we can remove them in unregister function

to make things clear in unregister function we remove our hotkeys

you can see completed script here (code could have some clean ups)

bl_info = {
"name": "Better_Scroll_Time",
"blender": (2, 80, 0),
"category": "Object",
}

import bpy
from bpy.props import *

class ScrollWheelTime(bpy.types.Operator):
"""Sets the time in range"""      # Use this as a tooltip for menu items and buttons.
bl_idname = "object.scroll"        # Unique identifier for buttons and menu items to reference.
bl_label = "Better Time Scroll Wheel"         # Display name in the interface.
bl_options = {'REGISTER', 'UNDO'}  # Enable undo for the operator.
direction: IntProperty()

def execute(self, context):        # execute() is called when running the operator.
# logic
scn = context.scene
current_frame = scn.frame_current
current_frame+=self.direction
scn.frame_set(current_frame)

if not scn.frame_start <= current_frame <= scn.frame_end:
scn.frame_set(scn.frame_start if self.direction>=1 else scn.frame_end)

return {'FINISHED'}            # Lets Blender know the operator finished successfully.

def register():
bpy.utils.register_class(ScrollWheelTime)
wm = bpy.context.window_manager
if kc:
km = wm.keyconfigs.addon.keymaps.new(name = "Window",space_type='EMPTY', region_type='WINDOW')
km_up = km.keymap_items.new(ScrollWheelTime.bl_idname, type='WHEELUPMOUSE', value='PRESS', alt=True)
km_down = km.keymap_items.new(ScrollWheelTime.bl_idname, type='WHEELDOWNMOUSE', value='PRESS', alt=True)

km_up.properties.direction = -1     # setting the default property value for wheel up
km_down.properties.direction = +1    # setting the default property value for wheel down

print("Installed Better Scroll Time !")

def unregister():
bpy.utils.unregister_class(ScrollWheelUpTime)

# Remove the hotkey
km.keymap_items.remove(k)

• context is already passed to the operator methods so you can replace bpy.context.* by context.* for all calls/properties and when declaring a variable use it, see: pasteall.org/oUiT/raw Also consider that this is no regular forum and link-only answers are discouraged, if the link goes down so does the answer hence the downvote I guess. Sep 16 at 8:27