Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-03-16 16:51:11 +0300
committerHans Goudey <h.goudey@me.com>2022-03-16 16:51:11 +0300
commit943b919fe807b53558631bcbc688c2d712d6b0cc (patch)
treec1c141866f50eb1f28e1875195395c8582898cc2 /source/blender/blenloader
parentcb267cec5552c17092a99999e4e352bf266b578f (diff)
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
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_290.c103
-rw-r--r--source/blender/blenloader/intern/versioning_300.c218
2 files changed, 0 insertions, 321 deletions
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) {
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index eead735b305..5b1964aa35c 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -527,7 +527,6 @@ static void version_geometry_nodes_add_realize_instance_nodes(bNodeTree *ntree)
GEO_NODE_TRIM_CURVE,
GEO_NODE_REPLACE_MATERIAL,
GEO_NODE_SUBDIVIDE_MESH,
- GEO_NODE_LEGACY_ATTRIBUTE_REMOVE,
GEO_NODE_TRIANGULATE)) {
bNodeSocket *geometry_socket = node->inputs.first;
add_realize_instances_before_socket(ntree, node, geometry_socket);
@@ -600,30 +599,6 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 3)) {
- /* Use new texture socket in Attribute Sample Texture node. */
- LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
- if (ntree->type != NTREE_GEOMETRY) {
- continue;
- }
- LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
- if (node->type != GEO_NODE_LEGACY_ATTRIBUTE_SAMPLE_TEXTURE) {
- continue;
- }
- if (node->id == NULL) {
- continue;
- }
- LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
- if (socket->type == SOCK_TEXTURE) {
- bNodeSocketValueTexture *socket_value = (bNodeSocketValueTexture *)
- socket->default_value;
- socket_value->value = (Tex *)node->id;
- break;
- }
- }
- node->id = NULL;
- }
- }
-
sort_linked_ids(bmain);
assert_sorted_ids(bmain);
}
@@ -951,141 +926,6 @@ static bNodeSocket *do_version_replace_float_size_with_vector(bNodeTree *ntree,
return new_socket;
}
-static bool geometry_node_is_293_legacy(const short node_type)
-{
- switch (node_type) {
- /* Not legacy: No attribute inputs or outputs. */
- case GEO_NODE_TRIANGULATE:
- case GEO_NODE_TRANSFORM:
- case GEO_NODE_MESH_BOOLEAN:
- case GEO_NODE_IS_VIEWPORT:
- case GEO_NODE_SUBDIVIDE_MESH:
- case GEO_NODE_MESH_PRIMITIVE_CUBE:
- case GEO_NODE_MESH_PRIMITIVE_CIRCLE:
- case GEO_NODE_MESH_PRIMITIVE_UV_SPHERE:
- case GEO_NODE_MESH_PRIMITIVE_CYLINDER:
- case GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE:
- case GEO_NODE_MESH_PRIMITIVE_CONE:
- case GEO_NODE_MESH_PRIMITIVE_LINE:
- case GEO_NODE_MESH_PRIMITIVE_GRID:
- case GEO_NODE_BOUNDING_BOX:
- case GEO_NODE_RESAMPLE_CURVE:
- case GEO_NODE_INPUT_MATERIAL:
- case GEO_NODE_REPLACE_MATERIAL:
- case GEO_NODE_CURVE_LENGTH:
- case GEO_NODE_CONVEX_HULL:
- case GEO_NODE_SEPARATE_COMPONENTS:
- case GEO_NODE_CURVE_PRIMITIVE_STAR:
- case GEO_NODE_CURVE_PRIMITIVE_SPIRAL:
- case GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER:
- case GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT:
- case GEO_NODE_CURVE_PRIMITIVE_CIRCLE:
- case GEO_NODE_VIEWER:
- case GEO_NODE_CURVE_PRIMITIVE_LINE:
- case GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL:
- case GEO_NODE_FILL_CURVE:
- case GEO_NODE_TRIM_CURVE:
- case GEO_NODE_CURVE_TO_MESH:
- return false;
-
- /* Not legacy: Newly added with fields patch. */
- case GEO_NODE_INPUT_POSITION:
- case GEO_NODE_SET_POSITION:
- case GEO_NODE_INPUT_INDEX:
- case GEO_NODE_INPUT_NORMAL:
- case GEO_NODE_CAPTURE_ATTRIBUTE:
- return false;
-
- /* Maybe legacy: Might need special attribute handling, depending on design. */
- case GEO_NODE_SWITCH:
- case GEO_NODE_JOIN_GEOMETRY:
- case GEO_NODE_LEGACY_ATTRIBUTE_REMOVE:
- case GEO_NODE_OBJECT_INFO:
- case GEO_NODE_COLLECTION_INFO:
- return false;
-
- /* Maybe legacy: Special case for grid names? Or finish patch from level set branch to
- * generate a mesh for all grids in the volume. */
- case GEO_NODE_LEGACY_VOLUME_TO_MESH:
- return false;
-
- /* Legacy: Transferred *all* attributes before, will not transfer all built-ins now. */
- case GEO_NODE_LEGACY_CURVE_ENDPOINTS:
- case GEO_NODE_LEGACY_CURVE_TO_POINTS:
- return true;
-
- /* Legacy: Attribute operation completely replaced by field nodes. */
- case GEO_NODE_LEGACY_ATTRIBUTE_RANDOMIZE:
- case GEO_NODE_LEGACY_ATTRIBUTE_MATH:
- case GEO_NODE_LEGACY_ATTRIBUTE_FILL:
- case GEO_NODE_LEGACY_ATTRIBUTE_MIX:
- case GEO_NODE_LEGACY_ATTRIBUTE_COLOR_RAMP:
- case GEO_NODE_LEGACY_ATTRIBUTE_COMPARE:
- case GEO_NODE_LEGACY_POINT_ROTATE:
- case GEO_NODE_LEGACY_ALIGN_ROTATION_TO_VECTOR:
- case GEO_NODE_LEGACY_POINT_SCALE:
- case GEO_NODE_LEGACY_ATTRIBUTE_SAMPLE_TEXTURE:
- case GEO_NODE_LEGACY_ATTRIBUTE_VECTOR_ROTATE:
- case GEO_NODE_LEGACY_ATTRIBUTE_CURVE_MAP:
- case GEO_NODE_LEGACY_ATTRIBUTE_MAP_RANGE:
- case GEO_NODE_LEGACY_ATTRIBUTE_CLAMP:
- case GEO_NODE_LEGACY_ATTRIBUTE_VECTOR_MATH:
- case GEO_NODE_LEGACY_ATTRIBUTE_COMBINE_XYZ:
- case GEO_NODE_LEGACY_ATTRIBUTE_SEPARATE_XYZ:
- return true;
-
- /* Legacy: Replaced by field node depending on another geometry. */
- case GEO_NODE_LEGACY_RAYCAST:
- case GEO_NODE_LEGACY_ATTRIBUTE_TRANSFER:
- case GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY:
- return true;
-
- /* Legacy: Simple selection attribute input. */
- case GEO_NODE_LEGACY_MESH_TO_CURVE:
- case GEO_NODE_LEGACY_POINT_SEPARATE:
- case GEO_NODE_LEGACY_CURVE_SELECT_HANDLES:
- case GEO_NODE_LEGACY_CURVE_SPLINE_TYPE:
- case GEO_NODE_LEGACY_CURVE_REVERSE:
- case GEO_NODE_LEGACY_MATERIAL_ASSIGN:
- case GEO_NODE_LEGACY_CURVE_SET_HANDLES:
- return true;
-
- /* Legacy: More complex attribute inputs or outputs. */
- case GEO_NODE_LEGACY_SUBDIVISION_SURFACE: /* Used "crease" attribute. */
- case GEO_NODE_LEGACY_EDGE_SPLIT: /* Needs selection input version. */
- case GEO_NODE_LEGACY_DELETE_GEOMETRY: /* Needs field input, domain drop-down. */
- case GEO_NODE_LEGACY_CURVE_SUBDIVIDE: /* Needs field count input. */
- case GEO_NODE_LEGACY_POINTS_TO_VOLUME: /* Needs field radius input. */
- case GEO_NODE_LEGACY_SELECT_BY_MATERIAL: /* Output anonymous attribute. */
- case GEO_NODE_LEGACY_POINT_TRANSLATE: /* Needs field inputs. */
- case GEO_NODE_LEGACY_POINT_INSTANCE: /* Needs field inputs. */
- case GEO_NODE_LEGACY_POINT_DISTRIBUTE: /* Needs field input, remove max for random mode. */
- case GEO_NODE_LEGACY_ATTRIBUTE_CONVERT: /* Attribute Capture, Store Attribute. */
- return true;
- }
- return false;
-}
-
-static void version_geometry_nodes_change_legacy_names(bNodeTree *ntree)
-{
- LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
- if (geometry_node_is_293_legacy(node->type)) {
- if (strstr(node->idname, "Legacy")) {
- /* Make sure we haven't changed this idname already, better safe than sorry. */
- continue;
- }
-
- char temp_idname[sizeof(node->idname)];
- BLI_strncpy(temp_idname, node->idname, sizeof(node->idname));
-
- BLI_snprintf(node->idname,
- sizeof(node->idname),
- "GeometryNodeLegacy%s",
- temp_idname + strlen("GeometryNode"));
- }
- }
-}
-
static bool seq_transform_origin_set(Sequence *seq, void *UNUSED(user_data))
{
StripTransform *transform = seq->strip->transform;
@@ -1873,24 +1713,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 19)) {
- /* Add node storage for subdivision surface node. */
- FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
- if (ntree->type == NTREE_GEOMETRY) {
- LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
- if (node->type == GEO_NODE_LEGACY_SUBDIVISION_SURFACE) {
- if (node->storage == NULL) {
- NodeGeometrySubdivisionSurface *data = MEM_callocN(
- sizeof(NodeGeometrySubdivisionSurface), __func__);
- data->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES;
- data->boundary_smooth = SUBSURF_BOUNDARY_SMOOTH_ALL;
- node->storage = data;
- }
- }
- }
- }
- }
- FOREACH_NODETREE_END;
-
/* Disable Fade Inactive Overlay by default as it is redundant after introducing flash on
* mode transfer. */
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
@@ -2091,30 +1913,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
-
- /* Deprecate the random float node in favor of the random value node. */
- LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
- if (ntree->type != NTREE_GEOMETRY) {
- continue;
- }
- LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
- if (node->type != FN_NODE_LEGACY_RANDOM_FLOAT) {
- continue;
- }
- if (strstr(node->idname, "Legacy")) {
- /* Make sure we haven't changed this idname already. */
- continue;
- }
-
- char temp_idname[sizeof(node->idname)];
- BLI_strncpy(temp_idname, node->idname, sizeof(node->idname));
-
- BLI_snprintf(node->idname,
- sizeof(node->idname),
- "FunctionNodeLegacy%s",
- temp_idname + strlen("FunctionNode"));
- }
- }
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 29)) {
@@ -2141,12 +1939,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
-
- LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
- if (ntree->type == NTREE_GEOMETRY) {
- version_geometry_nodes_change_legacy_names(ntree);
- }
- }
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 31)) {
@@ -2304,7 +2096,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
version_node_id(ntree, FN_NODE_SLICE_STRING, "FunctionNodeSliceString");
version_geometry_nodes_set_position_node_offset(ntree);
- version_node_id(ntree, GEO_NODE_LEGACY_VOLUME_TO_MESH, "GeometryNodeLegacyVolumeToMesh");
}
/* Add storage to viewer node. */
@@ -2637,14 +2428,5 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
*/
{
/* Keep this block, even when empty. */
-
- /* Deprecate the attribute remove node. It was hidden and is replaced by a version without a
- * multi-input socket. */
- LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
- if (ntree->type == NTREE_GEOMETRY) {
- version_node_id(
- ntree, GEO_NODE_LEGACY_ATTRIBUTE_REMOVE, "GeometryNodeLegacyAttributeRemove");
- }
- }
}
}