Geometry Nodes: Add versioning and legacy warning for random float node

This commit is contained in:
Hans Goudey 2021-09-24 14:06:41 -05:00
parent 536f9eb82e
commit 2dd3968335
2 changed files with 36 additions and 1 deletions

View File

@ -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"));
}
}
}
}
}

View File

@ -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. */