[Bf-blender-cvs] [702d85d7cdd] master: Fix (unreported) several issues when converting MBall to Mesh.

Bastien Montagne noreply at git.blender.org
Sun Jun 9 22:59:48 CEST 2019


Commit: 702d85d7cddbf819c386b525cb7f3b45c79913b8
Author: Bastien Montagne
Date:   Sun Jun 9 22:56:37 2019 +0200
Branches: master
https://developer.blender.org/rB702d85d7cddbf819c386b525cb7f3b45c79913b8

Fix (unreported) several issues when converting MBall to Mesh.

Redo panel would be hidden (when 'keep original' was not set), due to
same kind of (un)selected issue as in T65301 (see previous commit).

Further more, not all MBall objects of the family were properly removed.

===================================================================

M	source/blender/editors/object/object_add.c

===================================================================

diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 7d54f12df8f..4ab4290d867 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2320,6 +2320,7 @@ static int convert_exec(bContext *C, wmOperator *op)
         if (obact->type == OB_MBALL) {
           basact = basen;
         }
+        ED_object_base_select(basen, BA_SELECT);
 
         mballConverted = 1;
       }
@@ -2359,13 +2360,22 @@ static int convert_exec(bContext *C, wmOperator *op)
 
   if (!keep_original) {
     if (mballConverted) {
+      /* We need to remove non-basis MBalls first, otherwise we won't be able to detect them if
+       * their basis happens to be removed first. */
+      FOREACH_SCENE_OBJECT_BEGIN (scene, ob_mball) {
+        if (ob_mball->type == OB_MBALL) {
+          Object *ob_basis = NULL;
+          if (!BKE_mball_is_basis(ob_mball) &&
+              ((ob_basis = BKE_mball_basis_find(scene, ob_mball)) && (ob_basis->flag & OB_DONE))) {
+            ED_object_base_free_and_unlink(bmain, scene, ob_mball);
+          }
+        }
+      }
+      FOREACH_SCENE_OBJECT_END;
       FOREACH_SCENE_OBJECT_BEGIN (scene, ob_mball) {
         if (ob_mball->type == OB_MBALL) {
           if (ob_mball->flag & OB_DONE) {
-            Object *ob_basis = NULL;
-            if (BKE_mball_is_basis(ob_mball) ||
-                ((ob_basis = BKE_mball_basis_find(scene, ob_mball)) &&
-                 (ob_basis->flag & OB_DONE))) {
+            if (BKE_mball_is_basis(ob_mball)) {
               ED_object_base_free_and_unlink(bmain, scene, ob_mball);
             }
           }



More information about the Bf-blender-cvs mailing list