diff options
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d31167976ed..6f26ec73f90 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -115,6 +115,7 @@ #include "BKE_armature.h" #include "BKE_brush.h" +#include "BKE_cloth.h" #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" @@ -778,7 +779,7 @@ static void decode_blender_header(FileData *fd) readsize = fd->read(fd, header, sizeof(header)); if (readsize == sizeof(header)) { - if (strncmp(header, "BLENDER", 7) == 0) { + if (STREQLEN(header, "BLENDER", 7)) { int remove_this_endian_test = 1; fd->flags |= FD_FLAGS_FILE_OK; @@ -1183,7 +1184,7 @@ bool BLO_is_a_library(const char *path, char *dir, char *group) /* now we know that we are in a blend file and it is safe to * assume that gp actually points to a group */ - if (strcmp("Screen", gp) != 0) + if (!STREQ("Screen", gp)) BLI_strncpy(group, gp, BLO_GROUP_MAX); } return 1; @@ -3751,6 +3752,13 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) direct_link_partdeflect(part->pd); direct_link_partdeflect(part->pd2); + part->clumpcurve = newdataadr(fd, part->clumpcurve); + if (part->clumpcurve) + direct_link_curvemapping(fd, part->clumpcurve); + part->roughcurve = newdataadr(fd, part->roughcurve); + if (part->roughcurve) + direct_link_curvemapping(fd, part->roughcurve); + part->effector_weights = newdataadr(fd, part->effector_weights); if (!part->effector_weights) part->effector_weights = BKE_add_effector_weights(part->eff_group); @@ -3867,6 +3875,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) if (psys->clmd) { psys->clmd = newdataadr(fd, psys->clmd); psys->clmd->clothObject = NULL; + psys->clmd->hairdata = NULL; psys->clmd->sim_parms= newdataadr(fd, psys->clmd->sim_parms); psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms); @@ -3876,8 +3885,12 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) if (psys->clmd->sim_parms->presets > 10) psys->clmd->sim_parms->presets = 0; } + if (psys->clmd->coll_parms) { + psys->clmd->coll_parms->flags |= CLOTH_COLLSETTINGS_FLAG_POINTS; + } psys->hair_in_dm = psys->hair_out_dm = NULL; + psys->clmd->solver_result = NULL; psys->clmd->point_cache = psys->pointcache; } @@ -4472,7 +4485,7 @@ static void lib_link_object(FileData *fd, Main *main) steeringa->target = newlibadr(fd, ob->id.lib, steeringa->target); steeringa->navmesh = newlibadr(fd, ob->id.lib, steeringa->navmesh); } - else if(act->type == ACT_MOUSE) { + else if (act->type == ACT_MOUSE) { /* bMouseActuator *moa= act->data; */ } } @@ -4592,6 +4605,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) ClothModifierData *clmd = (ClothModifierData *)md; clmd->clothObject = NULL; + clmd->hairdata = NULL; clmd->sim_parms= newdataadr(fd, clmd->sim_parms); clmd->coll_parms= newdataadr(fd, clmd->coll_parms); @@ -4611,6 +4625,8 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL); } } + + clmd->solver_result = NULL; } else if (md->type == eModifierType_Fluidsim) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)md; @@ -4765,6 +4781,11 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { BLI_endian_switch_int32_array(hmd->indexar, hmd->totindex); } + + hmd->curfalloff = newdataadr(fd, hmd->curfalloff); + if (hmd->curfalloff) { + direct_link_curvemapping(fd, hmd->curfalloff); + } } else if (md->type == eModifierType_ParticleSystem) { ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; @@ -5197,6 +5218,8 @@ static void lib_link_scene(FileData *fd, Main *main) sce->toolsettings->skgen_template = newlibadr(fd, sce->id.lib, sce->toolsettings->skgen_template); + sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object); + for (base = sce->base.first; base; base = next) { next = base->next; @@ -5943,7 +5966,7 @@ typedef enum ePointerUserMode { static bool restore_pointer(ID *id, ID *newid, ePointerUserMode user) { - if (strcmp(newid->name + 2, id->name + 2) == 0) { + if (STREQ(newid->name + 2, id->name + 2)) { if (newid->lib == id->lib) { if (user == USER_ONE) { if (newid->us == 0) { @@ -6804,9 +6827,10 @@ static void direct_link_sound(FileData *fd, bSound *sound) sound->waveform = NULL; } - if (sound->mutex) - sound->mutex = BLI_mutex_alloc(); - + if (sound->spinlock) { + sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock"); + BLI_spin_init(sound->spinlock); + } /* clear waveform loading flag */ sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING; @@ -7521,9 +7545,7 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead) bfd->main->build_commit_timestamp = fg->build_commit_timestamp; BLI_strncpy(bfd->main->build_hash, fg->build_hash, sizeof(bfd->main->build_hash)); - bfd->winpos = fg->winpos; bfd->fileflags = fg->fileflags; - bfd->displaymode = fg->displaymode; bfd->globalf = fg->globalf; BLI_strncpy(bfd->filename, fg->filename, sizeof(bfd->filename)); @@ -9033,7 +9055,7 @@ static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, cons if (bhead->code == idcode) { const char *idname_test= bhead_id_name(fd, bhead); - if (strcmp(idname_test + 2, idname) == 0) { + if (STREQ(idname_test + 2, idname)) { found = 1; id = is_yet_read(fd, mainl, bhead); if (id == NULL) { @@ -9154,7 +9176,7 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **r_id) for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) { if (bhead->code == GS(id->name)) { - if (strcmp(id->name, bhead_id_name(fd, bhead))==0) { + if (STREQ(id->name, bhead_id_name(fd, bhead))) { id->flag &= ~LIB_READ; id->flag |= LIB_NEED_EXPAND; // printf("read lib block %s\n", id->name); |