UI: context menu for other editor types
D3458 by @billreynish w/ edits. - Context menu for dope-sheet, graph, image & node editors. - Add type to contenxt menu header. - Access with W-Key. - Change UV-editor weld key binding to Shift-W.
This commit is contained in:
parent
80d86f303a
commit
1df228a416
@ -469,6 +469,66 @@ class DOPESHEET_MT_delete(Menu):
|
||||
layout.operator("action.clean", text="Clean Channels").channels = True
|
||||
|
||||
|
||||
class DOPESHEET_MT_specials(Menu):
|
||||
bl_label = "Dope Sheet Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("action.copy", text="Copy")
|
||||
layout.operator("action.paste", text="Paste")
|
||||
layout.operator("action.paste", text="Paste Flipped").flipped = True
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("action.handle_type", "type", text="Handle Type")
|
||||
layout.operator_menu_enum("action.interpolation_type", "type", text="Interpolation Mode")
|
||||
layout.operator_menu_enum("action.easing_type", "type", text="Easing Type")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("action.keyframe_insert").type = 'SEL'
|
||||
layout.operator("action.duplicate_move")
|
||||
layout.operator("action.delete")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("action.mirror", "type", text="Mirror")
|
||||
layout.operator_menu_enum("action.snap", "type", text="Snap")
|
||||
|
||||
class DOPESHEET_MT_channel_specials(Menu):
|
||||
bl_label = "Dope Sheet Channel Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
layout.operator("anim.channels_setting_enable", text="Mute Channels").type='MUTE'
|
||||
layout.operator("anim.channels_setting_disable", text="Unmute Channels").type='MUTE'
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_setting_enable", text="Protect Channels").type='PROTECT'
|
||||
layout.operator("anim.channels_setting_disable", text="Unprotect Channels").type='PROTECT'
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_group")
|
||||
layout.operator("anim.channels_ungroup")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_editable_toggle")
|
||||
layout.operator_menu_enum("action.extrapolation_type", "type", text="Extrapolation Mode")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_expand")
|
||||
layout.operator("anim.channels_collapse")
|
||||
|
||||
layout.separator()
|
||||
layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("anim.channels_delete")
|
||||
|
||||
|
||||
classes = (
|
||||
DOPESHEET_HT_header,
|
||||
DOPESHEET_HT_editor_buttons,
|
||||
@ -482,6 +542,8 @@ classes = (
|
||||
DOPESHEET_MT_gpencil_channel,
|
||||
DOPESHEET_MT_gpencil_frame,
|
||||
DOPESHEET_MT_delete,
|
||||
DOPESHEET_MT_specials,
|
||||
DOPESHEET_MT_channel_specials,
|
||||
)
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
@ -299,6 +299,76 @@ class GRAPH_MT_delete(Menu):
|
||||
layout.operator("graph.clean").channels = False
|
||||
layout.operator("graph.clean", text="Clean Channels").channels = True
|
||||
|
||||
|
||||
class GRAPH_MT_specials(Menu):
|
||||
bl_label = "F-Curve Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("graph.copy", text="Copy")
|
||||
layout.operator("graph.paste", text="Paste")
|
||||
layout.operator("graph.paste", text="Paste Flipped").flipped = True
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
|
||||
layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
|
||||
layout.operator_menu_enum("graph.easing_type", "type", text="Easing Type")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("graph.keyframe_insert").type = 'SEL'
|
||||
layout.operator("graph.duplicate_move")
|
||||
layout.operator("graph.delete")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("graph.mirror", "type", text="Mirror")
|
||||
layout.operator_menu_enum("graph.snap", "type", text="Snap")
|
||||
|
||||
|
||||
class GRAPH_MT_channel_specials(Menu):
|
||||
bl_label = "F-Curve Channel Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
st = context.space_data
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_setting_enable", text="Mute Channels").type='MUTE'
|
||||
layout.operator("anim.channels_setting_disable", text="Unmute Channels").type='MUTE'
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_setting_enable", text="Protect Channels").type='PROTECT'
|
||||
layout.operator("anim.channels_setting_disable", text="Unprotect Channels").type='PROTECT'
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_group")
|
||||
layout.operator("anim.channels_ungroup")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_editable_toggle")
|
||||
layout.operator_menu_enum("graph.extrapolation_type", "type", text="Extrapolation Mode")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("graph.hide", text="Hide Selected Curves").unselected = False
|
||||
layout.operator("graph.hide", text="Hide Unselected Curves").unselected = True
|
||||
layout.operator("graph.reveal")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("anim.channels_expand")
|
||||
layout.operator("anim.channels_collapse")
|
||||
|
||||
layout.separator()
|
||||
layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("anim.channels_delete")
|
||||
if st.mode == 'DRIVERS':
|
||||
layout.operator("graph.driver_delete_invalid")
|
||||
|
||||
|
||||
classes = (
|
||||
GRAPH_HT_header,
|
||||
GRAPH_MT_editor_menus,
|
||||
@ -309,6 +379,8 @@ classes = (
|
||||
GRAPH_MT_key,
|
||||
GRAPH_MT_key_transform,
|
||||
GRAPH_MT_delete,
|
||||
GRAPH_MT_specials,
|
||||
GRAPH_MT_channel_specials,
|
||||
)
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
@ -422,6 +422,43 @@ class IMAGE_MT_uvs_select_mode(Menu):
|
||||
props.data_path = "tool_settings.uv_select_mode"
|
||||
|
||||
|
||||
class IMAGE_MT_specials(Menu):
|
||||
bl_label = "UV Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
sima = context.space_data
|
||||
|
||||
# UV Edit Mode
|
||||
if sima.show_uvedit:
|
||||
layout.operator("uv.unwrap")
|
||||
layout.operator("uv.follow_active_quads")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("uv.pin").clear = False
|
||||
layout.operator("uv.pin", text="Unpin").clear = True
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("uv.weld")
|
||||
layout.operator("uv.stitch")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_enum("uv.align", "axis") # W, 2/3/4
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("transform.mirror", text="Mirror X").constraint_axis[0] = True
|
||||
layout.operator("transform.mirror", text="Mirror Y").constraint_axis[1] = True
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.menu("IMAGE_MT_uvs_snap")
|
||||
|
||||
|
||||
class IMAGE_HT_header(Header):
|
||||
bl_space_type = 'IMAGE_EDITOR'
|
||||
|
||||
@ -1308,6 +1345,7 @@ classes = (
|
||||
IMAGE_MT_uvs_mirror,
|
||||
IMAGE_MT_uvs_weldalign,
|
||||
IMAGE_MT_uvs_select_mode,
|
||||
IMAGE_MT_specials,
|
||||
IMAGE_HT_header,
|
||||
MASK_MT_editor_menus,
|
||||
IMAGE_PT_mask,
|
||||
|
@ -290,6 +290,41 @@ class NODE_MT_node_color_specials(Menu):
|
||||
layout.operator("node.node_copy_color", icon='COPY_ID')
|
||||
|
||||
|
||||
class NODE_MT_specials(Menu):
|
||||
bl_label = "Node Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
layout.operator("node.duplicate_move")
|
||||
layout.operator("node.delete")
|
||||
layout.operator_context = 'EXEC_DEFAULT'
|
||||
|
||||
layout.operator("node.delete_reconnect")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("node.link_make").replace = False
|
||||
layout.operator("node.link_make", text="Make and Replace Links").replace = True
|
||||
layout.operator("node.links_detach")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("node.group_make", text="Group")
|
||||
layout.operator("node.group_ungroup", text="Ungroup")
|
||||
layout.operator("node.group_edit").exit = False
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("node.hide_toggle")
|
||||
layout.operator("node.mute_toggle")
|
||||
layout.operator("node.preview_toggle")
|
||||
layout.operator("node.hide_socket_toggle")
|
||||
layout.operator("node.options_toggle")
|
||||
layout.operator("node.collapse_hide_unused_toggle")
|
||||
|
||||
|
||||
class NODE_PT_active_node_generic(Panel):
|
||||
bl_space_type = 'NODE_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
@ -531,6 +566,7 @@ classes = (
|
||||
NODE_MT_node,
|
||||
NODE_MT_node_color_presets,
|
||||
NODE_MT_node_color_specials,
|
||||
NODE_MT_specials,
|
||||
NODE_PT_active_node_generic,
|
||||
NODE_PT_active_node_color,
|
||||
NODE_PT_active_node_properties,
|
||||
|
@ -1483,7 +1483,7 @@ class VIEW3D_MT_object_clear(Menu):
|
||||
|
||||
|
||||
class VIEW3D_MT_object_specials(Menu):
|
||||
bl_label = "Context Menu"
|
||||
bl_label = "Object Context Menu"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@ -2113,7 +2113,7 @@ class VIEW3D_MT_particle(Menu):
|
||||
|
||||
|
||||
class VIEW3D_MT_particle_specials(Menu):
|
||||
bl_label = "Context Menu"
|
||||
bl_label = "Particle Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -2363,7 +2363,7 @@ class VIEW3D_MT_pose_apply(Menu):
|
||||
|
||||
|
||||
class VIEW3D_MT_pose_specials(Menu):
|
||||
bl_label = "Context Menu"
|
||||
bl_label = "Pose Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -2496,7 +2496,7 @@ class VIEW3D_MT_edit_mesh(Menu):
|
||||
|
||||
|
||||
class VIEW3D_MT_edit_mesh_specials(Menu):
|
||||
bl_label = "Context Menu"
|
||||
bl_label = "Mesh Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -3030,7 +3030,7 @@ class VIEW3D_MT_edit_curve_clean(Menu):
|
||||
|
||||
|
||||
class VIEW3D_MT_edit_curve_specials(Menu):
|
||||
bl_label = "Context Menu"
|
||||
bl_label = "Curve Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -3244,7 +3244,7 @@ class VIEW3D_MT_edit_armature(Menu):
|
||||
|
||||
|
||||
class VIEW3D_MT_armature_specials(Menu):
|
||||
bl_label = "Context Menu"
|
||||
bl_label = "Armature Context Menu"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -216,6 +216,9 @@ static void action_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
|
||||
WM_keymap_add_item(keymap, "ACTION_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_item(keymap, "ACTION_OT_keyframe_type", RKEY, KM_PRESS, 0, 0);
|
||||
|
||||
/* specials */
|
||||
WM_keymap_add_menu(keymap, "DOPESHEET_MT_specials", WKEY, KM_PRESS, 0, 0);
|
||||
|
||||
/* destructive */
|
||||
WM_keymap_add_item(keymap, "ACTION_OT_sample", OKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
@ -289,4 +292,3 @@ void action_keymap(wmKeyConfig *keyconf)
|
||||
keymap = WM_keymap_find(keyconf, "Dopesheet", SPACE_ACTION, 0);
|
||||
action_keymap_keyframes(keyconf, keymap);
|
||||
}
|
||||
|
||||
|
@ -295,6 +295,8 @@ static void action_channel_region_init(wmWindowManager *wm, ARegion *ar)
|
||||
keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
|
||||
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
||||
|
||||
WM_keymap_add_menu(keymap, "DOPESHEET_MT_specials_channels", WKEY, KM_PRESS, 0, 0);
|
||||
|
||||
keymap = WM_keymap_find(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0);
|
||||
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
||||
}
|
||||
@ -903,4 +905,3 @@ void ED_spacetype_action(void)
|
||||
|
||||
BKE_spacetype_register(st);
|
||||
}
|
||||
|
||||
|
@ -614,6 +614,8 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
|
||||
WM_keymap_add_menu(keymap, "GRAPH_MT_delete", XKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_menu(keymap, "GRAPH_MT_delete", DELKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_menu(keymap, "GRAPH_MT_specials", WKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "GRAPH_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
/* insertkey */
|
||||
@ -715,4 +717,3 @@ void graphedit_keymap(wmKeyConfig *keyconf)
|
||||
keymap = WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0);
|
||||
graphedit_keymap_keyframes(keyconf, keymap);
|
||||
}
|
||||
|
||||
|
@ -302,6 +302,8 @@ static void image_keymap(struct wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "IMAGE_OT_properties", NKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "IMAGE_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_menu(keymap, "IMAGE_MT_specials", WKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, KM_ALT, 0)->ptr, "reverse", true);
|
||||
|
||||
@ -1134,4 +1136,3 @@ void ED_spacetype_image(void)
|
||||
|
||||
BKE_spacetype_register(st);
|
||||
}
|
||||
|
||||
|
@ -274,6 +274,8 @@ void node_keymap(struct wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "NODE_OT_backimage_fit", HOMEKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "NODE_OT_backimage_sample", ACTIONMOUSE, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
WM_keymap_add_menu(keymap, "NODE_MT_specials", WKEY, KM_PRESS, 0, 0);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "NODE_OT_link_make", FKEY, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(kmi->ptr, "replace", false);
|
||||
kmi = WM_keymap_add_item(keymap, "NODE_OT_link_make", FKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
@ -4437,7 +4437,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
|
||||
|
||||
WM_keymap_add_item(keymap, "UV_OT_select_pinned", PKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_weldalign", WKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_weldalign", WKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
/* uv operations */
|
||||
WM_keymap_add_item(keymap, "UV_OT_stitch", VKEY, KM_PRESS, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user