On Matt's suggestion moved "Make Link->Groups" to the add groups menu as "Add to Active Objects Groups"

removed "Make Link -> DupliGroup" because Copy->Duplis does the same thing.

Python's Group.c had an unneeded scene/base lookup.
This commit is contained in:
2006-10-12 13:13:45 +00:00
parent b2a8417fce
commit ce0f9a3cac
4 changed files with 154 additions and 153 deletions

View File

@@ -741,8 +741,6 @@ static PyObject *GroupObSeq_add( BPy_GroupObSeq * self, PyObject *args )
blen_ob = ( ( BPy_Object * ) pyobj )->object; blen_ob = ( ( BPy_Object * ) pyobj )->object;
base= object_in_scene(blen_ob, G.scene);
add_to_group_wraper(self->bpygroup->group, blen_ob); /* this checks so as not to add the object into the group twice*/ add_to_group_wraper(self->bpygroup->group, blen_ob); /* this checks so as not to add the object into the group twice*/
Py_RETURN_NONE; Py_RETURN_NONE;

View File

@@ -77,6 +77,39 @@ void add_selected_to_group(Group *group)
BIF_undo_push("Add to Group"); BIF_undo_push("Add to Group");
} }
void add_selected_to_act_ob_groups(void)
{
Object *ob= OBACT, *obt;
Base *base;
if (!ob) return;
/* linking to same group requires its own loop so we can avoid
looking up the active objects groups each time */
Group *group= G.main->group.first;
while(group) {
if(object_in_group(ob, group)) {
/* Assign groups to selected objects */
base= FIRSTBASE;
while(base) {
if(TESTBASE(base)) {
obt= base->object;
add_to_group(group, obt);
obt->flag |= OB_FROMGROUP;
base->flag |= OB_FROMGROUP;
}
base= base->next;
}
}
group= group->id.next;
}
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSOBJECT, 0);
DAG_scene_sort(G.scene);
BIF_undo_push("Add to Active Objects Group");
}
void rem_selected_from_group(void) void rem_selected_from_group(void)
{ {
Base *base; Base *base;
@@ -110,7 +143,7 @@ void group_operation_with_menu(void)
break; break;
if(group) if(group)
mode= pupmenu("Groups %t|Add to Existing Group %x3|Add to New Group %x1|Remove from All Groups %x2"); mode= pupmenu("Groups %t|Add to Existing Group %x3|Add to Active Objects Groups %x4|Add to New Group %x1|Remove from All Groups %x2");
else else
mode= pupmenu("Groups %t|Add to New Group %x1|Remove from All Groups %x2"); mode= pupmenu("Groups %t|Add to New Group %x1|Remove from All Groups %x2");
@@ -144,7 +177,8 @@ void group_operation(int mode)
else return; else return;
} }
if(mode==1 || mode==3) add_selected_to_group(group); if(mode==4) add_selected_to_act_ob_groups();
else if(mode==1 || mode==3) add_selected_to_group(group);
else if(mode==2) rem_selected_from_group(); else if(mode==2) rem_selected_from_group();
} }
} }

View File

@@ -3162,11 +3162,11 @@ void make_links_menu()
{ {
Object *ob; Object *ob;
short event=0; short event=0;
char str[160]; char str[140];
if(!(ob=OBACT)) return; if(!(ob=OBACT)) return;
strcpy(str, "Make Links %t|To Scene...%x1|%l|Object Ipo%x4|Object Groups%x7"); strcpy(str, "Make Links %t|To Scene...%x1|%l|Object Ipo%x4");
if(ob->type==OB_MESH) if(ob->type==OB_MESH)
strcat(str, "|Mesh Data%x2|Materials%x3"); strcat(str, "|Mesh Data%x2|Materials%x3");
@@ -3186,8 +3186,6 @@ void make_links_menu()
strcat(str, "|Lattice Data%x2"); strcat(str, "|Lattice Data%x2");
else if(ob->type==OB_ARMATURE) else if(ob->type==OB_ARMATURE)
strcat(str, "|Armature Data%x2"); strcat(str, "|Armature Data%x2");
else if(ob->type==OB_EMPTY)
strcat(str, "|DupliGroup%x6");
event= pupmenu(str); event= pupmenu(str);
@@ -3243,29 +3241,6 @@ void make_links(short event)
} }
} }
/* linking to same group requires its own loop so we can avoid
looking up the active objects groups each time */
if(event==7) {
Group *group= G.main->group.first;
while(group) {
if(object_in_group(ob, group)) {
/* Assign groups to selected objects */
base= FIRSTBASE;
while(base) {
if(TESTBASE(base)) {
obt= base->object;
add_to_group(group, obt);
obt->flag |= OB_FROMGROUP;
base->flag |= OB_FROMGROUP;
}
base= base->next;
}
}
group= group->id.next;
}
} else {
/* All non group linking */ /* All non group linking */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
@@ -3381,7 +3356,6 @@ void make_links(short event)
} }
base= base->next; base= base->next;
} }
}
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWOOPS, 0); allqueue(REDRAWOOPS, 0);

View File

@@ -1758,8 +1758,6 @@ static void do_view3d_edit_object_makelinksmenu(void *arg, int event)
case 2: case 2:
case 3: case 3:
case 4: case 4:
case 6:
case 7:
make_links((short)event); make_links((short)event);
break; break;
} }
@@ -1781,34 +1779,31 @@ static uiBlock *view3d_edit_object_makelinksmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Ipo|Ctrl L, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Ipo|Ctrl L, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Groups|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
if ((ob=OBACT)) { if ((ob=OBACT)) {
if(ob->type==OB_MESH) { if(ob->type==OB_MESH) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mesh Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mesh Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_CURVE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Curve Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_FONT) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_SURF) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Surface Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_MBALL) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_CURVE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Curve Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_FONT) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_SURF) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Surface Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_MBALL) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_CAMERA) { } else if(ob->type==OB_CAMERA) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_LAMP) { } else if(ob->type==OB_LAMP) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_LATTICE) { } else if(ob->type==OB_LATTICE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_ARMATURE) { } else if(ob->type==OB_ARMATURE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_EMPTY) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "DupliGroup|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
} }
} }