Cleanup: Simplify node editor link dragging storage

Now that `node_intern.hh` is a C++ header, we can use C++ types
there. This patch replaces the linked list of dragged links with a
vector. Also, the list of drag operator custom data, `nldrag`, doesn't
seem to need to be a list at all, so I just made it a unique pointer.

Differential Revision: https://developer.blender.org/D13252
This commit is contained in:
2021-11-19 15:36:32 -05:00
parent c3fed4d463
commit 51a7961e09
4 changed files with 44 additions and 71 deletions

View File

@@ -303,7 +303,10 @@ static void node_free(SpaceLink *sl)
MEM_freeN(path);
}
MEM_SAFE_FREE(snode->runtime);
if (snode->runtime) {
snode->runtime->linkdrag.reset();
MEM_freeN(snode->runtime);
}
}
/* spacetype; init callback */
@@ -534,10 +537,7 @@ static SpaceLink *node_duplicate(SpaceLink *sl)
BLI_duplicatelist(&snoden->treepath, &snode->treepath);
if (snode->runtime != nullptr) {
snoden->runtime = (SpaceNode_Runtime *)MEM_dupallocN(snode->runtime);
BLI_listbase_clear(&snoden->runtime->linkdrag);
}
snoden->runtime = nullptr;
/* NOTE: no need to set node tree user counts,
* the editor only keeps at least 1 (id_us_ensure_real),