[Bf-blender-cvs] [62da41d63dd] blender-v3.0-release: Fix: Incorrect socket identifier versioning

Jacques Lucke noreply at git.blender.org
Mon Nov 15 16:08:08 CET 2021


Commit: 62da41d63dd9fb131a3c7a1f339b49e6186b3300
Author: Jacques Lucke
Date:   Mon Nov 15 08:52:58 2021 -0600
Branches: blender-v3.0-release
https://developer.blender.org/rB62da41d63dd9fb131a3c7a1f339b49e6186b3300

Fix: Incorrect socket identifier versioning

There were two issues:
 - The third math node socket does not exist in old enough files.
 - The comment incorrectly referred to the vector math node.

Differential Revision: https://developer.blender.org/D13219

===================================================================

M	source/blender/blenloader/intern/versioning_300.c

===================================================================

diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 6402bcc0b05..c0c3a8e4d4b 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2158,8 +2158,8 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
    * \note Keep this message at the bottom of the function.
    */
   {
-    /* Use consistent socket identifiers for the vector math node.
-     * Thecode to make unique identifiers from the names was inconsitent. */
+    /* Use consistent socket identifiers for the math node.
+     * The code to make unique identifiers from the names was inconsistent. */
     FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
       if (ELEM(ntree->type, NTREE_SHADER, NTREE_GEOMETRY)) {
         LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
@@ -2167,7 +2167,11 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
             bNodeSocket *value1 = ((bNodeSocket *)node->inputs.first)->next;
             bNodeSocket *value2 = value1->next;
             strcpy(value1->identifier, "Value_001");
-            strcpy(value2->identifier, "Value_002");
+            if (value2 != NULL) {
+              /* This can be null when file is quite old so that the socket did not exist
+               * (before 0406eb110332a8). */
+              strcpy(value2->identifier, "Value_002");
+            }
           }
         }
       }



More information about the Bf-blender-cvs mailing list