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-10-27 16:36:59 +0300
committerHans Goudey <h.goudey@me.com>2021-10-27 16:36:59 +0300
commit827d7e7d252d488a4e267d3b84d49f4deeb654ec (patch)
tree4a6f0df8fa387bf94b4ffc6b4650659abd85f7ef /source/blender/blenloader
parentc1936be0c5572d6c2b84ac934d6f907b7335375c (diff)
Geometry Nodes: Rename some sockets
Subdivision surface: Both geometry sockets renamed to "Mesh" Points to Volume: Use "Points" and "Volume" names Distribute Points on Faces: Use "Mesh" input name These are meant to provide a hint to users which type each node is meant to use.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_300.c10
-rw-r--r--source/blender/blenloader/intern/versioning_common.cc54
-rw-r--r--source/blender/blenloader/intern/versioning_common.h8
3 files changed, 56 insertions, 16 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index d0d6c1471b7..6ab3e24cb2b 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2118,5 +2118,15 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+ if (ntree->type == NTREE_GEOMETRY) {
+ version_node_input_socket_name(
+ ntree, GEO_NODE_DISTRIBUTE_POINTS_ON_FACES, "Geometry", "Mesh");
+ version_node_input_socket_name(ntree, GEO_NODE_POINTS_TO_VOLUME, "Geometry", "Points");
+ version_node_output_socket_name(ntree, GEO_NODE_POINTS_TO_VOLUME, "Geometry", "Volume");
+ version_node_socket_name(ntree, GEO_NODE_SUBDIVISION_SURFACE, "Geometry", "Mesh");
+ }
+ }
}
}
diff --git a/source/blender/blenloader/intern/versioning_common.cc b/source/blender/blenloader/intern/versioning_common.cc
index 6c4996ba9b2..ecc944defba 100644
--- a/source/blender/blenloader/intern/versioning_common.cc
+++ b/source/blender/blenloader/intern/versioning_common.cc
@@ -87,6 +87,18 @@ ID *do_versions_rename_id(Main *bmain,
return id;
}
+static void change_node_socket_name(ListBase *sockets, const char *old_name, const char *new_name)
+{
+ LISTBASE_FOREACH (bNodeSocket *, socket, sockets) {
+ if (STREQ(socket->name, old_name)) {
+ BLI_strncpy(socket->name, new_name, sizeof(socket->name));
+ }
+ if (STREQ(socket->identifier, old_name)) {
+ BLI_strncpy(socket->identifier, new_name, sizeof(socket->name));
+ }
+ }
+}
+
void version_node_socket_name(bNodeTree *ntree,
const int node_type,
const char *old_name,
@@ -94,22 +106,32 @@ void version_node_socket_name(bNodeTree *ntree,
{
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->type == node_type) {
- LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
- if (STREQ(socket->name, old_name)) {
- BLI_strncpy(socket->name, new_name, sizeof(socket->name));
- }
- if (STREQ(socket->identifier, old_name)) {
- BLI_strncpy(socket->identifier, new_name, sizeof(socket->name));
- }
- }
- LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
- if (STREQ(socket->name, old_name)) {
- BLI_strncpy(socket->name, new_name, sizeof(socket->name));
- }
- if (STREQ(socket->identifier, old_name)) {
- BLI_strncpy(socket->identifier, new_name, sizeof(socket->name));
- }
- }
+ change_node_socket_name(&node->inputs, old_name, new_name);
+ change_node_socket_name(&node->outputs, old_name, new_name);
+ }
+ }
+}
+
+void version_node_input_socket_name(bNodeTree *ntree,
+ const int node_type,
+ const char *old_name,
+ const char *new_name)
+{
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+ if (node->type == node_type) {
+ change_node_socket_name(&node->inputs, old_name, new_name);
+ }
+ }
+}
+
+void version_node_output_socket_name(bNodeTree *ntree,
+ const int node_type,
+ const char *old_name,
+ const char *new_name)
+{
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+ if (node->type == node_type) {
+ change_node_socket_name(&node->outputs, old_name, new_name);
}
}
}
diff --git a/source/blender/blenloader/intern/versioning_common.h b/source/blender/blenloader/intern/versioning_common.h
index 1826182be21..8697e8e2639 100644
--- a/source/blender/blenloader/intern/versioning_common.h
+++ b/source/blender/blenloader/intern/versioning_common.h
@@ -43,6 +43,14 @@ void version_node_socket_name(struct bNodeTree *ntree,
const int node_type,
const char *old_name,
const char *new_name);
+void version_node_input_socket_name(struct bNodeTree *ntree,
+ const int node_type,
+ const char *old_name,
+ const char *new_name);
+void version_node_output_socket_name(struct bNodeTree *ntree,
+ const int node_type,
+ const char *old_name,
+ const char *new_name);
void version_node_id(struct bNodeTree *ntree, const int node_type, const char *new_name);