Geometry Nodes: Rename Curve Parameter, Add Index on Spline

- Rename the Curve Parameter node to Spline Parameter.
  - Add "Index on Spline" to the node. This output is the index of
the current point on it's parent spline rather than the entrire curve.

Differential Revision: https://developer.blender.org/D13275
This commit is contained in:
2021-11-30 07:21:14 -06:00
parent 2f7bec04e8
commit 1cd9fcd98d
10 changed files with 109 additions and 11 deletions

View File

@@ -2404,6 +2404,19 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
* \note Keep this message at the bottom of the function.
*/
{
LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
if (ntree->type != NTREE_GEOMETRY) {
continue;
}
version_node_id(ntree, GEO_NODE_CURVE_SPLINE_PARAMETER, "GeometryNodeSplineParameter");
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->type == GEO_NODE_CURVE_SPLINE_PARAMETER) {
version_node_add_socket_if_not_exist(
ntree, node, SOCK_OUT, SOCK_INT, PROP_NONE, "Index", "Index");
}
}
}
/* Keep this block, even when empty. */
}
}

View File

@@ -165,6 +165,21 @@ void version_node_output_socket_name(bNodeTree *ntree,
}
}
bNodeSocket *version_node_add_socket_if_not_exist(bNodeTree *ntree,
bNode *node,
eNodeSocketInOut in_out,
int type,
int subtype,
const char *identifier,
const char *name)
{
bNodeSocket *sock = nodeFindSocket(node, in_out, identifier);
if (sock != nullptr) {
return sock;
}
return nodeAddStaticSocket(ntree, node, in_out, type, subtype, identifier, name);
}
/**
* Replace the ID name of all nodes in the tree with the given type with the new name.
*/

View File

@@ -64,6 +64,14 @@ void version_node_id(struct bNodeTree *ntree, const int node_type, const char *n
void version_node_socket_id_delim(bNodeSocket *socket);
struct bNodeSocket *version_node_add_socket_if_not_exist(struct bNodeTree *ntree,
struct bNode *node,
eNodeSocketInOut in_out,
int type,
int subtype,
const char *identifier,
const char *name);
#ifdef __cplusplus
}
#endif