diff options
author | Miguel Porces <cmporces> | 2019-03-16 20:54:00 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-03-16 22:21:16 +0300 |
commit | 5797a5fc65c87b69460d910a82d219b5e3ea12ad (patch) | |
tree | 98ffac5a6ad2904d916987720460765b763d2e50 /source/blender/makesrna/intern/rna_nodetree.c | |
parent | b9af4efe41712680d554a389d771e83c66fce5c4 (diff) |
Fix ID user counting issues with NodeCustomGroup.
User counting now happens before init() and after free() methods, so that
the ID users are in a valid state when Python might modify them. ID user
counting was moved into node.c and simplified.
Patch by Miguel with further refactoring by Brecht. Ref D4370.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 01da2be2dec..74f47f76dc3 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -741,8 +741,8 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree, Main *bmain, ReportList * return; } - id_us_min(node->id); - nodeDeleteNode(bmain, ntree, node); + nodeRemoveNode(bmain, ntree, node, true); + RNA_POINTER_INVALIDATE(node_ptr); ntreeUpdateTree(bmain, ntree); /* update group node socket links */ @@ -759,10 +759,7 @@ static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *r while (node) { bNode *next_node = node->next; - if (node->id) - id_us_min(node->id); - - nodeDeleteNode(bmain, ntree, node); + nodeRemoveNode(bmain, ntree, node, true); node = next_node; } |