diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-03-06 14:44:56 +0300 |
---|---|---|
committer | Julian Eisel <julian_eisel@web.de> | 2015-03-06 19:24:11 +0300 |
commit | a15b239adcb178ae3fa83297189e0a0639f94943 (patch) | |
tree | 8431e79e71a6019354d5eb585fd347125a378934 /source/blender | |
parent | 76c215249ed943b08a95c8ee70ffea6dd3197299 (diff) |
Fix metaball->mesh removing all metas in the scene
Assumed the entire scene used the one motherball.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/object/object_add.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 5c8f95bfb4e..99b351561c7 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1605,18 +1605,30 @@ static int convert_exec(bContext *C, wmOperator *op) /* don't forget multiple users! */ - /* reset flags */ - CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { - ob = base->object; - ob->flag &= ~OB_DONE; + Base *base; - /* flag data thats not been edited (only needed for !keep_original) */ - if (ob->data) { - ((ID *)ob->data)->flag |= LIB_DOIT; + for (base = scene->base.first; base; base = base->next) { + ob = base->object; + ob->flag &= ~OB_DONE; + + /* flag data thats not been edited (only needed for !keep_original) */ + if (ob->data) { + ((ID *)ob->data)->flag |= LIB_DOIT; + } + + /* possible metaball basis is not in this scene */ + if (ob->type == OB_MBALL && target == OB_MESH) { + if (BKE_mball_is_basis(ob) == false) { + Object *ob_basis; + ob_basis = BKE_mball_basis_find(scene, ob); + if (ob_basis) { + ob_basis->flag &= ~OB_DONE; + } + } + } } } - CTX_DATA_END; CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { @@ -1855,14 +1867,21 @@ static int convert_exec(bContext *C, wmOperator *op) if (!keep_original) { if (mballConverted) { - Base *base = scene->base.first, *tmpbase; - while (base) { - ob = base->object; - tmpbase = base; - base = base->next; + Base *base, *base_next; + + for (base = scene->base.first; base; base = base_next) { + base_next = base->next; + ob = base->object; if (ob->type == OB_MBALL) { - ED_base_object_free_and_unlink(bmain, scene, tmpbase); + if (ob->flag & OB_DONE) { + Object *ob_basis = NULL; + if (BKE_mball_is_basis(ob) || + ((ob_basis = BKE_mball_basis_find(scene, ob)) && (ob_basis->flag & OB_DONE))) + { + ED_base_object_free_and_unlink(bmain, scene, base); + } + } } } } |