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.
This commit is contained in:
Lukas Tönne 2013-12-09 11:54:00 +01:00
parent 90e7be4710
commit 964252cdda
Notes: blender-bot 2023-02-14 11:31:00 +01:00
Referenced by issue #37755, Autokey doesn't work for local Z-Axis in Camera view with MotionPaths enabled
Referenced by issue #37741, When splitting a Node Editor area containing Python nodes, the new area shows nodes but does not have an active nodetree
1 changed files with 8 additions and 4 deletions

View File

@ -555,12 +555,16 @@ static SpaceLink *node_duplicate(SpaceLink *sl)
SpaceNode *snode = (SpaceNode *)sl;
SpaceNode *snoden = MEM_dupallocN(snode);
/* clear or remove stuff from old */
snoden->nodetree = NULL;
snoden->linkdrag.first = snoden->linkdrag.last = NULL;
BLI_duplicatelist(&snoden->treepath, &snode->treepath);
/* clear or remove stuff from old */
snoden->linkdrag.first = snoden->linkdrag.last = NULL;
/* 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;
}