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/intern/versioning_common.cc
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/intern/versioning_common.cc')
-rw-r--r--source/blender/blenloader/intern/versioning_common.cc54
1 files changed, 38 insertions, 16 deletions
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);
}
}
}