New dupli-group feature: you can now set in Groups the layers you want

a group to show when used for duplicators. Is in the Object Buttons,
"Object and Links" panel. Note that the duplicator layer itself still
defines still visiblitily of entire group.
This commit is contained in:
2006-11-14 17:16:15 +00:00
parent ba71fbb785
commit 9ab91ab361
6 changed files with 42 additions and 13 deletions

View File

@@ -303,20 +303,22 @@ static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], i
static void group_duplilist(ListBase *lb, Object *ob, int level)
{
DupliObject *dob;
Group *group;
GroupObject *go;
float mat[4][4];
if(ob->dup_group==NULL) return;
group= ob->dup_group;
/* simple preventing of too deep nested groups */
if(level>4) return;
/* handles animated groups, and */
/* we need to check update for objects that are not in scene... */
group_handle_recalc_and_update(ob, ob->dup_group);
group_handle_recalc_and_update(ob, group);
for(go= ob->dup_group->gobject.first; go; go= go->next) {
if(go->ob!=ob) {
for(go= group->gobject.first; go; go= go->next) {
if(go->ob!=ob && (go->ob->lay & group->layer)) {
Mat4MulMat4(mat, go->ob->obmat, ob->obmat);
dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0);
if(go->ob->dup_group) {

View File

@@ -110,6 +110,7 @@ Group *add_group()
Group *group;
group = alloc_libblock(&G.main->group, ID_GR, "Group");
group->layer= (1<<20)-1;
return group;
}

View File

@@ -5757,6 +5757,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob;
Curve *cu;
Material *ma;
Group *group;
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
@@ -5870,6 +5871,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ma->shad_alpha= 1.0f;
}
for(group= main->group.first; group; group= group->id.next)
if(group->layer==0)
group->layer= (1<<20)-1;
/* History fix (python?), shape key adrcode numbers have to be sorted */
sort_shape_fix(main);
}

View File

@@ -52,7 +52,8 @@ typedef struct Group {
ID id;
ListBase gobject; /* GroupObject */
unsigned int layer;
int pad;
} Group;

View File

@@ -3280,13 +3280,13 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm)
uiBlockBeginAlign(block);
for(a=0; a<8; a++) {
short dx= 21;
but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -10+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "");
but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -10+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "Don't draw this layer for group-duplicators");
uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a));
}
uiBlockBeginAlign(block);
for(a=8; a<16; a++) {
short dx= 21;
but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -6+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "");
but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -6+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "Don't draw this layer for group-duplicators");
uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a));
}

View File

@@ -1747,8 +1747,9 @@ static void object_panel_object(Object *ob)
uiBlock *block;
uiBut *but;
Group *group;
int a=0, xco;
int a, xco, yco=0;
short dx= 33, dy= 30;
block= uiNewBlock(&curarea->uiblocks, "object_panel_object", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Object and Links", "Object", 0, 0, 318, 204)==0) return;
@@ -1765,23 +1766,42 @@ static void object_panel_object(Object *ob)
uiDefBlockBut(block, add_groupmenu, NULL, "Add to Group", 10,150,150,20, "Add Object to a new Group");
/* all groups */
uiBlockBeginAlign(block);
for(group= G.main->group.first; group; group= group->id.next) {
if(object_in_group(ob, group)) {
xco= 160;
but = uiDefBut(block, TEX, B_IDNAME, "GR:", 10, 120-a, 150, 20, group->id.name+2, 0.0, 19.0, 0, 0, "Displays Group name. Click to change.");
uiBlockBeginAlign(block);
but = uiDefBut(block, TEX, B_IDNAME, "GR:", 10, 120-yco, 150, 20, group->id.name+2, 0.0, 19.0, 0, 0, "Displays Group name. Click to change.");
uiButSetFunc(but, test_idbutton_cb, group->id.name, NULL);
if(group->id.lib) {
but= uiDefIconBut(block, BUT, B_NOP, ICON_PARLIB, 160, 120-a, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Make Group local");
but= uiDefIconBut(block, BUT, B_NOP, ICON_PARLIB, 160, 120-yco, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Make Group local");
uiButSetFunc(but, group_local, group, NULL);
xco= 180;
}
but = uiDefIconBut(block, BUT, B_NOP, VICON_X, xco, 120-a, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove Group membership");
but = uiDefIconBut(block, BUT, B_NOP, VICON_X, xco, 120-yco, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove Group membership");
uiButSetFunc(but, group_ob_rem, group, ob);
a+= 20;
yco+= 20;
xco= 10;
/* layers */
uiBlockBeginAlign(block);
for(a=0; a<5; a++)
uiDefButBitI(block, TOG, 1<<a, B_REDR+a, "", (short)(xco+a*(dx/2)), 120-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, "");
for(a=0; a<5; a++)
uiDefButBitI(block, TOG, 1<<(a+10), B_REDR+a+10, "", (short)(xco+a*(dx/2)), 105-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, "");
xco+= 7;
uiBlockBeginAlign(block);
for(a=5; a<10; a++)
uiDefButBitI(block, TOG, 1<<a, B_REDR+a, "", (short)(xco+a*(dx/2)), 120-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, "");
for(a=5; a<10; a++)
uiDefButBitI(block, TOG, 1<<(a+10), B_REDR+a+10, "", (short)(xco+a*(dx/2)), 105-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, "");
uiBlockEndAlign(block);
yco+= 40;
}
}
}