Cleanup: Move function to versioning_common.cc
This commit is contained in:
parent
73ef2fc2f4
commit
a392609ab6
|
@ -829,33 +829,6 @@ static void do_versions_strip_cache_settings_recursive(const ListBase *seqbase)
|
|||
}
|
||||
}
|
||||
|
||||
static void version_node_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) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
|
||||
if (STREQ(socket->name, old_name)) {
|
||||
strcpy(socket->name, new_name);
|
||||
}
|
||||
if (STREQ(socket->identifier, old_name)) {
|
||||
strcpy(socket->identifier, new_name);
|
||||
}
|
||||
}
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
|
||||
if (STREQ(socket->name, old_name)) {
|
||||
strcpy(socket->name, new_name);
|
||||
}
|
||||
if (STREQ(socket->identifier, old_name)) {
|
||||
strcpy(socket->identifier, new_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void version_node_join_geometry_for_multi_input_socket(bNodeTree *ntree)
|
||||
{
|
||||
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
|
||||
|
|
|
@ -526,33 +526,6 @@ static void version_switch_node_input_prefix(Main *bmain)
|
|||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
static void version_node_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) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
|
||||
if (STREQ(socket->name, old_name)) {
|
||||
strcpy(socket->name, new_name);
|
||||
}
|
||||
if (STREQ(socket->identifier, old_name)) {
|
||||
strcpy(socket->identifier, new_name);
|
||||
}
|
||||
}
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
|
||||
if (STREQ(socket->name, old_name)) {
|
||||
strcpy(socket->name, new_name);
|
||||
}
|
||||
if (STREQ(socket->identifier, old_name)) {
|
||||
strcpy(socket->identifier, new_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool replace_bbone_len_scale_rnapath(char **p_old_path, int *p_index)
|
||||
{
|
||||
char *old_path = *p_old_path;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <cstring>
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
@ -85,3 +86,30 @@ ID *do_versions_rename_id(Main *bmain,
|
|||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
void version_node_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) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
struct ARegion;
|
||||
struct ListBase;
|
||||
struct Main;
|
||||
struct bNodeTree;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -38,6 +39,11 @@ ID *do_versions_rename_id(Main *bmain,
|
|||
const char *name_src,
|
||||
const char *name_dst);
|
||||
|
||||
void version_node_socket_name(struct bNodeTree *ntree,
|
||||
const int node_type,
|
||||
const char *old_name,
|
||||
const char *new_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue