changed select grouped hooks functionality- just select the hooks that use the active object.
also speed up for select group, only find group status for unselected objects. Updated the select group menu in 3 places, the space bar menu was out missing some other group options also.
This commit is contained in:
@@ -761,6 +761,7 @@ void do_view3d_select_object_groupedmenu(void *arg, int event)
|
||||
case 5: /* Type */
|
||||
case 6: /* Objects on Shared Layers */
|
||||
case 7: /* Objects in Same Group */
|
||||
case 8: /* Object Hooks*/
|
||||
select_object_grouped((short)event);
|
||||
break;
|
||||
}
|
||||
@@ -782,6 +783,7 @@ static uiBlock *view3d_select_object_groupedmenu(void *arg_unused)
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects of Same Type|Shift G, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects on Shared Layers|Shift G, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects in Same Group|Shift G, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Hooks|Shift G, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
|
||||
|
||||
uiBlockSetDirection(block, UI_RIGHT);
|
||||
uiTextBoundsBlock(block, 60);
|
||||
|
||||
@@ -609,46 +609,30 @@ static void select_same_group(Object *ob) /* Select objects in the same group as
|
||||
if (!group || !ob)
|
||||
return;
|
||||
|
||||
for (base= FIRSTBASE; base; base= base->next)
|
||||
if (object_in_group(base->object, group)) {
|
||||
for (base= FIRSTBASE; base; base= base->next) {
|
||||
if (!(base->flag & SELECT) && object_in_group(base->object, group)) {
|
||||
base->flag |= SELECT;
|
||||
base->object->flag |= SELECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void select_same_hook(Object *ob) /* Select objects in the same group as the active */
|
||||
static void select_object_hooks(Object *ob) /* Select objects in the same group as the active */
|
||||
{
|
||||
Base *base, *base_to;
|
||||
Base *base;
|
||||
ModifierData *md;
|
||||
HookModifierData *hmd;
|
||||
int ok;
|
||||
|
||||
if (!ob)
|
||||
return;
|
||||
|
||||
for (base= FIRSTBASE; base; base= base->next) {
|
||||
ok= 0;
|
||||
/* check that this object has a hook modifier and is using the active object as its deformer */
|
||||
for (md = base->object->modifiers.first; md; md=md->next) {
|
||||
for (md = ob->modifiers.first; md; md=md->next) {
|
||||
if (md->type==eModifierType_Hook) {
|
||||
hmd= (HookModifierData*) md;
|
||||
if (hmd->object == ob) {
|
||||
ok= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok) { /* this means that ob us using the active object as a hook, so select other hooks */
|
||||
for (md = base->object->modifiers.first; md; md=md->next) {
|
||||
if (md->type==eModifierType_Hook) {
|
||||
hmd= (HookModifierData*) md;
|
||||
if (hmd->object != ob) {
|
||||
base_to= object_in_scene(hmd->object, G.scene);
|
||||
if (base_to) {
|
||||
base_to->flag |= SELECT;
|
||||
base_to->object->flag |= SELECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hmd->object && !(hmd->object->flag & SELECT)) {
|
||||
base= object_in_scene(hmd->object, G.scene);
|
||||
base->flag |= SELECT;
|
||||
base->object->flag |= SELECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -700,7 +684,7 @@ void select_object_grouped(short nr)
|
||||
else if(nr==4) select_same_parent(OBACT);
|
||||
else if(nr==5) select_same_type(OBACT);
|
||||
else if(nr==7) select_same_group(OBACT);
|
||||
else if(nr==8) select_same_hook(OBACT);
|
||||
else if(nr==8) select_object_hooks(OBACT);
|
||||
|
||||
|
||||
|
||||
@@ -726,7 +710,7 @@ static void select_object_grouped_menu(void)
|
||||
"Objects of Same Type%x5|"
|
||||
"Objects on Shared Layers%x6|"
|
||||
"Objects in Same Group%x7|"
|
||||
"Hook Siblings (Deform Same Data)%x8|");
|
||||
"Object Hooks%x8|");
|
||||
|
||||
/* here we go */
|
||||
|
||||
|
||||
@@ -843,8 +843,11 @@ static TBitem tb_object_select_grouped[]= {
|
||||
{ 0, "Children|Shift G, 1", 1, NULL},
|
||||
{ 0, "Immediate Children|Shift G, 2", 2, NULL},
|
||||
{ 0, "Parent|Shift G, 3", 3, NULL},
|
||||
{ 0, "Objects on Shared Layers|Shift G, 4", 4, NULL},
|
||||
{ 0, "Objects in Same Group|Shift G, 5", 5, NULL},
|
||||
{ 0, "Siblings (Shared Parent)|Shift G, 4", 4, NULL},
|
||||
{ 0, "Objects of Same Type|Shift G, 5", 5, NULL},
|
||||
{ 0, "Objects on Shared Layers|Shift G, 6", 6, NULL},
|
||||
{ 0, "Objects in Same Group|Shift G, 7", 7, NULL},
|
||||
{ 0, "Object Hooks|Shift G, 8", 8, NULL},
|
||||
{ -1, "", 0, do_view3d_select_object_groupedmenu}};
|
||||
|
||||
static TBitem tb_object_select[]= {
|
||||
|
||||
Reference in New Issue
Block a user