diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 6ffd2bd68a1..df409b491bd 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -745,6 +745,7 @@ void do_view3d_select_object_groupedmenu(void *arg, int event) case 2: /* Immediate Children */ case 3: /* Parent */ case 4: /* Objects on Shared Layers */ + case 5: /* Objects in Same Group */ select_grouped((short)event); break; } @@ -763,6 +764,7 @@ static uiBlock *view3d_select_object_groupedmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Immediate Children|Shift G, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Parent|Shift G, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects on Shared Layers|Shift G, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects in Same Group|Shift G, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index dae28297f5b..c8dd5b712f3 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -57,6 +57,7 @@ #include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_curve_types.h" +#include "DNA_group_types.h" /* used for select_same_group */ #include "DNA_image_types.h" #include "DNA_ipo_types.h" #include "DNA_mesh_types.h" @@ -597,6 +598,20 @@ static void select_parent(void) /* Makes parent active and de-selected OBACT */ } } +static void select_same_group(Object *ob) /* Select objects in the same group as the active */ +{ + Base *base; + Group *group= find_group(ob); + if (!group || !ob) + return; + + for (base= FIRSTBASE; base; base= base->next) + if (object_in_group(base->object, group)) { + base->flag |= SELECT; + base->object->flag |= SELECT; + } +} + void select_grouped(short nr) { Base *base; @@ -609,8 +624,9 @@ void select_grouped(short nr) base->object->flag |= SELECT; } base= base->next; - } + } } + else if(nr==5) select_same_group(OBACT); else if(nr==2) select_children(OBACT, 0); else if(nr==1) select_children(OBACT, 1); else if(nr==3) select_parent(); @@ -632,7 +648,8 @@ static void select_grouped_menu(void) str= MEM_mallocN(160, "groupmenu"); strcpy(str, "Select Grouped%t|Children%x1|" "Immediate Children%x2|Parent%x3|" - "Objects on Shared Layers%x4"); + "Objects on Shared Layers%x4|" + "Objects in Same Group%x5|"); /* here we go */