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:
parent
38bc973a6c
commit
0f35436bcf
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue