[Bf-blender-cvs] [c5cabb6eb71] master: Correction to previous commit: Avoid unnecessary notifier

Julian Eisel noreply at git.blender.org
Tue Apr 20 22:45:13 CEST 2021


Commit: c5cabb6eb712ffc1f541b8b1adc8b17ea76b069f
Author: Julian Eisel
Date:   Tue Apr 20 22:43:43 2021 +0200
Branches: master
https://developer.blender.org/rBc5cabb6eb712ffc1f541b8b1adc8b17ea76b069f

Correction to previous commit: Avoid unnecessary notifier

Not a big deal, but nice to avoid notifiers when no change was done.

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

M	source/blender/makesrna/intern/rna_ID.c

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

diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index e1480dc2822..3c641c6ec1a 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -579,18 +579,18 @@ static ID *rna_ID_copy(ID *id, Main *bmain)
 
 static void rna_ID_mark_asset(ID *id, bContext *C)
 {
-  ED_asset_mark_id(C, id);
-
-  WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
-  WM_main_add_notifier(NC_ASSET | NA_ADDED, NULL);
+  if (ED_asset_mark_id(C, id)) {
+    WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
+    WM_main_add_notifier(NC_ASSET | NA_ADDED, NULL);
+  }
 }
 
 static void rna_ID_clear_asset(ID *id)
 {
-  ED_asset_clear_id(id);
-
-  WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
-  WM_main_add_notifier(NC_ASSET | NA_REMOVED, NULL);
+  if (ED_asset_clear_id(id)) {
+    WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
+    WM_main_add_notifier(NC_ASSET | NA_REMOVED, NULL);
+  }
 }
 
 static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)



More information about the Bf-blender-cvs mailing list