[Bf-blender-cvs] [e993667a46c] master: Fix (unreported) critical mistake in Node copying code.

Maxim Vasiliev noreply at git.blender.org
Sun Jan 5 18:27:11 CET 2020


Commit: e993667a46c2fa1c6f6f3dc609b334448ab347d8
Author: Maxim Vasiliev
Date:   Sun Jan 5 16:46:11 2020 +0100
Branches: master
https://developer.blender.org/rBe993667a46c2fa1c6f6f3dc609b334448ab347d8

Fix (unreported) critical mistake in Node copying code.

Nice reversed-logic mistake in rB693721cc7e7d.

How this could remain unnoticed for almost one year is fairly
mysterious, this should have basically broke all node tree copying,
would expect such bug to get reported within days, weeks at most...
Probably because that function is not that much used in current code.

Nice reminder also that those bloody nodetrees still need a lot of
cleanup/refactor/simplification when it comes to ID management code.

Reported/fixed as part of D6484, but this really needs its own commit.

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

M	source/blender/blenkernel/intern/node.c

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

diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index be28ca26459..13169d9ace8 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1595,7 +1595,7 @@ void BKE_node_tree_copy_data(Main *UNUSED(bmain),
 bNodeTree *ntreeCopyTree_ex(const bNodeTree *ntree, Main *bmain, const bool do_id_user)
 {
   bNodeTree *ntree_copy;
-  const int flag = do_id_user ? LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN : 0;
+  const int flag = do_id_user ? 0 : LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN;
   BKE_id_copy_ex(bmain, (ID *)ntree, (ID **)&ntree_copy, flag);
   return ntree_copy;
 }



More information about the Bf-blender-cvs mailing list