From 85c90b4951523052de0cd4bd7496f53153abff3a Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 14 Nov 2006 20:41:38 +0000 Subject: [PATCH] Fixes in commit for Group Proxy feature; - Groups with hidden parts didn't render OK - Layer buttons sent out wrong events --- source/blender/blenkernel/BKE_anim.h | 2 +- source/blender/blenkernel/intern/anim.c | 6 ++-- source/blender/src/buttons_object.c | 8 ++--- source/blender/src/drawview.c | 41 +++++++++++++------------ 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index d77677fa748..c7808331d7e 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -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; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 0bb0b65bb83..4d58e2b46b6 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -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); diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 3e104a2e623..1fdbfab4642 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -1788,16 +1788,16 @@ static void object_panel_object(Object *ob) /* layers */ uiBlockBeginAlign(block); for(a=0; a<5; a++) - uiDefButBitI(block, TOG, 1<layer), 0, 0, 0, 0, ""); + uiDefButBitI(block, TOG, 1<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<layer), 0, 0, 0, 0, ""); + uiDefButBitI(block, TOG, 1<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); diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 6d760bf29be..ee7b462f1da 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -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 */