2026
2163
bNodeTree *ntree;
2028
2165
/* only link ID pointers */
2029
for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
2030
if(ntree->id.flag & LIB_NEEDLINK) {
2166
for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
2167
if (ntree->id.flag & LIB_NEEDLINK) {
2031
2168
ntree->id.flag -= LIB_NEEDLINK;
2032
2169
lib_link_ntree(fd, &ntree->id, ntree);
2174
static void do_versions_socket_default_value(bNodeSocket *sock)
2176
bNodeSocketValueFloat *valfloat;
2177
bNodeSocketValueVector *valvector;
2178
bNodeSocketValueRGBA *valrgba;
2180
if (sock->default_value)
2183
switch (sock->type) {
2185
valfloat = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueFloat), "default socket value");
2186
valfloat->value = sock->ns.vec[0];
2187
valfloat->min = sock->ns.min;
2188
valfloat->max = sock->ns.max;
2189
valfloat->subtype = PROP_NONE;
2192
valvector = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueVector), "default socket value");
2193
copy_v3_v3(valvector->value, sock->ns.vec);
2194
valvector->min = sock->ns.min;
2195
valvector->max = sock->ns.max;
2196
valvector->subtype = PROP_NONE;
2199
valrgba = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueRGBA), "default socket value");
2200
copy_v4_v4(valrgba->value, sock->ns.vec);
2205
static void do_versions_nodetree_default_value(bNodeTree *ntree)
2209
for (node=ntree->nodes.first; node; node=node->next) {
2210
for (sock=node->inputs.first; sock; sock=sock->next)
2211
do_versions_socket_default_value(sock);
2212
for (sock=node->outputs.first; sock; sock=sock->next)
2213
do_versions_socket_default_value(sock);
2215
for (sock=ntree->inputs.first; sock; sock=sock->next)
2216
do_versions_socket_default_value(sock);
2217
for (sock=ntree->outputs.first; sock; sock=sock->next)
2218
do_versions_socket_default_value(sock);
2221
static void lib_nodetree_init_types_cb(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
2225
ntreeInitTypes(ntree);
2227
/* need to do this here instead of in do_versions, otherwise next function can crash */
2228
do_versions_nodetree_default_value(ntree);
2230
/* XXX could be replaced by do_versions for new nodes */
2231
for (node=ntree->nodes.first; node; node=node->next)
2232
node_verify_socket_templates(ntree, node);
2235
/* updates group node socket own_index so that
2236
* external links to/from the group node are preserved.
2238
static void lib_node_do_versions_group_indices(bNode *gnode)
2240
bNodeTree *ngroup= (bNodeTree*)gnode->id;
2242
bNodeSocket *sock, *gsock, *intsock;
2245
for (sock=gnode->outputs.first; sock; sock=sock->next) {
2246
int old_index = sock->to_index;
2247
for (gsock=ngroup->outputs.first; gsock; gsock=gsock->next) {
2248
if (gsock->link && gsock->link->fromsock->own_index == old_index) {
2249
sock->own_index = gsock->own_index;
2254
for (sock=gnode->inputs.first; sock; sock=sock->next) {
2255
int old_index = sock->to_index;
2256
/* can't use break in double loop */
2258
for (intnode=ngroup->nodes.first; intnode && !found; intnode=intnode->next) {
2259
for (intsock=intnode->inputs.first; intsock; intsock=intsock->next) {
2260
if (intsock->own_index == old_index && intsock->link) {
2261
sock->own_index = intsock->link->fromsock->own_index;
2270
/* updates external links for all group nodes in a tree */
2271
static void lib_nodetree_do_versions_group_indices_cb(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
2275
for (node=ntree->nodes.first; node; node=node->next) {
2276
if (node->type==NODE_GROUP) {
2277
bNodeTree *ngroup= (bNodeTree*)node->id;
2278
if (ngroup && (ngroup->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE))
2279
lib_node_do_versions_group_indices(node);
2284
/* make an update call for the tree */
2285
static void lib_nodetree_do_versions_update_cb(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
2288
ntreeUpdateTree(ntree);
2037
2291
/* verify types for nodes and groups, all data has to be read */
2038
2292
/* open = 0: appending/linking, open = 1: open new file (need to clean out dynamic
2040
static void lib_verify_nodetree(Main *main, int open)
2294
static void lib_verify_nodetree(Main *main, int UNUSED(open))
2045
2296
bNodeTree *ntree;
2047
/* this crashes blender on undo/redo
2298
bNodeTreeType *ntreetype;
2300
/* this crashes blender on undo/redo */
2049
2303
reinit_nodesystem();
2052
/* now create the own typeinfo structs an verify nodes */
2053
/* here we still assume no groups in groups */
2054
for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
2055
ntreeVerifyTypes(ntree); /* internal nodes, no groups! */
2056
ntreeMakeOwnType(ntree); /* for group usage */
2059
/* now verify all types in material trees, groups are set OK now */
2060
for(ma= main->mat.first; ma; ma= ma->id.next) {
2062
ntreeVerifyTypes(ma->nodetree);
2064
/* and scene trees */
2065
for(sce= main->scene.first; sce; sce= sce->id.next) {
2067
ntreeVerifyTypes(sce->nodetree);
2069
/* and texture trees */
2070
for(tx= main->tex.first; tx; tx= tx->id.next) {
2072
ntreeVerifyTypes(tx->nodetree);
2307
/* set node->typeinfo pointers */
2308
for (i=0; i < NUM_NTREE_TYPES; ++i) {
2309
ntreetype= ntreeGetType(i);
2310
if (ntreetype && ntreetype->foreach_nodetree)
2311
ntreetype->foreach_nodetree(main, NULL, lib_nodetree_init_types_cb);
2313
for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
2314
lib_nodetree_init_types_cb(NULL, NULL, ntree);
2317
int has_old_groups=0;
2318
/* XXX this should actually be part of do_versions, but since we need
2319
* finished library linking, it is not possible there. Instead in do_versions
2320
* we have set the NTREE_DO_VERSIONS flag, so at this point we can do the
2321
* actual group node updates.
2323
for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
2324
if (ntree->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE) {
2325
/* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */
2326
node_group_expose_all_sockets(ntree);
2331
if (has_old_groups) {
2332
for (i=0; i < NUM_NTREE_TYPES; ++i) {
2333
ntreetype= ntreeGetType(i);
2334
if (ntreetype && ntreetype->foreach_nodetree)
2335
ntreetype->foreach_nodetree(main, NULL, lib_nodetree_do_versions_group_indices_cb);
2339
for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
2340
ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE;
2343
/* verify all group user nodes */
2344
for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
2345
ntreeVerifyNodes(main, &ntree->id);
2348
/* make update calls where necessary */
2350
for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
2352
ntreeUpdateTree(ntree);
2354
for (i=0; i < NUM_NTREE_TYPES; ++i) {
2355
ntreetype= ntreeGetType(i);
2356
if (ntreetype && ntreetype->foreach_nodetree)
2357
ntreetype->foreach_nodetree(main, NULL, lib_nodetree_do_versions_update_cb);
2362
static void direct_link_node_socket(FileData *fd, bNodeSocket *sock)
2364
sock->link= newdataadr(fd, sock->link);
2365
sock->storage= newdataadr(fd, sock->storage);
2366
sock->default_value= newdataadr(fd, sock->default_value);
2078
2370
/* ntree itself has been read! */
2079
2371
static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
7493
static void do_version_bone_roll_256(Bone *bone)
7498
copy_m3_m4(submat, bone->arm_mat);
7499
mat3_to_vec_roll(submat, NULL, &bone->arm_roll);
7501
for (child = bone->childbase.first; child; child = child->next)
7502
do_version_bone_roll_256(child);
7505
static void do_versions_nodetree_dynamic_sockets(bNodeTree *ntree)
7508
for (sock=ntree->inputs.first; sock; sock=sock->next)
7509
sock->flag |= SOCK_DYNAMIC;
7510
for (sock=ntree->outputs.first; sock; sock=sock->next)
7511
sock->flag |= SOCK_DYNAMIC;
7514
void convert_tface_mt(FileData *fd, Main *main)
7518
/* this is a delayed do_version (so it can create new materials) */
7519
if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 3)) {
7521
//XXX hack, material.c uses G.main all over the place, instead of main
7522
// temporarily set G.main to the current main
7526
if (!(do_version_tface(main, 1))) {
7527
BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem. Error in console");
7530
//XXX hack, material.c uses G.main allover the place, instead of main
7535
static void do_versions_nodetree_image_default_alpha_output(bNodeTree *ntree)
7539
for (node=ntree->nodes.first; node; node=node->next) {
7540
if (ELEM(node->type, CMP_NODE_IMAGE, CMP_NODE_R_LAYERS)) {
7541
/* default Image output value should have 0 alpha */
7542
sock = node->outputs.first;
7543
((bNodeSocketValueRGBA*)sock->default_value)->value[3] = 0.0f;
7548
static void do_version_ntree_tex_mapping_260(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
7552
for (node=ntree->nodes.first; node; node=node->next) {
7553
if (node->type == SH_NODE_MAPPING) {
7554
TexMapping *tex_mapping;
7556
tex_mapping= node->storage;
7557
tex_mapping->projx= PROJ_X;
7558
tex_mapping->projy= PROJ_Y;
7559
tex_mapping->projz= PROJ_Z;
7564
static void do_versions_nodetree_convert_angle(bNodeTree *ntree)
7567
for (node=ntree->nodes.first; node; node=node->next) {
7568
if (node->type == CMP_NODE_ROTATE) {
7569
/* Convert degrees to radians. */
7570
bNodeSocket *sock = ((bNodeSocket*)node->inputs.first)->next;
7571
((bNodeSocketValueFloat*)sock->default_value)->value = DEG2RADF(((bNodeSocketValueFloat*)sock->default_value)->value);
7573
else if (node->type == CMP_NODE_DBLUR) {
7574
/* Convert degrees to radians. */
7575
NodeDBlurData *ndbd= node->storage;
7576
ndbd->angle = DEG2RADF(ndbd->angle);
7577
ndbd->spin = DEG2RADF(ndbd->spin);
7579
else if (node->type == CMP_NODE_DEFOCUS) {
7580
/* Convert degrees to radians. */
7581
NodeDefocus *nqd = node->storage;
7582
/* XXX DNA char to float conversion seems to map the char value into the [0.0f, 1.0f] range... */
7583
nqd->rotation = DEG2RADF(nqd->rotation*255.0f);
7585
else if (node->type == CMP_NODE_CHROMA_MATTE) {
7586
/* Convert degrees to radians. */
7587
NodeChroma *ndc = node->storage;
7588
ndc->t1 = DEG2RADF(ndc->t1);
7589
ndc->t2 = DEG2RADF(ndc->t2);
7591
else if (node->type == CMP_NODE_GLARE) {
7592
/* Convert degrees to radians. */
7593
NodeGlare* ndg = node->storage;
7594
/* XXX DNA char to float conversion seems to map the char value into the [0.0f, 1.0f] range... */
7595
ndg->angle_ofs = DEG2RADF(ndg->angle_ofs*255.0f);
7597
/* XXX TexMapping struct is used by other nodes too (at least node_composite_mapValue),
7598
* but not the rot part...
7600
else if (node->type == SH_NODE_MAPPING) {
7601
/* Convert degrees to radians. */
7602
TexMapping* tmap = node->storage;
7603
tmap->rot[0] = DEG2RADF(tmap->rot[0]);
7604
tmap->rot[1] = DEG2RADF(tmap->rot[1]);
7605
tmap->rot[2] = DEG2RADF(tmap->rot[2]);
7610
void do_versions_image_settings_2_60(Scene *sce)
7612
/* note: rd->subimtype is moved into individual settings now and no longer
7614
RenderData *rd= &sce->r;
7615
ImageFormatData *imf= &sce->r.im_format;
7617
/* we know no data loss happens here, the old values were in char range */
7618
imf->imtype= (char)rd->imtype;
7619
imf->planes= (char)rd->planes;
7620
imf->compress= (char)rd->quality;
7621
imf->quality= (char)rd->quality;
7623
/* default, was stored in multiple places, may override later */
7624
imf->depth= R_IMF_CHAN_DEPTH_8;
7627
imf->exr_codec = rd->quality & 7; /* strange but true! 0-4 are valid values, OPENEXR_COMPRESS */
7629
switch (imf->imtype) {
7630
case R_IMF_IMTYPE_OPENEXR:
7631
imf->depth= (rd->subimtype & R_OPENEXR_HALF) ? R_IMF_CHAN_DEPTH_16 : R_IMF_CHAN_DEPTH_32;
7632
if (rd->subimtype & R_PREVIEW_JPG) {
7633
imf->flag |= R_IMF_FLAG_PREVIEW_JPG;
7635
if (rd->subimtype & R_OPENEXR_ZBUF) {
7636
imf->flag |= R_IMF_FLAG_ZBUF;
7639
case R_IMF_IMTYPE_TIFF:
7640
if (rd->subimtype & R_TIFF_16BIT) {
7641
imf->depth= R_IMF_CHAN_DEPTH_16;
7644
case R_IMF_IMTYPE_JP2:
7645
if (rd->subimtype & R_JPEG2K_16BIT) {
7646
imf->depth= R_IMF_CHAN_DEPTH_16;
7648
else if (rd->subimtype & R_JPEG2K_12BIT) {
7649
imf->depth= R_IMF_CHAN_DEPTH_12;
7652
if (rd->subimtype & R_JPEG2K_YCC) {
7653
imf->jp2_flag |= R_IMF_JP2_FLAG_YCC;
7655
if (rd->subimtype & R_JPEG2K_CINE_PRESET) {
7656
imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
7658
if (rd->subimtype & R_JPEG2K_CINE_48FPS) {
7659
imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
7662
case R_IMF_IMTYPE_CINEON:
7663
case R_IMF_IMTYPE_DPX:
7664
if (rd->subimtype & R_CINEON_LOG) {
7665
imf->cineon_flag |= R_IMF_CINEON_FLAG_LOG;
7672
/* socket use flags were only temporary before */
7673
static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
7679
for (node=ntree->nodes.first; node; node=node->next) {
7680
for (sock=node->inputs.first; sock; sock=sock->next)
7681
sock->flag &= ~SOCK_IN_USE;
7682
for (sock=node->outputs.first; sock; sock=sock->next)
7683
sock->flag &= ~SOCK_IN_USE;
7685
for (sock=ntree->inputs.first; sock; sock=sock->next)
7686
sock->flag &= ~SOCK_IN_USE;
7687
for (sock=ntree->outputs.first; sock; sock=sock->next)
7688
sock->flag &= ~SOCK_IN_USE;
7690
for (link=ntree->links.first; link; link=link->next) {
7691
link->fromsock->flag |= SOCK_IN_USE;
7692
link->tosock->flag |= SOCK_IN_USE;
7696
static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNodeTree *ntree)
7701
for (node=ntree->nodes.first; node; node=node->next) {
7702
if (node->type==CMP_NODE_OUTPUT_FILE) {
7703
/* previous CMP_NODE_OUTPUT_FILE nodes get converted to multi-file outputs */
7704
NodeImageFile *old_data = node->storage;
7705
NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
7706
bNodeSocket *old_image = BLI_findlink(&node->inputs, 0);
7707
bNodeSocket *old_z = BLI_findlink(&node->inputs, 1);
7709
char basepath[FILE_MAXDIR];
7710
char filename[FILE_MAXFILE];
7712
node->storage= nimf;
7714
/* split off filename from the old path, to be used as socket sub-path */
7715
BLI_split_dirfile(old_data->name, basepath, filename, sizeof(basepath), sizeof(filename));
7717
BLI_strncpy(nimf->base_path, basepath, sizeof(nimf->base_path));
7718
nimf->format = old_data->im_format;
7720
/* if z buffer is saved, change the image type to multilayer exr.
7721
* XXX this is slightly messy, Z buffer was ignored before for anything but EXR and IRIS ...
7722
* i'm just assuming here that IRIZ means IRIS with z buffer ...
7724
if (ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
7725
char sockpath[FILE_MAX];
7727
nimf->format.imtype = R_IMF_IMTYPE_MULTILAYER;
7729
BLI_snprintf(sockpath, sizeof(sockpath), "%s_Image", filename);
7730
sock = ntreeCompositOutputFileAddSocket(ntree, node, sockpath, &nimf->format);
7731
/* XXX later do_versions copies path from socket name, need to set this explicitely */
7732
BLI_strncpy(sock->name, sockpath, sizeof(sock->name));
7733
if (old_image->link) {
7734
old_image->link->tosock = sock;
7735
sock->link = old_image->link;
7738
BLI_snprintf(sockpath, sizeof(sockpath), "%s_Z", filename);
7739
sock = ntreeCompositOutputFileAddSocket(ntree, node, sockpath, &nimf->format);
7740
/* XXX later do_versions copies path from socket name, need to set this explicitely */
7741
BLI_strncpy(sock->name, sockpath, sizeof(sock->name));
7743
old_z->link->tosock = sock;
7744
sock->link = old_z->link;
7748
sock = ntreeCompositOutputFileAddSocket(ntree, node, filename, &nimf->format);
7749
/* XXX later do_versions copies path from socket name, need to set this explicitely */
7750
BLI_strncpy(sock->name, filename, sizeof(sock->name));
7751
if (old_image->link) {
7752
old_image->link->tosock = sock;
7753
sock->link = old_image->link;
7757
nodeRemoveSocket(ntree, node, old_image);
7758
nodeRemoveSocket(ntree, node, old_z);
7759
MEM_freeN(old_data);
7761
else if (node->type==CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
7762
NodeImageMultiFile *nimf = node->storage;
7764
/* CMP_NODE_OUTPUT_MULTI_FILE has been redeclared as CMP_NODE_OUTPUT_FILE */
7765
node->type = CMP_NODE_OUTPUT_FILE;
7767
/* initialize the node-wide image format from render data, if available */
7769
nimf->format = sce->r.im_format;
7771
/* transfer render format toggle to node format toggle */
7772
for (sock=node->inputs.first; sock; sock=sock->next) {
7773
NodeImageMultiFileSocket *simf = sock->storage;
7774
simf->use_node_format = simf->use_render_format;
7777
/* we do have preview now */
7778
node->flag |= NODE_PREVIEW;
7783
/* blue and red are swapped pre 2.62.1, be sane (red == red) now! */
7784
static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me)
7786
CustomDataLayer *layer;
7791
for (a = 0; a < me->ldata.totlayer; a++) {
7792
layer = &me->ldata.layers[a];
7794
if (layer->type == CD_MLOOPCOL) {
7795
mloopcol = (MLoopCol *)layer->data;
7796
for (i = 0; i < me->totloop; i++, mloopcol++) {
7797
SWAP(char, mloopcol->r, mloopcol->b);
6573
7803
static void do_versions(FileData *fd, Library *lib, Main *main)
6575
7805
/* WATCH IT!!!: pointers from libdata have not been converted */
6578
printf("read file %s\n Version %d sub %d\n", fd->relabase, main->versionfile, main->subversionfile);
7807
if (G.debug & G_DEBUG)
7808
printf("read file %s\n Version %d sub %d svn r%d\n", fd->relabase, main->versionfile, main->subversionfile, main->revision);
6580
if(main->versionfile == 100) {
7810
if (main->versionfile == 100) {
6581
7811
/* tex->extend and tex->imageflag have changed: */
6582
7812
Tex *tex = main->tex.first;
6584
if(tex->id.flag & LIB_NEEDLINK) {
7814
if (tex->id.flag & LIB_NEEDLINK) {
6586
if(tex->extend==0) {
6587
if(tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
7816
if (tex->extend==0) {
7817
if (tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
6589
7819
tex->extend= TEX_EXTEND;
6590
7820
tex->xrepeat= tex->yrepeat= 1;
11033
12189
brush->add_col[1] == 0 &&
11034
12190
brush->add_col[2] == 0)
11036
brush->add_col[0] = 1.00;
11037
brush->add_col[1] = 0.39;
11038
brush->add_col[2] = 0.39;
12192
brush->add_col[0] = 1.00f;
12193
brush->add_col[1] = 0.39f;
12194
brush->add_col[2] = 0.39f;
11041
12197
if (brush->sub_col[0] == 0 &&
11042
12198
brush->sub_col[1] == 0 &&
11043
12199
brush->sub_col[2] == 0)
11045
brush->sub_col[0] = 0.39;
11046
brush->sub_col[1] = 0.39;
11047
brush->sub_col[2] = 1.00;
11053
/* put compatibility code here until next subversion bump */
12201
brush->sub_col[0] = 0.39f;
12202
brush->sub_col[1] = 0.39f;
12203
brush->sub_col[2] = 1.00f;
12209
/* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
12210
if (main->versionfile < 253) {
12212
for (sce= main->scene.first; sce; sce= sce->id.next) {
12213
if (sce->toolsettings->sculpt_paint_unified_alpha == 0)
12214
sce->toolsettings->sculpt_paint_unified_alpha = 0.5f;
12216
if (sce->toolsettings->sculpt_paint_unified_unprojected_radius == 0)
12217
sce->toolsettings->sculpt_paint_unified_unprojected_radius = 0.125f;
12219
if (sce->toolsettings->sculpt_paint_unified_size == 0)
12220
sce->toolsettings->sculpt_paint_unified_size = 35;
12224
if (main->versionfile < 253 || (main->versionfile == 253 && main->subversionfile < 1))
12228
for (ob = main->object.first; ob; ob = ob->id.next) {
12230
for (md= ob->modifiers.first; md; md= md->next) {
12231
if (md->type == eModifierType_Smoke) {
12232
SmokeModifierData *smd = (SmokeModifierData *)md;
12234
if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
12236
smd->domain->vorticity = 2.0f;
12237
smd->domain->time_scale = 1.0f;
12239
if (!(smd->domain->flags & (1<<4)))
12242
/* delete old MOD_SMOKE_INITVELOCITY flag */
12243
smd->domain->flags &= ~(1<<4);
12245
/* for now just add it to all flow objects in the scene */
12248
for (ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
12250
for (md2= ob2->modifiers.first; md2; md2= md2->next) {
12251
if (md2->type == eModifierType_Smoke) {
12252
SmokeModifierData *smd2 = (SmokeModifierData *)md2;
12254
if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
12256
smd2->flow->flags |= MOD_SMOKE_FLOW_INITVELOCITY;
12264
else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
12265
smd->flow->vel_multi = 1.0f;
12273
if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 1)) {
12275
ParticleSettings *part;
12279
for (br= main->brush.first; br; br= br->id.next) {
12280
if (br->ob_mode==0)
12281
br->ob_mode= OB_MODE_ALL_PAINT;
12284
for (part = main->particle.first; part; part = part->id.next) {
12286
part->boids->pitch = 1.0f;
12288
part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */
12289
part->kink_amp_clump = 1.f; /* keep old files looking similar */
12292
for (sc= main->screen.first; sc; sc= sc->id.next) {
12294
for (sa= sc->areabase.first; sa; sa= sa->next) {
12296
for (sl= sa->spacedata.first; sl; sl= sl->next) {
12297
if (sl->spacetype == SPACE_INFO) {
12298
SpaceInfo *sinfo= (SpaceInfo *)sl;
12301
sinfo->rpt_mask= INFO_RPT_OP;
12303
for (ar= sa->regionbase.first; ar; ar= ar->next) {
12304
if (ar->regiontype == RGN_TYPE_WINDOW) {
12305
ar->v2d.scroll = (V2D_SCROLL_RIGHT);
12306
ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
12307
ar->v2d.keepofs = V2D_LOCKOFS_X;
12308
ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
12309
ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
12310
ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
12318
/* fix rotation actuators for objects so they use real angles (radians)
12319
* since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */
12320
for (ob= main->object.first; ob; ob= ob->id.next) {
12321
bActuator *act= ob->actuators.first;
12323
if (act->type==ACT_OBJECT) {
12324
/* multiply velocity with 50 in old files */
12325
bObjectActuator *oa= act->data;
12326
mul_v3_fl(oa->drot, 0.8726646259971648f);
12333
// init facing axis property of steering actuators
12336
for (ob = main->object.first; ob; ob = ob->id.next) {
12338
for (act= ob->actuators.first; act; act= act->next) {
12339
if (act->type==ACT_STEERING) {
12340
bSteeringActuator* stact = act->data;
12341
if (stact->facingaxis==0)
12343
stact->facingaxis=1;
12350
if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) {
12353
/* ocean res is now squared, reset old ones - will be massive */
12354
for (ob = main->object.first; ob; ob = ob->id.next) {
12356
for (md= ob->modifiers.first; md; md= md->next) {
12357
if (md->type == eModifierType_Ocean) {
12358
OceanModifierData *omd = (OceanModifierData *)md;
12359
omd->resolution = 7;
12360
omd->oceancache = NULL;
12366
if (main->versionfile < 256) {
12371
/* Fix for sample line scope initializing with no height */
12372
for (sc= main->screen.first; sc; sc= sc->id.next) {
12373
sa= sc->areabase.first;
12376
for (sl= sa->spacedata.first; sl; sl= sl->next) {
12377
if (sl->spacetype==SPACE_IMAGE) {
12378
SpaceImage *sima= (SpaceImage *)sl;
12379
if (sima->sample_line_hist.height == 0 )
12380
sima->sample_line_hist.height = 100;
12387
/* old files could have been saved with slidermin = slidermax = 0.0, but the UI in
12388
* 2.4x would never reveal this to users as a dummy value always ended up getting used
12391
for (key = main->key.first; key; key = key->id.next) {
12394
for (kb = key->block.first; kb; kb = kb->next) {
12395
if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQ(kb->slidermax, 0))
12396
kb->slidermax = kb->slidermin + 1.0f;
12401
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 1)) {
12402
/* fix for bones that didn't have arm_roll before */
12407
for (arm = main->armature.first; arm; arm = arm->id.next)
12408
for (bone = arm->bonebase.first; bone; bone = bone->next)
12409
do_version_bone_roll_256(bone);
12411
/* fix for objects which have zero dquat's
12412
* since this is multiplied with the quat rather than added */
12413
for (ob= main->object.first; ob; ob= ob->id.next) {
12414
if (is_zero_v4(ob->dquat)) {
12415
unit_qt(ob->dquat);
12417
if (is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) {
12418
unit_axis_angle(ob->drotAxis, &ob->drotAngle);
12423
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
12426
/* node sockets are not exposed automatically any more,
12427
* this mimics the old behavior by adding all unlinked sockets to groups.
12429
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
12430
/* XXX Only setting a flag here. Actual adding of group sockets
12431
* is done in lib_verify_nodetree, because at this point the internal
12432
* nodes may not be up-to-date! (missing lib-link)
12434
ntree->flag |= NTREE_DO_VERSIONS_GROUP_EXPOSE;
12438
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)) {
12442
ParticleSettings *part;
12444
int tex_nr, transp_tex;
12446
for (mat = main->mat.first; mat; mat = mat->id.next) {
12447
if (!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)) {
12451
for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
12452
if (!mat->mtex[tex_nr]) continue;
12453
if (mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
12456
/* weak! material alpha could be animated */
12457
if (mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex) {
12458
mat->mode |= MA_TRANSP;
12459
mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
12464
/* redraws flag in SpaceTime has been moved to Screen level */
12465
for (sc = main->screen.first; sc; sc= sc->id.next) {
12466
if (sc->redraws_flag == 0) {
12467
/* just initialize to default? */
12468
// XXX: we could also have iterated through areas, and taken them from the first timeline available...
12469
sc->redraws_flag = TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
12473
for (brush= main->brush.first; brush; brush= brush->id.next) {
12474
if (brush->height == 0)
12475
brush->height= 0.4f;
12478
/* replace 'rim material' option for in offset*/
12479
for (ob = main->object.first; ob; ob = ob->id.next) {
12481
for (md= ob->modifiers.first; md; md= md->next) {
12482
if (md->type == eModifierType_Solidify) {
12483
SolidifyModifierData *smd = (SolidifyModifierData *)md;
12484
if (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) {
12485
smd->mat_ofs_rim= 1;
12486
smd->flag &= ~MOD_SOLIDIFY_RIM_MATERIAL;
12492
/* particle draw color from material */
12493
for (part = main->particle.first; part; part = part->id.next) {
12494
if (part->draw & PART_DRAW_MAT_COL)
12495
part->draw_col = PART_DRAW_COL_MAT;
12499
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)) {
12502
for (me= main->mesh.first; me; me= me->id.next)
12503
mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
12506
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
12507
/* update blur area sizes from 0..1 range to 0..100 percentage */
12510
for (scene=main->scene.first; scene; scene=scene->id.next)
12511
if (scene->nodetree)
12512
for (node=scene->nodetree->nodes.first; node; node=node->next)
12513
if (node->type==CMP_NODE_BLUR) {
12514
NodeBlurData *nbd= node->storage;
12515
nbd->percentx *= 100.0f;
12516
nbd->percenty *= 100.0f;
12520
if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)) {
12521
/* screen view2d settings were not properly initialized [#27164]
12522
* v2d->scroll caused the bug but best reset other values too which are in old blend files only.
12523
* need to make less ugly - possibly an iterator? */
12525
for (screen= main->screen.first; screen; screen= screen->id.next) {
12528
for (sa= screen->areabase.first; sa; sa= sa->next) {
12529
SpaceLink *sl= sa->spacedata.first;
12530
if (sl->spacetype==SPACE_IMAGE) {
12532
for (ar=sa->regionbase.first; ar; ar= ar->next) {
12533
if (ar->regiontype == RGN_TYPE_WINDOW) {
12534
View2D *v2d= &ar->v2d;
12535
v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
12539
for (sl= sa->spacedata.first; sl; sl= sl->next) {
12540
if (sl->spacetype==SPACE_IMAGE) {
12542
for (ar=sl->regionbase.first; ar; ar= ar->next) {
12543
if (ar->regiontype == RGN_TYPE_WINDOW) {
12544
View2D *v2d= &ar->v2d;
12545
v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
12554
/* Initialize texture point density curve falloff */
12556
for (tex= main->tex.first; tex; tex= tex->id.next) {
12558
if (tex->pd->falloff_speed_scale == 0.0f)
12559
tex->pd->falloff_speed_scale = 100.0f;
12561
if (!tex->pd->falloff_curve) {
12562
tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
12564
tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
12565
tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
12566
curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
12567
curvemapping_changed(tex->pd->falloff_curve, 0);
12574
/* add default value for behind strength of camera actuator */
12577
for (ob = main->object.first; ob; ob= ob->id.next) {
12578
for (act= ob->actuators.first; act; act= act->next) {
12579
if (act->type == ACT_CAMERA) {
12580
bCameraActuator *ba= act->data;
12582
ba->damping = 1.0/32.0;
12589
ParticleSettings *part;
12590
for (part = main->particle.first; part; part = part->id.next) {
12591
/* Initialize particle billboard scale */
12592
part->bb_size[0] = part->bb_size[1] = 1.0f;
12597
if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)) {
12602
for (scene=main->scene.first; scene; scene=scene->id.next)
12604
scene->r.ffcodecdata.audio_channels = 2;
12605
scene->audio.volume = 1.0f;
12606
SEQ_BEGIN(scene->ed, seq) {
12614
for (screen= main->screen.first; screen; screen= screen->id.next) {
12617
for (sa= screen->areabase.first; sa; sa= sa->next) {
12618
SpaceLink *sl= sa->spacedata.first;
12619
if (sl->spacetype==SPACE_SEQ) {
12621
for (ar=sa->regionbase.first; ar; ar= ar->next) {
12622
if (ar->regiontype == RGN_TYPE_WINDOW) {
12623
if (ar->v2d.min[1] == 4.0f)
12624
ar->v2d.min[1]= 0.5f;
12628
for (sl= sa->spacedata.first; sl; sl= sl->next) {
12629
if (sl->spacetype==SPACE_SEQ) {
12631
for (ar=sl->regionbase.first; ar; ar= ar->next) {
12632
if (ar->regiontype == RGN_TYPE_WINDOW) {
12633
if (ar->v2d.min[1] == 4.0f)
12634
ar->v2d.min[1]= 0.5f;
12643
/* Make "auto-clamped" handles a per-keyframe setting instead of per-FCurve
12645
* We're only patching F-Curves in Actions here, since it is assumed that most
12646
* drivers out there won't be using this (and if they are, they're in the minority).
12647
* While we should aim to fix everything ideally, in practice it's far too hard
12648
* to get to every animdata block, not to mention the performance hit that'd have
12653
for (act = main->action.first; act; act = act->id.next) {
12654
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
12656
unsigned int i = 0;
12658
/* only need to touch curves that had this flag set */
12659
if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0)
12661
if ((fcu->totvert == 0) || (fcu->bezt == NULL))
12664
/* only change auto-handles to auto-clamped */
12665
for (bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
12666
if (bezt->h1 == HD_AUTO) bezt->h1 = HD_AUTO_ANIM;
12667
if (bezt->h2 == HD_AUTO) bezt->h2 = HD_AUTO_ANIM;
12670
fcu->flag &= ~FCURVE_AUTO_HANDLES;
12675
/* convert fcurve and shape action actuators to action actuators */
12679
bActionActuator *aa;
12681
for (ob= main->object.first; ob; ob= ob->id.next) {
12682
for (act= ob->actuators.first; act; act= act->next) {
12683
if (act->type == ACT_IPO) {
12684
// Create the new actuator
12686
aa= MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version");
12689
aa->type = ia->type;
12690
aa->flag = ia->flag;
12693
BLI_strncpy(aa->name, ia->name, sizeof(aa->name));
12694
BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp));
12696
aa->act = ob->adt->action;
12698
// Get rid of the old actuator
12701
// Assign the new actuator
12703
act->type= act->otype= ACT_ACTION;
12706
else if (act->type == ACT_SHAPEACTION) {
12707
act->type = act->otype = ACT_ACTION;
12714
if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)) {
12716
/* Convert default socket values from bNodeStack */
12721
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
12722
do_versions_nodetree_default_value(ntree);
12723
ntree->update |= NTREE_UPDATE;
12725
for (sce=main->scene.first; sce; sce=sce->id.next)
12726
if (sce->nodetree) {
12727
do_versions_nodetree_default_value(sce->nodetree);
12728
sce->nodetree->update |= NTREE_UPDATE;
12730
for (mat=main->mat.first; mat; mat=mat->id.next)
12731
if (mat->nodetree) {
12732
do_versions_nodetree_default_value(mat->nodetree);
12733
mat->nodetree->update |= NTREE_UPDATE;
12735
for (tex=main->tex.first; tex; tex=tex->id.next)
12736
if (tex->nodetree) {
12737
do_versions_nodetree_default_value(tex->nodetree);
12738
tex->nodetree->update |= NTREE_UPDATE;
12742
/* add SOCK_DYNAMIC flag to existing group sockets */
12745
/* only need to do this for trees in main, local trees are not used as groups */
12746
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
12747
do_versions_nodetree_dynamic_sockets(ntree);
12748
ntree->update |= NTREE_UPDATE;
12753
/* Initialize group tree nodetypes.
12754
* These are used to distinguish tree types and
12755
* associate them with specific node types for polling.
12758
/* all node trees in main->nodetree are considered groups */
12759
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
12760
ntree->nodetype = NODE_GROUP;
12764
if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)) {
12766
/* Adaptive time step for particle systems */
12767
ParticleSettings *part;
12768
for (part = main->particle.first; part; part = part->id.next) {
12769
part->courant_target = 0.2f;
12770
part->time_flag &= ~PART_TIME_AUTOSF;
12775
/* set defaults for obstacle avoidance, recast data */
12777
for (sce = main->scene.first; sce; sce = sce->id.next)
12779
if (sce->gm.levelHeight == 0.f)
12780
sce->gm.levelHeight = 2.f;
12782
if (sce->gm.recastData.cellsize == 0.0f)
12783
sce->gm.recastData.cellsize = 0.3f;
12784
if (sce->gm.recastData.cellheight == 0.0f)
12785
sce->gm.recastData.cellheight = 0.2f;
12786
if (sce->gm.recastData.agentmaxslope == 0.0f)
12787
sce->gm.recastData.agentmaxslope = (float)M_PI/4;
12788
if (sce->gm.recastData.agentmaxclimb == 0.0f)
12789
sce->gm.recastData.agentmaxclimb = 0.9f;
12790
if (sce->gm.recastData.agentheight == 0.0f)
12791
sce->gm.recastData.agentheight = 2.0f;
12792
if (sce->gm.recastData.agentradius == 0.0f)
12793
sce->gm.recastData.agentradius = 0.6f;
12794
if (sce->gm.recastData.edgemaxlen == 0.0f)
12795
sce->gm.recastData.edgemaxlen = 12.0f;
12796
if (sce->gm.recastData.edgemaxerror == 0.0f)
12797
sce->gm.recastData.edgemaxerror = 1.3f;
12798
if (sce->gm.recastData.regionminsize == 0.0f)
12799
sce->gm.recastData.regionminsize = 8.f;
12800
if (sce->gm.recastData.regionmergesize == 0.0f)
12801
sce->gm.recastData.regionmergesize = 20.f;
12802
if (sce->gm.recastData.vertsperpoly<3)
12803
sce->gm.recastData.vertsperpoly = 6;
12804
if (sce->gm.recastData.detailsampledist == 0.0f)
12805
sce->gm.recastData.detailsampledist = 6.0f;
12806
if (sce->gm.recastData.detailsamplemaxerror == 0.0f)
12807
sce->gm.recastData.detailsamplemaxerror = 1.0f;
12812
if (main->versionfile < 260) {
12814
/* set default alpha value of Image outputs in image and render layer nodes to 0 */
12818
for (sce=main->scene.first; sce; sce=sce->id.next) {
12819
/* there are files with invalid audio_channels value, the real cause
12820
* is unknown, but we fix it here anyway to avoid crashes */
12821
if (sce->r.ffcodecdata.audio_channels == 0)
12822
sce->r.ffcodecdata.audio_channels = 2;
12825
do_versions_nodetree_image_default_alpha_output(sce->nodetree);
12828
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
12829
do_versions_nodetree_image_default_alpha_output(ntree);
12833
/* support old particle dupliobject rotation settings */
12834
ParticleSettings *part;
12836
for (part=main->particle.first; part; part=part->id.next) {
12837
if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
12838
part->draw |= PART_DRAW_ROTATE_OB;
12840
if (part->rotmode == 0)
12841
part->rotmode = PART_ROT_VEL;
12847
if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)) {
12850
for (ob= main->object.first; ob; ob= ob->id.next) {
12851
ob->collision_boundtype= ob->boundtype;
12856
for (cam= main->camera.first; cam; cam= cam->id.next) {
12857
if (cam->sensor_x < 0.01f)
12858
cam->sensor_x = DEFAULT_SENSOR_WIDTH;
12860
if (cam->sensor_y < 0.01f)
12861
cam->sensor_y = DEFAULT_SENSOR_HEIGHT;
12866
if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 2)) {
12867
bNodeTreeType *ntreetype= ntreeGetType(NTREE_SHADER);
12869
if (ntreetype && ntreetype->foreach_nodetree)
12870
ntreetype->foreach_nodetree(main, NULL, do_version_ntree_tex_mapping_260);
12873
if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 4)) {
12875
/* Convert node angles to radians! */
12880
for (sce=main->scene.first; sce; sce=sce->id.next) {
12882
do_versions_nodetree_convert_angle(sce->nodetree);
12885
for (mat=main->mat.first; mat; mat=mat->id.next) {
12887
do_versions_nodetree_convert_angle(mat->nodetree);
12890
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
12891
do_versions_nodetree_convert_angle(ntree);
12895
/* Tomato compatibility code. */
12899
for (sc= main->screen.first; sc; sc= sc->id.next) {
12901
for (sa= sc->areabase.first; sa; sa= sa->next) {
12903
for (sl= sa->spacedata.first; sl; sl= sl->next) {
12904
if (sl->spacetype==SPACE_VIEW3D) {
12905
View3D *v3d= (View3D *)sl;
12906
if (v3d->bundle_size==0.0f) {
12907
v3d->bundle_size= 0.2f;
12908
v3d->flag2 |= V3D_SHOW_RECONSTRUCTION;
12910
else if (sl->spacetype==SPACE_CLIP) {
12911
SpaceClip *sc= (SpaceClip *)sl;
12912
if (sc->scopes.track_preview_height==0)
12913
sc->scopes.track_preview_height= 120;
12916
if (v3d->bundle_drawtype==0)
12917
v3d->bundle_drawtype= OB_PLAINAXES;
12923
for (clip= main->movieclip.first; clip; clip= clip->id.next) {
12924
MovieTrackingTrack *track;
12926
if (clip->aspx<1.0f) {
12931
clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN |
12933
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
12935
if (clip->proxy.build_size_flag==0)
12936
clip->proxy.build_size_flag= IMB_PROXY_25;
12938
if (clip->proxy.quality==0)
12939
clip->proxy.quality= 90;
12941
if (clip->tracking.camera.pixel_aspect<0.01f)
12942
clip->tracking.camera.pixel_aspect= 1.f;
12944
track= clip->tracking.tracks.first;
12946
if (track->pyramid_levels==0)
12947
track->pyramid_levels= 2;
12949
if (track->minimum_correlation==0.0f)
12950
track->minimum_correlation= 0.75f;
12952
track= track->next;
12958
if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 6))
12964
for (sce = main->scene.first; sce; sce = sce->id.next) {
12965
do_versions_image_settings_2_60(sce);
12968
for (clip= main->movieclip.first; clip; clip= clip->id.next) {
12969
MovieTrackingSettings *settings= &clip->tracking.settings;
12971
if (settings->default_pyramid_levels==0) {
12972
settings->default_tracker= TRACKER_KLT;
12973
settings->default_pyramid_levels= 2;
12974
settings->default_minimum_correlation= 0.75;
12975
settings->default_pattern_size= 11;
12976
settings->default_search_size= 51;
12980
for (sc= main->screen.first; sc; sc= sc->id.next) {
12982
for (sa= sc->areabase.first; sa; sa= sa->next) {
12984
for (sl= sa->spacedata.first; sl; sl= sl->next) {
12985
if (sl->spacetype==SPACE_VIEW3D) {
12986
View3D *v3d= (View3D *)sl;
12987
v3d->flag2&= ~V3D_RENDER_SHADOW;
12995
for (ob= main->object.first; ob; ob= ob->id.next) {
12996
/* convert delta addition into delta scale */
12998
for (i= 0; i < 3; i++) {
12999
if ( (ob->dsize[i] == 0.0f) || /* simple case, user never touched dsize */
13000
(ob->size[i] == 0.0f)) /* cant scale the dsize to give a non zero result, so fallback to 1.0f */
13002
ob->dscale[i]= 1.0f;
13005
ob->dscale[i]= (ob->size[i] + ob->dsize[i]) / ob->size[i];
13011
/* sigh, this dscale vs dsize version patching was not done right, fix for fix,
13012
* this intentionally checks an exact subversion, also note this was never in a release,
13013
* at some point this could be removed. */
13014
else if (main->versionfile == 260 && main->subversionfile == 6) {
13016
for (ob = main->object.first; ob; ob= ob->id.next) {
13017
if (is_zero_v3(ob->dscale)) {
13018
fill_vn_fl(ob->dscale, 3, 1.0f);
13023
if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 8))
13027
for (brush= main->brush.first; brush; brush= brush->id.next) {
13028
if (brush->sculpt_tool == SCULPT_TOOL_ROTATE)
13029
brush->alpha= 1.0f;
13033
if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 1))
13036
/* update use flags for node sockets (was only temporary before) */
13044
for (sce=main->scene.first; sce; sce=sce->id.next)
13046
do_versions_nodetree_socket_use_flags_2_62(sce->nodetree);
13048
for (mat=main->mat.first; mat; mat=mat->id.next)
13050
do_versions_nodetree_socket_use_flags_2_62(mat->nodetree);
13052
for (tex=main->tex.first; tex; tex=tex->id.next)
13054
do_versions_nodetree_socket_use_flags_2_62(tex->nodetree);
13056
for (lamp=main->lamp.first; lamp; lamp=lamp->id.next)
13057
if (lamp->nodetree)
13058
do_versions_nodetree_socket_use_flags_2_62(lamp->nodetree);
13060
for (world=main->world.first; world; world=world->id.next)
13061
if (world->nodetree)
13062
do_versions_nodetree_socket_use_flags_2_62(world->nodetree);
13064
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
13065
do_versions_nodetree_socket_use_flags_2_62(ntree);
13068
/* Initialize BGE exit key to esc key */
13070
for (scene= main->scene.first; scene; scene= scene->id.next) {
13071
if (!scene->gm.exitkey)
13072
scene->gm.exitkey = 218; // Blender key code for ESC
13079
for (clip= main->movieclip.first; clip; clip= clip->id.next) {
13080
MovieTracking *tracking= &clip->tracking;
13081
MovieTrackingObject *tracking_object= tracking->objects.first;
13083
clip->proxy.build_tc_flag|= IMB_TC_RECORD_RUN_NO_GAPS;
13085
if (!tracking->settings.object_distance)
13086
tracking->settings.object_distance= 1.0f;
13088
if (tracking->objects.first == NULL)
13089
BKE_tracking_new_object(tracking, "Camera");
13091
while (tracking_object) {
13092
if (!tracking_object->scale)
13093
tracking_object->scale= 1.0f;
13095
tracking_object= tracking_object->next;
13099
for (ob= main->object.first; ob; ob= ob->id.next) {
13101
for (con= ob->constraints.first; con; con=con->next) {
13102
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
13107
if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
13108
bObjectSolverConstraint *data= (bObjectSolverConstraint *)con->data;
13110
if (data->invmat[3][3]==0.0f)
13111
unit_m4(data->invmat);
13117
/* Warn the user if he is using ["Text"] properties for Font objects */
13121
for (ob= main->object.first; ob; ob= ob->id.next) {
13122
if (ob->type == OB_FONT) {
13123
prop = get_ob_property(ob, "Text");
13125
BKE_reportf_wrap(fd->reports, RPT_WARNING,
13126
"Game property name conflict in object: \"%s\".\nText objects reserve the "
13127
"[\"Text\"] game property to change their content through Logic Bricks.\n",
13135
if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2))
13138
/* convert Camera Actuator values to defines */
13141
for (ob = main->object.first; ob; ob= ob->id.next) {
13142
for (act= ob->actuators.first; act; act= act->next) {
13143
if (act->type == ACT_CAMERA) {
13144
bCameraActuator *ba= act->data;
13146
if (ba->axis==(float) 'x') ba->axis=OB_POSX;
13147
else if (ba->axis==(float)'y') ba->axis=OB_POSY;
13148
/* don't do an if/else to avoid imediate subversion bump*/
13149
// ba->axis=((ba->axis == (float) 'x')?OB_POSX_X:OB_POSY);
13156
/* convert deprecated sculpt_paint_unified_* fields to
13157
* UnifiedPaintSettings */
13159
for (scene= main->scene.first; scene; scene= scene->id.next) {
13160
ToolSettings *ts= scene->toolsettings;
13161
UnifiedPaintSettings *ups= &ts->unified_paint_settings;
13162
ups->size= ts->sculpt_paint_unified_size;
13163
ups->unprojected_radius= ts->sculpt_paint_unified_unprojected_radius;
13164
ups->alpha= ts->sculpt_paint_unified_alpha;
13165
ups->flag= ts->sculpt_paint_settings;
13170
if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 3))
13173
/* convert extended ascii to utf-8 for text editor */
13175
for (text= main->text.first; text; text= text->id.next)
13176
if (!(text->flags & TXT_ISEXT)) {
13179
for (tl= text->lines.first; tl; tl= tl->next) {
13180
int added= txt_extended_ascii_as_utf8(&tl->line);
13183
/* reset cursor position if line was changed */
13184
if (added && tl == text->curl)
13190
/* set new dynamic paint values */
13192
for (ob = main->object.first; ob; ob = ob->id.next) {
13194
for (md= ob->modifiers.first; md; md= md->next) {
13195
if (md->type == eModifierType_DynamicPaint) {
13196
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
13199
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
13200
for (; surface; surface=surface->next) {
13201
surface->color_dry_threshold = 1.0f;
13202
surface->influence_scale = 1.0f;
13203
surface->radius_scale = 1.0f;
13204
surface->flags |= MOD_DPAINT_USE_DRYING;
13213
if (main->versionfile < 262)
13216
for (ob=main->object.first; ob; ob= ob->id.next) {
13219
for (md=ob->modifiers.first; md; md=md->next) {
13220
if (md->type==eModifierType_Cloth) {
13221
ClothModifierData *clmd = (ClothModifierData*) md;
13222
if (clmd->sim_parms)
13223
clmd->sim_parms->vel_damping = 1.0f;
13229
if (main->versionfile < 263)
13231
/* set fluidsim rate. the version patch for this in 2.62 was wrong, so
13232
* try to correct it, if rate is 0.0 that's likely not intentional */
13235
for (ob = main->object.first; ob; ob = ob->id.next) {
13237
for (md = ob->modifiers.first; md; md = md->next) {
13238
if (md->type == eModifierType_Fluidsim) {
13239
FluidsimModifierData *fmd = (FluidsimModifierData *)md;
13240
if (fmd->fss->animRate == 0.0f)
13241
fmd->fss->animRate = 1.0f;
13247
if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 1))
13249
/* update use flags for node sockets (was only temporary before) */
13253
for (sce=main->scene.first; sce; sce=sce->id.next)
13255
do_versions_nodetree_multi_file_output_format_2_62_1(sce, sce->nodetree);
13257
/* XXX can't associate with scene for group nodes, image format will stay uninitialized */
13258
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
13259
do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree);
13262
/* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
13263
if (main->versionfile == 262 && main->subversionfile == 1)
13267
for (me = main->mesh.first; me; me = me->id.next) {
13268
do_versions_mesh_mloopcol_swap_2_62_1(me);
13274
if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 2))
13277
/* Set new idname of keyingsets from their now "label-only" name. */
13279
for (scene = main->scene.first; scene; scene = scene->id.next) {
13281
for (ks = scene->keyingsets.first; ks; ks = ks->next) {
13282
if (!ks->idname[0])
13283
BLI_strncpy(ks->idname, ks->name, sizeof(ks->idname));
13289
if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 3))
13294
for (ob = main->object.first; ob; ob = ob->id.next) {
13295
for (md=ob->modifiers.first; md; md=md->next) {
13296
if (md->type == eModifierType_Lattice) {
13297
LatticeModifierData *lmd = (LatticeModifierData *)md;
13298
lmd->strength = 1.0f;
13304
if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 4))
13306
/* Read Viscosity presets from older files */
13309
for (ob = main->object.first; ob; ob = ob->id.next) {
13311
for (md = ob->modifiers.first; md; md = md->next) {
13312
if (md->type == eModifierType_Fluidsim) {
13313
FluidsimModifierData *fmd = (FluidsimModifierData *)md;
13314
if (fmd->fss->viscosityMode == 3) {
13315
fmd->fss->viscosityValue = 5.0;
13316
fmd->fss->viscosityExponent = 5;
13318
else if (fmd->fss->viscosityMode == 4) {
13319
fmd->fss->viscosityValue = 2.0;
13320
fmd->fss->viscosityExponent = 3;
13329
if (main->versionfile < 263)
13331
/* Default for old files is to save particle rotations to pointcache */
13332
ParticleSettings *part;
13333
for (part = main->particle.first; part; part = part->id.next)
13334
part->flag |= PART_ROTATIONS;
11057
13337
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */