diff options
author | Hans Goudey <h.goudey@me.com> | 2021-12-24 19:05:47 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-12-24 19:05:47 +0300 |
commit | d48fc7d156818e9e4377825417dfa1f71fc3414d (patch) | |
tree | 94d6b4eec50c17141f4da1e8e69485a0b2f318f5 /source/blender/editors/space_node | |
parent | dd01ce2cd079e4a772bbb192022cd5a972c7503e (diff) |
Cleanup: Use vector instead of linked list
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/node_group.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/editors/space_node/node_group.cc b/source/blender/editors/space_node/node_group.cc index 0846eb826f1..f6802e64049 100644 --- a/source/blender/editors/space_node/node_group.cc +++ b/source/blender/editors/space_node/node_group.cc @@ -32,6 +32,7 @@ #include "BLI_linklist.h" #include "BLI_listbase.h" #include "BLI_string.h" +#include "BLI_vector.hh" #include "BLT_translation.h" @@ -63,6 +64,7 @@ using blender::float2; using blender::Map; +using blender::Vector; /* -------------------------------------------------------------------- */ /** \name Local Utilities @@ -218,11 +220,13 @@ static void animation_basepath_change_free(AnimationBasePathChange *basepath_cha MEM_freeN(basepath_change); } -/* returns 1 if its OK */ -static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) +/** + * \return True if successful. + */ +static bool node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) { ListBase anim_basepaths = {nullptr, nullptr}; - LinkNode *nodes_delayed_free = nullptr; + Vector<bNode *> nodes_delayed_free; const bNodeTree *ngroup = reinterpret_cast<const bNodeTree *>(gnode->id); /* wgroup is a temporary copy of the NodeTree we're merging in @@ -239,7 +243,7 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) */ if (ELEM(node->type, NODE_GROUP_INPUT, NODE_GROUP_OUTPUT)) { /* We must delay removal since sockets will reference this node. see: T52092 */ - BLI_linklist_prepend(&nodes_delayed_free, node); + nodes_delayed_free.append(node); } /* keep track of this node's RNA "base" path (the part of the path identifying the node) @@ -384,15 +388,14 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) } } - while (nodes_delayed_free) { - bNode *node = (bNode *)BLI_linklist_pop(&nodes_delayed_free); + for (bNode *node : nodes_delayed_free) { nodeRemoveNode(bmain, ntree, node, false); } /* delete the group instance and dereference group tree */ nodeRemoveNode(bmain, ntree, gnode, true); - return 1; + return true; } static int node_group_ungroup_exec(bContext *C, wmOperator *op) |