Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/versioning_270.c
| Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_particle_types.h" | #include "DNA_particle_types.h" | ||||
| #include "DNA_linestyle_types.h" | #include "DNA_linestyle_types.h" | ||||
| #include "DNA_actuator_types.h" | #include "DNA_actuator_types.h" | ||||
| #include "DNA_genfile.h" | #include "DNA_genfile.h" | ||||
| #include "BKE_library.h" | |||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| #include "BKE_texture.h" | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLO_readfile.h" | #include "BLO_readfile.h" | ||||
| #include "readfile.h" | #include "readfile.h" | ||||
| ▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | for (con = lb->first; con; con = con->next) { | ||||
| if (con->type == CONSTRAINT_TYPE_STRETCHTO) { | if (con->type == CONSTRAINT_TYPE_STRETCHTO) { | ||||
| bStretchToConstraint *data = (bStretchToConstraint *)con->data; | bStretchToConstraint *data = (bStretchToConstraint *)con->data; | ||||
| data->bulge_min = 1.0f; | data->bulge_min = 1.0f; | ||||
| data->bulge_max = 1.0f; | data->bulge_max = 1.0f; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) | void blo_do_versions_270(FileData *fd, Library *lib, Main *main) | ||||
| { | { | ||||
| if (!MAIN_VERSION_ATLEAST(main, 270, 0)) { | if (!MAIN_VERSION_ATLEAST(main, 270, 0)) { | ||||
| if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) { | if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) { | ||||
| Object *ob; | Object *ob; | ||||
| for (ob = main->object.first; ob; ob = ob->id.next) { | for (ob = main->object.first; ob; ob = ob->id.next) { | ||||
| ModifierData *md; | ModifierData *md; | ||||
| ▲ Show 20 Lines • Show All 316 Lines • ▼ Show 20 Lines | for (br = main->brush.first; br; br = br->id.next) { | ||||
| } | } | ||||
| br->mtex.random_angle = 2.0f * M_PI; | br->mtex.random_angle = 2.0f * M_PI; | ||||
| br->mask_mtex.random_angle = 2.0f * M_PI; | br->mask_mtex.random_angle = 2.0f * M_PI; | ||||
| } | } | ||||
| #undef BRUSH_RAKE | #undef BRUSH_RAKE | ||||
| #undef BRUSH_RANDOM_ROTATION | #undef BRUSH_RANDOM_ROTATION | ||||
| } | } | ||||
| if (!MAIN_VERSION_ATLEAST(main, 273, 3)) { | |||||
| Material *material; | |||||
| bNode *node; | |||||
| BKE_main_id_tag_idcode(main, ID_NT, false); | |||||
| /* This is a bit convoluted, but we can't rely on the scene to see if | |||||
| * materials needs do versions here. This is because it's possible to | |||||
| * have linked material from asset file into a production file. | |||||
| * | |||||
| * To deal with this we're using heuristic that materials which needs to | |||||
| * be altered has at least one ode which is only compatible with new | |||||
| * shading system. Usually that;d be material/light output nodes. | |||||
| * | |||||
| * We also need to tag node groups for update, because for them it's not | |||||
| * always correct assumptions about new shading system nodes only. | |||||
| */ | |||||
| for (material = main->mat.first; | |||||
| material != NULL; | |||||
| material = material->id.next) | |||||
| { | |||||
| if (material->nodetree != NULL) { | |||||
| bool has_only_new_shading = false; | |||||
| for (node = material->nodetree->nodes.first; | |||||
| node != NULL; | |||||
| node = node->next) | |||||
| { | |||||
| bNodeType *ntype = nodeTypeFind(node->idname); | |||||
| if (ntype->compatibility == NODE_NEW_SHADING) { | |||||
| has_only_new_shading = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if (has_only_new_shading) { | |||||
| for (node = material->nodetree->nodes.first; | |||||
| node != NULL; | |||||
| node = node->next) | |||||
| { | |||||
| if (node->type == NODE_GROUP) { | |||||
| bNodeTree *group_tree = | |||||
| blo_do_versions_newlibadr(fd, lib, node->id); | |||||
| if (group_tree != NULL) { | |||||
| group_tree->id.flag |= LIB_DOIT; | |||||
| } | |||||
| } | |||||
| } | |||||
| material->nodetree->id.flag |= LIB_DOIT; | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Perform actual do versions on all trees tagged for it. */ | |||||
| FOREACH_NODETREE(main, ntree, id) { | |||||
| if (ntree->type == NTREE_SHADER && ntree->id.flag & LIB_DOIT) { | |||||
| for (node = ntree->nodes.first; | |||||
| node != NULL; | |||||
| node = node->next) | |||||
| { | |||||
| if (node->type == SH_NODE_MAPPING) { | |||||
| TexMapping *texmap = node->storage; | |||||
| float quat[4]; | |||||
| eulO_to_quat(quat, texmap->rot, EULER_ORDER_ZYX); | |||||
| quat_to_eulO(texmap->rot, EULER_ORDER_XYZ, quat); | |||||
| init_tex_mapping(texmap); | |||||
| } | |||||
| ntree->id.flag &= ~LIB_DOIT; | |||||
| } | |||||
| } | |||||
| } FOREACH_NODETREE_END | |||||
| } | |||||
| } | } | ||||