[Bf-blender-cvs] [0a6bca1f753] master: Cleanup: revert part of da160dc32d1518dc3e59a8fb7995b59c88870444

Campbell Barton noreply at git.blender.org
Sun Mar 28 09:54:31 CEST 2021


Commit: 0a6bca1f75398aa9acbeae8bd596550cd2ee23e6
Author: Campbell Barton
Date:   Sun Mar 28 18:28:07 2021 +1100
Branches: master
https://developer.blender.org/rB0a6bca1f75398aa9acbeae8bd596550cd2ee23e6

Cleanup: revert part of da160dc32d1518dc3e59a8fb7995b59c88870444

The grease-pencil parent check was enabled when deleting objects,
when previously it was only done when unlinking.

While harmless, the previous logic is correct.

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

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 c0b31d6ed65..7c192190c06 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1965,20 +1965,6 @@ static int object_delete_exec(bContext *C, wmOperator *op)
       DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
     }
 
-    /* remove from Grease Pencil parent */
-    /* XXX This is likely not correct?
-     *     Will also remove parent from grease pencil from other scenes,
-     *     even when use_global is false... */
-    for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
-      LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
-        if (gpl->parent != NULL) {
-          if (gpl->parent == ob) {
-            gpl->parent = NULL;
-          }
-        }
-      }
-    }
-
     /* Use multi tagged delete if `use_global=True`, or the object is used only in one scene. */
     if (use_global || ID_REAL_USERS(ob) <= 1) {
       ob->id.tag |= LIB_TAG_DOIT;
@@ -1988,6 +1974,18 @@ static int object_delete_exec(bContext *C, wmOperator *op)
       /* Object is used in multiple scenes. Delete the object from the current scene only. */
       ED_object_base_free_and_unlink_no_indirect_check(bmain, scene, ob);
       changed_count += 1;
+
+      /* FIXME: this will also remove parent from grease pencil from other scenes. */
+      /* Remove from Grease Pencil parent */
+      for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
+        LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+          if (gpl->parent != NULL) {
+            if (gpl->parent == ob) {
+              gpl->parent = NULL;
+            }
+          }
+        }
+      }
     }
   }
   CTX_DATA_END;



More information about the Bf-blender-cvs mailing list