Cleanup: style, use braces for blenloader

This commit is contained in:
Campbell Barton
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");
for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ENDB)
if (bhead->code == ENDB) {
break;
}
else {
const short *sp = fd->filesdna->structs[bhead->SDNAnr];
const char *name = fd->filesdna->types[sp[0]];
@@ -150,8 +151,9 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
BLI_linklist_prepend(&names, strdup(idname + 2));
tot++;
}
else if (bhead->code == ENDB)
else if (bhead->code == ENDB) {
break;
}
}
*tot_names = tot;

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -92,10 +92,12 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
BLI_addtail(lb, ar);
ar->regiontype = RGN_TYPE_HEADER;
if (sa->headertype == 1)
if (sa->headertype == 1) {
ar->alignment = RGN_ALIGN_BOTTOM;
else
}
else {
ar->alignment = RGN_ALIGN_TOP;
}
/* initialize view2d data for header region, to allow panning */
/* is copy from ui_view2d.c */
@@ -203,8 +205,9 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
case SPACE_SEQ:
ar_main = (ARegion *)lb->first;
for (; ar_main; ar_main = ar_main->next) {
if (ar_main->regiontype == RGN_TYPE_WINDOW)
if (ar_main->regiontype == RGN_TYPE_WINDOW) {
break;
}
}
ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_insertlinkbefore(lb, ar_main, 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
* only shows ShapeKey-rooted actions only)
*/
if (saction->mode == SACTCONT_SHAPEKEY)
if (saction->mode == SACTCONT_SHAPEKEY) {
saction->action = NULL;
}
break;
}
case SPACE_SEQ: {
@@ -397,29 +401,33 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
/* add regions */
for (sa = screen->areabase.first; sa; sa = sa->next) {
/* we keep headertype variable to convert old files only */
if (sa->headertype)
if (sa->headertype) {
area_add_header_region(sa, &sa->regionbase);
}
area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase);
/* space imageselect is deprecated */
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 */
}
}
/* space sound is deprecated */
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 */
}
}
/* pushed back spaces also need regions! */
if (sa->spacedata.first) {
sl = sa->spacedata.first;
for (sl = sl->next; sl; sl = sl->next) {
if (sa->headertype)
if (sa->headertype) {
area_add_header_region(sa, &sl->regionbase);
}
area_add_window_regions(sa, sl, &sl->regionbase);
}
}
@@ -436,8 +444,9 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
BKE_id_new_name_validate(lb, id, name);
/* 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);
}
}
static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
@@ -538,8 +547,9 @@ static void do_version_bone_roll_256(Bone *bone)
copy_m3_m4(submat, bone->arm_mat);
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);
}
}
/* deprecated, only keep this for readfile.c */
@@ -591,8 +601,9 @@ static void do_versions_socket_default_value_259(bNodeSocket *sock)
bNodeSocketValueVector *valvector;
bNodeSocketValueRGBA *valrgba;
if (sock->default_value)
if (sock->default_value) {
return;
}
switch (sock->type) {
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.
*/
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");
}
}
/* and composite trees */
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
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");
}
/* move to cameras */
if (sce->r.mode & R_PANORAMA) {
@@ -708,13 +721,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bNode *node;
if (tx->nodetree) {
if (tx->nodetree->id.name[0] == '\0')
if (tx->nodetree->id.name[0] == '\0') {
strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
}
/* which_output 0 is now "not specified" */
for (node = tx->nodetree->nodes.first; node; node = node->next)
if (node->type == TEX_NODE_OUTPUT)
for (node = tx->nodetree->nodes.first; node; node = node->next) {
if (node->type == TEX_NODE_OUTPUT) {
node->custom1++;
}
}
}
}
@@ -795,15 +811,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
int a;
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;
}
}
}
/* texture filter */
for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->afmax == 0)
if (tex->afmax == 0) {
tex->afmax = 8;
}
}
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
@@ -816,8 +834,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
* (i.e. will result in blank box when enabled)
*/
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->uv_selectmode = UV_SELECT_VERTEX;
ts->vgroup_weight = 1.0f;
}
@@ -828,8 +847,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
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;
}
}
}
@@ -839,16 +859,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ParticleSettings *part;
bool do_gravity = false;
for (sce = bmain->scenes.first; sce; sce = sce->id.next)
if (sce->unit.scale_length == 0.0f)
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->unit.scale_length == 0.0f) {
sce->unit.scale_length = 1.0f;
}
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
/* fluid-sim stuff */
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(
ob, eModifierType_Fluidsim);
if (fluidmd)
if (fluidmd) {
fluidmd->fss->fmd = fluidmd;
}
/* rotation modes were added,
* 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) {
if (sce->audio.main == 0.0f)
if (sce->audio.main == 0.0f) {
sce->audio.main = 1.0f;
}
sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
sce->r.ffcodecdata.audio_volume = sce->audio.main;
@@ -880,8 +904,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* Assign proper global gravity weights for dynamics
* (only z-coordinate is taken into account) */
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;
}
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
@@ -891,24 +916,29 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (md = ob->modifiers.first; md; md = md->next) {
ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob,
eModifierType_Cloth);
if (clmd)
if (clmd) {
clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2] /
-9.81f;
}
}
if (ob->soft)
if (ob->soft) {
ob->soft->effector_weights->global_gravity = ob->soft->grav / 9.81f;
}
}
/* Normal wind shape is plane */
if (ob->pd) {
if (ob->pd->forcefield == PFIELD_WIND)
if (ob->pd->forcefield == PFIELD_WIND) {
ob->pd->shape = PFIELD_SHAPE_PLANE;
}
if (ob->pd->flag & PFIELD_PLANAR)
if (ob->pd->flag & PFIELD_PLANAR) {
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->flag |= PFIELD_DO_LOCATION;
}
@@ -954,8 +984,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
data = key->refkey->data;
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);
}
}
}
@@ -964,8 +995,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
data = key->refkey->data;
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);
}
}
}
@@ -1007,8 +1039,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
{
Scene *sce = bmain->scenes.first;
while (sce) {
if (sce->r.frame_step == 0)
if (sce->r.frame_step == 0) {
sce->r.frame_step = 1;
}
sce = sce->id.next;
}
@@ -1033,8 +1066,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Object *ob = bmain->objects.first;
while (ob) {
/* shaded mode disabled for now */
if (ob->dt == OB_MATERIAL)
if (ob->dt == OB_MATERIAL) {
ob->dt = OB_TEXTURE;
}
ob = ob->id.next;
}
}
@@ -1049,8 +1083,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
if (v3d->drawtype == OB_MATERIAL)
if (v3d->drawtype == OB_MATERIAL) {
v3d->drawtype = OB_SOLID;
}
}
}
}
@@ -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... */
while (sce) {
if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT)
if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
convert = 1;
}
sce = sce->id.next;
}
@@ -1102,13 +1138,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Mesh *me;
Object *ob;
for (sce = bmain->scenes.first; sce; sce = sce->id.next)
if (!sce->toolsettings->particle.selectmode)
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (!sce->toolsettings->particle.selectmode) {
sce->toolsettings->particle.selectmode = SCE_SELECT_PATH;
}
}
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);
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(
@@ -1133,8 +1172,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) {
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;
}
}
}
}
@@ -1163,8 +1203,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
for (ar = regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_PREVIEW)
if (ar->regiontype == RGN_TYPE_PREVIEW) {
break;
}
}
if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) {
@@ -1201,15 +1242,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
regionbase = &sl->regionbase;
}
if (sseq->view == 0)
if (sseq->view == 0) {
sseq->view = SEQ_VIEW_SEQUENCE;
if (sseq->mainb == 0)
}
if (sseq->mainb == 0) {
sseq->mainb = SEQ_DRAW_IMG_IMBUF;
}
ar_main = (ARegion *)regionbase->first;
for (; ar_main; ar_main = ar_main->next) {
if (ar_main->regiontype == RGN_TYPE_WINDOW)
if (ar_main->regiontype == RGN_TYPE_WINDOW) {
break;
}
}
ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_insertlinkbefore(regionbase, ar_main, ar);
@@ -1247,26 +1291,32 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
avs->path_ef = 250;
/* flags */
if (arm->pathflag & ARM_PATH_FNUMS)
if (arm->pathflag & ARM_PATH_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;
if (arm->pathflag & ARM_PATH_KFNOS)
}
if (arm->pathflag & ARM_PATH_KFNOS) {
avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS;
}
/* bake flags */
if (arm->pathflag & ARM_PATH_HEADS)
if (arm->pathflag & ARM_PATH_HEADS) {
avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS;
}
/* type */
if (arm->pathflag & ARM_PATH_ACFRA)
if (arm->pathflag & ARM_PATH_ACFRA) {
avs->path_type = MOTIONPATH_TYPE_ACFRA;
}
/* stepsize */
avs->path_step = 1;
}
else
else {
animviz_settings_init(&ob->pose->avs);
}
}
}
@@ -1315,10 +1365,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ListBase *regionbase;
ARegion *ar;
if (sl == sa->spacedata.first)
if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase;
else
}
else {
regionbase = &sl->regionbase;
}
if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
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;
}
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
}
SEQ_BEGIN (sce->ed, seq) {
seq->volume = 1.0f;
@@ -1361,8 +1414,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ParticleEditSettings *pset = &sce->toolsettings->particle;
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;
}
}
/* sequencer changes */
@@ -1387,8 +1441,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ar_preview = (ARegion *)regionbase->first;
for (; ar_preview; ar_preview = ar_preview->next) {
if (ar_preview->regiontype == RGN_TYPE_PREVIEW)
if (ar_preview->regiontype == RGN_TYPE_PREVIEW) {
break;
}
}
if (ar_preview && (ar_preview->regiontype == RGN_TYPE_PREVIEW)) {
sequencer_init_preview_region(ar_preview);
@@ -1428,8 +1483,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bNodeTree *ntree;
for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->curve)
if (brush->curve) {
brush->curve->preset = CURVE_PRESET_SMOOTH;
}
}
/* properly initialize active flag for fluidsim modifiers */
@@ -1481,8 +1537,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 2)) {
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);
}
}
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
@@ -1523,22 +1580,28 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ListBase *regionbase;
ARegion *ar;
if (sl == sa->spacedata.first)
if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase;
else
}
else {
regionbase = &sl->regionbase;
}
if (snode->v2d.minzoom > 0.09f)
if (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;
}
for (ar = regionbase->first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
if (ar->v2d.minzoom > 0.09f)
if (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;
}
}
}
}
@@ -1598,8 +1661,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (tex = bmain->textures.first; tex; tex = tex->id.next) {
/* if youre picky, this isn't correct until we do a version bump
* since you could set saturation to be 0.0*/
if (tex->saturation == 0.0f)
if (tex->saturation == 0.0f) {
tex->saturation = 1.0f;
}
}
{
@@ -1627,44 +1691,54 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* Sanity Check */
/* infinite number of dabs */
if (brush->spacing == 0)
if (brush->spacing == 0) {
brush->spacing = 10;
}
/* will have no effect */
if (brush->alpha == 0)
if (brush->alpha == 0) {
brush->alpha = 0.5f;
}
/* bad radius */
if (brush->unprojected_radius == 0)
if (brush->unprojected_radius == 0) {
brush->unprojected_radius = 0.125f;
}
/* unusable size */
if (brush->size == 0)
if (brush->size == 0) {
brush->size = 35;
}
/* can't see overlay */
if (brush->texture_overlay_alpha == 0)
if (brush->texture_overlay_alpha == 0) {
brush->texture_overlay_alpha = 33;
}
/* same as draw brush */
if (brush->crease_pinch_factor == 0)
if (brush->crease_pinch_factor == 0) {
brush->crease_pinch_factor = 0.5f;
}
/* will sculpt no vertexes */
if (brush->plane_trim == 0)
if (brush->plane_trim == 0) {
brush->plane_trim = 0.5f;
}
/* same as smooth stroke off */
if (brush->smooth_stroke_radius == 0)
if (brush->smooth_stroke_radius == 0) {
brush->smooth_stroke_radius = 75;
}
/* will keep cursor in one spot */
if (brush->smooth_stroke_radius == 1)
if (brush->smooth_stroke_radius == 1) {
brush->smooth_stroke_factor = 0.9f;
}
/* same as dots */
if (brush->rate == 0)
if (brush->rate == 0) {
brush->rate = 0.1f;
}
/* New Settings */
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
@@ -1694,14 +1768,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 253) {
Scene *sce;
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;
}
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;
}
if (sce->toolsettings->sculpt_paint_unified_size == 0)
if (sce->toolsettings->sculpt_paint_unified_size == 0) {
sce->toolsettings->sculpt_paint_unified_size = 35;
}
}
}
@@ -1719,8 +1796,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
smd->domain->vorticity = 2.0f;
smd->domain->time_scale = 1.0f;
if (!(smd->domain->flags & (1 << 4)))
if (!(smd->domain->flags & (1 << 4))) {
continue;
}
/* delete old MOD_SMOKE_INITVELOCITY flag */
smd->domain->flags &= ~(1 << 4);
@@ -1756,13 +1834,15 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bScreen *sc;
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;
}
}
for (part = bmain->particles.first; part; part = part->id.next) {
if (part->boids)
if (part->boids) {
part->boids->pitch = 1.0f;
}
part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */
part->kink_amp_clump = 1.f; /* keep old files looking similar */
@@ -1825,8 +1905,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)sl;
if (sima->sample_line_hist.height == 0)
if (sima->sample_line_hist.height == 0) {
sima->sample_line_hist.height = 100;
}
}
}
sa = sa->next;
@@ -1841,8 +1922,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
KeyBlock *kb;
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;
}
}
}
}
@@ -1853,9 +1935,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
Bone *bone;
Object *ob;
for (arm = bmain->armatures.first; arm; arm = arm->id.next)
for (bone = arm->bonebase.first; bone; bone = bone->next)
for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
for (bone = arm->bonebase.first; bone; bone = bone->next) {
do_version_bone_roll_256(bone);
}
}
/* fix for objects which have zero dquat's
* since this is multiplied with the quat rather than added */
@@ -1883,12 +1967,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* first make sure the own_index for new sockets is valid */
for (node = ntree->nodes.first; node; node = node->next) {
for (sock = node->inputs.first; sock; sock = sock->next)
if (sock->own_index >= ntree->cur_index)
for (sock = node->inputs.first; sock; sock = sock->next) {
if (sock->own_index >= ntree->cur_index) {
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;
}
}
}
/* add ntree->inputs/ntree->outputs sockets for all unlinked sockets in the group tree. */
@@ -1968,8 +2056,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
if (brush->height == 0)
if (brush->height == 0) {
brush->height = 0.4f;
}
}
/* replace 'rim material' option for in offset*/
@@ -1988,30 +2077,35 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* particle draw color from material */
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;
}
}
}
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 6)) {
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);
}
}
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) {
/* update blur area sizes from 0..1 range to 0..100 percentage */
Scene *scene;
bNode *node;
for (scene = bmain->scenes.first; scene; scene = scene->id.next)
if (scene->nodetree)
for (node = scene->nodetree->nodes.first; node; node = node->next)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->nodetree) {
for (node = scene->nodetree->nodes.first; node; node = node->next) {
if (node->type == CMP_NODE_BLUR) {
NodeBlurData *nbd = node->storage;
nbd->percentx *= 100.0f;
nbd->percenty *= 100.0f;
}
}
}
}
}
if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) {
@@ -2088,8 +2182,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ARegion *ar;
for (ar = sa->regionbase.first; ar; ar = ar->next) {
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;
}
}
}
}
@@ -2098,8 +2193,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
ARegion *ar;
for (ar = sl->regionbase.first; ar; ar = ar->next) {
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;
}
}
}
}
@@ -2125,17 +2221,21 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
uint i = 0;
/* 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;
if ((fcu->totvert == 0) || (fcu->bezt == NULL))
}
if ((fcu->totvert == 0) || (fcu->bezt == NULL)) {
continue;
}
/* only change auto-handles to auto-clamped */
for (bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (bezt->h1 == HD_AUTO)
if (bezt->h1 == HD_AUTO) {
bezt->h1 = HD_AUTO_ANIM;
if (bezt->h2 == HD_AUTO)
}
if (bezt->h2 == HD_AUTO) {
bezt->h2 = HD_AUTO_ANIM;
}
}
fcu->flag &= ~FCURVE_AUTO_HANDLES;
@@ -2152,16 +2252,20 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
bNodeSocket *sock;
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)
}
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);
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);
}
ntree->update |= NTREE_UPDATE;
}
@@ -2175,8 +2279,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
*/
bNodeTree *ntree;
/* 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;
}
}
}

View File

@@ -205,15 +205,19 @@ static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
bNodeLink *link;
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)
}
for (sock = node->outputs.first; sock; sock = sock->next) {
sock->flag &= ~SOCK_IN_USE;
}
}
for (sock = ntree->inputs.first; sock; sock = sock->next)
for (sock = ntree->inputs.first; sock; sock = sock->next) {
sock->flag &= ~SOCK_IN_USE;
for (sock = ntree->outputs.first; sock; sock = sock->next)
}
for (sock = ntree->outputs.first; sock; sock = sock->next) {
sock->flag &= ~SOCK_IN_USE;
}
for (link = ntree->links.first; link; link = link->next) {
link->fromsock->flag |= SOCK_IN_USE;
@@ -296,8 +300,9 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
nodeRemoveSocket(ntree, node, old_image);
nodeRemoveSocket(ntree, node, old_z);
if (old_data)
if (old_data) {
MEM_freeN(old_data);
}
}
else if (node->type == CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
NodeImageMultiFile *nimf = node->storage;
@@ -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;
/* initialize the node-wide image format from render data, if available */
if (sce)
if (sce) {
nimf->format = sce->r.im_format;
}
/* transfer render format toggle to node format toggle */
for (sock = node->inputs.first; sock; sock = sock->next) {
@@ -543,16 +549,20 @@ static void do_versions_nodetree_customnodes(bNodeTree *ntree, int UNUSED(is_gro
node->flag |= NODE_INIT;
/* 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)
}
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 */
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));
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));
}
}
/* initialize socket in_out values */
@@ -561,15 +571,19 @@ static void do_versions_nodetree_customnodes(bNodeTree *ntree, int UNUSED(is_gro
bNodeSocket *sock;
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;
for (sock = node->outputs.first; sock; sock = sock->next)
}
for (sock = node->outputs.first; sock; sock = sock->next) {
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;
for (sock = ntree->outputs.first; sock; sock = sock->next)
}
for (sock = ntree->outputs.first; sock; sock = sock->next) {
sock->in_out = SOCK_OUT;
}
}
/* initialize socket identifier strings */
@@ -629,15 +643,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
/* there are files with invalid audio_channels value, the real cause
* 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;
}
if (sce->nodetree)
if (sce->nodetree) {
do_versions_nodetree_image_default_alpha_output(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_image_default_alpha_output(ntree);
}
}
{
@@ -648,8 +665,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
part->draw |= PART_DRAW_ROTATE_OB;
if (part->rotmode == 0)
if (part->rotmode == 0) {
part->rotmode = PART_ROT_VEL;
}
}
}
}
@@ -665,11 +683,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
Camera *cam;
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;
}
if (cam->sensor_y < 0.01f)
if (cam->sensor_y < 0.01f) {
cam->sensor_y = DEFAULT_SENSOR_HEIGHT;
}
}
}
}
@@ -701,17 +721,20 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bNodeTree *ntree;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree)
if (sce->nodetree) {
do_versions_nodetree_convert_angle(sce->nodetree);
}
}
for (mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->nodetree)
if (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);
}
}
{
@@ -731,13 +754,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
v3d->flag2 |= V3D_SHOW_RECONSTRUCTION;
}
if (v3d->bundle_drawtype == 0)
if (v3d->bundle_drawtype == 0) {
v3d->bundle_drawtype = OB_PLAINAXES;
}
}
else if (sl->spacetype == SPACE_CLIP) {
SpaceClip *sclip = (SpaceClip *)sl;
if (sclip->scopes.track_preview_height == 0)
if (sclip->scopes.track_preview_height == 0) {
sclip->scopes.track_preview_height = 120;
}
}
}
}
@@ -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 |
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;
}
if (clip->proxy.quality == 0)
if (clip->proxy.quality == 0) {
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;
}
track = clip->tracking.tracks.first;
while (track) {
if (track->minimum_correlation == 0.0f)
if (track->minimum_correlation == 0.0f) {
track->minimum_correlation = 0.75f;
}
track = track->next;
}
@@ -828,8 +857,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Brush *brush;
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;
}
}
}
@@ -843,28 +873,33 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bNodeTree *ntree;
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) {
@@ -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;
if (!tracking->settings.object_distance)
if (!tracking->settings.object_distance) {
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");
}
while (tracking_object) {
if (!tracking_object->scale)
if (!tracking_object->scale) {
tracking_object->scale = 1.0f;
}
tracking_object = tracking_object->next;
}
@@ -901,8 +939,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
if (data->invmat[3][3] == 0.0f)
if (data->invmat[3][3] == 0.0f) {
unit_m4(data->invmat);
}
}
}
}
@@ -938,8 +977,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
tl->len += added;
/* reset cursor position if line was changed */
if (added && tl == text->curl)
if (added && tl == text->curl) {
text->curc = 0;
}
}
}
}
@@ -975,8 +1015,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Cloth) {
ClothModifierData *clmd = (ClothModifierData *)md;
if (clmd->sim_parms)
if (clmd->sim_parms) {
clmd->sim_parms->vel_damping = 1.0f;
}
}
}
}
@@ -992,8 +1033,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Fluidsim) {
FluidsimModifierData *fmd = (FluidsimModifierData *)md;
if (fmd->fss->animRate == 0.0f)
if (fmd->fss->animRate == 0.0f) {
fmd->fss->animRate = 1.0f;
}
}
}
}
@@ -1005,13 +1047,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bNodeTree *ntree;
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);
}
}
/* 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);
}
}
/* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
@@ -1030,8 +1074,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
KeyingSet *ks;
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));
}
}
}
}
@@ -1085,11 +1130,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Scene *sce;
bNodeTree *ntree;
for (sce = bmain->scenes.first; sce; sce = sce->id.next)
if (sce->nodetree)
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (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);
}
}
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 3)) {
@@ -1194,28 +1242,39 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
World *world;
bNodeTree *ntree;
for (sce = bmain->scenes.first; sce; sce = sce->id.next)
if (sce->nodetree)
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree) {
do_versions_nodetree_frame_2_64_6(sce->nodetree);
}
}
for (mat = bmain->materials.first; mat; mat = mat->id.next)
if (mat->nodetree)
for (mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->nodetree) {
do_versions_nodetree_frame_2_64_6(mat->nodetree);
}
}
for (tex = bmain->textures.first; tex; tex = tex->id.next)
if (tex->nodetree)
for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->nodetree) {
do_versions_nodetree_frame_2_64_6(tex->nodetree);
}
}
for (Light *la = bmain->lights.first; la; la = la->id.next)
if (la->nodetree)
for (Light *la = bmain->lights.first; la; la = la->id.next) {
if (la->nodetree) {
do_versions_nodetree_frame_2_64_6(la->nodetree);
}
}
for (world = bmain->worlds.first; world; world = world->id.next)
if (world->nodetree)
for (world = bmain->worlds.first; world; world = world->id.next) {
if (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);
}
}
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 7)) {
@@ -1366,10 +1425,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
FOREACH_NODETREE_END;
/* keep compatibility for dupliobject particle size */
for (part = bmain->particles.first; part; part = part->id.next)
if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR))
if ((part->draw & PART_DRAW_ROTATE_OB) == 0)
for (part = bmain->particles.first; part; part = part->id.next) {
if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
if ((part->draw & PART_DRAW_ROTATE_OB) == 0) {
part->draw |= PART_DRAW_NO_SCALE_OB;
}
}
}
}
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 17)) {
@@ -1504,9 +1566,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type == NTREE_SHADER) {
bNode *node;
for (node = ntree->nodes.first; node; node = node->next)
if (node->type == SH_NODE_TEX_COORD)
for (node = ntree->nodes.first; node; node = node->next) {
if (node->type == SH_NODE_TEX_COORD) {
node->flag |= NODE_OPTIONS;
}
}
}
}
FOREACH_NODETREE_END;
@@ -1724,8 +1788,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
SEQ_END;
if (scene->r.bake_samples == 0)
if (scene->r.bake_samples == 0) {
scene->r.bake_samples = 256;
}
}
for (Image *image = bmain->images.first; image; image = image->id.next) {
@@ -1741,8 +1806,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) {
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;
}
}
}
@@ -1754,8 +1820,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
Image *image = blo_do_versions_newlibadr(fd, ntree->id.lib, node->id);
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;
}
}
}
}
@@ -1768,9 +1835,11 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
* for compatibility all textures assumed it to be enabled */
Tex *tex;
for (tex = bmain->textures.first; tex; tex = tex->id.next)
if (tex->type == TEX_IMAGE)
for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->type == TEX_IMAGE) {
tex->imaflag |= TEX_USEALPHA;
}
}
}
if (bmain->versionfile < 265 || (bmain->versionfile == 265 && bmain->subversionfile < 7)) {
@@ -1895,8 +1964,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Only add interface nodes once.
* 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;
}
}
FOREACH_NODETREE_END;
}
@@ -1911,11 +1981,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
*/
bNode *node;
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (id == &ntree->id)
if (id == &ntree->id) {
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);
}
}
FOREACH_NODETREE_END;
}
@@ -1938,8 +2010,9 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
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);
}
}
#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;
}
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;
}
if (srl->freestyleConfig.raycasting_algorithm ==
FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE ||
srl->freestyleConfig.raycasting_algorithm ==
@@ -2024,10 +2098,12 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
linestyle->thickness_position = LS_THICKNESS_CENTER;
linestyle->thickness_ratio = 0.5f;
}
if (linestyle->chaining == 0)
if (linestyle->chaining == 0) {
linestyle->chaining = LS_CHAINING_PLAIN;
if (linestyle->rounds == 0)
}
if (linestyle->rounds == 0) {
linestyle->rounds = 3;
}
}
}
@@ -2045,24 +2121,28 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (sl->spacetype == SPACE_NODE) {
SpaceNode *snode = (SpaceNode *)sl;
bNodeTreePath *path = snode->treepath.last;
if (!path)
if (!path) {
continue;
}
active_viewer_key = path->parent_key;
break;
}
}
if (active_viewer_key.value != 0)
if (active_viewer_key.value != 0) {
break;
}
}
if (active_viewer_key.value != 0)
if (active_viewer_key.value != 0) {
break;
}
}
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
/* 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;
}
}
}
@@ -2100,12 +2180,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (brush = bmain->brushes.first; brush; brush = brush->id.next) {
brush->flag &= ~BRUSH_FIXED;
if (brush->cursor_overlay_alpha < 2)
if (brush->cursor_overlay_alpha < 2) {
brush->cursor_overlay_alpha = 33;
if (brush->texture_overlay_alpha < 2)
}
if (brush->texture_overlay_alpha < 2) {
brush->texture_overlay_alpha = 33;
if (brush->mask_overlay_alpha < 2)
}
if (brush->mask_overlay_alpha < 2) {
brush->mask_overlay_alpha = 33;
}
}
#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) {
if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) {
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;
else if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS)
}
else if (data->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) {
data->projAxis = OB_POSY;
else
}
else {
data->projAxis = OB_POSZ;
}
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) {
ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
if (ar)
if (ar) {
continue;
}
/* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
if (ar == NULL)
if (ar == NULL) {
continue;
}
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) {
/* this can now be turned off */
ToolSettings *ts = scene->toolsettings;
if (ts->sculpt)
if (ts->sculpt) {
ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE;
}
/* '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;
}
#ifdef WITH_FFMPEG
/* Update for removed "sound-only" option in FFMPEG export settings. */
@@ -2404,14 +2494,18 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
};
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;
if (symmetry_flags & SCULPT_SYMM_Y)
}
if (symmetry_flags & SCULPT_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;
if (symmetry_flags & SCULPT_SYMMETRY_FEATHER)
}
if (symmetry_flags & SCULPT_SYMMETRY_FEATHER) {
sd->paint.symmetry_flags |= PAINT_SYMMETRY_FEATHER;
}
}
}
}

View File

@@ -324,12 +324,15 @@ static void do_versions_compositor_render_passes_storage(bNode *node)
node_cmp_rlayers_sock_to_pass(pass_index),
sizeof(sockdata->pass_name));
if (pass_index == 0)
if (pass_index == 0) {
sockname = "Image";
else if (pass_index == 1)
}
else if (pass_index == 1) {
sockname = "Alpha";
else
}
else {
sockname = node_cmp_rlayers_sock_to_pass(pass_index);
}
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
* 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");
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");
}
if (new_path) {
MEM_freeN(old_path);
@@ -658,8 +663,9 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
Brush *br;
for (br = bmain->brushes.first; br; br = br->id.next) {
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;
}
}
}
@@ -729,10 +735,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 273, 3)) {
ParticleSettings *part;
for (part = bmain->particles.first; part; part = part->id.next) {
if (part->clumpcurve)
if (part->clumpcurve) {
part->child_flag |= PART_CHILD_USE_CLUMP_CURVE;
if (part->roughcurve)
}
if (part->roughcurve) {
part->child_flag |= PART_CHILD_USE_ROUGH_CURVE;
}
}
}
@@ -918,10 +926,12 @@ 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_FILE (1 << 21)
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;
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;
}
}
#undef SEQ_USE_PROXY_CUSTOM_DIR
#undef SEQ_USE_PROXY_CUSTOM_FILE
@@ -1193,10 +1203,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (enabled)
if (enabled) {
gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
else
}
else {
gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
}
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 276, 5)) {
@@ -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->fill, gpl->fill);
if (gpl->flag & GP_LAYER_HIDE)
if (gpl->flag & GP_LAYER_HIDE) {
palcolor->flag |= PC_COLOR_HIDE;
if (gpl->flag & GP_LAYER_LOCKED)
}
if (gpl->flag & GP_LAYER_LOCKED) {
palcolor->flag |= PC_COLOR_LOCKED;
if (gpl->flag & GP_LAYER_ONIONSKIN)
}
if (gpl->flag & GP_LAYER_ONIONSKIN) {
palcolor->flag |= PC_COLOR_ONIONSKIN;
if (gpl->flag & GP_LAYER_VOLUMETRIC)
}
if (gpl->flag & GP_LAYER_VOLUMETRIC) {
palcolor->flag |= PC_COLOR_VOLUMETRIC;
}
/* set layer opacity to 1 */
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 */
if (!MAIN_VERSION_ATLEAST(bmain, 280, 23)) {
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;
}
cu->key->elemstr[0] = 3; /*KEYELEM_ELEM_SIZE_CURVE*/
cu->key->elemsize = sizeof(float[3]);
@@ -865,8 +866,9 @@ void do_versions_after_linking_280(Main *bmain)
int old_count = block->totelem;
void *old_data = block->data;
if (!old_data || old_count <= 0)
if (!old_data || old_count <= 0) {
continue;
}
block->totelem = new_count;
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;
int a;
if (me->totface == 0 || me->mcol == NULL)
if (me->totface == 0 || me->mcol == NULL) {
return;
}
mcoln = mcolmain = MEM_malloc_arrayN(me->totface, 4 * sizeof(int), "mcoln");
mcol = (uint *)me->mcol;
@@ -128,8 +129,9 @@ static void do_version_bone_head_tail_237(Bone *bone)
mul_v3_fl(vec, bone->length);
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);
}
}
static void bone_version_238(ListBase *lb)
@@ -142,8 +144,9 @@ static void bone_version_238(ListBase *lb)
bone->rad_tail = 0.1f * bone->length;
bone->dist -= bone->rad_head;
if (bone->dist <= 0.0f)
if (bone->dist <= 0.0f) {
bone->dist = 0.0f;
}
}
bone_version_238(&bone->childbase);
}
@@ -154,8 +157,9 @@ static void bone_version_239(ListBase *lb)
Bone *bone;
for (bone = lb->first; bone; bone = bone->next) {
if (bone->layer == 0)
if (bone->layer == 0) {
bone->layer = 1;
}
bone_version_239(&bone->childbase);
}
}
@@ -197,8 +201,9 @@ static void ntree_version_242(bNodeTree *ntree)
if (node->type == CMP_NODE_HUE_SAT) {
if (node->storage) {
NodeHueSat *nhs = node->storage;
if (nhs->val == 0.0f)
if (nhs->val == 0.0f) {
nhs->val = 1.0f;
}
}
}
}
@@ -219,8 +224,9 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
if (!node->storage) {
ntf = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
node->storage = ntf;
if (node->custom1)
if (node->custom1) {
ntf->x = 1.0f;
}
}
}
@@ -247,8 +253,9 @@ static void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
int 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);
}
}
if (prop->len != i) {
@@ -279,19 +286,22 @@ static void customdata_version_242(Mesh *me)
if (!me->vdata.totlayer) {
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);
}
}
if (!me->edata.totlayer)
if (!me->edata.totlayer) {
CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->medge, me->totedge);
}
if (!me->fdata.totlayer) {
CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, me->mface, me->totface);
if (me->tface) {
if (me->mcol)
if (me->mcol) {
MEM_freeN(me->mcol);
}
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);
@@ -323,19 +333,23 @@ static void customdata_version_242(Mesh *me)
if (layer->type == CD_MTFACE) {
if (layer->name[0] == 0) {
if (mtfacen == 0)
if (mtfacen == 0) {
strcpy(layer->name, "UVMap");
else
}
else {
BLI_snprintf(layer->name, sizeof(layer->name), "UVMap.%.3d", mtfacen);
}
}
mtfacen++;
}
else if (layer->type == CD_MCOL) {
if (layer->name[0] == 0) {
if (mcoln == 0)
if (mcoln == 0) {
strcpy(layer->name, "Col");
else
}
else {
BLI_snprintf(layer->name, sizeof(layer->name), "Col.%.3d", mcoln);
}
}
mcoln++;
}
@@ -394,8 +408,9 @@ static void do_version_free_effect_245(Effect *eff)
if (eff->type == EFF_PARTICLE) {
paf = (PartEff *)eff;
if (paf->keys)
if (paf->keys) {
MEM_freeN(paf->keys);
}
}
MEM_freeN(eff);
}
@@ -437,8 +452,9 @@ static void do_version_constraints_245(ListBase *lb)
bLocateLikeConstraint *data = (bLocateLikeConstraint *)con->data;
/* new headtail functionality makes Bone-Tip function obsolete */
if (data->flag & LOCLIKE_TIP)
if (data->flag & LOCLIKE_TIP) {
con->headtail = 1.0f;
}
}
}
}
@@ -449,8 +465,9 @@ PartEff *blo_do_version_give_parteff_245(Object *ob)
paf = ob->effect.first;
while (paf) {
if (paf->type == EFF_PARTICLE)
if (paf->type == EFF_PARTICLE) {
return paf;
}
paf = paf->next;
}
return NULL;
@@ -518,8 +535,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ob->colbits = 0;
if (ob->totcol) {
for (a = 0; a < ob->totcol; a++) {
if (ob->mat[a])
if (ob->mat[a]) {
ob->colbits |= (1 << a);
}
}
}
ob = ob->id.next;
@@ -541,8 +559,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* mcol changed */
Mesh *me = bmain->meshes.first;
while (me) {
if (me->mcol)
if (me->mcol) {
vcol_to_fcol(me);
}
me = me->id.next;
}
}
@@ -551,8 +570,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
ob = bmain->objects.first;
while (ob) {
if (ob->dt == 0)
if (ob->dt == 0) {
ob->dt = OB_SOLID;
}
ob = ob->id.next;
}
}
@@ -568,8 +588,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
if (v3d->gridlines == 0)
if (v3d->gridlines == 0) {
v3d->gridlines = 20;
}
}
sl = sl->next;
}
@@ -609,8 +630,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 153) {
Scene *sce = bmain->scenes.first;
while (sce) {
if (sce->r.blurfac == 0.0f)
if (sce->r.blurfac == 0.0f) {
sce->r.blurfac = 1.0f;
}
sce = sce->id.next;
}
}
@@ -618,8 +640,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 163) {
Scene *sce = bmain->scenes.first;
while (sce) {
if (sce->r.frs_sec == 0)
if (sce->r.frs_sec == 0) {
sce->r.frs_sec = 25;
}
sce = sce->id.next;
}
}
@@ -662,8 +685,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile <= 169) {
Mesh *me = bmain->meshes.first;
while (me) {
if (me->subdiv == 0)
if (me->subdiv == 0) {
me->subdiv = 1;
}
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->distance = 1.0;
if (sound->attenuation > 0.0f)
if (sound->attenuation > 0.0f) {
sound->flags |= SOUND_FLAGS_3D;
else
}
else {
sound->flags &= ~SOUND_FLAGS_3D;
}
sound = sound->id.next;
}
@@ -784,10 +810,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
me->subdiv = 1;
}
else {
if (me->subdiv < 2)
if (me->subdiv < 2) {
me->subdiv = 1;
else
}
else {
me->subdiv--;
}
}
}
}
@@ -1146,8 +1174,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (wrld->aodist == 0.0f) {
wrld->aodist = 10.0f;
}
if (wrld->aoenergy == 0.0f)
if (wrld->aoenergy == 0.0f) {
wrld->aoenergy = 1.0f;
}
wrld = wrld->id.next;
}
@@ -1196,8 +1225,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_TEXT) {
SpaceText *st = (SpaceText *)sl;
if (st->tabnumber == 0)
if (st->tabnumber == 0) {
st->tabnumber = 2;
}
}
}
}
@@ -1211,16 +1241,18 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Editing *ed;
while (tex) {
if (tex->nabla == 0.0f)
if (tex->nabla == 0.0f) {
tex->nabla = 0.025f;
}
tex = tex->id.next;
}
while (sce) {
ed = sce->ed;
if (ed) {
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_END;
}
@@ -1236,8 +1268,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
while (cam) {
if (cam->ortho_scale == 0.0f) {
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");
}
}
cam = cam->id.next;
}
@@ -1247,10 +1280,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* softbody init new vars */
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->soft) {
if (ob->soft->defgoal == 0.0f)
if (ob->soft->defgoal == 0.0f) {
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;
}
if (ob->soft->interval == 0) {
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) {
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);
}
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (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;
}
}
/* btw. armature_rebuild_pose is further only called on leave editmode */
if (ob->type == OB_ARMATURE) {
if (ob->pose)
if (ob->pose) {
BKE_pose_tag_recalc(bmain, ob->pose);
}
/* cannot call stuff now (pointers!), done in setup_app_data */
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->modifier.mode = 0;
if (me->subdiv != 0)
if (me->subdiv != 0) {
smd->modifier.mode |= 1;
if (me->subdivr != 0)
}
if (me->subdivr != 0) {
smd->modifier.mode |= 2;
}
if (me->flag & ME_OPT_EDGES)
if (me->flag & ME_OPT_EDGES) {
smd->flags |= eSubsurfModifierFlag_ControlEdges;
}
BLI_addtail(&ob->modifiers, smd);
@@ -1341,8 +1382,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (obc && obc->type == OB_CURVE) {
Curve *cu = blo_do_versions_newlibadr(fd, lib, obc->data);
if (cu)
if (cu) {
cu->flag |= CU_PATH;
}
}
}
}
@@ -1431,12 +1473,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
paf = blo_do_version_give_parteff_245(ob);
if (paf) {
if (paf->disp == 0)
if (paf->disp == 0) {
paf->disp = 100;
if (paf->speedtex == 0)
}
if (paf->speedtex == 0) {
paf->speedtex = 8;
if (paf->omat == 0)
}
if (paf->omat == 0) {
paf->omat = 1;
}
}
}
@@ -1460,8 +1505,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (kb = key->block.first; kb; kb = kb->next) {
if (kb == key->refkey) {
if (kb->name[0] == 0)
if (kb->name[0] == 0) {
strcpy(kb->name, "Basis");
}
}
else {
if (kb->name[0] == 0) {
@@ -1499,8 +1545,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* updating stepsize for ghost drawing */
for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_239(&arm->bonebase);
if (arm->layer == 0)
if (arm->layer == 0) {
arm->layer = 1;
}
}
for (; sce; sce = sce->id.next) {
@@ -1511,16 +1558,19 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
for (; cam; cam = cam->id.next) {
if (set_passepartout)
if (set_passepartout) {
cam->flag |= CAM_SHOWPASSEPARTOUT;
}
/* 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;
}
/* set an appropriate camera passepartout alpha */
if (!(cam->passepartalpha))
if (!(cam->passepartalpha)) {
cam->passepartalpha = 0.2f;
}
}
}
@@ -1534,12 +1584,14 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* updating layers still */
for (arm = bmain->armatures.first; arm; arm = arm->id.next) {
bone_version_239(&arm->bonebase);
if (arm->layer == 0)
if (arm->layer == 0) {
arm->layer = 1;
}
}
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->audio.mixrate == 0)
if (sce->audio.mixrate == 0) {
sce->audio.mixrate = 48000;
}
/* 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
@@ -1548,14 +1600,16 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
SceneRenderLayer *srl;
/* new layer flag for sky, was default for solid */
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->passflag &= (SCE_PASS_COMBINED | SCE_PASS_Z | SCE_PASS_NORMAL | SCE_PASS_VECTOR);
}
/* node version changes */
if (sce->nodetree)
if (sce->nodetree) {
ntree_version_241(sce->nodetree);
}
/* uv calculation options moved to toolsettings */
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);
}
for (la = bmain->lights.first; la; la = la->id.next)
if (la->buffers == 0)
for (la = bmain->lights.first; la; la = la->id.next) {
if (la->buffers == 0) {
la->buffers = 1;
}
}
/* for empty drawsize and drawtype */
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
@@ -1614,8 +1671,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
if (v3d->gridsubdiv == 0)
if (v3d->gridsubdiv == 0) {
v3d->gridsubdiv = 10;
}
}
}
sa = sa->next;
@@ -1626,20 +1684,25 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
enum {
R_THREADS = (1 << 19),
};
if (sce->toolsettings->select_thresh == 0.0f)
if (sce->toolsettings->select_thresh == 0.0f) {
sce->toolsettings->select_thresh = 0.01f;
if (sce->r.threads == 0) {
if (sce->r.mode & R_THREADS)
sce->r.threads = 2;
else
sce->r.threads = 1;
}
if (sce->nodetree)
if (sce->r.threads == 0) {
if (sce->r.mode & R_THREADS) {
sce->r.threads = 2;
}
else {
sce->r.threads = 1;
}
}
if (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);
}
/* add default radius values to old curve points */
for (cu = bmain->curves.first; cu; cu = cu->id.next) {
@@ -1647,14 +1710,16 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (nu) {
if (nu->bezt) {
for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
if (!bezt->radius)
if (!bezt->radius) {
bezt->radius = 1.0;
}
}
}
else if (nu->bp) {
for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
if (!bp->radius)
if (!bp->radius) {
bp->radius = 1.0;
}
}
}
}
@@ -1675,10 +1740,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
switch (curcon->type) {
case CONSTRAINT_TYPE_MINMAX: {
bMinMaxConstraint *data = curcon->data;
if (data->sticky == 1)
if (data->sticky == 1) {
data->flag |= MINMAX_STICKY;
else
}
else {
data->flag &= ~MINMAX_STICKY;
}
break;
}
@@ -1686,8 +1753,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bRotateLikeConstraint *data = curcon->data;
/* version patch from buttons_object.c */
if (data->flag == 0)
if (data->flag == 0) {
data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
}
break;
}
@@ -1704,10 +1772,12 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
switch (curcon->type) {
case CONSTRAINT_TYPE_MINMAX: {
bMinMaxConstraint *data = curcon->data;
if (data->sticky == 1)
if (data->sticky == 1) {
data->flag |= MINMAX_STICKY;
else
}
else {
data->flag &= ~MINMAX_STICKY;
}
break;
}
case CONSTRAINT_TYPE_KINEMATIC: {
@@ -1722,8 +1792,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bRotateLikeConstraint *data = curcon->data;
/* version patch from buttons_object.c */
if (data->flag == 0)
if (data->flag == 0) {
data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
}
break;
}
}
@@ -1737,23 +1808,28 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (md->type == eModifierType_Curve) {
CurveModifierData *cmd = (CurveModifierData *)md;
if (cmd->defaxis == 0)
if (cmd->defaxis == 0) {
cmd->defaxis = ob->trackflag + 1;
}
}
}
}
for (ma = bmain->materials.first; ma; ma = ma->id.next) {
if (ma->nodetree)
if (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);
}
for (collection = bmain->collections.first; collection; collection = collection->id.next)
if (collection->layer == 0)
for (collection = bmain->collections.first; collection; collection = collection->id.next) {
if (collection->layer == 0) {
collection->layer = (1 << 20) - 1;
}
}
/* now, subversion control! */
if (bmain->subversionfile < 3) {
@@ -1796,14 +1872,18 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
tex->iuser.cycl = (tex->imaflag & TEX_ANIMCYCLIC) != 0;
}
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree)
if (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);
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);
}
}
}
if (bmain->subversionfile < 4) {
@@ -1857,8 +1937,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* render layer added, this is not the active layer */
if (bmain->versionfile <= 243 || bmain->subversionfile < 2) {
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);
}
}
}
@@ -1926,8 +2007,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bLocLimitConstraint *data = (bLocLimitConstraint *)curcon->data;
/* old limit without parent option for objects */
if (data->flag2)
if (data->flag2) {
curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
}
break;
}
}
@@ -1956,8 +2038,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bActionConstraint *data = (bActionConstraint *)curcon->data;
/* 'data->local' used to mean that target was in local-space */
if (data->local)
if (data->local) {
curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
}
break;
}
}
@@ -1982,8 +2065,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* add point caches */
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);
}
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
if (psys->pointcache) {
@@ -1993,8 +2077,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
psys->pointcache->flag &= ~PTCACHE_BAKED;
}
}
else
else {
psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
}
}
for (md = ob->modifiers.first; md; md = md->next) {
@@ -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) {
if (part->ren_child_nbr == 0)
if (part->ren_child_nbr == 0) {
part->ren_child_nbr = part->child_nbr;
}
}
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
if (sce->nodetree)
if (sce->nodetree) {
ntree_version_245(fd, lib, sce->nodetree);
}
if (sce->r.simplify_subsurf == 0) {
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);
}
/* fix for temporary flag changes during 245 cycle */
for (ima = bmain->images.first; ima; ima = ima->id.next) {
@@ -2095,13 +2183,15 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ModifierData *md;
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;
}
for (ob = bmain->objects.first; ob; ob = ob->id.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;
}
}
}
}
@@ -2143,8 +2233,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
int 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);
@@ -2166,8 +2257,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
int 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);
@@ -2289,8 +2381,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(
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;
}
}
do_version_free_effects_245(&ob->effect);
@@ -2324,8 +2417,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Object *ob;
/* 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;
}
}
if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
@@ -2337,19 +2431,23 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (strip = ob->nlastrips.first; strip; strip = strip->next) {
float length, actlength, repeat;
if (strip->flag & ACTSTRIP_USESTRIDE)
if (strip->flag & ACTSTRIP_USESTRIDE) {
repeat = 1.0f;
else
}
else {
repeat = strip->repeat;
}
length = strip->end - strip->start;
if (length == 0.0f)
if (length == 0.0f) {
length = 1.0f;
}
actlength = strip->actend - strip->actstart;
strip->scale = length / (repeat * actlength);
if (strip->scale == 0.0f)
if (strip->scale == 0.0f) {
strip->scale = 1.0f;
}
}
if (ob->soft) {
ob->soft->inpush = ob->soft->inspring;
@@ -2364,8 +2462,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
SEQ_BEGIN (sce->ed, seq) {
if (seq->blend_mode == 0)
if (seq->blend_mode == 0) {
seq->blend_opacity = 100.0f;
}
}
SEQ_END;
}
@@ -2426,8 +2525,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 246 || (bmain->versionfile == 246 && bmain->subversionfile < 1)) {
Object *ob;
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;
}
}
}
@@ -2503,8 +2603,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (bmain->versionfile < 249 && bmain->subversionfile < 1) {
Object *ob;
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;
}
}
}

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)
/* the UserDef struct is not corrected with do_versions() .... ugh! */
if (userdef->wheellinescroll == 0)
if (userdef->wheellinescroll == 0) {
userdef->wheellinescroll = 3;
}
if (userdef->menuthreshold1 == 0) {
userdef->menuthreshold1 = 5;
userdef->menuthreshold2 = 2;
}
if (userdef->mixbufsize == 0)
if (userdef->mixbufsize == 0) {
userdef->mixbufsize = 2048;
}
if (userdef->autokey_mode == 0) {
/* 'add/replace' but not on */
userdef->autokey_mode = 2;
@@ -177,8 +179,9 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
userdef->gizmo_size = 75;
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;
}
/* graph editor - unselected F-Curve visibility */
if (userdef->fcu_inactive_alpha == 0) {
@@ -197,18 +200,21 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
/* added seam, normal color, undo */
if (!USER_VERSION_ATLEAST(235, 0)) {
userdef->uiflag |= USER_GLOBALUNDO;
if (userdef->undosteps == 0)
if (userdef->undosteps == 0) {
userdef->undosteps = 32;
}
}
if (!USER_VERSION_ATLEAST(236, 0)) {
/* illegal combo... */
if (userdef->flag & USER_LMOUSESELECT)
if (userdef->flag & USER_LMOUSESELECT) {
userdef->flag &= ~USER_TWOBUTTONMOUSE;
}
}
if (!USER_VERSION_ATLEAST(240, 0)) {
userdef->uiflag |= USER_PLAINMENUS;
if (userdef->obcenter_dia == 0)
if (userdef->obcenter_dia == 0) {
userdef->obcenter_dia = 6;
}
}
if (!USER_VERSION_ATLEAST(242, 0)) {
/* set defaults for 3D View rotating axis indicator */
@@ -221,12 +227,14 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
}
if (!USER_VERSION_ATLEAST(244, 0)) {
/* set default number of recently-used files (if not set) */
if (userdef->recent_files == 0)
if (userdef->recent_files == 0) {
userdef->recent_files = 10;
}
}
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);
}
}
if (!USER_VERSION_ATLEAST(245, 3)) {
userdef->flag |= USER_ADD_VIEWALIGNED | USER_ADD_EDITMODE;
@@ -242,56 +250,76 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (!USER_VERSION_ATLEAST(250, 3)) {
/* new audio system */
if (userdef->audiochannels == 0)
if (userdef->audiochannels == 0) {
userdef->audiochannels = 2;
if (userdef->audioformat == 0)
}
if (userdef->audioformat == 0) {
userdef->audioformat = 0x24;
if (userdef->audiorate == 0)
}
if (userdef->audiorate == 0) {
userdef->audiorate = 48000;
}
}
if (!USER_VERSION_ATLEAST(250, 8)) {
wmKeyMap *km;
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");
else if (STREQ(km->idname, "View3D"))
}
else if (STREQ(km->idname, "View3D")) {
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");
else if (STREQ(km->idname, "EditMesh"))
}
else if (STREQ(km->idname, "EditMesh")) {
strcpy(km->idname, "Mesh");
else if (STREQ(km->idname, "UVEdit"))
}
else if (STREQ(km->idname, "UVEdit")) {
strcpy(km->idname, "UV Editor");
else if (STREQ(km->idname, "Animation_Channels"))
}
else if (STREQ(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");
else if (STREQ(km->idname, "GraphEdit Generic"))
}
else if (STREQ(km->idname, "GraphEdit 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");
else if (STREQ(km->idname, "NLA Data"))
}
else if (STREQ(km->idname, "NLA Data")) {
strcpy(km->idname, "NLA Editor");
else if (STREQ(km->idname, "Node Generic"))
}
else if (STREQ(km->idname, "Node Generic")) {
strcpy(km->idname, "Node Editor");
else if (STREQ(km->idname, "Logic Generic"))
}
else if (STREQ(km->idname, "Logic Generic")) {
strcpy(km->idname, "Logic Editor");
else if (STREQ(km->idname, "File"))
}
else if (STREQ(km->idname, "File")) {
strcpy(km->idname, "File Browser");
else if (STREQ(km->idname, "FileMain"))
}
else if (STREQ(km->idname, "FileMain")) {
strcpy(km->idname, "File Browser Main");
else if (STREQ(km->idname, "FileButtons"))
}
else if (STREQ(km->idname, "FileButtons")) {
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");
}
}
}
if (!USER_VERSION_ATLEAST(252, 3)) {
if (userdef->flag & USER_LMOUSESELECT)
if (userdef->flag & USER_LMOUSESELECT) {
userdef->flag &= ~USER_TWOBUTTONMOUSE;
}
}
if (!USER_VERSION_ATLEAST(252, 4)) {
/* default new handle type is auto handles */
@@ -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
* 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;
}
/* enable (Cycles) addon by default */
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) {
userdef->v2d_min_gridsize = 35;
}
if (userdef->widget_unit == 0)
if (userdef->widget_unit == 0) {
userdef->widget_unit = 20;
if (userdef->anisotropic_filter <= 0)
}
if (userdef->anisotropic_filter <= 0) {
userdef->anisotropic_filter = 1;
}
if (userdef->ndof_sensitivity == 0.0f) {
userdef->ndof_sensitivity = 1.0f;
@@ -345,11 +376,13 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (userdef->ndof_orbit_sensitivity == 0.0f) {
userdef->ndof_orbit_sensitivity = userdef->ndof_sensitivity;
if (!(userdef->flag & USER_TRACKBALL))
if (!(userdef->flag & USER_TRACKBALL)) {
userdef->ndof_flag |= NDOF_TURNTABLE;
}
}
if (userdef->tweak_threshold == 0)
if (userdef->tweak_threshold == 0) {
userdef->tweak_threshold = 10;
}
}
/* NOTE!! from now on use userdef->versionfile and userdef->subversionfile */
@@ -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;
}
for (bTheme *btheme = userdef->themes.first; btheme; btheme = btheme->next) {
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);
}
}
else
else {
printf("regiondata write missing!\n");
}
break;
default:
printf("regiondata write missing!\n");