diff options
author | Jiri Hnidek <jiri.hnidek@tul.cz> | 2005-11-18 02:26:45 +0300 |
---|---|---|
committer | Jiri Hnidek <jiri.hnidek@tul.cz> | 2005-11-18 02:26:45 +0300 |
commit | 81eb851796eeb58411eb12a07366291c20d1e11e (patch) | |
tree | 53878d99373ef940ece005d8ae4197b5c88fe680 /source/blender/blenkernel/intern/mball.c | |
parent | cab2b3e3d0632a0d7b44f78450bf12890e8c1103 (diff) |
- bug fix of bug #2923
bug was reported by ideasman, thanks! This bug fix also solve problem, when
MetaBall is parented to some zero size object.
Diffstat (limited to 'source/blender/blenkernel/intern/mball.c')
-rw-r--r-- | source/blender/blenkernel/intern/mball.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index a5ae80b937b..ea1608d8a18 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -1439,7 +1439,7 @@ float init_meta(Object *ob) /* return totsize */ MetaElem *ml; float size, totsize, (*mat)[4] = NULL, (*imat)[4] = NULL, obinv[4][4], vec[3]; float temp1[4][4], temp2[4][4], temp3[4][4]; //max=0.0; - int a, obnr; + int a, obnr, zero_size=0; char obname[32]; Mat4Invert(obinv, ob->obmat); @@ -1453,7 +1453,9 @@ float init_meta(Object *ob) /* return totsize */ while(next_object(1, &base, &bob)) { if(bob->type==OB_MBALL) { - ml= 0; + zero_size= 0; + ml= NULL; + if(bob==ob) { mat= imat= 0; mb= ob->data; @@ -1475,6 +1477,32 @@ float init_meta(Object *ob) /* return totsize */ else ml= mb->elems.first; } } + + /* when metaball object hase zero scale, then MetaElem ot this MetaBall + * will not be put to mainb array */ + if(bob->size[0]==0.0 || bob->size[1]==0.0 || bob->size[2]==0.0) { + zero_size= 1; + } + else if(bob->parent) { + struct Object *pob=bob->parent; + while(pob) { + if(pob->size[0]==0.0 || pob->size[1]==0.0 || pob->size[2]==0.0) { + zero_size= 1; + break; + } + pob= pob->parent; + } + } + + if (zero_size) { + unsigned int ml_count=0; + while(ml) { + ml_count++; + ml= ml->next; + } + totelem -= ml_count; + } + else { while(ml) { if(!(ml->flag & MB_HIDE)) { int i; @@ -1583,6 +1611,7 @@ float init_meta(Object *ob) /* return totsize */ } ml= ml->next; } + } } } |