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-11-13 02:07:38 +0300
committerHans Goudey <h.goudey@me.com>2021-11-13 02:07:38 +0300
commit6b4ca781085fecc1058566a3b51bd3536eb9d4a1 (patch)
tree2fc2ef5c5c7abf09ad67d3bdb89660835c4d6eb9 /source/blender/blenloader/intern
parent8d3a7715743a40493d71dae83053b1702eb182c5 (diff)
Fix T92636: Vector math node link disconnects when loading old file
Previously, unique identifiers for sockets were created automatically, sometimes using .001 and sometimes _001. Now they are created manually with the second format, but some files were saved with .001 format. I think this was only an issue in the vector math node. rBd845ba481c6d fixed this problem in 3.1, but in a more general way. After I merge this patch to 3.1, I will revert it, since the versioning added in that commit will make this redundant. Differential Revision: https://developer.blender.org/D13209
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r--source/blender/blenloader/intern/versioning_300.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 6d44017157c..6402bcc0b05 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -783,7 +783,6 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
*/
{
/* Keep this block, even when empty. */
-
}
}
@@ -2159,6 +2158,20 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
* \note Keep this message at the bottom of the function.
*/
{
- /* Keep this block, even when empty. */
+ /* Use consistent socket identifiers for the vector math node.
+ * Thecode to make unique identifiers from the names was inconsitent. */
+ FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
+ if (ELEM(ntree->type, NTREE_SHADER, NTREE_GEOMETRY)) {
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+ if (node->type == SH_NODE_MATH) {
+ bNodeSocket *value1 = ((bNodeSocket *)node->inputs.first)->next;
+ bNodeSocket *value2 = value1->next;
+ strcpy(value1->identifier, "Value_001");
+ strcpy(value2->identifier, "Value_002");
+ }
+ }
+ }
+ }
+ FOREACH_NODETREE_END;
}
}