diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-08-19 21:08:44 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-08-19 21:12:50 +0300 |
commit | dbc4f6fdc900493a9d03c88afe48beae6289fb30 (patch) | |
tree | c5dd3fc03efa67f3cf3595b2b27641a8f92a8b23 /intern/cycles/blender/blender_shader.cpp | |
parent | 871f7f4ad8326a944bc96251179c8885986d7ef7 (diff) |
Fix error rendering Cycles shader nodes from before 2013
After the recent changes to use socket identifiers instead of names.
Diffstat (limited to 'intern/cycles/blender/blender_shader.cpp')
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 24819bacbb5..de7b2761d00 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -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"; } |