[Bf-blender-cvs] [e9bf624a498] blender-v2.83-release: Fix T75680: Nodegroup user count increased when file saved in edit group mode.
Bastien Montagne
noreply at git.blender.org
Thu Apr 16 17:08:52 CEST 2020
Commit: e9bf624a498a4f0074374740737d47c5df7fd87d
Author: Bastien Montagne
Date: Thu Apr 16 17:05:58 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBe9bf624a498a4f0074374740737d47c5df7fd87d
Fix T75680: Nodegroup user count increased when file saved in edit group mode.
This editor's code was a bit schizophrenic, some parts considering its
nodetree usages as real refcounted ones, others, as shallow 'user one'
ones...
Editors should not be real ID users anyway, unless there are *very* good
reasons for it, so swich it to fully 'shallow' usage now.
===================================================================
M source/blender/blenkernel/intern/lib_query.c
M source/blender/editors/space_node/space_node.c
===================================================================
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 9c0fa33157c..4ffdcf14fa7 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -492,16 +492,17 @@ static void library_foreach_screen_area(LibraryForeachIDData *data, ScrArea *are
FOREACH_CALLBACK_INVOKE_ID(data, snode->from, IDWALK_CB_NOP);
FOREACH_CALLBACK_INVOKE(
- data, snode->nodetree, is_private_nodetree ? IDWALK_CB_EMBEDDED : IDWALK_CB_USER);
+ data, snode->nodetree, is_private_nodetree ? IDWALK_CB_EMBEDDED : IDWALK_CB_USER_ONE);
for (path = snode->treepath.first; path; path = path->next) {
if (path == snode->treepath.first) {
/* first nodetree in path is same as snode->nodetree */
- FOREACH_CALLBACK_INVOKE(
- data, path->nodetree, is_private_nodetree ? IDWALK_CB_EMBEDDED : IDWALK_CB_NOP);
+ FOREACH_CALLBACK_INVOKE(data,
+ path->nodetree,
+ is_private_nodetree ? IDWALK_CB_EMBEDDED : IDWALK_CB_USER_ONE);
}
else {
- FOREACH_CALLBACK_INVOKE(data, path->nodetree, IDWALK_CB_USER);
+ FOREACH_CALLBACK_INVOKE(data, path->nodetree, IDWALK_CB_USER_ONE);
}
if (path->nodetree == NULL) {
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index d682cab7293..b6ee393b991 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -890,8 +890,7 @@ static void node_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, I
for (path = snode->treepath.first; path; path = path->next) {
if ((ID *)path->nodetree == old_id) {
path->nodetree = (bNodeTree *)new_id;
- id_us_min(old_id);
- id_us_plus(new_id);
+ id_us_ensure_real(new_id);
}
if (path == snode->treepath.first) {
/* first nodetree in path is same as snode->nodetree */
More information about the Bf-blender-cvs
mailing list