Fix T50736: Zero streaks in Glare node.
[blender.git] / source / blender / blenloader / intern / versioning_270.c
index 6235ebf28ee4e56ec4ba83c0412d08a807f1b46a..7106cf607212a10f9e8dbf45a6c1daa43b9258a5 100644 (file)
@@ -1575,6 +1575,29 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                        }
                }
 
+               /* Fix for T50736, Glare comp node using same var for two different things. */
+               if (!DNA_struct_elem_find(fd->filesdna, "NodeGlare", "char", "star_45")) {
+                       FOREACH_NODETREE(main, ntree, id) {
+                               if (ntree->type == NTREE_COMPOSIT) {
+                                       ntreeSetTypes(NULL, ntree);
+                                       for (bNode *node = ntree->nodes.first; node; node = node->next) {
+                                               if (node->type == CMP_NODE_GLARE) {
+                                                       NodeGlare *ndg = node->storage;
+                                                       switch (ndg->type) {
+                                                               case 2:  /* Grrrr! magic numbers :( */
+                                                                       ndg->streaks = ndg->angle;
+                                                                       break;
+                                                               case 0:
+                                                                       ndg->star_45 = ndg->angle != 0;
+                                                                       break;
+                                                               default:
+                                                                       break;
+                                                       }
+                                               }
+                                       }
+                               }
+                       } FOREACH_NODETREE_END
+               }
        }
 }