Cleanup: style, use braces for blenloader

This commit is contained in:
2019-04-22 09:13:00 +10:00
parent 6b3bf9e2a8
commit 6cc09d006a
10 changed files with 1292 additions and 648 deletions

View File

@@ -99,8 +99,9 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
fprintf(fp, "[\n"); fprintf(fp, "[\n");
for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ENDB) if (bhead->code == ENDB) {
break; break;
}
else { else {
const short *sp = fd->filesdna->structs[bhead->SDNAnr]; const short *sp = fd->filesdna->structs[bhead->SDNAnr];
const char *name = fd->filesdna->types[sp[0]]; const char *name = fd->filesdna->types[sp[0]];
@@ -150,9 +151,10 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
BLI_linklist_prepend(&names, strdup(idname + 2)); BLI_linklist_prepend(&names, strdup(idname + 2));
tot++; tot++;
} }
else if (bhead->code == ENDB) else if (bhead->code == ENDB) {
break; break;
} }
}
*tot_names = tot; *tot_names = tot;
return names; return names;

File diff suppressed because it is too large Load Diff

View File

@@ -81,11 +81,13 @@ void BLO_memfile_merge(MemFile *first, MemFile *second)
fc->is_identical = true; fc->is_identical = true;
} }
} }
if (fc) if (fc) {
fc = fc->next; fc = fc->next;
if (sc) }
if (sc) {
sc = sc->next; sc = sc->next;
} }
}
BLO_memfile_free(first); BLO_memfile_free(first);
} }

View File

@@ -92,10 +92,12 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
BLI_addtail(lb, ar); BLI_addtail(lb, ar);
ar->regiontype = RGN_TYPE_HEADER; ar->regiontype = RGN_TYPE_HEADER;
if (sa->headertype == 1) if (sa->headertype == 1) {
ar->alignment = RGN_ALIGN_BOTTOM; ar->alignment = RGN_ALIGN_BOTTOM;
else }
else {
ar->alignment = RGN_ALIGN_TOP; ar->alignment = RGN_ALIGN_TOP;
}
/* initialize view2d data for header region, to allow panning */ /* initialize view2d data for header region, to allow panning */
/* is copy from ui_view2d.c */ /* is copy from ui_view2d.c */
@@ -203,9 +205,10 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
case SPACE_SEQ: case SPACE_SEQ:
ar_main = (ARegion *)lb->first; ar_main = (ARegion *)lb->first;
for (; ar_main; ar_main = ar_main->next) { for (; ar_main; ar_main = ar_main->next) {
if (ar_main->regiontype == RGN_TYPE_WINDOW) if (ar_main->regiontype == RGN_TYPE_WINDOW) {
break; break;
} }
}
ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer"); ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_insertlinkbefore(lb, ar_main, ar); BLI_insertlinkbefore(lb, ar_main, ar);
sequencer_init_preview_region(ar); sequencer_init_preview_region(ar);
@@ -337,8 +340,9 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
* it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit * it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit
* only shows ShapeKey-rooted actions only) * only shows ShapeKey-rooted actions only)
*/ */
if (saction->mode == SACTCONT_SHAPEKEY) if (saction->mode == SACTCONT_SHAPEKEY) {
saction->action = NULL; saction->action = NULL;
}
break; break;
} }
case SPACE_SEQ: { case SPACE_SEQ: {
@@ -397,29 +401,33 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
/* add regions */ /* add regions */
for (sa = screen->areabase.first; sa; sa = sa->next) { for (sa = screen->areabase.first; sa; sa = sa->next) {
/* we keep headertype variable to convert old files only */ /* we keep headertype variable to convert old files only */
if (sa->headertype) if (sa->headertype) {
area_add_header_region(sa, &sa->regionbase); area_add_header_region(sa, &sa->regionbase);
}
area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase); area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase);
/* space imageselect is deprecated */ /* space imageselect is deprecated */
for (sl = sa->spacedata.first; sl; sl = sl->next) { for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_IMASEL) if (sl->spacetype == SPACE_IMASEL) {
sl->spacetype = SPACE_EMPTY; /* spacedata then matches */ sl->spacetype = SPACE_EMPTY; /* spacedata then matches */
} }
}
/* space sound is deprecated */ /* space sound is deprecated */
for (sl = sa->spacedata.first; sl; sl = sl->next) { for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_SOUND) if (sl->spacetype == SPACE_SOUND) {
sl->spacetype = SPACE_EMPTY; /* spacedata then matches */ sl->spacetype = SPACE_EMPTY; /* spacedata then matches */
} }
}
/* pushed back spaces also need regions! */ /* pushed back spaces also need regions! */
if (sa->spacedata.first) { if (sa->spacedata.first) {
sl = sa->spacedata.first; sl = sa->spacedata.first;
for (sl = sl->next; sl; sl = sl->next) { for (sl = sl->next; sl; sl = sl->next) {
if (sa->headertype) if (sa->headertype) {
area_add_header_region(sa, &sl->regionbase); area_add_header_region(sa, &sl->regionbase);
}
area_add_window_regions(sa, sl, &sl->regionbase); area_add_window_regions(sa, sl, &sl->regionbase);
} }
} }
@@ -436,9 +444,10 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
BKE_id_new_name_validate(lb, id, name); BKE_id_new_name_validate(lb, id, name);
/* alphabetic insertion: is in BKE_id_new_name_validate */ /* alphabetic insertion: is in BKE_id_new_name_validate */
if (G.debug & G_DEBUG) if (G.debug & G_DEBUG) {
printf("Converted GPencil to ID: %s\n", id->name + 2); printf("Converted GPencil to ID: %s\n", id->name + 2);
} }
}
static void do_versions_gpencil_2_50(Main *main, bScreen *screen) static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
{ {
@@ -538,9 +547,10 @@ static void do_version_bone_roll_256(Bone *bone)
copy_m3_m4(submat, bone->arm_mat); copy_m3_m4(submat, bone->arm_mat);
mat3_to_vec_roll(submat, NULL, &bone->arm_roll); mat3_to_vec_roll(submat, NULL, &bone->arm_roll);
for (child = bone->childbase.first; child; child = child->next) for (child = bone->childbase.first; child; child = child->next) {
do_version_bone_roll_256(child); do_version_bone_roll_256(child);
} }
}
/* deprecated, only keep this for readfile.c */ /* deprecated, only keep this for readfile.c */
/* XXX Deprecated function to add a socket in ntree->inputs/ntree->outputs list /* XXX Deprecated function to add a socket in ntree->inputs/ntree->outputs list
@@ -591,8 +601,9 @@ static void do_versions_socket_default_value_259(bNodeSocket *sock)
bNodeSocketValueVector *valvector; bNodeSocketValueVector *valvector;
bNodeSocketValueRGBA *valrgba; bNodeSocketValueRGBA *valrgba;
if (sock->default_value) if (sock->default_value) {
return; return;
}
switch (sock->type) { switch (sock->type) {
case SOCK_FLOAT: case SOCK_FLOAT:
@@ -678,15 +689,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
* to have them show in RNA viewer and accessible otherwise. * to have them show in RNA viewer and accessible otherwise.
*/ */
for (ma = bmain->materials.first; ma; ma = ma->id.next) { for (ma = bmain->materials.first; ma; ma = ma->id.next) {
if (ma->nodetree && ma->nodetree->id.name[0] == '\0') if (ma->nodetree && ma->nodetree->id.name[0] == '\0') {
strcpy(ma->nodetree->id.name, "NTShader Nodetree"); strcpy(ma->nodetree->id.name, "NTShader Nodetree");
} }
}
/* and composite trees */ /* and composite trees */
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
enum { R_PANORAMA = (1 << 10) }; enum { R_PANORAMA = (1 << 10) };
if (sce->nodetree && sce->nodetree->id.name[0] == '\0') if (sce->nodetree && sce->nodetree->id.name[0] == '\0') {
strcpy(sce->nodetree->id.name, "NTCompositing Nodetree"); strcpy(sce->nodetree->id.name, "NTCompositing Nodetree");
}
/* move to cameras */ /* move to cameras */
if (sce->r.mode & R_PANORAMA) { if (sce->r.mode & R_PANORAMA) {
@@ -708,15 +721,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bNode *node; bNode *node;
if (tx->nodetree) { if (tx->nodetree) {
if (tx->nodetree->id.name[0] == '\0') if (tx->nodetree->id.name[0] == '\0') {
strcpy(tx->nodetree->id.name, "NTTexture Nodetree"); strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
}
/* which_output 0 is now "not specified" */ /* which_output 0 is now "not specified" */
for (node = tx->nodetree->nodes.first; node; node = node->next) for (node = tx->nodetree->nodes.first; node; node = node->next) {
if (node->type == TEX_NODE_OUTPUT) if (node->type == TEX_NODE_OUTPUT) {
node->custom1++; node->custom1++;
} }
} }
}
}
/* particle draw and render types */ /* particle draw and render types */
for (part = bmain->particles.first; part; part = part->id.next) { for (part = bmain->particles.first; part; part = part->id.next) {
@@ -795,16 +811,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
int a; int a;
ob->matbits = MEM_calloc_arrayN(ob->totcol, sizeof(char), "ob->matbits"); ob->matbits = MEM_calloc_arrayN(ob->totcol, sizeof(char), "ob->matbits");
for (a = 0; a < ob->totcol; a++) for (a = 0; a < ob->totcol; a++) {
ob->matbits[a] = (ob->colbits & (1 << a)) != 0; ob->matbits[a] = (ob->colbits & (1 << a)) != 0;
} }
} }
}
/* texture filter */ /* texture filter */
for (tex = bmain->textures.first; tex; tex = tex->id.next) { for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->afmax == 0) if (tex->afmax == 0) {
tex->afmax = 8; tex->afmax = 8;
} }
}
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
ts = sce->toolsettings; ts = sce->toolsettings;
@@ -816,8 +834,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
* (i.e. will result in blank box when enabled) * (i.e. will result in blank box when enabled)
*/ */
ts->autokey_mode = U.autokey_mode; ts->autokey_mode = U.autokey_mode;
if (ts->autokey_mode == 0) if (ts->autokey_mode == 0) {
ts->autokey_mode = 2; /* 'add/replace' but not on */ ts->autokey_mode = 2; /* 'add/replace' but not on */
}
ts->uv_selectmode = UV_SELECT_VERTEX; ts->uv_selectmode = UV_SELECT_VERTEX;
ts->vgroup_weight = 1.0f; ts->vgroup_weight = 1.0f;
} }
@@ -828,10 +847,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Object *ob; Object *ob;
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->flag & 8192) // OB_POSEMODE = 8192 if (ob->flag & 8192) { // OB_POSEMODE = 8192
ob->mode |= OB_MODE_POSE; ob->mode |= OB_MODE_POSE;
} }
} }
}
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 4)) { if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 4)) {
Scene *sce; Scene *sce;
@@ -839,16 +859,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ParticleSettings *part; ParticleSettings *part;
bool do_gravity = false; bool do_gravity = false;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->unit.scale_length == 0.0f) if (sce->unit.scale_length == 0.0f) {
sce->unit.scale_length = 1.0f; sce->unit.scale_length = 1.0f;
}
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* fluid-sim stuff */ /* fluid-sim stuff */
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType( FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(
ob, eModifierType_Fluidsim); ob, eModifierType_Fluidsim);
if (fluidmd) if (fluidmd) {
fluidmd->fss->fmd = fluidmd; fluidmd->fss->fmd = fluidmd;
}
/* rotation modes were added, /* rotation modes were added,
* but old objects would now default to being 'quaternion based' */ * but old objects would now default to being 'quaternion based' */
@@ -856,8 +879,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
} }
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->audio.main == 0.0f) if (sce->audio.main == 0.0f) {
sce->audio.main = 1.0f; sce->audio.main = 1.0f;
}
sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate; sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
sce->r.ffcodecdata.audio_volume = sce->audio.main; sce->r.ffcodecdata.audio_volume = sce->audio.main;
@@ -880,9 +904,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* Assign proper global gravity weights for dynamics /* Assign proper global gravity weights for dynamics
* (only z-coordinate is taken into account) */ * (only z-coordinate is taken into account) */
if (do_gravity) { if (do_gravity) {
for (part = bmain->particles.first; part; part = part->id.next) for (part = bmain->particles.first; part; part = part->id.next) {
part->effector_weights->global_gravity = part->acc[2] / -9.81f; part->effector_weights->global_gravity = part->acc[2] / -9.81f;
} }
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md; ModifierData *md;
@@ -891,24 +916,29 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (md = ob->modifiers.first; md; md = md->next) { for (md = ob->modifiers.first; md; md = md->next) {
ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob,
eModifierType_Cloth); eModifierType_Cloth);
if (clmd) if (clmd) {
clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2] / clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2] /
-9.81f; -9.81f;
} }
}
if (ob->soft) if (ob->soft) {
ob->soft->effector_weights->global_gravity = ob->soft->grav / 9.81f; ob->soft->effector_weights->global_gravity = ob->soft->grav / 9.81f;
} }
}
/* Normal wind shape is plane */ /* Normal wind shape is plane */
if (ob->pd) { if (ob->pd) {
if (ob->pd->forcefield == PFIELD_WIND) if (ob->pd->forcefield == PFIELD_WIND) {
ob->pd->shape = PFIELD_SHAPE_PLANE; ob->pd->shape = PFIELD_SHAPE_PLANE;
}
if (ob->pd->flag & PFIELD_PLANAR) if (ob->pd->flag & PFIELD_PLANAR) {
ob->pd->shape = PFIELD_SHAPE_PLANE; ob->pd->shape = PFIELD_SHAPE_PLANE;
else if (ob->pd->flag & PFIELD_SURFACE) }
else if (ob->pd->flag & PFIELD_SURFACE) {
ob->pd->shape = PFIELD_SHAPE_SURFACE; ob->pd->shape = PFIELD_SHAPE_SURFACE;
}
ob->pd->flag |= PFIELD_DO_LOCATION; ob->pd->flag |= PFIELD_DO_LOCATION;
} }
@@ -954,20 +984,22 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
data = key->refkey->data; data = key->refkey->data;
tot = MIN2(me->totvert, key->refkey->totelem); tot = MIN2(me->totvert, key->refkey->totelem);
for (a = 0; a < tot; a++, data += 3) for (a = 0; a < tot; a++, data += 3) {
copy_v3_v3(me->mvert[a].co, data); copy_v3_v3(me->mvert[a].co, data);
} }
} }
}
for (lt = bmain->lattices.first; lt; lt = lt->id.next) { for (lt = bmain->lattices.first; lt; lt = lt->id.next) {
if ((key = blo_do_versions_newlibadr(fd, lib, lt->key)) && key->refkey) { if ((key = blo_do_versions_newlibadr(fd, lib, lt->key)) && key->refkey) {
data = key->refkey->data; data = key->refkey->data;
tot = MIN2(lt->pntsu * lt->pntsv * lt->pntsw, key->refkey->totelem); tot = MIN2(lt->pntsu * lt->pntsv * lt->pntsw, key->refkey->totelem);
for (a = 0; a < tot; a++, data += 3) for (a = 0; a < tot; a++, data += 3) {
copy_v3_v3(lt->def[a].vec, data); copy_v3_v3(lt->def[a].vec, data);
} }
} }
}
for (cu = bmain->curves.first; cu; cu = cu->id.next) { for (cu = bmain->curves.first; cu; cu = cu->id.next) {
if ((key = blo_do_versions_newlibadr(fd, lib, cu->key)) && key->refkey) { if ((key = blo_do_versions_newlibadr(fd, lib, cu->key)) && key->refkey) {
@@ -1007,8 +1039,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
{ {
Scene *sce = bmain->scenes.first; Scene *sce = bmain->scenes.first;
while (sce) { while (sce) {
if (sce->r.frame_step == 0) if (sce->r.frame_step == 0) {
sce->r.frame_step = 1; sce->r.frame_step = 1;
}
sce = sce->id.next; sce = sce->id.next;
} }
@@ -1033,8 +1066,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Object *ob = bmain->objects.first; Object *ob = bmain->objects.first;
while (ob) { while (ob) {
/* shaded mode disabled for now */ /* shaded mode disabled for now */
if (ob->dt == OB_MATERIAL) if (ob->dt == OB_MATERIAL) {
ob->dt = OB_TEXTURE; ob->dt = OB_TEXTURE;
}
ob = ob->id.next; ob = ob->id.next;
} }
} }
@@ -1049,13 +1083,14 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) { for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) { if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl; View3D *v3d = (View3D *)sl;
if (v3d->drawtype == OB_MATERIAL) if (v3d->drawtype == OB_MATERIAL) {
v3d->drawtype = OB_SOLID; v3d->drawtype = OB_SOLID;
} }
} }
} }
} }
} }
}
/* only convert old 2.50 files with color management */ /* only convert old 2.50 files with color management */
if (bmain->versionfile == 250) { if (bmain->versionfile == 250) {
@@ -1071,8 +1106,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* don't know what scene is active, so we'll convert if any scene has it enabled... */ /* don't know what scene is active, so we'll convert if any scene has it enabled... */
while (sce) { while (sce) {
if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT) if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
convert = 1; convert = 1;
}
sce = sce->id.next; sce = sce->id.next;
} }
@@ -1102,13 +1138,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Mesh *me; Mesh *me;
Object *ob; Object *ob;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (!sce->toolsettings->particle.selectmode) if (!sce->toolsettings->particle.selectmode) {
sce->toolsettings->particle.selectmode = SCE_SELECT_PATH; sce->toolsettings->particle.selectmode = SCE_SELECT_PATH;
}
}
if (bmain->versionfile == 250 && bmain->subversionfile > 1) { if (bmain->versionfile == 250 && bmain->subversionfile > 1) {
for (me = bmain->meshes.first; me; me = me->id.next) for (me = bmain->meshes.first; me; me = me->id.next) {
multires_load_old_250(me); multires_load_old_250(me);
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType( MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(
@@ -1133,12 +1172,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (md = ob->modifiers.first; md; md = md->next) { for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) { if (md->type == eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData *)md; ClothModifierData *clmd = (ClothModifierData *)md;
if (clmd->sim_parms->velocity_smooth < 0.01f) if (clmd->sim_parms->velocity_smooth < 0.01f) {
clmd->sim_parms->velocity_smooth = 0.f; clmd->sim_parms->velocity_smooth = 0.f;
} }
} }
} }
} }
}
/* fix bad area setup in subversion 10 */ /* fix bad area setup in subversion 10 */
if (bmain->versionfile == 250 && bmain->subversionfile == 10) { if (bmain->versionfile == 250 && bmain->subversionfile == 10) {
@@ -1163,9 +1203,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
} }
for (ar = regionbase->first; ar; ar = ar->next) { for (ar = regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_PREVIEW) if (ar->regiontype == RGN_TYPE_PREVIEW) {
break; break;
} }
}
if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) { if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) {
SpaceType *st = BKE_spacetype_from_id(SPACE_SEQ); SpaceType *st = BKE_spacetype_from_id(SPACE_SEQ);
@@ -1201,16 +1242,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
regionbase = &sl->regionbase; regionbase = &sl->regionbase;
} }
if (sseq->view == 0) if (sseq->view == 0) {
sseq->view = SEQ_VIEW_SEQUENCE; sseq->view = SEQ_VIEW_SEQUENCE;
if (sseq->mainb == 0) }
if (sseq->mainb == 0) {
sseq->mainb = SEQ_DRAW_IMG_IMBUF; sseq->mainb = SEQ_DRAW_IMG_IMBUF;
}
ar_main = (ARegion *)regionbase->first; ar_main = (ARegion *)regionbase->first;
for (; ar_main; ar_main = ar_main->next) { for (; ar_main; ar_main = ar_main->next) {
if (ar_main->regiontype == RGN_TYPE_WINDOW) if (ar_main->regiontype == RGN_TYPE_WINDOW) {
break; break;
} }
}
ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer"); ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_insertlinkbefore(regionbase, ar_main, ar); BLI_insertlinkbefore(regionbase, ar_main, ar);
sequencer_init_preview_region(ar); sequencer_init_preview_region(ar);
@@ -1247,28 +1291,34 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
avs->path_ef = 250; avs->path_ef = 250;
/* flags */ /* flags */
if (arm->pathflag & ARM_PATH_FNUMS) if (arm->pathflag & ARM_PATH_FNUMS) {
avs->path_viewflag |= MOTIONPATH_VIEW_FNUMS; avs->path_viewflag |= MOTIONPATH_VIEW_FNUMS;
if (arm->pathflag & ARM_PATH_KFRAS) }
if (arm->pathflag & ARM_PATH_KFRAS) {
avs->path_viewflag |= MOTIONPATH_VIEW_KFRAS; avs->path_viewflag |= MOTIONPATH_VIEW_KFRAS;
if (arm->pathflag & ARM_PATH_KFNOS) }
if (arm->pathflag & ARM_PATH_KFNOS) {
avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS; avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS;
}
/* bake flags */ /* bake flags */
if (arm->pathflag & ARM_PATH_HEADS) if (arm->pathflag & ARM_PATH_HEADS) {
avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS; avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS;
}
/* type */ /* type */
if (arm->pathflag & ARM_PATH_ACFRA) if (arm->pathflag & ARM_PATH_ACFRA) {
avs->path_type = MOTIONPATH_TYPE_ACFRA; avs->path_type = MOTIONPATH_TYPE_ACFRA;
}
/* stepsize */ /* stepsize */
avs->path_step = 1; avs->path_step = 1;
} }
else else {
animviz_settings_init(&ob->pose->avs); animviz_settings_init(&ob->pose->avs);
} }
} }
}
/* brush texture changes */ /* brush texture changes */
for (brush = bmain->brushes.first; brush; brush = brush->id.next) { for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
@@ -1315,10 +1365,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ListBase *regionbase; ListBase *regionbase;
ARegion *ar; ARegion *ar;
if (sl == sa->spacedata.first) if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase; regionbase = &sa->regionbase;
else }
else {
regionbase = &sl->regionbase; regionbase = &sl->regionbase;
}
if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) { if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
for (ar = (ARegion *)regionbase->first; ar; ar = ar->next) { for (ar = (ARegion *)regionbase->first; ar; ar = ar->next) {
@@ -1347,8 +1399,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
sce->r.border.ymax = 1.0f; sce->r.border.ymax = 1.0f;
} }
if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0) if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0) {
sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE
}
SEQ_BEGIN (sce->ed, seq) { SEQ_BEGIN (sce->ed, seq) {
seq->volume = 1.0f; seq->volume = 1.0f;
@@ -1361,9 +1414,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ParticleEditSettings *pset = &sce->toolsettings->particle; ParticleEditSettings *pset = &sce->toolsettings->particle;
int a; int a;
for (a = 0; a < ARRAY_SIZE(pset->brush); a++) for (a = 0; a < ARRAY_SIZE(pset->brush); a++) {
pset->brush[a].strength /= 100.0f; pset->brush[a].strength /= 100.0f;
} }
}
/* sequencer changes */ /* sequencer changes */
{ {
@@ -1387,9 +1441,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ar_preview = (ARegion *)regionbase->first; ar_preview = (ARegion *)regionbase->first;
for (; ar_preview; ar_preview = ar_preview->next) { for (; ar_preview; ar_preview = ar_preview->next) {
if (ar_preview->regiontype == RGN_TYPE_PREVIEW) if (ar_preview->regiontype == RGN_TYPE_PREVIEW) {
break; break;
} }
}
if (ar_preview && (ar_preview->regiontype == RGN_TYPE_PREVIEW)) { if (ar_preview && (ar_preview->regiontype == RGN_TYPE_PREVIEW)) {
sequencer_init_preview_region(ar_preview); sequencer_init_preview_region(ar_preview);
} }
@@ -1428,9 +1483,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bNodeTree *ntree; bNodeTree *ntree;
for (brush = bmain->brushes.first; brush; brush = brush->id.next) { for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->curve) if (brush->curve) {
brush->curve->preset = CURVE_PRESET_SMOOTH; brush->curve->preset = CURVE_PRESET_SMOOTH;
} }
}
/* properly initialize active flag for fluidsim modifiers */ /* properly initialize active flag for fluidsim modifiers */
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
@@ -1481,9 +1537,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 2)) { if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 2)) {
Object *ob; Object *ob;
for (ob = bmain->objects.first; ob; ob = ob->id.next) for (ob = bmain->objects.first; ob; ob = ob->id.next) {
blo_do_version_old_trackto_to_constraints(ob); blo_do_version_old_trackto_to_constraints(ob);
} }
}
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) { if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
bScreen *sc; bScreen *sc;
@@ -1523,21 +1580,26 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ListBase *regionbase; ListBase *regionbase;
ARegion *ar; ARegion *ar;
if (sl == sa->spacedata.first) if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase; regionbase = &sa->regionbase;
else }
else {
regionbase = &sl->regionbase; regionbase = &sl->regionbase;
}
if (snode->v2d.minzoom > 0.09f) if (snode->v2d.minzoom > 0.09f) {
snode->v2d.minzoom = 0.09f; snode->v2d.minzoom = 0.09f;
if (snode->v2d.maxzoom < 2.31f) }
if (snode->v2d.maxzoom < 2.31f) {
snode->v2d.maxzoom = 2.31f; snode->v2d.maxzoom = 2.31f;
}
for (ar = regionbase->first; ar; ar = ar->next) { for (ar = regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) { if (ar->regiontype == RGN_TYPE_WINDOW) {
if (ar->v2d.minzoom > 0.09f) if (ar->v2d.minzoom > 0.09f) {
ar->v2d.minzoom = 0.09f; ar->v2d.minzoom = 0.09f;
if (ar->v2d.maxzoom < 2.31f) }
if (ar->v2d.maxzoom < 2.31f) {
ar->v2d.maxzoom = 2.31f; ar->v2d.maxzoom = 2.31f;
} }
} }
@@ -1545,6 +1607,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
} }
} }
} }
}
do_version_mdef_250(bmain); do_version_mdef_250(bmain);
@@ -1598,9 +1661,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (tex = bmain->textures.first; tex; tex = tex->id.next) { for (tex = bmain->textures.first; tex; tex = tex->id.next) {
/* if youre picky, this isn't correct until we do a version bump /* if youre picky, this isn't correct until we do a version bump
* since you could set saturation to be 0.0*/ * since you could set saturation to be 0.0*/
if (tex->saturation == 0.0f) if (tex->saturation == 0.0f) {
tex->saturation = 1.0f; tex->saturation = 1.0f;
} }
}
{ {
Curve *cu; Curve *cu;
@@ -1627,44 +1691,54 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* Sanity Check */ /* Sanity Check */
/* infinite number of dabs */ /* infinite number of dabs */
if (brush->spacing == 0) if (brush->spacing == 0) {
brush->spacing = 10; brush->spacing = 10;
}
/* will have no effect */ /* will have no effect */
if (brush->alpha == 0) if (brush->alpha == 0) {
brush->alpha = 0.5f; brush->alpha = 0.5f;
}
/* bad radius */ /* bad radius */
if (brush->unprojected_radius == 0) if (brush->unprojected_radius == 0) {
brush->unprojected_radius = 0.125f; brush->unprojected_radius = 0.125f;
}
/* unusable size */ /* unusable size */
if (brush->size == 0) if (brush->size == 0) {
brush->size = 35; brush->size = 35;
}
/* can't see overlay */ /* can't see overlay */
if (brush->texture_overlay_alpha == 0) if (brush->texture_overlay_alpha == 0) {
brush->texture_overlay_alpha = 33; brush->texture_overlay_alpha = 33;
}
/* same as draw brush */ /* same as draw brush */
if (brush->crease_pinch_factor == 0) if (brush->crease_pinch_factor == 0) {
brush->crease_pinch_factor = 0.5f; brush->crease_pinch_factor = 0.5f;
}
/* will sculpt no vertexes */ /* will sculpt no vertexes */
if (brush->plane_trim == 0) if (brush->plane_trim == 0) {
brush->plane_trim = 0.5f; brush->plane_trim = 0.5f;
}
/* same as smooth stroke off */ /* same as smooth stroke off */
if (brush->smooth_stroke_radius == 0) if (brush->smooth_stroke_radius == 0) {
brush->smooth_stroke_radius = 75; brush->smooth_stroke_radius = 75;
}
/* will keep cursor in one spot */ /* will keep cursor in one spot */
if (brush->smooth_stroke_radius == 1) if (brush->smooth_stroke_radius == 1) {
brush->smooth_stroke_factor = 0.9f; brush->smooth_stroke_factor = 0.9f;
}
/* same as dots */ /* same as dots */
if (brush->rate == 0) if (brush->rate == 0) {
brush->rate = 0.1f; brush->rate = 0.1f;
}
/* New Settings */ /* New Settings */
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) { if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
@@ -1694,16 +1768,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 253) { if (bmain->versionfile < 253) {
Scene *sce; Scene *sce;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->toolsettings->sculpt_paint_unified_alpha == 0) if (sce->toolsettings->sculpt_paint_unified_alpha == 0) {
sce->toolsettings->sculpt_paint_unified_alpha = 0.5f; sce->toolsettings->sculpt_paint_unified_alpha = 0.5f;
}
if (sce->toolsettings->sculpt_paint_unified_unprojected_radius == 0) if (sce->toolsettings->sculpt_paint_unified_unprojected_radius == 0) {
sce->toolsettings->sculpt_paint_unified_unprojected_radius = 0.125f; sce->toolsettings->sculpt_paint_unified_unprojected_radius = 0.125f;
}
if (sce->toolsettings->sculpt_paint_unified_size == 0) if (sce->toolsettings->sculpt_paint_unified_size == 0) {
sce->toolsettings->sculpt_paint_unified_size = 35; sce->toolsettings->sculpt_paint_unified_size = 35;
} }
} }
}
if (bmain->versionfile < 253 || (bmain->versionfile == 253 && bmain->subversionfile < 1)) { if (bmain->versionfile < 253 || (bmain->versionfile == 253 && bmain->subversionfile < 1)) {
Object *ob; Object *ob;
@@ -1719,8 +1796,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
smd->domain->vorticity = 2.0f; smd->domain->vorticity = 2.0f;
smd->domain->time_scale = 1.0f; smd->domain->time_scale = 1.0f;
if (!(smd->domain->flags & (1 << 4))) if (!(smd->domain->flags & (1 << 4))) {
continue; continue;
}
/* delete old MOD_SMOKE_INITVELOCITY flag */ /* delete old MOD_SMOKE_INITVELOCITY flag */
smd->domain->flags &= ~(1 << 4); smd->domain->flags &= ~(1 << 4);
@@ -1756,13 +1834,15 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bScreen *sc; bScreen *sc;
for (br = bmain->brushes.first; br; br = br->id.next) { for (br = bmain->brushes.first; br; br = br->id.next) {
if (br->ob_mode == 0) if (br->ob_mode == 0) {
br->ob_mode = OB_MODE_ALL_PAINT; br->ob_mode = OB_MODE_ALL_PAINT;
} }
}
for (part = bmain->particles.first; part; part = part->id.next) { for (part = bmain->particles.first; part; part = part->id.next) {
if (part->boids) if (part->boids) {
part->boids->pitch = 1.0f; part->boids->pitch = 1.0f;
}
part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */ part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */
part->kink_amp_clump = 1.f; /* keep old files looking similar */ part->kink_amp_clump = 1.f; /* keep old files looking similar */
@@ -1825,10 +1905,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) { for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_IMAGE) { if (sl->spacetype == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)sl; SpaceImage *sima = (SpaceImage *)sl;
if (sima->sample_line_hist.height == 0) if (sima->sample_line_hist.height == 0) {
sima->sample_line_hist.height = 100; sima->sample_line_hist.height = 100;
} }
} }
}
sa = sa->next; sa = sa->next;
} }
} }
@@ -1841,11 +1922,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
KeyBlock *kb; KeyBlock *kb;
for (kb = key->block.first; kb; kb = kb->next) { for (kb = key->block.first; kb; kb = kb->next) {
if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQF(kb->slidermax, 0.0f)) if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQF(kb->slidermax, 0.0f)) {
kb->slidermax = kb->slidermin + 1.0f; kb->slidermax = kb->slidermin + 1.0f;
} }
} }
} }
}
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 1)) { if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 1)) {
/* fix for bones that didn't have arm_roll before */ /* fix for bones that didn't have arm_roll before */
@@ -1853,9 +1935,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Bone *bone; Bone *bone;
Object *ob; Object *ob;
for (arm = bmain->armatures.first; arm; arm = arm->id.next) for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
for (bone = arm->bonebase.first; bone; bone = bone->next) for (bone = arm->bonebase.first; bone; bone = bone->next) {
do_version_bone_roll_256(bone); do_version_bone_roll_256(bone);
}
}
/* fix for objects which have zero dquat's /* fix for objects which have zero dquat's
* since this is multiplied with the quat rather than added */ * since this is multiplied with the quat rather than added */
@@ -1883,13 +1967,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* first make sure the own_index for new sockets is valid */ /* first make sure the own_index for new sockets is valid */
for (node = ntree->nodes.first; node; node = node->next) { for (node = ntree->nodes.first; node; node = node->next) {
for (sock = node->inputs.first; sock; sock = sock->next) for (sock = node->inputs.first; sock; sock = sock->next) {
if (sock->own_index >= ntree->cur_index) if (sock->own_index >= ntree->cur_index) {
ntree->cur_index = sock->own_index + 1; ntree->cur_index = sock->own_index + 1;
for (sock = node->outputs.first; sock; sock = sock->next) }
if (sock->own_index >= ntree->cur_index) }
for (sock = node->outputs.first; sock; sock = sock->next) {
if (sock->own_index >= ntree->cur_index) {
ntree->cur_index = sock->own_index + 1; ntree->cur_index = sock->own_index + 1;
} }
}
}
/* add ntree->inputs/ntree->outputs sockets for all unlinked sockets in the group tree. */ /* add ntree->inputs/ntree->outputs sockets for all unlinked sockets in the group tree. */
for (node = ntree->nodes.first; node; node = node->next) { for (node = ntree->nodes.first; node; node = node->next) {
@@ -1968,9 +2056,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
} }
for (brush = bmain->brushes.first; brush; brush = brush->id.next) { for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->height == 0) if (brush->height == 0) {
brush->height = 0.4f; brush->height = 0.4f;
} }
}
/* replace 'rim material' option for in offset*/ /* replace 'rim material' option for in offset*/
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
@@ -1988,31 +2077,36 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* particle draw color from material */ /* particle draw color from material */
for (part = bmain->particles.first; part; part = part->id.next) { for (part = bmain->particles.first; part; part = part->id.next) {
if (part->draw & PART_DRAW_MAT_COL) if (part->draw & PART_DRAW_MAT_COL) {
part->draw_col = PART_DRAW_COL_MAT; part->draw_col = PART_DRAW_COL_MAT;
} }
} }
}
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 6)) { if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 6)) {
Mesh *me; Mesh *me;
for (me = bmain->meshes.first; me; me = me->id.next) for (me = bmain->meshes.first; me; me = me->id.next) {
BKE_mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL); BKE_mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
} }
}
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) { if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) {
/* update blur area sizes from 0..1 range to 0..100 percentage */ /* update blur area sizes from 0..1 range to 0..100 percentage */
Scene *scene; Scene *scene;
bNode *node; bNode *node;
for (scene = bmain->scenes.first; scene; scene = scene->id.next) for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->nodetree) if (scene->nodetree) {
for (node = scene->nodetree->nodes.first; node; node = node->next) for (node = scene->nodetree->nodes.first; node; node = node->next) {
if (node->type == CMP_NODE_BLUR) { if (node->type == CMP_NODE_BLUR) {
NodeBlurData *nbd = node->storage; NodeBlurData *nbd = node->storage;
nbd->percentx *= 100.0f; nbd->percentx *= 100.0f;
nbd->percenty *= 100.0f; nbd->percenty *= 100.0f;
} }
} }
}
}
}
if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) { if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) {
/* screen view2d settings were not properly initialized T27164. /* screen view2d settings were not properly initialized T27164.
@@ -2088,17 +2182,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ARegion *ar; ARegion *ar;
for (ar = sa->regionbase.first; ar; ar = ar->next) { for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) { if (ar->regiontype == RGN_TYPE_WINDOW) {
if (ar->v2d.min[1] == 4.0f) if (ar->v2d.min[1] == 4.0f) {
ar->v2d.min[1] = 0.5f; ar->v2d.min[1] = 0.5f;
} }
} }
} }
}
for (sl = sa->spacedata.first; sl; sl = sl->next) { for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_SEQ) { if (sl->spacetype == SPACE_SEQ) {
ARegion *ar; ARegion *ar;
for (ar = sl->regionbase.first; ar; ar = ar->next) { for (ar = sl->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) { if (ar->regiontype == RGN_TYPE_WINDOW) {
if (ar->v2d.min[1] == 4.0f) if (ar->v2d.min[1] == 4.0f) {
ar->v2d.min[1] = 0.5f; ar->v2d.min[1] = 0.5f;
} }
} }
@@ -2107,6 +2202,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
} }
} }
} }
}
{ {
/* Make "auto-clamped" handles a per-keyframe setting instead of per-FCurve /* Make "auto-clamped" handles a per-keyframe setting instead of per-FCurve
@@ -2125,18 +2221,22 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
uint i = 0; uint i = 0;
/* only need to touch curves that had this flag set */ /* only need to touch curves that had this flag set */
if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0) if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0) {
continue; continue;
if ((fcu->totvert == 0) || (fcu->bezt == NULL)) }
if ((fcu->totvert == 0) || (fcu->bezt == NULL)) {
continue; continue;
}
/* only change auto-handles to auto-clamped */ /* only change auto-handles to auto-clamped */
for (bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { for (bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (bezt->h1 == HD_AUTO) if (bezt->h1 == HD_AUTO) {
bezt->h1 = HD_AUTO_ANIM; bezt->h1 = HD_AUTO_ANIM;
if (bezt->h2 == HD_AUTO) }
if (bezt->h2 == HD_AUTO) {
bezt->h2 = HD_AUTO_ANIM; bezt->h2 = HD_AUTO_ANIM;
} }
}
fcu->flag &= ~FCURVE_AUTO_HANDLES; fcu->flag &= ~FCURVE_AUTO_HANDLES;
} }
@@ -2152,16 +2252,20 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bNodeSocket *sock; bNodeSocket *sock;
for (node = ntree->nodes.first; node; node = node->next) { for (node = ntree->nodes.first; node; node = node->next) {
for (sock = node->inputs.first; sock; sock = sock->next) for (sock = node->inputs.first; sock; sock = sock->next) {
do_versions_socket_default_value_259(sock);
for (sock = node->outputs.first; sock; sock = sock->next)
do_versions_socket_default_value_259(sock); do_versions_socket_default_value_259(sock);
} }
for (sock = node->outputs.first; sock; sock = sock->next) {
do_versions_socket_default_value_259(sock);
}
}
for (sock = ntree->inputs.first; sock; sock = sock->next) for (sock = ntree->inputs.first; sock; sock = sock->next) {
do_versions_socket_default_value_259(sock); do_versions_socket_default_value_259(sock);
for (sock = ntree->outputs.first; sock; sock = sock->next) }
for (sock = ntree->outputs.first; sock; sock = sock->next) {
do_versions_socket_default_value_259(sock); do_versions_socket_default_value_259(sock);
}
ntree->update |= NTREE_UPDATE; ntree->update |= NTREE_UPDATE;
} }
@@ -2175,10 +2279,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
*/ */
bNodeTree *ntree; bNodeTree *ntree;
/* all node trees in bmain->nodetree are considered groups */ /* all node trees in bmain->nodetree are considered groups */
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
ntree->nodetype = NODE_GROUP; ntree->nodetype = NODE_GROUP;
} }
} }
}
if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 4)) { if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 4)) {
{ {

View File

@@ -205,15 +205,19 @@ static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
bNodeLink *link; bNodeLink *link;
for (node = ntree->nodes.first; node; node = node->next) { for (node = ntree->nodes.first; node; node = node->next) {
for (sock = node->inputs.first; sock; sock = sock->next) for (sock = node->inputs.first; sock; sock = sock->next) {
sock->flag &= ~SOCK_IN_USE;
for (sock = node->outputs.first; sock; sock = sock->next)
sock->flag &= ~SOCK_IN_USE; sock->flag &= ~SOCK_IN_USE;
} }
for (sock = ntree->inputs.first; sock; sock = sock->next) for (sock = node->outputs.first; sock; sock = sock->next) {
sock->flag &= ~SOCK_IN_USE; sock->flag &= ~SOCK_IN_USE;
for (sock = ntree->outputs.first; sock; sock = sock->next) }
}
for (sock = ntree->inputs.first; sock; sock = sock->next) {
sock->flag &= ~SOCK_IN_USE; sock->flag &= ~SOCK_IN_USE;
}
for (sock = ntree->outputs.first; sock; sock = sock->next) {
sock->flag &= ~SOCK_IN_USE;
}
for (link = ntree->links.first; link; link = link->next) { for (link = ntree->links.first; link; link = link->next) {
link->fromsock->flag |= SOCK_IN_USE; link->fromsock->flag |= SOCK_IN_USE;
@@ -296,9 +300,10 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
nodeRemoveSocket(ntree, node, old_image); nodeRemoveSocket(ntree, node, old_image);
nodeRemoveSocket(ntree, node, old_z); nodeRemoveSocket(ntree, node, old_z);
if (old_data) if (old_data) {
MEM_freeN(old_data); MEM_freeN(old_data);
} }
}
else if (node->type == CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) { else if (node->type == CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
NodeImageMultiFile *nimf = node->storage; NodeImageMultiFile *nimf = node->storage;
bNodeSocket *sock; bNodeSocket *sock;
@@ -307,8 +312,9 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
node->type = CMP_NODE_OUTPUT_FILE; node->type = CMP_NODE_OUTPUT_FILE;
/* initialize the node-wide image format from render data, if available */ /* initialize the node-wide image format from render data, if available */
if (sce) if (sce) {
nimf->format = sce->r.im_format; nimf->format = sce->r.im_format;
}
/* transfer render format toggle to node format toggle */ /* transfer render format toggle to node format toggle */
for (sock = node->inputs.first; sock; sock = sock->next) { for (sock = node->inputs.first; sock; sock = sock->next) {
@@ -543,17 +549,21 @@ static void do_versions_nodetree_customnodes(bNodeTree *ntree, int UNUSED(is_gro
node->flag |= NODE_INIT; node->flag |= NODE_INIT;
/* sockets idname */ /* sockets idname */
for (sock = node->inputs.first; sock; sock = sock->next) for (sock = node->inputs.first; sock; sock = sock->next) {
BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
for (sock = node->outputs.first; sock; sock = sock->next)
BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname)); BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
} }
for (sock = node->outputs.first; sock; sock = sock->next) {
BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
}
}
/* tree sockets idname */ /* tree sockets idname */
for (sock = ntree->inputs.first; sock; sock = sock->next) for (sock = ntree->inputs.first; sock; sock = sock->next) {
BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname)); BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
for (sock = ntree->outputs.first; sock; sock = sock->next) }
for (sock = ntree->outputs.first; sock; sock = sock->next) {
BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname)); BLI_strncpy(sock->idname, node_socket_get_static_idname(sock), sizeof(sock->idname));
} }
}
/* initialize socket in_out values */ /* initialize socket in_out values */
{ {
@@ -561,16 +571,20 @@ static void do_versions_nodetree_customnodes(bNodeTree *ntree, int UNUSED(is_gro
bNodeSocket *sock; bNodeSocket *sock;
for (node = ntree->nodes.first; node; node = node->next) { for (node = ntree->nodes.first; node; node = node->next) {
for (sock = node->inputs.first; sock; sock = sock->next) for (sock = node->inputs.first; sock; sock = sock->next) {
sock->in_out = SOCK_IN; sock->in_out = SOCK_IN;
for (sock = node->outputs.first; sock; sock = sock->next) }
for (sock = node->outputs.first; sock; sock = sock->next) {
sock->in_out = SOCK_OUT; sock->in_out = SOCK_OUT;
} }
for (sock = ntree->inputs.first; sock; sock = sock->next) }
for (sock = ntree->inputs.first; sock; sock = sock->next) {
sock->in_out = SOCK_IN; sock->in_out = SOCK_IN;
for (sock = ntree->outputs.first; sock; sock = sock->next) }
for (sock = ntree->outputs.first; sock; sock = sock->next) {
sock->in_out = SOCK_OUT; sock->in_out = SOCK_OUT;
} }
}
/* initialize socket identifier strings */ /* initialize socket identifier strings */
{ {
@@ -629,16 +643,19 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
/* there are files with invalid audio_channels value, the real cause /* there are files with invalid audio_channels value, the real cause
* is unknown, but we fix it here anyway to avoid crashes */ * is unknown, but we fix it here anyway to avoid crashes */
if (sce->r.ffcodecdata.audio_channels == 0) if (sce->r.ffcodecdata.audio_channels == 0) {
sce->r.ffcodecdata.audio_channels = 2; sce->r.ffcodecdata.audio_channels = 2;
if (sce->nodetree)
do_versions_nodetree_image_default_alpha_output(sce->nodetree);
} }
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) if (sce->nodetree) {
do_versions_nodetree_image_default_alpha_output(sce->nodetree);
}
}
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_versions_nodetree_image_default_alpha_output(ntree); do_versions_nodetree_image_default_alpha_output(ntree);
} }
}
{ {
/* support old particle dupliobject rotation settings */ /* support old particle dupliobject rotation settings */
@@ -648,12 +665,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
part->draw |= PART_DRAW_ROTATE_OB; part->draw |= PART_DRAW_ROTATE_OB;
if (part->rotmode == 0) if (part->rotmode == 0) {
part->rotmode = PART_ROT_VEL; part->rotmode = PART_ROT_VEL;
} }
} }
} }
} }
}
if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 1)) { if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 1)) {
Object *ob; Object *ob;
@@ -665,14 +683,16 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{ {
Camera *cam; Camera *cam;
for (cam = bmain->cameras.first; cam; cam = cam->id.next) { for (cam = bmain->cameras.first; cam; cam = cam->id.next) {
if (cam->sensor_x < 0.01f) if (cam->sensor_x < 0.01f) {
cam->sensor_x = DEFAULT_SENSOR_WIDTH; cam->sensor_x = DEFAULT_SENSOR_WIDTH;
}
if (cam->sensor_y < 0.01f) if (cam->sensor_y < 0.01f) {
cam->sensor_y = DEFAULT_SENSOR_HEIGHT; cam->sensor_y = DEFAULT_SENSOR_HEIGHT;
} }
} }
} }
}
if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 2)) { if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 2)) {
FOREACH_NODETREE_BEGIN (bmain, ntree, id) { FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
@@ -701,18 +721,21 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bNodeTree *ntree; bNodeTree *ntree;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) if (sce->nodetree) {
do_versions_nodetree_convert_angle(sce->nodetree); do_versions_nodetree_convert_angle(sce->nodetree);
} }
}
for (mat = bmain->materials.first; mat; mat = mat->id.next) { for (mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->nodetree) if (mat->nodetree) {
do_versions_nodetree_convert_angle(mat->nodetree); do_versions_nodetree_convert_angle(mat->nodetree);
} }
}
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_versions_nodetree_convert_angle(ntree); do_versions_nodetree_convert_angle(ntree);
} }
}
{ {
/* Tomato compatibility code. */ /* Tomato compatibility code. */
@@ -731,17 +754,19 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
v3d->flag2 |= V3D_SHOW_RECONSTRUCTION; v3d->flag2 |= V3D_SHOW_RECONSTRUCTION;
} }
if (v3d->bundle_drawtype == 0) if (v3d->bundle_drawtype == 0) {
v3d->bundle_drawtype = OB_PLAINAXES; v3d->bundle_drawtype = OB_PLAINAXES;
} }
}
else if (sl->spacetype == SPACE_CLIP) { else if (sl->spacetype == SPACE_CLIP) {
SpaceClip *sclip = (SpaceClip *)sl; SpaceClip *sclip = (SpaceClip *)sl;
if (sclip->scopes.track_preview_height == 0) if (sclip->scopes.track_preview_height == 0) {
sclip->scopes.track_preview_height = 120; sclip->scopes.track_preview_height = 120;
} }
} }
} }
} }
}
for (clip = bmain->movieclips.first; clip; clip = clip->id.next) { for (clip = bmain->movieclips.first; clip; clip = clip->id.next) {
MovieTrackingTrack *track; MovieTrackingTrack *track;
@@ -754,19 +779,23 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
clip->proxy.build_tc_flag = IMB_TC_RECORD_RUN | IMB_TC_FREE_RUN | clip->proxy.build_tc_flag = IMB_TC_RECORD_RUN | IMB_TC_FREE_RUN |
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN; IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
if (clip->proxy.build_size_flag == 0) if (clip->proxy.build_size_flag == 0) {
clip->proxy.build_size_flag = IMB_PROXY_25; clip->proxy.build_size_flag = IMB_PROXY_25;
}
if (clip->proxy.quality == 0) if (clip->proxy.quality == 0) {
clip->proxy.quality = 90; clip->proxy.quality = 90;
}
if (clip->tracking.camera.pixel_aspect < 0.01f) if (clip->tracking.camera.pixel_aspect < 0.01f) {
clip->tracking.camera.pixel_aspect = 1.0f; clip->tracking.camera.pixel_aspect = 1.0f;
}
track = clip->tracking.tracks.first; track = clip->tracking.tracks.first;
while (track) { while (track) {
if (track->minimum_correlation == 0.0f) if (track->minimum_correlation == 0.0f) {
track->minimum_correlation = 0.75f; track->minimum_correlation = 0.75f;
}
track = track->next; track = track->next;
} }
@@ -828,10 +857,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Brush *brush; Brush *brush;
for (brush = bmain->brushes.first; brush; brush = brush->id.next) { for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) {
brush->alpha = 1.0f; brush->alpha = 1.0f;
} }
} }
}
if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 1)) { if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 1)) {
{ {
@@ -843,29 +873,34 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bNodeTree *ntree; bNodeTree *ntree;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) if (sce->nodetree) {
do_versions_nodetree_socket_use_flags_2_62(sce->nodetree); do_versions_nodetree_socket_use_flags_2_62(sce->nodetree);
} }
}
for (mat = bmain->materials.first; mat; mat = mat->id.next) { for (mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->nodetree) if (mat->nodetree) {
do_versions_nodetree_socket_use_flags_2_62(mat->nodetree); do_versions_nodetree_socket_use_flags_2_62(mat->nodetree);
} }
}
for (tex = bmain->textures.first; tex; tex = tex->id.next) { for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->nodetree) if (tex->nodetree) {
do_versions_nodetree_socket_use_flags_2_62(tex->nodetree); do_versions_nodetree_socket_use_flags_2_62(tex->nodetree);
} }
}
for (Light *la = bmain->lights.first; la; la = la->id.next) { for (Light *la = bmain->lights.first; la; la = la->id.next) {
if (la->nodetree) if (la->nodetree) {
do_versions_nodetree_socket_use_flags_2_62(la->nodetree); do_versions_nodetree_socket_use_flags_2_62(la->nodetree);
} }
}
for (world = bmain->worlds.first; world; world = world->id.next) { for (world = bmain->worlds.first; world; world = world->id.next) {
if (world->nodetree) if (world->nodetree) {
do_versions_nodetree_socket_use_flags_2_62(world->nodetree); do_versions_nodetree_socket_use_flags_2_62(world->nodetree);
} }
}
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_versions_nodetree_socket_use_flags_2_62(ntree); do_versions_nodetree_socket_use_flags_2_62(ntree);
@@ -881,15 +916,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
clip->proxy.build_tc_flag |= IMB_TC_RECORD_RUN_NO_GAPS; clip->proxy.build_tc_flag |= IMB_TC_RECORD_RUN_NO_GAPS;
if (!tracking->settings.object_distance) if (!tracking->settings.object_distance) {
tracking->settings.object_distance = 1.0f; tracking->settings.object_distance = 1.0f;
}
if (BLI_listbase_is_empty(&tracking->objects)) if (BLI_listbase_is_empty(&tracking->objects)) {
BKE_tracking_object_add(tracking, "Camera"); BKE_tracking_object_add(tracking, "Camera");
}
while (tracking_object) { while (tracking_object) {
if (!tracking_object->scale) if (!tracking_object->scale) {
tracking_object->scale = 1.0f; tracking_object->scale = 1.0f;
}
tracking_object = tracking_object->next; tracking_object = tracking_object->next;
} }
@@ -901,13 +939,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) { if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data; bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
if (data->invmat[3][3] == 0.0f) if (data->invmat[3][3] == 0.0f) {
unit_m4(data->invmat); unit_m4(data->invmat);
} }
} }
} }
} }
} }
}
if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 2)) { if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 2)) {
{ {
@@ -938,12 +977,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
tl->len += added; tl->len += added;
/* reset cursor position if line was changed */ /* reset cursor position if line was changed */
if (added && tl == text->curl) if (added && tl == text->curl) {
text->curc = 0; text->curc = 0;
} }
} }
} }
} }
}
{ {
/* set new dynamic paint values */ /* set new dynamic paint values */
Object *ob; Object *ob;
@@ -975,12 +1015,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (md = ob->modifiers.first; md; md = md->next) { for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) { if (md->type == eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData *)md; ClothModifierData *clmd = (ClothModifierData *)md;
if (clmd->sim_parms) if (clmd->sim_parms) {
clmd->sim_parms->vel_damping = 1.0f; clmd->sim_parms->vel_damping = 1.0f;
} }
} }
} }
} }
}
if (bmain->versionfile < 263) { if (bmain->versionfile < 263) {
/* set fluidsim rate. the version patch for this in 2.62 was wrong, so /* set fluidsim rate. the version patch for this in 2.62 was wrong, so
@@ -992,12 +1033,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (md = ob->modifiers.first; md; md = md->next) { for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Fluidsim) { if (md->type == eModifierType_Fluidsim) {
FluidsimModifierData *fmd = (FluidsimModifierData *)md; FluidsimModifierData *fmd = (FluidsimModifierData *)md;
if (fmd->fss->animRate == 0.0f) if (fmd->fss->animRate == 0.0f) {
fmd->fss->animRate = 1.0f; fmd->fss->animRate = 1.0f;
} }
} }
} }
} }
}
if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 1)) { if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 1)) {
/* update use flags for node sockets (was only temporary before) */ /* update use flags for node sockets (was only temporary before) */
@@ -1005,14 +1047,16 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bNodeTree *ntree; bNodeTree *ntree;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) if (sce->nodetree) {
do_versions_nodetree_multi_file_output_format_2_62_1(sce, sce->nodetree); do_versions_nodetree_multi_file_output_format_2_62_1(sce, sce->nodetree);
} }
}
/* XXX can't associate with scene for group nodes, image format will stay uninitialized */ /* XXX can't associate with scene for group nodes, image format will stay uninitialized */
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree); do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree);
} }
}
/* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */ /* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
if (bmain->versionfile == 262 && bmain->subversionfile == 1) { if (bmain->versionfile == 262 && bmain->subversionfile == 1) {
@@ -1030,11 +1074,12 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) { for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
KeyingSet *ks; KeyingSet *ks;
for (ks = scene->keyingsets.first; ks; ks = ks->next) { for (ks = scene->keyingsets.first; ks; ks = ks->next) {
if (!ks->idname[0]) if (!ks->idname[0]) {
BLI_strncpy(ks->idname, ks->name, sizeof(ks->idname)); BLI_strncpy(ks->idname, ks->name, sizeof(ks->idname));
} }
} }
} }
}
if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 3)) { if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 3)) {
Object *ob; Object *ob;
@@ -1085,12 +1130,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce; Scene *sce;
bNodeTree *ntree; bNodeTree *ntree;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) if (sce->nodetree) {
do_versions_nodetree_multi_file_output_path_2_63_1(sce->nodetree); do_versions_nodetree_multi_file_output_path_2_63_1(sce->nodetree);
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) }
}
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_versions_nodetree_multi_file_output_path_2_63_1(ntree); do_versions_nodetree_multi_file_output_path_2_63_1(ntree);
} }
}
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 3)) { if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 3)) {
Scene *scene; Scene *scene;
@@ -1194,29 +1242,40 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
World *world; World *world;
bNodeTree *ntree; bNodeTree *ntree;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) if (sce->nodetree) {
do_versions_nodetree_frame_2_64_6(sce->nodetree); do_versions_nodetree_frame_2_64_6(sce->nodetree);
}
}
for (mat = bmain->materials.first; mat; mat = mat->id.next) for (mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->nodetree) if (mat->nodetree) {
do_versions_nodetree_frame_2_64_6(mat->nodetree); do_versions_nodetree_frame_2_64_6(mat->nodetree);
}
}
for (tex = bmain->textures.first; tex; tex = tex->id.next) for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->nodetree) if (tex->nodetree) {
do_versions_nodetree_frame_2_64_6(tex->nodetree); do_versions_nodetree_frame_2_64_6(tex->nodetree);
}
}
for (Light *la = bmain->lights.first; la; la = la->id.next) for (Light *la = bmain->lights.first; la; la = la->id.next) {
if (la->nodetree) if (la->nodetree) {
do_versions_nodetree_frame_2_64_6(la->nodetree); do_versions_nodetree_frame_2_64_6(la->nodetree);
}
}
for (world = bmain->worlds.first; world; world = world->id.next) for (world = bmain->worlds.first; world; world = world->id.next) {
if (world->nodetree) if (world->nodetree) {
do_versions_nodetree_frame_2_64_6(world->nodetree); do_versions_nodetree_frame_2_64_6(world->nodetree);
}
}
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_versions_nodetree_frame_2_64_6(ntree); do_versions_nodetree_frame_2_64_6(ntree);
} }
}
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 7)) { if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 7)) {
Object *ob; Object *ob;
@@ -1366,11 +1425,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
FOREACH_NODETREE_END; FOREACH_NODETREE_END;
/* keep compatibility for dupliobject particle size */ /* keep compatibility for dupliobject particle size */
for (part = bmain->particles.first; part; part = part->id.next) for (part = bmain->particles.first; part; part = part->id.next) {
if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
if ((part->draw & PART_DRAW_ROTATE_OB) == 0) if ((part->draw & PART_DRAW_ROTATE_OB) == 0) {
part->draw |= PART_DRAW_NO_SCALE_OB; part->draw |= PART_DRAW_NO_SCALE_OB;
} }
}
}
}
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 17)) { if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 17)) {
FOREACH_NODETREE_BEGIN (bmain, ntree, id) { FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
@@ -1504,11 +1566,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
FOREACH_NODETREE_BEGIN (bmain, ntree, id) { FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type == NTREE_SHADER) { if (ntree->type == NTREE_SHADER) {
bNode *node; bNode *node;
for (node = ntree->nodes.first; node; node = node->next) for (node = ntree->nodes.first; node; node = node->next) {
if (node->type == SH_NODE_TEX_COORD) if (node->type == SH_NODE_TEX_COORD) {
node->flag |= NODE_OPTIONS; node->flag |= NODE_OPTIONS;
} }
} }
}
}
FOREACH_NODETREE_END; FOREACH_NODETREE_END;
} }
@@ -1724,9 +1788,10 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
} }
SEQ_END; SEQ_END;
if (scene->r.bake_samples == 0) if (scene->r.bake_samples == 0) {
scene->r.bake_samples = 256; scene->r.bake_samples = 256;
} }
}
for (Image *image = bmain->images.first; image; image = image->id.next) { for (Image *image = bmain->images.first; image; image = image->id.next) {
if (image->flag & IMA_DO_PREMUL) { if (image->flag & IMA_DO_PREMUL) {
@@ -1741,10 +1806,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) { if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) {
Image *image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima); Image *image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima);
if (image && (image->flag & IMA_DO_PREMUL) == 0) if (image && (image->flag & IMA_DO_PREMUL) == 0) {
image->flag |= IMA_IGNORE_ALPHA; image->flag |= IMA_IGNORE_ALPHA;
} }
} }
}
FOREACH_NODETREE_BEGIN (bmain, ntree, id) { FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type == NTREE_COMPOSIT) { if (ntree->type == NTREE_COMPOSIT) {
@@ -1754,13 +1820,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Image *image = blo_do_versions_newlibadr(fd, ntree->id.lib, node->id); Image *image = blo_do_versions_newlibadr(fd, ntree->id.lib, node->id);
if (image) { if (image) {
if ((image->flag & IMA_DO_PREMUL) == 0 && image->alpha_mode == IMA_ALPHA_STRAIGHT) if ((image->flag & IMA_DO_PREMUL) == 0 && image->alpha_mode == IMA_ALPHA_STRAIGHT) {
node->custom1 |= CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT; node->custom1 |= CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT;
} }
} }
} }
} }
} }
}
FOREACH_NODETREE_END; FOREACH_NODETREE_END;
} }
else if (bmain->versionfile < 266 || (bmain->versionfile == 266 && bmain->subversionfile < 1)) { else if (bmain->versionfile < 266 || (bmain->versionfile == 266 && bmain->subversionfile < 1)) {
@@ -1768,10 +1835,12 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
* for compatibility all textures assumed it to be enabled */ * for compatibility all textures assumed it to be enabled */
Tex *tex; Tex *tex;
for (tex = bmain->textures.first; tex; tex = tex->id.next) for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->type == TEX_IMAGE) if (tex->type == TEX_IMAGE) {
tex->imaflag |= TEX_USEALPHA; tex->imaflag |= TEX_USEALPHA;
} }
}
}
if (bmain->versionfile < 265 || (bmain->versionfile == 265 && bmain->subversionfile < 7)) { if (bmain->versionfile < 265 || (bmain->versionfile == 265 && bmain->subversionfile < 7)) {
Curve *cu; Curve *cu;
@@ -1895,9 +1964,10 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Only add interface nodes once. /* Only add interface nodes once.
* In old Blender versions they will be removed automatically due to undefined type */ * In old Blender versions they will be removed automatically due to undefined type */
if (MAIN_VERSION_OLDER(bmain, 266, 2)) if (MAIN_VERSION_OLDER(bmain, 266, 2)) {
ntree->flag |= NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE; ntree->flag |= NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE;
} }
}
FOREACH_NODETREE_END; FOREACH_NODETREE_END;
} }
@@ -1911,12 +1981,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
*/ */
bNode *node; bNode *node;
FOREACH_NODETREE_BEGIN (bmain, ntree, id) { FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (id == &ntree->id) if (id == &ntree->id) {
continue; /* already fixed for node groups */ continue; /* already fixed for node groups */
}
for (node = ntree->nodes.first; node; node = node->next) for (node = ntree->nodes.first; node; node = node->next) {
nodeUniqueName(ntree, node); nodeUniqueName(ntree, node);
} }
}
FOREACH_NODETREE_END; FOREACH_NODETREE_END;
} }
} }
@@ -1938,9 +2010,10 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (brush = bmain->brushes.first; brush; brush = brush->id.next) { for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
brush->overlay_flags = 0; brush->overlay_flags = 0;
if (brush->flag & BRUSH_TEXTURE_OVERLAY) if (brush->flag & BRUSH_TEXTURE_OVERLAY) {
brush->overlay_flags |= (BRUSH_OVERLAY_PRIMARY | BRUSH_OVERLAY_CURSOR); brush->overlay_flags |= (BRUSH_OVERLAY_PRIMARY | BRUSH_OVERLAY_CURSOR);
} }
}
#undef BRUSH_TEXTURE_OVERLAY #undef BRUSH_TEXTURE_OVERLAY
} }
@@ -1983,8 +2056,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
sce->r.unit_line_thickness = 1.0f; sce->r.unit_line_thickness = 1.0f;
} }
for (srl = sce->r.layers.first; srl; srl = srl->next) { for (srl = sce->r.layers.first; srl; srl = srl->next) {
if (srl->freestyleConfig.mode == 0) if (srl->freestyleConfig.mode == 0) {
srl->freestyleConfig.mode = FREESTYLE_CONTROL_EDITOR_MODE; srl->freestyleConfig.mode = FREESTYLE_CONTROL_EDITOR_MODE;
}
if (srl->freestyleConfig.raycasting_algorithm == if (srl->freestyleConfig.raycasting_algorithm ==
FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE || FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE ||
srl->freestyleConfig.raycasting_algorithm == srl->freestyleConfig.raycasting_algorithm ==
@@ -2024,12 +2098,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
linestyle->thickness_position = LS_THICKNESS_CENTER; linestyle->thickness_position = LS_THICKNESS_CENTER;
linestyle->thickness_ratio = 0.5f; linestyle->thickness_ratio = 0.5f;
} }
if (linestyle->chaining == 0) if (linestyle->chaining == 0) {
linestyle->chaining = LS_CHAINING_PLAIN; linestyle->chaining = LS_CHAINING_PLAIN;
if (linestyle->rounds == 0) }
if (linestyle->rounds == 0) {
linestyle->rounds = 3; linestyle->rounds = 3;
} }
} }
}
if (bmain->versionfile < 267) { if (bmain->versionfile < 267) {
/* Initialize the active_viewer_key for compositing */ /* Initialize the active_viewer_key for compositing */
@@ -2045,26 +2121,30 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (sl->spacetype == SPACE_NODE) { if (sl->spacetype == SPACE_NODE) {
SpaceNode *snode = (SpaceNode *)sl; SpaceNode *snode = (SpaceNode *)sl;
bNodeTreePath *path = snode->treepath.last; bNodeTreePath *path = snode->treepath.last;
if (!path) if (!path) {
continue; continue;
}
active_viewer_key = path->parent_key; active_viewer_key = path->parent_key;
break; break;
} }
} }
if (active_viewer_key.value != 0) if (active_viewer_key.value != 0) {
break; break;
} }
if (active_viewer_key.value != 0) }
if (active_viewer_key.value != 0) {
break; break;
} }
}
for (scene = bmain->scenes.first; scene; scene = scene->id.next) { for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* NB: scene->nodetree is a local ID block, has been direct_link'ed */ /* NB: scene->nodetree is a local ID block, has been direct_link'ed */
if (scene->nodetree) if (scene->nodetree) {
scene->nodetree->active_viewer_key = active_viewer_key; scene->nodetree->active_viewer_key = active_viewer_key;
} }
} }
}
if (MAIN_VERSION_OLDER(bmain, 267, 1)) { if (MAIN_VERSION_OLDER(bmain, 267, 1)) {
Object *ob; Object *ob;
@@ -2100,13 +2180,16 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (brush = bmain->brushes.first; brush; brush = brush->id.next) { for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
brush->flag &= ~BRUSH_FIXED; brush->flag &= ~BRUSH_FIXED;
if (brush->cursor_overlay_alpha < 2) if (brush->cursor_overlay_alpha < 2) {
brush->cursor_overlay_alpha = 33; brush->cursor_overlay_alpha = 33;
if (brush->texture_overlay_alpha < 2) }
if (brush->texture_overlay_alpha < 2) {
brush->texture_overlay_alpha = 33; brush->texture_overlay_alpha = 33;
if (brush->mask_overlay_alpha < 2) }
if (brush->mask_overlay_alpha < 2) {
brush->mask_overlay_alpha = 33; brush->mask_overlay_alpha = 33;
} }
}
#undef BRUSH_FIXED #undef BRUSH_FIXED
} }
@@ -2119,12 +2202,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (con = ob->constraints.first; con; con = con->next) { for (con = ob->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) { if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) {
bShrinkwrapConstraint *data = (bShrinkwrapConstraint *)con->data; bShrinkwrapConstraint *data = (bShrinkwrapConstraint *)con->data;
if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) {
data->projAxis = OB_POSX; data->projAxis = OB_POSX;
else if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) }
else if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) {
data->projAxis = OB_POSY; data->projAxis = OB_POSY;
else }
else {
data->projAxis = OB_POSZ; data->projAxis = OB_POSZ;
}
data->projAxisSpace = CONSTRAINT_SPACE_LOCAL; data->projAxisSpace = CONSTRAINT_SPACE_LOCAL;
} }
} }
@@ -2177,15 +2263,17 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (sa->spacetype == SPACE_NODE) { if (sa->spacetype == SPACE_NODE) {
ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS); ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
if (ar) if (ar) {
continue; continue;
}
/* add subdiv level; after header */ /* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */ /* is error! */
if (ar == NULL) if (ar == NULL) {
continue; continue;
}
arnew = MEM_callocN(sizeof(ARegion), "node tools"); arnew = MEM_callocN(sizeof(ARegion), "node tools");
@@ -2304,12 +2392,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) { for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* this can now be turned off */ /* this can now be turned off */
ToolSettings *ts = scene->toolsettings; ToolSettings *ts = scene->toolsettings;
if (ts->sculpt) if (ts->sculpt) {
ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE; ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE;
}
/* 'Increment' mode disabled for nodes, use true grid snapping instead */ /* 'Increment' mode disabled for nodes, use true grid snapping instead */
if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT) if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT) {
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID; scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
}
#ifdef WITH_FFMPEG #ifdef WITH_FFMPEG
/* Update for removed "sound-only" option in FFMPEG export settings. */ /* Update for removed "sound-only" option in FFMPEG export settings. */
@@ -2404,17 +2494,21 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}; };
int symmetry_flags = sd->flags & 7; int symmetry_flags = sd->flags & 7;
if (symmetry_flags & SCULPT_SYMM_X) if (symmetry_flags & SCULPT_SYMM_X) {
sd->paint.symmetry_flags |= PAINT_SYMM_X; sd->paint.symmetry_flags |= PAINT_SYMM_X;
if (symmetry_flags & SCULPT_SYMM_Y) }
if (symmetry_flags & SCULPT_SYMM_Y) {
sd->paint.symmetry_flags |= PAINT_SYMM_Y; sd->paint.symmetry_flags |= PAINT_SYMM_Y;
if (symmetry_flags & SCULPT_SYMM_Z) }
if (symmetry_flags & SCULPT_SYMM_Z) {
sd->paint.symmetry_flags |= PAINT_SYMM_Z; sd->paint.symmetry_flags |= PAINT_SYMM_Z;
if (symmetry_flags & SCULPT_SYMMETRY_FEATHER) }
if (symmetry_flags & SCULPT_SYMMETRY_FEATHER) {
sd->paint.symmetry_flags |= PAINT_SYMMETRY_FEATHER; sd->paint.symmetry_flags |= PAINT_SYMMETRY_FEATHER;
} }
} }
} }
}
if (!MAIN_VERSION_ATLEAST(bmain, 269, 8)) { if (!MAIN_VERSION_ATLEAST(bmain, 269, 8)) {
Curve *cu; Curve *cu;

View File

@@ -324,12 +324,15 @@ static void do_versions_compositor_render_passes_storage(bNode *node)
node_cmp_rlayers_sock_to_pass(pass_index), node_cmp_rlayers_sock_to_pass(pass_index),
sizeof(sockdata->pass_name)); sizeof(sockdata->pass_name));
if (pass_index == 0) if (pass_index == 0) {
sockname = "Image"; sockname = "Image";
else if (pass_index == 1) }
else if (pass_index == 1) {
sockname = "Alpha"; sockname = "Alpha";
else }
else {
sockname = node_cmp_rlayers_sock_to_pass(pass_index); sockname = node_cmp_rlayers_sock_to_pass(pass_index);
}
BLI_strncpy(sock->name, sockname, sizeof(sock->name)); BLI_strncpy(sock->name, sockname, sizeof(sock->name));
} }
} }
@@ -359,10 +362,12 @@ static char *replace_bbone_easing_rnapath(char *old_path)
/* NOTE: This will break paths for any bones/custom-properties /* NOTE: This will break paths for any bones/custom-properties
* which happen be named after the bbone property id's * which happen be named after the bbone property id's
*/ */
if (strstr(old_path, "bbone_in")) if (strstr(old_path, "bbone_in")) {
new_path = BLI_str_replaceN(old_path, "bbone_in", "bbone_easein"); new_path = BLI_str_replaceN(old_path, "bbone_in", "bbone_easein");
else if (strstr(old_path, "bbone_out")) }
else if (strstr(old_path, "bbone_out")) {
new_path = BLI_str_replaceN(old_path, "bbone_out", "bbone_easeout"); new_path = BLI_str_replaceN(old_path, "bbone_out", "bbone_easeout");
}
if (new_path) { if (new_path) {
MEM_freeN(old_path); MEM_freeN(old_path);
@@ -658,10 +663,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Brush *br; Brush *br;
for (br = bmain->brushes.first; br; br = br->id.next) { for (br = bmain->brushes.first; br; br = br->id.next) {
if ((br->ob_mode & OB_MODE_SCULPT) && if ((br->ob_mode & OB_MODE_SCULPT) &&
ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK)) ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK)) {
br->alpha = 1.0f; br->alpha = 1.0f;
} }
} }
}
if (!MAIN_VERSION_ATLEAST(bmain, 272, 2)) { if (!MAIN_VERSION_ATLEAST(bmain, 272, 2)) {
if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) { if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) {
@@ -729,12 +735,14 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 273, 3)) { if (!MAIN_VERSION_ATLEAST(bmain, 273, 3)) {
ParticleSettings *part; ParticleSettings *part;
for (part = bmain->particles.first; part; part = part->id.next) { for (part = bmain->particles.first; part; part = part->id.next) {
if (part->clumpcurve) if (part->clumpcurve) {
part->child_flag |= PART_CHILD_USE_CLUMP_CURVE; part->child_flag |= PART_CHILD_USE_CLUMP_CURVE;
if (part->roughcurve) }
if (part->roughcurve) {
part->child_flag |= PART_CHILD_USE_ROUGH_CURVE; part->child_flag |= PART_CHILD_USE_ROUGH_CURVE;
} }
} }
}
if (!MAIN_VERSION_ATLEAST(bmain, 273, 6)) { if (!MAIN_VERSION_ATLEAST(bmain, 273, 6)) {
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) { if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
@@ -918,11 +926,13 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19) #define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21) #define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
if (seq->strip && seq->strip->proxy && !seq->strip->proxy->storage) { if (seq->strip && seq->strip->proxy && !seq->strip->proxy->storage) {
if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR; seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_DIR;
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) }
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE; seq->strip->proxy->storage = SEQ_STORAGE_PROXY_CUSTOM_FILE;
} }
}
#undef SEQ_USE_PROXY_CUSTOM_DIR #undef SEQ_USE_PROXY_CUSTOM_DIR
#undef SEQ_USE_PROXY_CUSTOM_FILE #undef SEQ_USE_PROXY_CUSTOM_FILE
} }
@@ -1193,12 +1203,14 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
} }
} }
if (enabled) if (enabled) {
gpd->flag |= GP_DATA_SHOW_ONIONSKINS; gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
else }
else {
gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS; gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
} }
} }
}
if (!MAIN_VERSION_ATLEAST(bmain, 276, 5)) { if (!MAIN_VERSION_ATLEAST(bmain, 276, 5)) {
ListBase *lbarray[MAX_LIBARRAY]; ListBase *lbarray[MAX_LIBARRAY];
int a; int a;
@@ -1437,14 +1449,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
copy_v4_v4(palcolor->color, gpl->color); copy_v4_v4(palcolor->color, gpl->color);
copy_v4_v4(palcolor->fill, gpl->fill); copy_v4_v4(palcolor->fill, gpl->fill);
if (gpl->flag & GP_LAYER_HIDE) if (gpl->flag & GP_LAYER_HIDE) {
palcolor->flag |= PC_COLOR_HIDE; palcolor->flag |= PC_COLOR_HIDE;
if (gpl->flag & GP_LAYER_LOCKED) }
if (gpl->flag & GP_LAYER_LOCKED) {
palcolor->flag |= PC_COLOR_LOCKED; palcolor->flag |= PC_COLOR_LOCKED;
if (gpl->flag & GP_LAYER_ONIONSKIN) }
if (gpl->flag & GP_LAYER_ONIONSKIN) {
palcolor->flag |= PC_COLOR_ONIONSKIN; palcolor->flag |= PC_COLOR_ONIONSKIN;
if (gpl->flag & GP_LAYER_VOLUMETRIC) }
if (gpl->flag & GP_LAYER_VOLUMETRIC) {
palcolor->flag |= PC_COLOR_VOLUMETRIC; palcolor->flag |= PC_COLOR_VOLUMETRIC;
}
/* set layer opacity to 1 */ /* set layer opacity to 1 */
gpl->opacity = 1.0f; gpl->opacity = 1.0f;

View File

@@ -853,8 +853,9 @@ void do_versions_after_linking_280(Main *bmain)
/* Update Curve object Shape Key data layout to include the Radius property */ /* Update Curve object Shape Key data layout to include the Radius property */
if (!MAIN_VERSION_ATLEAST(bmain, 280, 23)) { if (!MAIN_VERSION_ATLEAST(bmain, 280, 23)) {
for (Curve *cu = bmain->curves.first; cu; cu = cu->id.next) { for (Curve *cu = bmain->curves.first; cu; cu = cu->id.next) {
if (!cu->key || cu->key->elemsize != sizeof(float[4])) if (!cu->key || cu->key->elemsize != sizeof(float[4])) {
continue; continue;
}
cu->key->elemstr[0] = 3; /*KEYELEM_ELEM_SIZE_CURVE*/ cu->key->elemstr[0] = 3; /*KEYELEM_ELEM_SIZE_CURVE*/
cu->key->elemsize = sizeof(float[3]); cu->key->elemsize = sizeof(float[3]);
@@ -865,8 +866,9 @@ void do_versions_after_linking_280(Main *bmain)
int old_count = block->totelem; int old_count = block->totelem;
void *old_data = block->data; void *old_data = block->data;
if (!old_data || old_count <= 0) if (!old_data || old_count <= 0) {
continue; continue;
}
block->totelem = new_count; block->totelem = new_count;
block->data = MEM_callocN(sizeof(float[3]) * new_count, __func__); block->data = MEM_callocN(sizeof(float[3]) * new_count, __func__);

View File

@@ -97,8 +97,9 @@ static void vcol_to_fcol(Mesh *me)
uint *mcol, *mcoln, *mcolmain; uint *mcol, *mcoln, *mcolmain;
int a; int a;
if (me->totface == 0 || me->mcol == NULL) if (me->totface == 0 || me->mcol == NULL) {
return; return;
}
mcoln = mcolmain = MEM_malloc_arrayN(me->totface, 4 * sizeof(int), "mcoln"); mcoln = mcolmain = MEM_malloc_arrayN(me->totface, 4 * sizeof(int), "mcoln");
mcol = (uint *)me->mcol; mcol = (uint *)me->mcol;
@@ -128,9 +129,10 @@ static void do_version_bone_head_tail_237(Bone *bone)
mul_v3_fl(vec, bone->length); mul_v3_fl(vec, bone->length);
add_v3_v3v3(bone->arm_tail, bone->arm_head, vec); add_v3_v3v3(bone->arm_tail, bone->arm_head, vec);
for (child = bone->childbase.first; child; child = child->next) for (child = bone->childbase.first; child; child = child->next) {
do_version_bone_head_tail_237(child); do_version_bone_head_tail_237(child);
} }
}
static void bone_version_238(ListBase *lb) static void bone_version_238(ListBase *lb)
{ {
@@ -142,9 +144,10 @@ static void bone_version_238(ListBase *lb)
bone->rad_tail = 0.1f * bone->length; bone->rad_tail = 0.1f * bone->length;
bone->dist -= bone->rad_head; bone->dist -= bone->rad_head;
if (bone->dist <= 0.0f) if (bone->dist <= 0.0f) {
bone->dist = 0.0f; bone->dist = 0.0f;
} }
}
bone_version_238(&bone->childbase); bone_version_238(&bone->childbase);
} }
} }
@@ -154,8 +157,9 @@ static void bone_version_239(ListBase *lb)
Bone *bone; Bone *bone;
for (bone = lb->first; bone; bone = bone->next) { for (bone = lb->first; bone; bone = bone->next) {
if (bone->layer == 0) if (bone->layer == 0) {
bone->layer = 1; bone->layer = 1;
}
bone_version_239(&bone->childbase); bone_version_239(&bone->childbase);
} }
} }
@@ -197,13 +201,14 @@ static void ntree_version_242(bNodeTree *ntree)
if (node->type == CMP_NODE_HUE_SAT) { if (node->type == CMP_NODE_HUE_SAT) {
if (node->storage) { if (node->storage) {
NodeHueSat *nhs = node->storage; NodeHueSat *nhs = node->storage;
if (nhs->val == 0.0f) if (nhs->val == 0.0f) {
nhs->val = 1.0f; nhs->val = 1.0f;
} }
} }
} }
} }
} }
}
static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree) static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
{ {
@@ -219,10 +224,11 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
if (!node->storage) { if (!node->storage) {
ntf = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); ntf = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
node->storage = ntf; node->storage = ntf;
if (node->custom1) if (node->custom1) {
ntf->x = 1.0f; ntf->x = 1.0f;
} }
} }
}
/* fix for temporary flag changes during 245 cycle */ /* fix for temporary flag changes during 245 cycle */
nodeid = blo_do_versions_newlibadr(fd, lib, node->id); nodeid = blo_do_versions_newlibadr(fd, lib, node->id);
@@ -247,9 +253,10 @@ static void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
int i; int i;
for (loop = prop->data.group.first, i = 0; loop; loop = loop->next, i++) { for (loop = prop->data.group.first, i = 0; loop; loop = loop->next, i++) {
if (loop->type == IDP_GROUP) if (loop->type == IDP_GROUP) {
idproperties_fix_groups_lengths_recurse(loop); idproperties_fix_groups_lengths_recurse(loop);
} }
}
if (prop->len != i) { if (prop->len != i) {
printf("Found and fixed bad id property group length.\n"); printf("Found and fixed bad id property group length.\n");
@@ -279,19 +286,22 @@ static void customdata_version_242(Mesh *me)
if (!me->vdata.totlayer) { if (!me->vdata.totlayer) {
CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, me->mvert, me->totvert); CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, me->mvert, me->totvert);
if (me->dvert) if (me->dvert) {
CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_ASSIGN, me->dvert, me->totvert); CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_ASSIGN, me->dvert, me->totvert);
} }
}
if (!me->edata.totlayer) if (!me->edata.totlayer) {
CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->medge, me->totedge); CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->medge, me->totedge);
}
if (!me->fdata.totlayer) { if (!me->fdata.totlayer) {
CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, me->mface, me->totface); CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, me->mface, me->totface);
if (me->tface) { if (me->tface) {
if (me->mcol) if (me->mcol) {
MEM_freeN(me->mcol); MEM_freeN(me->mcol);
}
me->mcol = CustomData_add_layer(&me->fdata, CD_MCOL, CD_CALLOC, NULL, me->totface); me->mcol = CustomData_add_layer(&me->fdata, CD_MCOL, CD_CALLOC, NULL, me->totface);
me->mtface = CustomData_add_layer(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface); me->mtface = CustomData_add_layer(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface);
@@ -323,20 +333,24 @@ static void customdata_version_242(Mesh *me)
if (layer->type == CD_MTFACE) { if (layer->type == CD_MTFACE) {
if (layer->name[0] == 0) { if (layer->name[0] == 0) {
if (mtfacen == 0) if (mtfacen == 0) {
strcpy(layer->name, "UVMap"); strcpy(layer->name, "UVMap");
else }
else {
BLI_snprintf(layer->name, sizeof(layer->name), "UVMap.%.3d", mtfacen); BLI_snprintf(layer->name, sizeof(layer->name), "UVMap.%.3d", mtfacen);
} }
}
mtfacen++; mtfacen++;
} }
else if (layer->type == CD_MCOL) { else if (layer->type == CD_MCOL) {
if (layer->name[0] == 0) { if (layer->name[0] == 0) {
if (mcoln == 0) if (mcoln == 0) {
strcpy(layer->name, "Col"); strcpy(layer->name, "Col");
else }
else {
BLI_snprintf(layer->name, sizeof(layer->name), "Col.%.3d", mcoln); BLI_snprintf(layer->name, sizeof(layer->name), "Col.%.3d", mcoln);
} }
}
mcoln++; mcoln++;
} }
} }
@@ -394,9 +408,10 @@ static void do_version_free_effect_245(Effect *eff)
if (eff->type == EFF_PARTICLE) { if (eff->type == EFF_PARTICLE) {
paf = (PartEff *)eff; paf = (PartEff *)eff;
if (paf->keys) if (paf->keys) {
MEM_freeN(paf->keys); MEM_freeN(paf->keys);
} }
}
MEM_freeN(eff); MEM_freeN(eff);
} }
@@ -437,11 +452,12 @@ static void do_version_constraints_245(ListBase *lb)
bLocateLikeConstraint *data = (bLocateLikeConstraint *)con->data; bLocateLikeConstraint *data = (bLocateLikeConstraint *)con->data;
/* new headtail functionality makes Bone-Tip function obsolete */ /* new headtail functionality makes Bone-Tip function obsolete */
if (data->flag & LOCLIKE_TIP) if (data->flag & LOCLIKE_TIP) {
con->headtail = 1.0f; con->headtail = 1.0f;
} }
} }
} }
}
PartEff *blo_do_version_give_parteff_245(Object *ob) PartEff *blo_do_version_give_parteff_245(Object *ob)
{ {
@@ -449,8 +465,9 @@ PartEff *blo_do_version_give_parteff_245(Object *ob)
paf = ob->effect.first; paf = ob->effect.first;
while (paf) { while (paf) {
if (paf->type == EFF_PARTICLE) if (paf->type == EFF_PARTICLE) {
return paf; return paf;
}
paf = paf->next; paf = paf->next;
} }
return NULL; return NULL;
@@ -518,10 +535,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ob->colbits = 0; ob->colbits = 0;
if (ob->totcol) { if (ob->totcol) {
for (a = 0; a < ob->totcol; a++) { for (a = 0; a < ob->totcol; a++) {
if (ob->mat[a]) if (ob->mat[a]) {
ob->colbits |= (1 << a); ob->colbits |= (1 << a);
} }
} }
}
ob = ob->id.next; ob = ob->id.next;
} }
} }
@@ -541,8 +559,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* mcol changed */ /* mcol changed */
Mesh *me = bmain->meshes.first; Mesh *me = bmain->meshes.first;
while (me) { while (me) {
if (me->mcol) if (me->mcol) {
vcol_to_fcol(me); vcol_to_fcol(me);
}
me = me->id.next; me = me->id.next;
} }
} }
@@ -551,8 +570,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Object *ob; Object *ob;
ob = bmain->objects.first; ob = bmain->objects.first;
while (ob) { while (ob) {
if (ob->dt == 0) if (ob->dt == 0) {
ob->dt = OB_SOLID; ob->dt = OB_SOLID;
}
ob = ob->id.next; ob = ob->id.next;
} }
} }
@@ -568,9 +588,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (sl->spacetype == SPACE_VIEW3D) { if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl; View3D *v3d = (View3D *)sl;
if (v3d->gridlines == 0) if (v3d->gridlines == 0) {
v3d->gridlines = 20; v3d->gridlines = 20;
} }
}
sl = sl->next; sl = sl->next;
} }
sa = sa->next; sa = sa->next;
@@ -609,8 +630,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 153) { if (bmain->versionfile <= 153) {
Scene *sce = bmain->scenes.first; Scene *sce = bmain->scenes.first;
while (sce) { while (sce) {
if (sce->r.blurfac == 0.0f) if (sce->r.blurfac == 0.0f) {
sce->r.blurfac = 1.0f; sce->r.blurfac = 1.0f;
}
sce = sce->id.next; sce = sce->id.next;
} }
} }
@@ -618,8 +640,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 163) { if (bmain->versionfile <= 163) {
Scene *sce = bmain->scenes.first; Scene *sce = bmain->scenes.first;
while (sce) { while (sce) {
if (sce->r.frs_sec == 0) if (sce->r.frs_sec == 0) {
sce->r.frs_sec = 25; sce->r.frs_sec = 25;
}
sce = sce->id.next; sce = sce->id.next;
} }
} }
@@ -662,8 +685,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 169) { if (bmain->versionfile <= 169) {
Mesh *me = bmain->meshes.first; Mesh *me = bmain->meshes.first;
while (me) { while (me) {
if (me->subdiv == 0) if (me->subdiv == 0) {
me->subdiv = 1; me->subdiv = 1;
}
me = me->id.next; me = me->id.next;
} }
} }
@@ -759,10 +783,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
sound->min_gain = 0.0; sound->min_gain = 0.0;
sound->distance = 1.0; sound->distance = 1.0;
if (sound->attenuation > 0.0f) if (sound->attenuation > 0.0f) {
sound->flags |= SOUND_FLAGS_3D; sound->flags |= SOUND_FLAGS_3D;
else }
else {
sound->flags &= ~SOUND_FLAGS_3D; sound->flags &= ~SOUND_FLAGS_3D;
}
sound = sound->id.next; sound = sound->id.next;
} }
@@ -784,13 +810,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
me->subdiv = 1; me->subdiv = 1;
} }
else { else {
if (me->subdiv < 2) if (me->subdiv < 2) {
me->subdiv = 1; me->subdiv = 1;
else }
else {
me->subdiv--; me->subdiv--;
} }
} }
} }
}
if (bmain->versionfile <= 220) { if (bmain->versionfile <= 220) {
Mesh *me; Mesh *me;
@@ -1146,8 +1174,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (wrld->aodist == 0.0f) { if (wrld->aodist == 0.0f) {
wrld->aodist = 10.0f; wrld->aodist = 10.0f;
} }
if (wrld->aoenergy == 0.0f) if (wrld->aoenergy == 0.0f) {
wrld->aoenergy = 1.0f; wrld->aoenergy = 1.0f;
}
wrld = wrld->id.next; wrld = wrld->id.next;
} }
@@ -1196,13 +1225,14 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) { for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_TEXT) { if (sl->spacetype == SPACE_TEXT) {
SpaceText *st = (SpaceText *)sl; SpaceText *st = (SpaceText *)sl;
if (st->tabnumber == 0) if (st->tabnumber == 0) {
st->tabnumber = 2; st->tabnumber = 2;
} }
} }
} }
} }
} }
}
if (bmain->versionfile <= 235) { if (bmain->versionfile <= 235) {
Tex *tex = bmain->textures.first; Tex *tex = bmain->textures.first;
@@ -1211,17 +1241,19 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Editing *ed; Editing *ed;
while (tex) { while (tex) {
if (tex->nabla == 0.0f) if (tex->nabla == 0.0f) {
tex->nabla = 0.025f; tex->nabla = 0.025f;
}
tex = tex->id.next; tex = tex->id.next;
} }
while (sce) { while (sce) {
ed = sce->ed; ed = sce->ed;
if (ed) { if (ed) {
SEQ_BEGIN (sce->ed, seq) { SEQ_BEGIN (sce->ed, seq) {
if (seq->type == SEQ_TYPE_IMAGE || seq->type == SEQ_TYPE_MOVIE) if (seq->type == SEQ_TYPE_IMAGE || seq->type == SEQ_TYPE_MOVIE) {
seq->alpha_mode = SEQ_ALPHA_STRAIGHT; seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
} }
}
SEQ_END; SEQ_END;
} }
@@ -1236,9 +1268,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
while (cam) { while (cam) {
if (cam->ortho_scale == 0.0f) { if (cam->ortho_scale == 0.0f) {
cam->ortho_scale = 256.0f / cam->lens; cam->ortho_scale = 256.0f / cam->lens;
if (cam->type == CAM_ORTHO) if (cam->type == CAM_ORTHO) {
printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n"); printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
} }
}
cam = cam->id.next; cam = cam->id.next;
} }
/* force oops draw if depgraph was set*/ /* force oops draw if depgraph was set*/
@@ -1247,10 +1280,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* softbody init new vars */ /* softbody init new vars */
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->soft) { if (ob->soft) {
if (ob->soft->defgoal == 0.0f) if (ob->soft->defgoal == 0.0f) {
ob->soft->defgoal = 0.7f; ob->soft->defgoal = 0.7f;
if (ob->soft->physics_speed == 0.0f) }
if (ob->soft->physics_speed == 0.0f) {
ob->soft->physics_speed = 1.0f; ob->soft->physics_speed = 1.0f;
}
if (ob->soft->interval == 0) { if (ob->soft->interval == 0) {
ob->soft->interval = 2; ob->soft->interval = 2;
@@ -1278,20 +1313,23 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (arm = bmain->armatures.first; arm; arm = arm->id.next) { for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
BKE_armature_where_is(arm); BKE_armature_where_is(arm);
for (bone = arm->bonebase.first; bone; bone = bone->next) for (bone = arm->bonebase.first; bone; bone = bone->next) {
do_version_bone_head_tail_237(bone); do_version_bone_head_tail_237(bone);
} }
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->parent) { if (ob->parent) {
Object *parent = blo_do_versions_newlibadr(fd, lib, ob->parent); Object *parent = blo_do_versions_newlibadr(fd, lib, ob->parent);
if (parent && parent->type == OB_LATTICE) if (parent && parent->type == OB_LATTICE) {
ob->partype = PARSKEL; ob->partype = PARSKEL;
} }
}
/* btw. armature_rebuild_pose is further only called on leave editmode */ /* btw. armature_rebuild_pose is further only called on leave editmode */
if (ob->type == OB_ARMATURE) { if (ob->type == OB_ARMATURE) {
if (ob->pose) if (ob->pose) {
BKE_pose_tag_recalc(bmain, ob->pose); BKE_pose_tag_recalc(bmain, ob->pose);
}
/* cannot call stuff now (pointers!), done in setup_app_data */ /* cannot call stuff now (pointers!), done in setup_app_data */
ob->id.recalc |= ID_RECALC_ALL; ob->id.recalc |= ID_RECALC_ALL;
@@ -1319,13 +1357,16 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
smd->subdivType = me->subsurftype; smd->subdivType = me->subsurftype;
smd->modifier.mode = 0; smd->modifier.mode = 0;
if (me->subdiv != 0) if (me->subdiv != 0) {
smd->modifier.mode |= 1; smd->modifier.mode |= 1;
if (me->subdivr != 0) }
if (me->subdivr != 0) {
smd->modifier.mode |= 2; smd->modifier.mode |= 2;
}
if (me->flag & ME_OPT_EDGES) if (me->flag & ME_OPT_EDGES) {
smd->flags |= eSubsurfModifierFlag_ControlEdges; smd->flags |= eSubsurfModifierFlag_ControlEdges;
}
BLI_addtail(&ob->modifiers, smd); BLI_addtail(&ob->modifiers, smd);
@@ -1341,13 +1382,14 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (obc && obc->type == OB_CURVE) { if (obc && obc->type == OB_CURVE) {
Curve *cu = blo_do_versions_newlibadr(fd, lib, obc->data); Curve *cu = blo_do_versions_newlibadr(fd, lib, obc->data);
if (cu) if (cu) {
cu->flag |= CU_PATH; cu->flag |= CU_PATH;
} }
} }
} }
} }
} }
}
if (bmain->versionfile <= 238) { if (bmain->versionfile <= 238) {
Lattice *lt; Lattice *lt;
@@ -1431,14 +1473,17 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
paf = blo_do_version_give_parteff_245(ob); paf = blo_do_version_give_parteff_245(ob);
if (paf) { if (paf) {
if (paf->disp == 0) if (paf->disp == 0) {
paf->disp = 100; paf->disp = 100;
if (paf->speedtex == 0) }
if (paf->speedtex == 0) {
paf->speedtex = 8; paf->speedtex = 8;
if (paf->omat == 0) }
if (paf->omat == 0) {
paf->omat = 1; paf->omat = 1;
} }
} }
}
for (arm = bmain->armatures.first; arm; arm = arm->id.next) { for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_238(&arm->bonebase); bone_version_238(&arm->bonebase);
@@ -1460,9 +1505,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (kb = key->block.first; kb; kb = kb->next) { for (kb = key->block.first; kb; kb = kb->next) {
if (kb == key->refkey) { if (kb == key->refkey) {
if (kb->name[0] == 0) if (kb->name[0] == 0) {
strcpy(kb->name, "Basis"); strcpy(kb->name, "Basis");
} }
}
else { else {
if (kb->name[0] == 0) { if (kb->name[0] == 0) {
BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index); BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
@@ -1499,9 +1545,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* updating stepsize for ghost drawing */ /* updating stepsize for ghost drawing */
for (arm = bmain->armatures.first; arm; arm = arm->id.next) { for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_239(&arm->bonebase); bone_version_239(&arm->bonebase);
if (arm->layer == 0) if (arm->layer == 0) {
arm->layer = 1; arm->layer = 1;
} }
}
for (; sce; sce = sce->id.next) { for (; sce; sce = sce->id.next) {
if (sce->r.scemode & R_PASSEPARTOUT) { if (sce->r.scemode & R_PASSEPARTOUT) {
@@ -1511,18 +1558,21 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
} }
for (; cam; cam = cam->id.next) { for (; cam; cam = cam->id.next) {
if (set_passepartout) if (set_passepartout) {
cam->flag |= CAM_SHOWPASSEPARTOUT; cam->flag |= CAM_SHOWPASSEPARTOUT;
}
/* make sure old cameras have title safe on */ /* make sure old cameras have title safe on */
if (!(cam->flag & CAM_SHOW_SAFE_MARGINS)) if (!(cam->flag & CAM_SHOW_SAFE_MARGINS)) {
cam->flag |= CAM_SHOW_SAFE_MARGINS; cam->flag |= CAM_SHOW_SAFE_MARGINS;
}
/* set an appropriate camera passepartout alpha */ /* set an appropriate camera passepartout alpha */
if (!(cam->passepartalpha)) if (!(cam->passepartalpha)) {
cam->passepartalpha = 0.2f; cam->passepartalpha = 0.2f;
} }
} }
}
if (bmain->versionfile <= 241) { if (bmain->versionfile <= 241) {
Object *ob; Object *ob;
@@ -1534,12 +1584,14 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* updating layers still */ /* updating layers still */
for (arm = bmain->armatures.first; arm; arm = arm->id.next) { for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_239(&arm->bonebase); bone_version_239(&arm->bonebase);
if (arm->layer == 0) if (arm->layer == 0) {
arm->layer = 1; arm->layer = 1;
} }
}
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->audio.mixrate == 0) if (sce->audio.mixrate == 0) {
sce->audio.mixrate = 48000; sce->audio.mixrate = 48000;
}
/* We don't add default layer since blender2.8 because the layers /* We don't add default layer since blender2.8 because the layers
* are now in Scene->view_layers and a default layer is created in * are now in Scene->view_layers and a default layer is created in
@@ -1548,14 +1600,16 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
SceneRenderLayer *srl; SceneRenderLayer *srl;
/* new layer flag for sky, was default for solid */ /* new layer flag for sky, was default for solid */
for (srl = sce->r.layers.first; srl; srl = srl->next) { for (srl = sce->r.layers.first; srl; srl = srl->next) {
if (srl->layflag & SCE_LAY_SOLID) if (srl->layflag & SCE_LAY_SOLID) {
srl->layflag |= SCE_LAY_SKY; srl->layflag |= SCE_LAY_SKY;
}
srl->passflag &= (SCE_PASS_COMBINED | SCE_PASS_Z | SCE_PASS_NORMAL | SCE_PASS_VECTOR); srl->passflag &= (SCE_PASS_COMBINED | SCE_PASS_Z | SCE_PASS_NORMAL | SCE_PASS_VECTOR);
} }
/* node version changes */ /* node version changes */
if (sce->nodetree) if (sce->nodetree) {
ntree_version_241(sce->nodetree); ntree_version_241(sce->nodetree);
}
/* uv calculation options moved to toolsettings */ /* uv calculation options moved to toolsettings */
if (sce->toolsettings->unwrapper == 0) { if (sce->toolsettings->unwrapper == 0) {
@@ -1564,12 +1618,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
} }
} }
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
ntree_version_241(ntree); ntree_version_241(ntree);
}
for (la = bmain->lights.first; la; la = la->id.next) for (la = bmain->lights.first; la; la = la->id.next) {
if (la->buffers == 0) if (la->buffers == 0) {
la->buffers = 1; la->buffers = 1;
}
}
/* for empty drawsize and drawtype */ /* for empty drawsize and drawtype */
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
@@ -1614,10 +1671,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) { for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) { if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl; View3D *v3d = (View3D *)sl;
if (v3d->gridsubdiv == 0) if (v3d->gridsubdiv == 0) {
v3d->gridsubdiv = 10; v3d->gridsubdiv = 10;
} }
} }
}
sa = sa->next; sa = sa->next;
} }
} }
@@ -1626,20 +1684,25 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
enum { enum {
R_THREADS = (1 << 19), R_THREADS = (1 << 19),
}; };
if (sce->toolsettings->select_thresh == 0.0f) if (sce->toolsettings->select_thresh == 0.0f) {
sce->toolsettings->select_thresh = 0.01f; sce->toolsettings->select_thresh = 0.01f;
}
if (sce->r.threads == 0) { if (sce->r.threads == 0) {
if (sce->r.mode & R_THREADS) if (sce->r.mode & R_THREADS) {
sce->r.threads = 2; sce->r.threads = 2;
else }
else {
sce->r.threads = 1; sce->r.threads = 1;
} }
if (sce->nodetree) }
if (sce->nodetree) {
ntree_version_242(sce->nodetree); ntree_version_242(sce->nodetree);
} }
}
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
ntree_version_242(ntree); ntree_version_242(ntree);
}
/* add default radius values to old curve points */ /* add default radius values to old curve points */
for (cu = bmain->curves.first; cu; cu = cu->id.next) { for (cu = bmain->curves.first; cu; cu = cu->id.next) {
@@ -1647,19 +1710,21 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (nu) { if (nu) {
if (nu->bezt) { if (nu->bezt) {
for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) { for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
if (!bezt->radius) if (!bezt->radius) {
bezt->radius = 1.0; bezt->radius = 1.0;
} }
} }
}
else if (nu->bp) { else if (nu->bp) {
for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) { for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
if (!bp->radius) if (!bp->radius) {
bp->radius = 1.0; bp->radius = 1.0;
} }
} }
} }
} }
} }
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ModifierData *md; ModifierData *md;
@@ -1675,10 +1740,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
switch (curcon->type) { switch (curcon->type) {
case CONSTRAINT_TYPE_MINMAX: { case CONSTRAINT_TYPE_MINMAX: {
bMinMaxConstraint *data = curcon->data; bMinMaxConstraint *data = curcon->data;
if (data->sticky == 1) if (data->sticky == 1) {
data->flag |= MINMAX_STICKY; data->flag |= MINMAX_STICKY;
else }
else {
data->flag &= ~MINMAX_STICKY; data->flag &= ~MINMAX_STICKY;
}
break; break;
} }
@@ -1686,8 +1753,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bRotateLikeConstraint *data = curcon->data; bRotateLikeConstraint *data = curcon->data;
/* version patch from buttons_object.c */ /* version patch from buttons_object.c */
if (data->flag == 0) if (data->flag == 0) {
data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z; data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
}
break; break;
} }
@@ -1704,10 +1772,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
switch (curcon->type) { switch (curcon->type) {
case CONSTRAINT_TYPE_MINMAX: { case CONSTRAINT_TYPE_MINMAX: {
bMinMaxConstraint *data = curcon->data; bMinMaxConstraint *data = curcon->data;
if (data->sticky == 1) if (data->sticky == 1) {
data->flag |= MINMAX_STICKY; data->flag |= MINMAX_STICKY;
else }
else {
data->flag &= ~MINMAX_STICKY; data->flag &= ~MINMAX_STICKY;
}
break; break;
} }
case CONSTRAINT_TYPE_KINEMATIC: { case CONSTRAINT_TYPE_KINEMATIC: {
@@ -1722,8 +1792,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bRotateLikeConstraint *data = curcon->data; bRotateLikeConstraint *data = curcon->data;
/* version patch from buttons_object.c */ /* version patch from buttons_object.c */
if (data->flag == 0) if (data->flag == 0) {
data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z; data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
}
break; break;
} }
} }
@@ -1737,23 +1808,28 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (md->type == eModifierType_Curve) { if (md->type == eModifierType_Curve) {
CurveModifierData *cmd = (CurveModifierData *)md; CurveModifierData *cmd = (CurveModifierData *)md;
if (cmd->defaxis == 0) if (cmd->defaxis == 0) {
cmd->defaxis = ob->trackflag + 1; cmd->defaxis = ob->trackflag + 1;
} }
} }
} }
}
for (ma = bmain->materials.first; ma; ma = ma->id.next) { for (ma = bmain->materials.first; ma; ma = ma->id.next) {
if (ma->nodetree) if (ma->nodetree) {
ntree_version_242(ma->nodetree); ntree_version_242(ma->nodetree);
} }
}
for (me = bmain->meshes.first; me; me = me->id.next) for (me = bmain->meshes.first; me; me = me->id.next) {
customdata_version_242(me); customdata_version_242(me);
}
for (collection = bmain->collections.first; collection; collection = collection->id.next) for (collection = bmain->collections.first; collection; collection = collection->id.next) {
if (collection->layer == 0) if (collection->layer == 0) {
collection->layer = (1 << 20) - 1; collection->layer = (1 << 20) - 1;
}
}
/* now, subversion control! */ /* now, subversion control! */
if (bmain->subversionfile < 3) { if (bmain->subversionfile < 3) {
@@ -1796,15 +1872,19 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC) != 0; tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC) != 0;
} }
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) if (sce->nodetree) {
do_version_ntree_242_2(sce->nodetree); do_version_ntree_242_2(sce->nodetree);
} }
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) }
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
do_version_ntree_242_2(ntree); do_version_ntree_242_2(ntree);
for (ma = bmain->materials.first; ma; ma = ma->id.next) }
if (ma->nodetree) for (ma = bmain->materials.first; ma; ma = ma->id.next) {
if (ma->nodetree) {
do_version_ntree_242_2(ma->nodetree); do_version_ntree_242_2(ma->nodetree);
} }
}
}
if (bmain->subversionfile < 4) { if (bmain->subversionfile < 4) {
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
@@ -1857,10 +1937,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* render layer added, this is not the active layer */ /* render layer added, this is not the active layer */
if (bmain->versionfile <= 243 || bmain->subversionfile < 2) { if (bmain->versionfile <= 243 || bmain->subversionfile < 2) {
Mesh *me; Mesh *me;
for (me = bmain->meshes.first; me; me = me->id.next) for (me = bmain->meshes.first; me; me = me->id.next) {
customdata_version_243(me); customdata_version_243(me);
} }
} }
}
if (bmain->versionfile <= 244) { if (bmain->versionfile <= 244) {
bScreen *sc; bScreen *sc;
@@ -1926,8 +2007,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bLocLimitConstraint *data = (bLocLimitConstraint *)curcon->data; bLocLimitConstraint *data = (bLocLimitConstraint *)curcon->data;
/* old limit without parent option for objects */ /* old limit without parent option for objects */
if (data->flag2) if (data->flag2) {
curcon->ownspace = CONSTRAINT_SPACE_LOCAL; curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
}
break; break;
} }
} }
@@ -1956,8 +2038,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bActionConstraint *data = (bActionConstraint *)curcon->data; bActionConstraint *data = (bActionConstraint *)curcon->data;
/* 'data->local' used to mean that target was in local-space */ /* 'data->local' used to mean that target was in local-space */
if (data->local) if (data->local) {
curcon->tarspace = CONSTRAINT_SPACE_LOCAL; curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
}
break; break;
} }
} }
@@ -1982,8 +2065,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* add point caches */ /* add point caches */
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->soft && !ob->soft->pointcache) if (ob->soft && !ob->soft->pointcache) {
ob->soft->pointcache = BKE_ptcache_add(&ob->soft->ptcaches); ob->soft->pointcache = BKE_ptcache_add(&ob->soft->ptcaches);
}
for (psys = ob->particlesystem.first; psys; psys = psys->next) { for (psys = ob->particlesystem.first; psys; psys = psys->next) {
if (psys->pointcache) { if (psys->pointcache) {
@@ -1993,9 +2077,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
psys->pointcache->flag &= ~PTCACHE_BAKED; psys->pointcache->flag &= ~PTCACHE_BAKED;
} }
} }
else else {
psys->pointcache = BKE_ptcache_add(&psys->ptcaches); psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
} }
}
for (md = ob->modifiers.first; md; md = md->next) { for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) { if (md->type == eModifierType_Cloth) {
@@ -2043,13 +2128,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
} }
for (part = bmain->particles.first; part; part = part->id.next) { for (part = bmain->particles.first; part; part = part->id.next) {
if (part->ren_child_nbr == 0) if (part->ren_child_nbr == 0) {
part->ren_child_nbr = part->child_nbr; part->ren_child_nbr = part->child_nbr;
} }
}
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) if (sce->nodetree) {
ntree_version_245(fd, lib, sce->nodetree); ntree_version_245(fd, lib, sce->nodetree);
}
if (sce->r.simplify_subsurf == 0) { if (sce->r.simplify_subsurf == 0) {
sce->r.simplify_subsurf = 6; sce->r.simplify_subsurf = 6;
@@ -2057,8 +2144,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
} }
} }
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
ntree_version_245(fd, lib, ntree); ntree_version_245(fd, lib, ntree);
}
/* fix for temporary flag changes during 245 cycle */ /* fix for temporary flag changes during 245 cycle */
for (ima = bmain->images.first; ima; ima = ima->id.next) { for (ima = bmain->images.first; ima; ima = ima->id.next) {
@@ -2095,16 +2183,18 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ModifierData *md; ModifierData *md;
Object *ob; Object *ob;
for (arm = bmain->armatures.first; arm; arm = arm->id.next) for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
arm->deformflag |= ARM_DEF_B_BONE_REST; arm->deformflag |= ARM_DEF_B_BONE_REST;
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
for (md = ob->modifiers.first; md; md = md->next) { for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Armature) if (md->type == eModifierType_Armature) {
((ArmatureModifierData *)md)->deformflag |= ARM_DEF_B_BONE_REST; ((ArmatureModifierData *)md)->deformflag |= ARM_DEF_B_BONE_REST;
} }
} }
} }
}
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 5)) { if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 5)) {
/* foreground color needs to be something other then black */ /* foreground color needs to be something other then black */
@@ -2143,9 +2233,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
int k; int k;
for (k = 0; k < sb->totkey; k++) { for (k = 0; k < sb->totkey; k++) {
if (sb->keys[k]) if (sb->keys[k]) {
MEM_freeN(sb->keys[k]); MEM_freeN(sb->keys[k]);
} }
}
MEM_freeN(sb->keys); MEM_freeN(sb->keys);
@@ -2166,9 +2257,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
int k; int k;
for (k = 0; k < sb->totkey; k++) { for (k = 0; k < sb->totkey; k++) {
if (sb->keys[k]) if (sb->keys[k]) {
MEM_freeN(sb->keys[k]); MEM_freeN(sb->keys[k]);
} }
}
MEM_freeN(sb->keys); MEM_freeN(sb->keys);
@@ -2289,9 +2381,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
{ {
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType( FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(
ob, eModifierType_Fluidsim); ob, eModifierType_Fluidsim);
if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE) if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE) {
part->type = PART_FLUID; part->type = PART_FLUID;
} }
}
do_version_free_effects_245(&ob->effect); do_version_free_effects_245(&ob->effect);
@@ -2324,9 +2417,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Object *ob; Object *ob;
/* dupliface scale */ /* dupliface scale */
for (ob = bmain->objects.first; ob; ob = ob->id.next) for (ob = bmain->objects.first; ob; ob = ob->id.next) {
ob->instance_faces_scale = 1.0f; ob->instance_faces_scale = 1.0f;
} }
}
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) { if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
Object *ob; Object *ob;
@@ -2337,20 +2431,24 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (strip = ob->nlastrips.first; strip; strip = strip->next) { for (strip = ob->nlastrips.first; strip; strip = strip->next) {
float length, actlength, repeat; float length, actlength, repeat;
if (strip->flag & ACTSTRIP_USESTRIDE) if (strip->flag & ACTSTRIP_USESTRIDE) {
repeat = 1.0f; repeat = 1.0f;
else }
else {
repeat = strip->repeat; repeat = strip->repeat;
}
length = strip->end - strip->start; length = strip->end - strip->start;
if (length == 0.0f) if (length == 0.0f) {
length = 1.0f; length = 1.0f;
}
actlength = strip->actend - strip->actstart; actlength = strip->actend - strip->actstart;
strip->scale = length / (repeat * actlength); strip->scale = length / (repeat * actlength);
if (strip->scale == 0.0f) if (strip->scale == 0.0f) {
strip->scale = 1.0f; strip->scale = 1.0f;
} }
}
if (ob->soft) { if (ob->soft) {
ob->soft->inpush = ob->soft->inspring; ob->soft->inpush = ob->soft->inspring;
ob->soft->shearstiff = 1.0f; ob->soft->shearstiff = 1.0f;
@@ -2364,9 +2462,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (sce = bmain->scenes.first; sce; sce = sce->id.next) { for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
SEQ_BEGIN (sce->ed, seq) { SEQ_BEGIN (sce->ed, seq) {
if (seq->blend_mode == 0) if (seq->blend_mode == 0) {
seq->blend_opacity = 100.0f; seq->blend_opacity = 100.0f;
} }
}
SEQ_END; SEQ_END;
} }
} }
@@ -2426,10 +2525,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 246 || (bmain->versionfile == 246 && bmain->subversionfile < 1)) { if (bmain->versionfile < 246 || (bmain->versionfile == 246 && bmain->subversionfile < 1)) {
Object *ob; Object *ob;
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pd && (ob->pd->forcefield == PFIELD_WIND)) if (ob->pd && (ob->pd->forcefield == PFIELD_WIND)) {
ob->pd->f_noise = 0.0f; ob->pd->f_noise = 0.0f;
} }
} }
}
/* set the curve radius interpolation to 2.47 default - easy */ /* set the curve radius interpolation to 2.47 default - easy */
if (bmain->versionfile < 247 || (bmain->versionfile == 247 && bmain->subversionfile < 6)) { if (bmain->versionfile < 247 || (bmain->versionfile == 247 && bmain->subversionfile < 6)) {
@@ -2503,10 +2603,11 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 249 && bmain->subversionfile < 1) { if (bmain->versionfile < 249 && bmain->subversionfile < 1) {
Object *ob; Object *ob;
for (ob = bmain->objects.first; ob; ob = ob->id.next) { for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->pd) if (ob->pd) {
ob->pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128; ob->pd->seed = ((uint)(ceil(PIL_check_seconds_timer())) + 1) % 128;
} }
} }
}
if (bmain->versionfile < 249 && bmain->subversionfile < 2) { if (bmain->versionfile < 249 && bmain->subversionfile < 2) {
Scene *sce = bmain->scenes.first; Scene *sce = bmain->scenes.first;

View File

@@ -157,14 +157,16 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(bmain, ver, subver) #define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(bmain, ver, subver)
/* the UserDef struct is not corrected with do_versions() .... ugh! */ /* the UserDef struct is not corrected with do_versions() .... ugh! */
if (userdef->wheellinescroll == 0) if (userdef->wheellinescroll == 0) {
userdef->wheellinescroll = 3; userdef->wheellinescroll = 3;
}
if (userdef->menuthreshold1 == 0) { if (userdef->menuthreshold1 == 0) {
userdef->menuthreshold1 = 5; userdef->menuthreshold1 = 5;
userdef->menuthreshold2 = 2; userdef->menuthreshold2 = 2;
} }
if (userdef->mixbufsize == 0) if (userdef->mixbufsize == 0) {
userdef->mixbufsize = 2048; userdef->mixbufsize = 2048;
}
if (userdef->autokey_mode == 0) { if (userdef->autokey_mode == 0) {
/* 'add/replace' but not on */ /* 'add/replace' but not on */
userdef->autokey_mode = 2; userdef->autokey_mode = 2;
@@ -177,8 +179,9 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
userdef->gizmo_size = 75; userdef->gizmo_size = 75;
userdef->gizmo_flag |= USER_GIZMO_DRAW; userdef->gizmo_flag |= USER_GIZMO_DRAW;
} }
if (userdef->pad_rot_angle == 0.0f) if (userdef->pad_rot_angle == 0.0f) {
userdef->pad_rot_angle = 15.0f; userdef->pad_rot_angle = 15.0f;
}
/* graph editor - unselected F-Curve visibility */ /* graph editor - unselected F-Curve visibility */
if (userdef->fcu_inactive_alpha == 0) { if (userdef->fcu_inactive_alpha == 0) {
@@ -197,19 +200,22 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
/* added seam, normal color, undo */ /* added seam, normal color, undo */
if (!USER_VERSION_ATLEAST(235, 0)) { if (!USER_VERSION_ATLEAST(235, 0)) {
userdef->uiflag |= USER_GLOBALUNDO; userdef->uiflag |= USER_GLOBALUNDO;
if (userdef->undosteps == 0) if (userdef->undosteps == 0) {
userdef->undosteps = 32; userdef->undosteps = 32;
} }
}
if (!USER_VERSION_ATLEAST(236, 0)) { if (!USER_VERSION_ATLEAST(236, 0)) {
/* illegal combo... */ /* illegal combo... */
if (userdef->flag & USER_LMOUSESELECT) if (userdef->flag & USER_LMOUSESELECT) {
userdef->flag &= ~USER_TWOBUTTONMOUSE; userdef->flag &= ~USER_TWOBUTTONMOUSE;
} }
}
if (!USER_VERSION_ATLEAST(240, 0)) { if (!USER_VERSION_ATLEAST(240, 0)) {
userdef->uiflag |= USER_PLAINMENUS; userdef->uiflag |= USER_PLAINMENUS;
if (userdef->obcenter_dia == 0) if (userdef->obcenter_dia == 0) {
userdef->obcenter_dia = 6; userdef->obcenter_dia = 6;
} }
}
if (!USER_VERSION_ATLEAST(242, 0)) { if (!USER_VERSION_ATLEAST(242, 0)) {
/* set defaults for 3D View rotating axis indicator */ /* set defaults for 3D View rotating axis indicator */
/* since size can't be set to 0, this indicates it's not saved in startup.blend */ /* since size can't be set to 0, this indicates it's not saved in startup.blend */
@@ -221,13 +227,15 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
} }
if (!USER_VERSION_ATLEAST(244, 0)) { if (!USER_VERSION_ATLEAST(244, 0)) {
/* set default number of recently-used files (if not set) */ /* set default number of recently-used files (if not set) */
if (userdef->recent_files == 0) if (userdef->recent_files == 0) {
userdef->recent_files = 10; userdef->recent_files = 10;
} }
}
if (!USER_VERSION_ATLEAST(245, 3)) { if (!USER_VERSION_ATLEAST(245, 3)) {
if (userdef->coba_weight.tot == 0) if (userdef->coba_weight.tot == 0) {
BKE_colorband_init(&userdef->coba_weight, true); BKE_colorband_init(&userdef->coba_weight, true);
} }
}
if (!USER_VERSION_ATLEAST(245, 3)) { if (!USER_VERSION_ATLEAST(245, 3)) {
userdef->flag |= USER_ADD_VIEWALIGNED | USER_ADD_EDITMODE; userdef->flag |= USER_ADD_VIEWALIGNED | USER_ADD_EDITMODE;
} }
@@ -242,57 +250,77 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (!USER_VERSION_ATLEAST(250, 3)) { if (!USER_VERSION_ATLEAST(250, 3)) {
/* new audio system */ /* new audio system */
if (userdef->audiochannels == 0) if (userdef->audiochannels == 0) {
userdef->audiochannels = 2; userdef->audiochannels = 2;
if (userdef->audioformat == 0) }
if (userdef->audioformat == 0) {
userdef->audioformat = 0x24; userdef->audioformat = 0x24;
if (userdef->audiorate == 0) }
if (userdef->audiorate == 0) {
userdef->audiorate = 48000; userdef->audiorate = 48000;
} }
}
if (!USER_VERSION_ATLEAST(250, 8)) { if (!USER_VERSION_ATLEAST(250, 8)) {
wmKeyMap *km; wmKeyMap *km;
for (km = userdef->user_keymaps.first; km; km = km->next) { for (km = userdef->user_keymaps.first; km; km = km->next) {
if (STREQ(km->idname, "Armature_Sketch")) if (STREQ(km->idname, "Armature_Sketch")) {
strcpy(km->idname, "Armature Sketch"); strcpy(km->idname, "Armature Sketch");
else if (STREQ(km->idname, "View3D")) }
else if (STREQ(km->idname, "View3D")) {
strcpy(km->idname, "3D View"); strcpy(km->idname, "3D View");
else if (STREQ(km->idname, "View3D Generic")) }
else if (STREQ(km->idname, "View3D Generic")) {
strcpy(km->idname, "3D View Generic"); strcpy(km->idname, "3D View Generic");
else if (STREQ(km->idname, "EditMesh")) }
else if (STREQ(km->idname, "EditMesh")) {
strcpy(km->idname, "Mesh"); strcpy(km->idname, "Mesh");
else if (STREQ(km->idname, "UVEdit")) }
else if (STREQ(km->idname, "UVEdit")) {
strcpy(km->idname, "UV Editor"); strcpy(km->idname, "UV Editor");
else if (STREQ(km->idname, "Animation_Channels")) }
else if (STREQ(km->idname, "Animation_Channels")) {
strcpy(km->idname, "Animation Channels"); strcpy(km->idname, "Animation Channels");
else if (STREQ(km->idname, "GraphEdit Keys")) }
else if (STREQ(km->idname, "GraphEdit Keys")) {
strcpy(km->idname, "Graph Editor"); strcpy(km->idname, "Graph Editor");
else if (STREQ(km->idname, "GraphEdit Generic")) }
else if (STREQ(km->idname, "GraphEdit Generic")) {
strcpy(km->idname, "Graph Editor Generic"); strcpy(km->idname, "Graph Editor Generic");
else if (STREQ(km->idname, "Action_Keys")) }
else if (STREQ(km->idname, "Action_Keys")) {
strcpy(km->idname, "Dopesheet"); strcpy(km->idname, "Dopesheet");
else if (STREQ(km->idname, "NLA Data")) }
else if (STREQ(km->idname, "NLA Data")) {
strcpy(km->idname, "NLA Editor"); strcpy(km->idname, "NLA Editor");
else if (STREQ(km->idname, "Node Generic")) }
else if (STREQ(km->idname, "Node Generic")) {
strcpy(km->idname, "Node Editor"); strcpy(km->idname, "Node Editor");
else if (STREQ(km->idname, "Logic Generic")) }
else if (STREQ(km->idname, "Logic Generic")) {
strcpy(km->idname, "Logic Editor"); strcpy(km->idname, "Logic Editor");
else if (STREQ(km->idname, "File")) }
else if (STREQ(km->idname, "File")) {
strcpy(km->idname, "File Browser"); strcpy(km->idname, "File Browser");
else if (STREQ(km->idname, "FileMain")) }
else if (STREQ(km->idname, "FileMain")) {
strcpy(km->idname, "File Browser Main"); strcpy(km->idname, "File Browser Main");
else if (STREQ(km->idname, "FileButtons")) }
else if (STREQ(km->idname, "FileButtons")) {
strcpy(km->idname, "File Browser Buttons"); strcpy(km->idname, "File Browser Buttons");
else if (STREQ(km->idname, "Buttons Generic")) }
else if (STREQ(km->idname, "Buttons Generic")) {
strcpy(km->idname, "Property Editor"); strcpy(km->idname, "Property Editor");
} }
} }
}
if (!USER_VERSION_ATLEAST(252, 3)) { if (!USER_VERSION_ATLEAST(252, 3)) {
if (userdef->flag & USER_LMOUSESELECT) if (userdef->flag & USER_LMOUSESELECT) {
userdef->flag &= ~USER_TWOBUTTONMOUSE; userdef->flag &= ~USER_TWOBUTTONMOUSE;
} }
}
if (!USER_VERSION_ATLEAST(252, 4)) { if (!USER_VERSION_ATLEAST(252, 4)) {
/* default new handle type is auto handles */ /* default new handle type is auto handles */
userdef->keyhandles_new = HD_AUTO; userdef->keyhandles_new = HD_AUTO;
@@ -308,8 +336,9 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
/* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead /* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead
* was changed in 260 as part of GSoC11, but version patch was wrong * was changed in 260 as part of GSoC11, but version patch was wrong
*/ */
if (userdef->keyhandles_new == HD_AUTO) if (userdef->keyhandles_new == HD_AUTO) {
userdef->keyhandles_new = HD_AUTO_ANIM; userdef->keyhandles_new = HD_AUTO_ANIM;
}
/* enable (Cycles) addon by default */ /* enable (Cycles) addon by default */
BKE_addon_ensure(&userdef->addons, "cycles"); BKE_addon_ensure(&userdef->addons, "cycles");
@@ -331,10 +360,12 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (userdef->v2d_min_gridsize == 0) { if (userdef->v2d_min_gridsize == 0) {
userdef->v2d_min_gridsize = 35; userdef->v2d_min_gridsize = 35;
} }
if (userdef->widget_unit == 0) if (userdef->widget_unit == 0) {
userdef->widget_unit = 20; userdef->widget_unit = 20;
if (userdef->anisotropic_filter <= 0) }
if (userdef->anisotropic_filter <= 0) {
userdef->anisotropic_filter = 1; userdef->anisotropic_filter = 1;
}
if (userdef->ndof_sensitivity == 0.0f) { if (userdef->ndof_sensitivity == 0.0f) {
userdef->ndof_sensitivity = 1.0f; userdef->ndof_sensitivity = 1.0f;
@@ -345,12 +376,14 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (userdef->ndof_orbit_sensitivity == 0.0f) { if (userdef->ndof_orbit_sensitivity == 0.0f) {
userdef->ndof_orbit_sensitivity = userdef->ndof_sensitivity; userdef->ndof_orbit_sensitivity = userdef->ndof_sensitivity;
if (!(userdef->flag & USER_TRACKBALL)) if (!(userdef->flag & USER_TRACKBALL)) {
userdef->ndof_flag |= NDOF_TURNTABLE; userdef->ndof_flag |= NDOF_TURNTABLE;
} }
if (userdef->tweak_threshold == 0) }
if (userdef->tweak_threshold == 0) {
userdef->tweak_threshold = 10; userdef->tweak_threshold = 10;
} }
}
/* NOTE!! from now on use userdef->versionfile and userdef->subversionfile */ /* NOTE!! from now on use userdef->versionfile and userdef->subversionfile */
#undef USER_VERSION_ATLEAST #undef USER_VERSION_ATLEAST
@@ -508,8 +541,9 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
} }
} }
if (userdef->pixelsize == 0.0f) if (userdef->pixelsize == 0.0f) {
userdef->pixelsize = 1.0f; userdef->pixelsize = 1.0f;
}
for (bTheme *btheme = userdef->themes.first; btheme; btheme = btheme->next) { for (bTheme *btheme = userdef->themes.first; btheme; btheme = btheme->next) {
do_versions_theme(userdef, btheme); do_versions_theme(userdef, btheme);

View File

@@ -2776,8 +2776,9 @@ static void write_region(WriteData *wd, ARegion *ar, int spacetype)
writestruct(wd, DATA, BoundBox, 1, rv3d->clipbb); writestruct(wd, DATA, BoundBox, 1, rv3d->clipbb);
} }
} }
else else {
printf("regiondata write missing!\n"); printf("regiondata write missing!\n");
}
break; break;
default: default:
printf("regiondata write missing!\n"); printf("regiondata write missing!\n");