Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-10-12 10:36:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-10-12 10:36:17 +0400
commit14a94607557a2436cd187b6e7d89ee418a3eedf0 (patch)
tree7ffbb5f438f8475da300af1e4e07579b502458c7 /source
parent4a10a1a6bed10b0fcc3df666aac5ff60eb4fa12b (diff)
renamed
Make Links -> Group to DupliGroup added "Make Linkes -> Groups" so you can add other selected objects to the groups of the active object.
Diffstat (limited to 'source')
-rw-r--r--source/blender/src/editobject.c219
-rw-r--r--source/blender/src/header_view3d.c30
2 files changed, 138 insertions, 111 deletions
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 6f0d3c2971a..5ce68ce0050 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -3162,11 +3162,11 @@ void make_links_menu()
{
Object *ob;
short event=0;
- char str[140];
+ char str[160];
if(!(ob=OBACT)) return;
- strcpy(str, "Make Links %t|To Scene...%x1|%l|Object Ipo%x4");
+ strcpy(str, "Make Links %t|To Scene...%x1|%l|Object Ipo%x4|Object Groups%x7");
if(ob->type==OB_MESH)
strcat(str, "|Mesh Data%x2|Materials%x3");
@@ -3187,7 +3187,7 @@ void make_links_menu()
else if(ob->type==OB_ARMATURE)
strcat(str, "|Armature Data%x2");
else if(ob->type==OB_EMPTY)
- strcat(str, "|Group%x6");
+ strcat(str, "|DupliGroup%x6");
event= pupmenu(str);
@@ -3243,119 +3243,144 @@ void make_links(short event)
}
}
- base= FIRSTBASE;
- while(base) {
- if(event==1 || base != BASACT) {
-
- obt= base->object;
-
- if(TESTBASE(base)) {
-
- if(event==1) { /* to scene */
-
- /* test if already linked */
- sbase= sce->base.first;
- while(sbase) {
- if(sbase->object==base->object) break;
- sbase= sbase->next;
+ /* 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;
}
- if(sbase) { /* remove */
- base= base->next;
- continue;
- }
-
- nbase= MEM_mallocN( sizeof(Base), "newbase");
- *nbase= *base;
- BLI_addhead( &(sce->base), nbase);
- id_us_plus((ID *)base->object);
+ base= base->next;
}
+
}
- if(TESTBASELIB(base)) {
- if(event==2 || event==5) { /* obdata */
- if(ob->type==obt->type) {
-
- id= obt->data;
- id->us--;
-
- id= ob->data;
- id_us_plus(id);
- obt->data= id;
-
- /* if amount of material indices changed: */
- test_object_materials(obt->data);
+ group= group->id.next;
+ }
+
+ } else {
+ /* All non group linking */
+ base= FIRSTBASE;
+ while(base) {
+ if(event==1 || base != BASACT) {
+
+ obt= base->object;
- obt->recalc |= OB_RECALC_DATA;
+ if(TESTBASE(base)) {
+
+ if(event==1) { /* to scene */
+
+ /* test if already linked */
+ sbase= sce->base.first;
+ while(sbase) {
+ if(sbase->object==base->object) break;
+ sbase= sbase->next;
}
- }
- else if(event==4) { /* ob ipo */
- if(obt->ipo) obt->ipo->id.us--;
- obt->ipo= ob->ipo;
- if(obt->ipo) {
- id_us_plus((ID *)obt->ipo);
- do_ob_ipo(obt);
- }
- }
- else if(event==6) {
- if(ob->dup_group) ob->dup_group->id.us--;
- obt->dup_group= ob->dup_group;
- if(obt->dup_group) {
- id_us_plus((ID *)obt->dup_group);
- obt->transflag |= OB_DUPLIGROUP;
+ if(sbase) { /* remove */
+ base= base->next;
+ continue;
+ }
+
+ nbase= MEM_mallocN( sizeof(Base), "newbase");
+ *nbase= *base;
+ BLI_addhead( &(sce->base), nbase);
+ id_us_plus((ID *)base->object);
}
}
- else if(event==3) { /* materials */
-
- /* only if obt has no material: make arrays */
- /* from ob to obt! */
-
- obmatarar= give_matarar(ob);
- matarar= give_matarar(obt);
- totcolp= give_totcolp(obt);
-
- /* if one of the two is zero: no render-able object */
- if( matarar && obmatarar) {
-
- /* take care of users! so first a copy of original: */
+ if(TESTBASELIB(base)) {
+ if(event==2 || event==5) { /* obdata */
+ if(ob->type==obt->type) {
+
+ id= obt->data;
+ id->us--;
+
+ id= ob->data;
+ id_us_plus(id);
+ obt->data= id;
+
+ /* if amount of material indices changed: */
+ test_object_materials(obt->data);
- if(ob->totcol) {
- matar1= MEM_dupallocN(ob->mat);
- matar2= MEM_dupallocN(*obmatarar);
+ obt->recalc |= OB_RECALC_DATA;
+ }
}
- else {
- matar1= matar2= NULL;
+ else if(event==4) { /* ob ipo */
+ if(obt->ipo) obt->ipo->id.us--;
+ obt->ipo= ob->ipo;
+ if(obt->ipo) {
+ id_us_plus((ID *)obt->ipo);
+ do_ob_ipo(obt);
}
-
- /* remove links from obt */
- for(a=0; a<obt->totcol; a++) {
- if(obt->mat[a]) obt->mat[a]->id.us--;
- if( (*matarar)[a]) (*matarar)[a]->id.us--;
+ }
+ else if(event==6) {
+ if(ob->dup_group) ob->dup_group->id.us--;
+ obt->dup_group= ob->dup_group;
+ if(obt->dup_group) {
+ id_us_plus((ID *)obt->dup_group);
+ obt->transflag |= OB_DUPLIGROUP;
}
+ }
+ else if(event==3) { /* materials */
- /* free */
- if(obt->mat) MEM_freeN(obt->mat);
- if(*matarar) MEM_freeN(*matarar);
+ /* only if obt has no material: make arrays */
+ /* from ob to obt! */
- /* connect a copy */
- obt->mat= matar1;
- *matarar= matar2;
- obt->totcol= ob->totcol;
- *totcolp= ob->totcol;
-
- /* increase users */
- for(a=0; a<obt->totcol; a++) {
- if(obt->mat[a]) id_us_plus((ID *)obt->mat[a]);
- if( (*matarar)[a]) id_us_plus((ID *)(*matarar)[a]);
- }
+ obmatarar= give_matarar(ob);
+ matarar= give_matarar(obt);
+ totcolp= give_totcolp(obt);
+
+ /* if one of the two is zero: no render-able object */
+ if( matarar && obmatarar) {
+
+ /* take care of users! so first a copy of original: */
- obt->colbits= ob->colbits;
+ if(ob->totcol) {
+ matar1= MEM_dupallocN(ob->mat);
+ matar2= MEM_dupallocN(*obmatarar);
+ }
+ else {
+ matar1= matar2= NULL;
+ }
+
+ /* remove links from obt */
+ for(a=0; a<obt->totcol; a++) {
+ if(obt->mat[a]) obt->mat[a]->id.us--;
+ if( (*matarar)[a]) (*matarar)[a]->id.us--;
+ }
+
+ /* free */
+ if(obt->mat) MEM_freeN(obt->mat);
+ if(*matarar) MEM_freeN(*matarar);
+
+ /* connect a copy */
+ obt->mat= matar1;
+ *matarar= matar2;
+ obt->totcol= ob->totcol;
+ *totcolp= ob->totcol;
- /* if amount of material indices changed: */
- test_object_materials(obt->data);
+ /* increase users */
+ for(a=0; a<obt->totcol; a++) {
+ if(obt->mat[a]) id_us_plus((ID *)obt->mat[a]);
+ if( (*matarar)[a]) id_us_plus((ID *)(*matarar)[a]);
+ }
+
+ obt->colbits= ob->colbits;
+
+ /* if amount of material indices changed: */
+ test_object_materials(obt->data);
+ }
}
}
}
+ base= base->next;
}
- base= base->next;
}
allqueue(REDRAWVIEW3D, 0);
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index e2e6f168112..ef37625d2c9 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -1759,6 +1759,7 @@ static void do_view3d_edit_object_makelinksmenu(void *arg, int event)
case 3:
case 4:
case 6:
+ case 7:
make_links((short)event);
break;
}
@@ -1780,33 +1781,34 @@ 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, "");
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->type==OB_MESH) {
- 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, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+ 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, "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, 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, "");
+ 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, 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, "");
+ 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, 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, "");
+ 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, 3", 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_CAMERA) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_LAMP) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_LATTICE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_ARMATURE) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature Data|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_EMPTY) {
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Group|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "DupliGroup|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
}
}