From 263bf635098deea551dc1f285db7d5cf51abc69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Tue, 9 May 2023 15:15:40 +0200 Subject: [PATCH] Cleanup: Remove versioning for simulation zone socket identifiers This was added temporarily during development. Loading files created in the geometry-nodes-simulation branch (3.5.4 and older) will remove links from simulation zones, which need to be added back manually. Pull Request: https://projects.blender.org/blender/blender/pulls/107781 --- .../blenloader/intern/versioning_300.cc | 72 ------------------- 1 file changed, 72 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_300.cc b/source/blender/blenloader/intern/versioning_300.cc index 8f4fcb4cb35..20bb6268d0b 100644 --- a/source/blender/blenloader/intern/versioning_300.cc +++ b/source/blender/blenloader/intern/versioning_300.cc @@ -4321,78 +4321,6 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain) /* Rename Grease Pencil weight draw brush. */ do_versions_rename_id(bmain, ID_BR, "Draw Weight", "Weight Draw"); - - /* Identifier generation for simulation node sockets changed. - * Update identifiers so links are not removed during validation. - * This only affects files that have been created using simulation nodes before they were first - * officially released. */ - if (!DNA_struct_elem_find(fd->filesdna, "NodeSimulationItem", "int", "identifier")) { - static auto set_socket_identifiers = [](bNode *node, - const bNode *output_node, - int extra_outputs) { - const NodeGeometrySimulationOutput *output_data = - static_cast(output_node->storage); - /* Includes extension socket. */ - BLI_assert(BLI_listbase_count(&node->inputs) == output_data->items_num + 1); - /* Includes extension socket. */ - BLI_assert(BLI_listbase_count(&node->outputs) == - output_data->items_num + 1 + extra_outputs); - - int i; - LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->inputs, i) { - /* Skip extension socket. */ - if (i >= output_data->items_num) { - break; - } - SNPRINTF(sock->identifier, "Item_%d", output_data->items[i].identifier); - } - LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) { - const int item_i = i - extra_outputs; - /* Skip extra outputs. */ - if (i < extra_outputs) { - continue; - } - /* Skip extension socket. */ - if (item_i >= output_data->items_num) { - break; - } - SNPRINTF(sock->identifier, "Item_%d", output_data->items[i - extra_outputs].identifier); - } - }; - - LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) { - if (ntree->type == NTREE_GEOMETRY) { - /* Initialize item identifiers. */ - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_SIMULATION_OUTPUT) { - NodeGeometrySimulationOutput *data = static_cast( - node->storage); - for (int i = 0; i < data->items_num; ++i) { - data->items[i].identifier = i; - } - data->next_identifier = data->items_num; - } - } - - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_SIMULATION_INPUT) { - const NodeGeometrySimulationInput *input_data = - static_cast(node->storage); - LISTBASE_FOREACH (bNode *, output_node, &ntree->nodes) { - if (output_node->identifier == input_data->output_node_id) { - /* 'Delta Time' socket in input nodes */ - set_socket_identifiers(node, output_node, 1); - break; - } - } - } - if (node->type == GEO_NODE_SIMULATION_OUTPUT) { - set_socket_identifiers(node, node, 0); - } - } - } - } - } } /* fcm->name was never used to store modifier name so it has always been an empty string. Now