From 964252cdda6feedab58d42fc3fe92a42cd47501d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Mon, 9 Dec 2013 11:54:00 +0100 Subject: 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. --- source/blender/editors/space_node/space_node.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/space_node/space_node.c') 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; } -- cgit v1.2.3