Outliner: Moving object context menu to Python, and adding hierarchy

As suggested by Pablo Vazquez, though I think we can refine it a bit with icons.
I will wait for his feedback on it.
This commit is contained in:
Dalai Felinto 2018-01-29 18:01:53 -02:00
parent 38bc973a6c
commit 0f35436bcf
2 changed files with 38 additions and 1 deletions

View File

@ -201,6 +201,40 @@ class OUTLINER_MT_context_scene_collection(Menu):
layout.operator("outliner.collection_objects_remove", text="Remove Selected", icon='ZOOMOUT')
class OUTLINER_MT_context_object_select(Menu):
bl_label = "Object Operation Select"
def draw(self, context):
layout = self.layout
layout.operator("outliner.object_operation", text="Select").type='SELECT'
layout.operator("outliner.object_operation", text="Deselect").type='DESELECT'
layout.operator("outliner.object_operation", text="Select Hierarchy").type='SELECT_HIERARCHY'
class OUTLINER_MT_context_object_delete(Menu):
bl_label = "Object Operation Delete"
def draw(self, context):
layout = self.layout
layout.operator("outliner.object_operation", text="Delete").type='DELETE'
layout.operator("outliner.object_operation", text="Delete Hierarchy").type='DELETE_HIERARCHY'
class OUTLINER_MT_context_object(Menu):
bl_label = "Object"
def draw(self, context):
layout = self.layout
layout.menu("OUTLINER_MT_context_object_select", text="Select")
layout.menu("OUTLINER_MT_context_object_delete", text="Delete")
layout.separator()
layout.operator("outliner.object_operation", text="Remap Users").type='REMAP'
layout.operator("outliner.object_operation", text="Rename").type='RENAME'
classes = (
OUTLINER_HT_header,
OUTLINER_MT_editor_menus,
@ -209,6 +243,9 @@ classes = (
OUTLINER_MT_edit_datablocks,
OUTLINER_MT_edit_orphan_data,
OUTLINER_MT_context_scene_collection,
OUTLINER_MT_context_object,
OUTLINER_MT_context_object_delete,
OUTLINER_MT_context_object_select,
)
if __name__ == "__main__": # only for live edit.

View File

@ -2048,7 +2048,7 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop
}
}
else if (objectlevel) {
WM_operator_name_call(C, "OUTLINER_OT_object_operation", WM_OP_INVOKE_REGION_WIN, NULL);
WM_menu_name_call(C, "OUTLINER_MT_context_object", WM_OP_INVOKE_REGION_WIN);
}
else if (idlevel) {
if (idlevel == -1 || datalevel) {