diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2013-03-10 21:19:03 +0400 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2013-03-10 21:19:03 +0400 |
commit | 98cafc953810a61c44ab37b8d27d7e12e83d0922 (patch) | |
tree | 98407b8c2ba9b05aade9d72c5f685213129aebdc /source/blender/editors/space_outliner/outliner_tools.c | |
parent | 874b692e80181a7212c77e1d9c83b6e0b36be967 (diff) |
Added menu entry for recursive hierarchy selec in outliner
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tools.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 0f85ed458bc..7b28064d5e3 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -75,6 +75,7 @@ #include "outliner_intern.h" + /* ****************************************************** */ /* ************ SELECTION OPERATIONS ********* */ @@ -266,6 +267,17 @@ static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, } } +static void object_select_hierarchy_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *UNUSED(tselem)) +{ + /* From where do i get the x,y coordinate of the mouse event ? */ + wmWindow *win = CTX_wm_window(C); + int x = win->eventstate->mval[0]; + int y = win->eventstate->mval[1]; + outliner_item_do_activate(C, x, y, true, true); +} + + static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { @@ -571,15 +583,29 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li /* **************************************** */ +enum { + OL_OP_ENDMARKER =0, + OL_OP_SELECT, + OL_OP_DESELECT, + OL_OP_SELECT_HIERARCHY, + OL_OP_DELETE, + OL_OP_LOCALIZED, /* disabled, see below */ + OL_OP_TOGVIS, + OL_OP_TOGSEL, + OL_OP_TOGREN, + OL_OP_RENAME +}; + static EnumPropertyItem prop_object_op_types[] = { - {1, "SELECT", 0, "Select", ""}, - {2, "DESELECT", 0, "Deselect", ""}, - {4, "DELETE", 0, "Delete", ""}, - {6, "TOGVIS", 0, "Toggle Visible", ""}, - {7, "TOGSEL", 0, "Toggle Selectable", ""}, - {8, "TOGREN", 0, "Toggle Renderable", ""}, - {9, "RENAME", 0, "Rename", ""}, - {0, NULL, 0, NULL, NULL} + {OL_OP_SELECT, "SELECT", 0, "Select", ""}, + {OL_OP_DESELECT, "DESELECT", 0, "Deselect", ""}, + {OL_OP_SELECT_HIERARCHY, "SELECT_HIERARCHY", 0, "Select Hierarchy", ""}, + {OL_OP_DELETE, "DELETE", 0, "Delete", ""}, + {OL_OP_TOGVIS, "TOGVIS", 0, "Toggle Visible", ""}, + {OL_OP_TOGSEL, "TOGSEL", 0, "Toggle Selectable", ""}, + {OL_OP_TOGREN, "TOGREN", 0, "Toggle Renderable", ""}, + {OL_OP_RENAME, "RENAME", 0, "Rename", ""}, + {OL_OP_ENDMARKER, NULL, 0, NULL, NULL} }; static int outliner_object_operation_exec(bContext *C, wmOperator *op) @@ -596,7 +622,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) event = RNA_enum_get(op->ptr, "type"); - if (event == 1) { + if (event == OL_OP_SELECT) { Scene *sce = scene; // to be able to delete, scenes are set... outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_cb); if (scene != sce) { @@ -606,12 +632,21 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) str = "Select Objects"; WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } - else if (event == 2) { + else if (event == OL_OP_SELECT_HIERARCHY) { + Scene *sce = scene; // to be able to delete, scenes are set... + outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_hierarchy_cb); + if (scene != sce) { + ED_screen_set_scene(C, CTX_wm_screen(C), sce); + } + str = "Select Object Hierarchy"; + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); + } + else if (event == OL_OP_DESELECT) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb); str = "Deselect Objects"; WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } - else if (event == 4) { + else if (event == OL_OP_DELETE) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); /* XXX: tree management normally happens from draw_outliner(), but when @@ -625,26 +660,26 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) str = "Delete Objects"; WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); } - else if (event == 5) { /* disabled, see above enum (ton) */ + else if (event == OL_OP_LOCALIZED) { /* disabled, see above enum (ton) */ outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb); str = "Localized Objects"; } - else if (event == 6) { + else if (event == OL_OP_TOGVIS) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb); str = "Toggle Visibility"; WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene); } - else if (event == 7) { + else if (event == OL_OP_TOGSEL) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb); str = "Toggle Selectability"; WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } - else if (event == 8) { + else if (event == OL_OP_TOGREN) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb); str = "Toggle Renderability"; WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene); } - else if (event == 9) { + else if (event == OL_OP_RENAME) { outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb); str = "Rename Object"; } |