Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2013-12-09 14:54:00 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2013-12-09 14:56:46 +0400
commit964252cdda6feedab58d42fc3fe92a42cd47501d (patch)
treeeb3bd9873ffc2aeb7c272dfd3616742fcbe20ddb
parent90e7be47101fedea8ca1b35e0118cdfdda1291a1 (diff)
Fix T37741: Duplicating node editor did not copy node tree pointers.
The effect of this is not visible with standard compositor/shader nodes, because the editor node tree is immediately set from context afterward using the scene or active material. But with pynodes the context update is not necessarily defined and the node tree pointer gets lost.
-rw-r--r--source/blender/editors/space_node/space_node.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 6ae8a1f94b1..2fe63c4b895 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -555,11 +555,15 @@ static SpaceLink *node_duplicate(SpaceLink *sl)
SpaceNode *snode = (SpaceNode *)sl;
SpaceNode *snoden = MEM_dupallocN(snode);
+ BLI_duplicatelist(&snoden->treepath, &snode->treepath);
+
/* clear or remove stuff from old */
- snoden->nodetree = NULL;
snoden->linkdrag.first = snoden->linkdrag.last = NULL;
-
- BLI_duplicatelist(&snoden->treepath, &snode->treepath);
+
+ /* Note: no need to set node tree user counts,
+ * the editor only keeps at least 1 (id_us_ensure_real),
+ * which is already done by the original SpaceNode.
+ */
return (SpaceLink *)snoden;
}