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>2021-09-24 22:06:41 +0300
committerHans Goudey <h.goudey@me.com>2021-09-24 22:06:41 +0300
commit2dd39683358100a39d7e7774e1051136ec1df7d9 (patch)
treecf7877594df612deb65a3f5307e416203640146c
parent536f9eb82e07778565b789f7408f3ce81aa6d675 (diff)
Geometry Nodes: Add versioning and legacy warning for random float node
-rw-r--r--source/blender/blenloader/intern/versioning_300.c27
-rw-r--r--source/blender/modifiers/intern/MOD_nodes_evaluator.cc10
2 files changed, 36 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 88df4f73d45..caba972c744 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -808,6 +808,7 @@ static void version_geometry_nodes_change_legacy_names(bNodeTree *ntree)
}
}
}
+
static bool seq_transform_origin_set(Sequence *seq, void *UNUSED(user_data))
{
StripTransform *transform = seq->strip->transform;
@@ -1480,5 +1481,29 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /* Deprecate the random float node in favor of the random float 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"));
+ }
+ }
}
-}
+} \ No newline at end of file
diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
index 9f296f4cfe9..fd0205cffc5 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
@@ -887,6 +887,16 @@ class GeometryNodesEvaluator {
const MultiFunction &fn,
NodeState &node_state)
{
+ if (USER_EXPERIMENTAL_TEST(&U, use_geometry_nodes_fields)) {
+ if (node->idname().find("Legacy") != StringRef::not_found) {
+ /* Create geometry nodes params just for creating an error message. */
+ NodeParamsProvider params_provider{*this, node, node_state};
+ GeoNodeExecParams params{params_provider};
+ params.error_message_add(geo_log::NodeWarningType::Legacy,
+ TIP_("Legacy node will be removed before Blender 4.0"));
+ }
+ }
+
LinearAllocator<> &allocator = local_allocators_.local();
/* Prepare the inputs for the multi function. */