Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-03-06 14:44:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-03-06 14:46:45 +0300
commit9794facab393e486cc7bb3ad77b0ee70cd39e890 (patch)
tree4bb711996d0652e633ad208e4fb234fe24903d34 /source
parent6405aa4e9c73a2d51234b4e855bd5e8c1e4ba30f (diff)
Fix metaball->mesh removing all metas in the scene
Assumed the entire scene used the one motherball.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/object/object_add.c47
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 8fd857a7683..db7cd991338 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)
{
@@ -1856,14 +1868,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);
+ }
+ }
}
}
}