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:
authorJohnny Matthews <johnny.matthews@gmail.com>2021-11-30 16:21:14 +0300
committerJohnny Matthews <johnny.matthews@gmail.com>2021-11-30 16:21:14 +0300
commit1cd9fcd98d5f1f11d2c20a35ae19142e5458068c (patch)
tree7600f6bc0084c126ca2359aaef3f1e6a1acc9677 /source/blender/blenloader
parent2f7bec04e8e7e423f11767535b469cdeb5062b14 (diff)
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
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_300.c13
-rw-r--r--source/blender/blenloader/intern/versioning_common.cc15
-rw-r--r--source/blender/blenloader/intern/versioning_common.h8
3 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 068541a5825..295084cd62f 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -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. */
}
}
diff --git a/source/blender/blenloader/intern/versioning_common.cc b/source/blender/blenloader/intern/versioning_common.cc
index ef275c56891..8ad948915ac 100644
--- a/source/blender/blenloader/intern/versioning_common.cc
+++ b/source/blender/blenloader/intern/versioning_common.cc
@@ -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.
*/
diff --git a/source/blender/blenloader/intern/versioning_common.h b/source/blender/blenloader/intern/versioning_common.h
index 7f179800ddd..3788d8f5595 100644
--- a/source/blender/blenloader/intern/versioning_common.h
+++ b/source/blender/blenloader/intern/versioning_common.h
@@ -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