1
1

Fix error rendering Cycles shader nodes from before 2013

After the recent changes to use socket identifiers instead of names.
This commit is contained in:
2021-08-19 20:08:44 +02:00
parent 871f7f4ad8
commit dbc4f6fdc9

View File

@@ -1020,13 +1020,21 @@ static ShaderInput *node_find_input_by_name(ShaderNode *node, BL::NodeSocket &b_
input = node->input(name.c_str());
if (!input) {
/* Different internal numbering of two sockets with same name. */
/* Different internal numbering of two sockets with same name.
* Note that the Blender convention for unique socket names changed
* from . to _ at some point, so we check both to handle old files. */
if (string_endswith(name, "_001")) {
string_replace(name, "_001", "2");
}
else if (string_endswith(name, ".001")) {
string_replace(name, ".001", "2");
}
else if (string_endswith(name, "_002")) {
string_replace(name, "_002", "3");
}
else if (string_endswith(name, ".002")) {
string_replace(name, ".002", "3");
}
else {
name += "1";
}