Fixes in commit for Group Proxy feature;

- Groups with hidden parts didn't render OK
- Layer buttons sent out wrong events
This commit is contained in:
Ton Roosendaal 2006-11-14 20:41:38 +00:00
parent a8ca44ea41
commit 85c90b4951
4 changed files with 31 additions and 26 deletions

@ -44,7 +44,7 @@ typedef struct DupliObject {
struct DupliObject *next, *prev;
struct Object *ob;
unsigned int origlay;
int index;
int index, no_draw;
float mat[4][4], omat[4][4];
} DupliObject;

@ -279,7 +279,7 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* returns OK
static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index)
{
DupliObject *dob= MEM_mallocN(sizeof(DupliObject), "dupliobject");
DupliObject *dob= MEM_callocN(sizeof(DupliObject), "dupliobject");
BLI_addtail(lb, dob);
dob->ob= ob;
@ -318,9 +318,11 @@ static void group_duplilist(ListBase *lb, Object *ob, int level)
group_handle_recalc_and_update(ob, group);
for(go= group->gobject.first; go; go= go->next) {
if(go->ob!=ob && (go->ob->lay & group->layer)) {
/* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */
if(go->ob!=ob) {
Mat4MulMat4(mat, go->ob->obmat, ob->obmat);
dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0);
dob->no_draw= (dob->origlay & group->layer)==0;
if(go->ob->dup_group) {
Mat4CpyMat4(dob->ob->obmat, dob->mat);
group_duplilist(lb, go->ob, level+1);

@ -1788,16 +1788,16 @@ static void object_panel_object(Object *ob)
/* 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, "");
uiDefButBitI(block, TOG, 1<<a, REDRAWVIEW3D, "", (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, "");
uiDefButBitI(block, TOG, 1<<(a+10), REDRAWVIEW3D, "", (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, "");
uiDefButBitI(block, TOG, 1<<a, REDRAWVIEW3D, "", (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, "");
uiDefButBitI(block, TOG, 1<<(a+10), REDRAWVIEW3D, "", (short)(xco+a*(dx/2)), 105-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, "");
uiBlockEndAlign(block);

@ -2645,25 +2645,28 @@ static void draw_dupli_objects(View3D *v3d, Base *base)
lb= object_duplilist(G.scene, base->object);
for(dob= lb->first; dob; dob= dob->next) {
tbase.object= dob->ob;
Mat4CpyMat4(dob->ob->obmat, dob->mat);
/* extra service: draw the duplicator in drawtype of parent */
dt= tbase.object->dt; tbase.object->dt= base->object->dt;
dtx= tbase.object->dtx; tbase.object->dtx= base->object->dtx;
/* negative scale flag has to propagate */
transflag= tbase.object->transflag;
if(base->object->transflag & OB_NEG_SCALE)
tbase.object->transflag ^= OB_NEG_SCALE;
BIF_ThemeColorBlend(color, TH_BACK, 0.5);
draw_object(&tbase, DRAW_CONSTCOLOR);
tbase.object->dt= dt;
tbase.object->dtx= dtx;
tbase.object->transflag= transflag;
if(dob->no_draw);
else {
tbase.object= dob->ob;
Mat4CpyMat4(dob->ob->obmat, dob->mat);
/* extra service: draw the duplicator in drawtype of parent */
dt= tbase.object->dt; tbase.object->dt= base->object->dt;
dtx= tbase.object->dtx; tbase.object->dtx= base->object->dtx;
/* negative scale flag has to propagate */
transflag= tbase.object->transflag;
if(base->object->transflag & OB_NEG_SCALE)
tbase.object->transflag ^= OB_NEG_SCALE;
BIF_ThemeColorBlend(color, TH_BACK, 0.5);
draw_object(&tbase, DRAW_CONSTCOLOR);
tbase.object->dt= dt;
tbase.object->dtx= dtx;
tbase.object->transflag= transflag;
}
}
/* Transp afterdraw disabled, afterdraw only stores base pointers, and duplis can be same obj */