diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-01-09 20:15:06 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-01-09 20:15:06 +0400 |
commit | e5113c51a75731d2b051ce2aeafadc55c947d414 (patch) | |
tree | 7a41c83fc234fcd06750fb8f61bb0ad2749c099c /source | |
parent | b29f7038814341639d91b815db3871801e9649ca (diff) |
Small fix for r53685: Allow setting NULL/None as parent, i.e. detach a node from a frame.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 276eba2033e..eecdf13813c 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -293,18 +293,22 @@ static void rna_Node_parent_set(PointerRNA *ptr, PointerRNA value) bNode *node = ptr->data; bNode *parent = value.data; - /* XXX only Frame node allowed for now, - * in the future should have a poll function or so to test possible attachment. - */ - if (parent->type != NODE_FRAME) - return; - - /* make sure parent is not attached to the node */ - if (nodeAttachNodeCheck(parent, node)) - return; + if (parent) { + /* XXX only Frame node allowed for now, + * in the future should have a poll function or so to test possible attachment. + */ + if (parent->type != NODE_FRAME) + return; + + /* make sure parent is not attached to the node */ + if (nodeAttachNodeCheck(parent, node)) + return; + } nodeDetachNode(node); - nodeAttachNode(node, parent); + if (parent) { + nodeAttachNode(node, parent); + } } static int rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value) |