I’ve been working in the dope sheet like mad lately, developing what I hope’s going to be a pretty sweet all-blender animation. I frequently use the ghost and cursor icons to show hidden layers in the dope sheet and to show only selected layers respectively. I have been using it so much I was hoping to add a hot key in order to expedite my work flow, but I can’t seem to find the correct python line to insert for my hotkey.
I tried:
dopesheet.show_only_selected
-for the cursor icon &
dopesheet.show_hidden
- for the ghost icon
Yet neither appear to work.
Any ideas would be super tremendously helpful.
It’s those little functionalities that really help optimize one’s work flow.
Here’s an addon which toggle the selected channel by pressing Alt-Q; you should be able to modify the shortcut to your needs and to implement this functionality for the “ghost” icon as well.
regards
blackno666
import bpy
bl_info = {
"name": "toggle include selected channels",
"description": "Toggles include channels relating to selected objects and data",
"author": "blackno666",
"version": (1, 0),
"category": "Dopesheet"
}
class DOPESHEET_OT_toggle_selection(bpy.types.Operator):
'''Toggle include channels in dopesheet'''
bl_idname = "dopesheet.selected_toggle"
bl_label = "Toggle include channels"
@classmethod
def poll(cls, context):
return context.active_object
def execute(self, context):
context.space_data.dopesheet.show_only_selected = not context.space_data.dopesheet.show_only_selected
return {'FINISHED'}
def register():
bpy.utils.register_class(DOPESHEET_OT_toggle_selection)
kc = bpy.context.window_manager.keyconfigs.addon
if kc:
km = kc.keymaps.new(name="Dopesheet", space_type="DOPESHEET_EDITOR")
kmi = km.keymap_items.new('dopesheet.selected_toggle', 'Q', 'PRESS', alt=True)
def unregister():
bpy.utils.unregister_class(DOPESHEET_OT_toggle_selection)
kc = bpy.context.window_manager.keyconfigs.addon
if kc:
km = kc.keymaps["Dopesheet"]
for kmi in km.keymap_items:
if kmi.idname == 'dopesheet.selected_toggle':
km.keymap_items.remove(kmi)
break
if __name__ == "__main__":
register()