From 943b919fe807b53558631bcbc688c2d712d6b0cc Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 16 Mar 2022 08:51:11 -0500 Subject: Geometry Nodes: Remove legacy node code This commit removes the implementations of legacy nodes, their type definitions, and related code that becomes unused. Now that we have two releases that included the legacy nodes, there is not much reason to include them still. Removing the code means refactoring will be easier, and old code doesn't have to be tested and maintained. After this commit, the legacy nodes will be undefined in the UI, so 3.0 or 3.1 should be used to convert files to the fields system. The net change is 12184 lines removed! The tooltip for legacy nodes mentioned that we would remove them before 4.0, which was purposefully a bit vague to allow us this flexibility. In a poll in a devtalk post showed that the majority of people were okay with removing the nodes. https://devtalk.blender.org/t/geometry-nodes-backward-compatibility-poll/20199 Differential Revision: https://developer.blender.org/D14353 --- source/blender/blenloader/intern/versioning_290.c | 103 ---------------------- 1 file changed, 103 deletions(-) (limited to 'source/blender/blenloader/intern/versioning_290.c') diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 3ae26dea767..079d69be4d9 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1510,27 +1510,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } if (!MAIN_VERSION_ATLEAST(bmain, 292, 9)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_ATTRIBUTE_MATH && node->storage == NULL) { - const int old_use_attibute_a = (1 << 0); - const int old_use_attibute_b = (1 << 1); - NodeAttributeMath *data = MEM_callocN(sizeof(NodeAttributeMath), "NodeAttributeMath"); - data->operation = NODE_MATH_ADD; - data->input_type_a = (node->custom2 & old_use_attibute_a) ? - GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE : - GEO_NODE_ATTRIBUTE_INPUT_FLOAT; - data->input_type_b = (node->custom2 & old_use_attibute_b) ? - GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE : - GEO_NODE_ATTRIBUTE_INPUT_FLOAT; - node->storage = data; - } - } - } - } - FOREACH_NODETREE_END; - /* Default properties editors to auto outliner sync. */ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { @@ -1668,39 +1647,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 3)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type != NTREE_GEOMETRY) { - continue; - } - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_POINT_INSTANCE && node->storage == NULL) { - NodeGeometryPointInstance *data = (NodeGeometryPointInstance *)MEM_callocN( - sizeof(NodeGeometryPointInstance), __func__); - data->instance_type = node->custom1; - data->flag = (node->custom2 ? 0 : GEO_NODE_POINT_INSTANCE_WHOLE_COLLECTION); - node->storage = data; - } - } - } - FOREACH_NODETREE_END; - } - - if (!MAIN_VERSION_ATLEAST(bmain, 293, 4)) { - /* Add support for all operations to the "Attribute Math" node. */ - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_ATTRIBUTE_MATH) { - NodeAttributeMath *data = (NodeAttributeMath *)node->storage; - data->input_type_c = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE; - } - } - } - } - FOREACH_NODETREE_END; - } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 5)) { /* Change Nishita sky model Altitude unit. */ FOREACH_NODETREE_BEGIN (bmain, ntree, id) { @@ -1744,24 +1690,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_NODETREE_END; } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 8)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type != NTREE_GEOMETRY) { - continue; - } - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_ATTRIBUTE_RANDOMIZE && node->storage == NULL) { - NodeAttributeRandomize *data = (NodeAttributeRandomize *)MEM_callocN( - sizeof(NodeAttributeRandomize), __func__); - data->data_type = node->custom1; - data->operation = GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE; - node->storage = data; - } - } - } - FOREACH_NODETREE_END; - } - if (!MAIN_VERSION_ATLEAST(bmain, 293, 9)) { if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "bokeh_overblur")) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { @@ -1784,23 +1712,9 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - version_node_socket_name(ntree, GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY, "Result", "Distance"); - } - } - FOREACH_NODETREE_END; } if (!MAIN_VERSION_ATLEAST(bmain, 293, 10)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - version_node_socket_name( - ntree, GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY, "Location", "Position"); - } - } - FOREACH_NODETREE_END; - LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { /* Fix old scene with too many samples that were not being used. * Now they are properly used and might produce a huge slowdown. @@ -1886,16 +1800,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) light->volume_fac = 1.0f; } } - - LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) { - if (ntree->type == NTREE_GEOMETRY) { - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->type == GEO_NODE_LEGACY_ATTRIBUTE_FILL) { - node->custom2 = ATTR_DOMAIN_AUTO; - } - } - } - } } if (!MAIN_VERSION_ATLEAST(bmain, 293, 15)) { @@ -1940,13 +1844,6 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } if (!MAIN_VERSION_ATLEAST(bmain, 293, 18)) { - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - version_node_socket_name(ntree, GEO_NODE_LEGACY_VOLUME_TO_MESH, "Grid", "Density"); - } - } - FOREACH_NODETREE_END; - if (!DNA_struct_elem_find(fd->filesdna, "bArmature", "float", "axes_position")) { /* Convert the axes draw position to its old default (tip of bone). */ LISTBASE_FOREACH (struct bArmature *, arm, &bmain->armatures) { -- cgit v1.2.3