diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-06-27 16:45:09 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-06-27 16:45:09 +0400 |
commit | 650de24271501bddce1c0782ea071e9d8727101a (patch) | |
tree | 93f3922e564d7132e9a0536c46aac578aab1e498 /source/blender | |
parent | 3262dfdadd352f27043f2ba13540c3fb45d3743a (diff) |
Recalculate motherball when metaball is deleting
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_mball.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mball.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 11 |
3 files changed, 18 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index ce70b4cca2f..130969d4892 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -168,6 +168,7 @@ float *make_orco_mball(struct Object *ob); void copy_mball_properties(struct Scene *scene, struct Object *active_object); struct Object *find_basis_mball(struct Scene *scene, struct Object *ob); int is_basis_mball(struct Object *ob); +int is_mball_basis_for(struct Object *ob1, struct Object *ob2); void metaball_polygonize(struct Scene *scene, struct Object *ob); void calc_mballco(struct MetaElem *ml, float *vec); float densfunc(struct MetaElem *ball, float x, float y, float z); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 8d2dbf964b8..a15dad16e41 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -275,6 +275,19 @@ int is_basis_mball(Object *ob) return 1; } +/* return nonzero if ob1 is a basis mball for ob */ +int is_mball_basis_for(Object *ob1, Object *ob2) +{ + int basis1nr, basis2nr; + char basis1name[32], basis2name[32]; + + splitIDname(ob1->id.name+2, basis1name, &basis1nr); + splitIDname(ob2->id.name+2, basis2name, &basis2nr); + + if(!strcmp(basis1name, basis2name)) return is_basis_mball(ob1); + else return 0; +} + /* \brief copy some properties from object to other metaball object with same base name * * When some properties (wiresize, threshold, update flags) of metaball are changed, then this properties diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 61d81e461b6..5d3527d5afc 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -404,6 +404,9 @@ void unlink_object(Scene *scene, Object *ob) if(pchan->custom==ob) pchan->custom= NULL; } + } else if(ELEM(OB_MBALL, ob->type, obt->type)) { + if(is_mball_basis_for(obt, ob)) + obt->recalc|= OB_RECALC_DATA; } sca_remove_ob_poin(obt, ob); @@ -536,13 +539,7 @@ void unlink_object(Scene *scene, Object *ob) } tex= tex->id.next; } - - /* mballs (scene==NULL when called from library.c) */ - if(scene && ob->type==OB_MBALL) { - obt= find_basis_mball(scene, ob); - if(obt) freedisplist(&obt->disp); - } - + /* worlds */ wrld= G.main->world.first; while(wrld) { |