Nodes: Panel declarations for grouping sockets #108649

Merged
Lukas Tönne merged 27 commits from LukasTonne/blender:node-socket-categories into main 2023-06-14 18:02:46 +02:00
1 changed files with 16 additions and 0 deletions
Showing only changes of commit 57f33fe531 - Show all commits

View File

@ -202,6 +202,15 @@ static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, cons
BLI_addtail(&ntree_dst->outputs, dst_socket);
}
/* copy panels */
ntree_dst->socket_panels_array = static_cast<bNodeSocketPanel **>(
MEM_dupallocN(ntree_src->socket_panels_array));
ntree_dst->socket_panels_num = ntree_src->socket_panels_num;
for (bNodeSocketPanel *&panel_ptr : ntree_dst->socket_panels_for_write()) {
panel_ptr = static_cast<bNodeSocketPanel *>(MEM_dupallocN(panel_ptr));
panel_ptr->name = BLI_strdup(panel_ptr->name);
}
/* copy preview hash */
if (ntree_src->previews && (flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
bNodeInstanceHashIterator iter;
@ -276,6 +285,13 @@ static void ntree_free_data(ID *id)
MEM_freeN(sock);
}
/* free panels */
for (bNodeSocketPanel *panel : ntree->socket_panels_for_write()) {
MEM_SAFE_FREE(panel->name);
MEM_SAFE_FREE(panel);
}
MEM_SAFE_FREE(ntree->socket_panels_array);
/* free preview hash */
if (ntree->previews) {
BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)node_preview_free);