diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-07-25 23:45:34 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-07-25 23:45:34 +0400 |
commit | 4ca9275b448fa62fa1c0d55007417558c6552d77 (patch) | |
tree | b1d639721eca0ad58464be6fb6cd085ab6089a0b /source/blender/editors/object/object_select.c | |
parent | b66f541b426be7a5904459625627ad354c796ed2 (diff) |
Implement operator to select linked data from outliner
Supports selecting using object data, material and library.
Would be nice to hide this menu item from menus appearing for
datablocks which does not support such a selection, but that
could be done separately.
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r-- | source/blender/editors/object/object_select.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index f5f1ba61e8b..c83331a8eb7 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -372,6 +372,25 @@ static int object_select_all_by_library_obdata(bContext *C, Library *lib) return changed; } +void ED_object_select_linked_by_id(bContext *C, ID *id) +{ + int gs = GS(id->name); + int changed = FALSE; + + if (ELEM8(gs, ID_ME, ID_CU, ID_MB, ID_LT, ID_LA, ID_CA, ID_TXT, ID_SPK)) { + changed = object_select_all_by_obdata(C, id); + } + else if (gs == ID_MA) { + changed = object_select_all_by_material_texture(C, FALSE, (Material *)id, NULL); + } + else if (gs == ID_LI) { + changed = object_select_all_by_library(C, (Library *) id); + } + + if (changed) + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); +} + static int object_select_linked_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -1097,5 +1116,3 @@ void OBJECT_OT_select_random(wmOperatorType *ot) RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of objects to select randomly", 0.f, 100.0f); RNA_def_boolean(ot->srna, "extend", FALSE, "Extend Selection", "Extend selection instead of deselecting everything first"); } - - |