From 54b64cfd612922054f014460f1c08ec4b0374a3d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 26 May 2012 22:21:56 +0000 Subject: code cleanup: use const float and define array size --- source/blender/blenkernel/intern/armature.c | 4 ++-- source/blender/blenkernel/intern/shrinkwrap.c | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 752036c6b9f..5ad81db1979 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -734,7 +734,7 @@ static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonem } static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float vec[3], DualQuat *dq, - float mat[][3], float *co) + float mat[][3], const float co[3]) { Bone *bone = pchan->bone; float fac, contrib = 0.0; @@ -781,7 +781,7 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f } static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float weight, float vec[3], DualQuat *dq, - float mat[][3], float *co, float *contrib) + float mat[][3], const float co[3], float *contrib) { float cop[3], bbonemat[3][3]; DualQuat bbonedq; diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 6c1c18c7cf8..464b7fda51d 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -83,8 +83,6 @@ #endif -typedef void (*Shrinkwrap_ForeachVertexCallback)(DerivedMesh *target, float *co, float *normal); - /* get derived mesh */ //TODO is anyfunction that does this? returning the derivedFinal without we caring if its in edit mode or not? DerivedMesh *object_get_derived_final(Object *ob) @@ -109,23 +107,23 @@ void space_transform_from_matrixs(SpaceTransform *data, float local[4][4], float invert_m4_m4(data->target2local, data->local2target); } -void space_transform_apply(const SpaceTransform *data, float *co) +void space_transform_apply(const SpaceTransform *data, float co[3]) { mul_v3_m4v3(co, ((SpaceTransform *)data)->local2target, co); } -void space_transform_invert(const SpaceTransform *data, float *co) +void space_transform_invert(const SpaceTransform *data, float co[3]) { mul_v3_m4v3(co, ((SpaceTransform *)data)->target2local, co); } -static void space_transform_apply_normal(const SpaceTransform *data, float *no) +static void space_transform_apply_normal(const SpaceTransform *data, float no[3]) { mul_mat3_m4_v3(((SpaceTransform *)data)->local2target, no); normalize_v3(no); // TODO: could we just determine de scale value from the matrix? } -static void space_transform_invert_normal(const SpaceTransform *data, float *no) +static void space_transform_invert_normal(const SpaceTransform *data, float no[3]) { mul_mat3_m4_v3(((SpaceTransform *)data)->target2local, no); normalize_v3(no); // TODO: could we just determine de scale value from the matrix? @@ -211,7 +209,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) * MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (front faces hits are ignored) * MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (back faces hits are ignored) */ -int normal_projection_project_vertex(char options, const float *vert, const float *dir, const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata) +int normal_projection_project_vertex(char options, const float vert[3], const float dir[3], const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata) { float tmp_co[3], tmp_no[3]; const float *co, *no; -- cgit v1.2.3 From 857dedbc584fcf0af0afa13f008377fd9a83dad1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 May 2012 00:36:50 +0000 Subject: style cleanup --- source/blender/blenkernel/intern/seqeffects.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index fac74d27e0d..915f5557925 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -58,8 +58,7 @@ #include "RNA_access.h" /* **** XXX **** */ -static void error(const char *UNUSED(error), ...) { -} +static void error(const char *UNUSED(error), ...) {} #define INT 96 #define FLO 128 -- cgit v1.2.3 From 2ab62ce126651c600a8039de0dd95a4e3c02ea47 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 May 2012 12:21:13 +0000 Subject: code cleanup: defines with braces - end with '(void)0' so callers must end with ';' like normal function. ... without this some editors dont parse the source so well. --- source/blender/blenkernel/intern/CCGSubSurf.c | 6 ++-- source/blender/blenkernel/intern/library.c | 2 +- source/blender/blenkernel/intern/mesh_validate.c | 6 ++-- source/blender/blenkernel/intern/particle.c | 45 +++++++++++++----------- source/blender/blenkernel/intern/pointcache.c | 11 ++++-- 5 files changed, 41 insertions(+), 29 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index e4309a64e56..d26a722b628 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -275,9 +275,9 @@ static int ccg_edgebase(int level) /***/ -#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } -#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } -#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } +#define NormZero(av) { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; } (void)0 +#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] = _b[0]; _a[1] = _b[1]; _a[2] = _b[2]; } (void)0 +#define NormAdd(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; } (void)0 /***/ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 25e34bf1879..26516b62aa3 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1310,7 +1310,7 @@ void clear_id_newpoins(void) } } -#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } +#define LIBTAG(a) if (a && a->id.lib) {a->id.flag &= ~LIB_INDIRECT; a->id.flag |= LIB_EXTERN; } (void)0 static void lib_indirect_test_id(ID *id, Library *lib) { diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index a60bb98ac18..669ae4f198a 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -103,11 +103,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh, MDeformVert *dverts, /* assume totvert length */ const short do_verbose, const short do_fixes) { -# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } +# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } (void)0 # define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1) -# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } -# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } +# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } (void)0 +# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } (void)0 MVert *mv = mverts; MEdge *me; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 66dd23e76b9..cd5efb9951b 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3751,9 +3751,14 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co return 1; } -#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } -#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if (event & type) { if (pvalue < 0.f) pvalue = 1.f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } -#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } +#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \ + if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0 + +#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \ + if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0 + +#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \ + if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0 static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra) { @@ -3884,26 +3889,26 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex else ptex->time = texture_value_blend(def, ptex->time, value, mtex->timefac, blend); } - SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac) - SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac) - SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac) - SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac) - SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac) - SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac) - SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac) - SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac) + SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac); + SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac); + SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac); + SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac); + SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac); + SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac); + SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac); + SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac); } } - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field) - CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp) - CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field); + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length); } /************************************************/ /* Particle State */ diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 90d17e53349..91023513d4d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -99,8 +99,15 @@ # include "BLI_winstuff.h" #endif -#define PTCACHE_DATA_FROM(data, type, from) if (data[type]) { memcpy(data[type], from, ptcache_data_size[type]); } -#define PTCACHE_DATA_TO(data, type, index, to) if (data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); } +#define PTCACHE_DATA_FROM(data, type, from) \ + if (data[type]) { \ + memcpy(data[type], from, ptcache_data_size[type]); \ + } (void)0 + +#define PTCACHE_DATA_TO(data, type, index, to) \ + if (data[type]) { \ + memcpy(to, (char *)(data)[type] + ((index) ? (index) * ptcache_data_size[type] : 0), ptcache_data_size[type]); \ + } (void)0 /* could be made into a pointcache option */ #define DURIAN_POINTCACHE_LIB_OK 1 -- cgit v1.2.3 From a1091fbfa6b37d192c90866c7115a789d15de37b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 27 May 2012 13:33:09 +0000 Subject: Fix #26876: Soft Body ignores Goal on Lattice Patch by Arno Mayrhofer (aka azrael3000) with only slight code style modifications, thanks! --- source/blender/blenkernel/intern/softbody.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 5abc4bc3830..63f0a29821f 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3514,7 +3514,9 @@ static void lattice_to_softbody(Scene *scene, Object *ob) { Lattice *lt= ob->data; SoftBody *sb; - int totvert, totspring = 0; + int totvert, totspring = 0, a; + BodyPoint *bp; + BPoint *bpnt = lt->def; totvert= lt->pntsu*lt->pntsv*lt->pntsw; @@ -3531,18 +3533,17 @@ static void lattice_to_softbody(Scene *scene, Object *ob) /* renew ends with ob->soft with points and edges, also checks & makes ob->soft */ renew_softbody(scene, ob, totvert, totspring); sb= ob->soft; /* can be created in renew_softbody() */ + bp = sb->bpoint; - /* weights from bpoints, same code used as for mesh vertices */ - /* if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { 2.4x one*/ - /* new! take the weights from lattice vertex anyhow */ - if (ob->softflag & OB_SB_GOAL) { - BodyPoint *bp= sb->bpoint; - BPoint *bpnt= lt->def; - /* jow_go_for2_5 */ - int a; - - for (a=0; agoal= bpnt->weight; + /* same code used as for mesh vertices */ + for (a = 0; a < totvert; a++, bp++, bpnt++) { + if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { + get_scalar_from_vertexgroup(ob, a, (short) (sb->vertgroup - 1), &bp->goal); + } + else { + if (ob->softflag & OB_SB_GOAL) { + bp->goal = sb->defgoal; + } } } -- cgit v1.2.3 From 1e13168183361e65e01c7613f094407780d0967e Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Sun, 27 May 2012 18:45:16 +0000 Subject: Smoke: a) Another boundary fix. Resulted in smoke getting "sucked" back into the domain b) Disabling substeps (internal thing). Fixes arbitrary explosions/instabilities. Part of my Blender Smoke Development. --- source/blender/blenkernel/intern/smoke.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index edb4348dc5a..ce739a00bb4 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1592,8 +1592,8 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps) /* adapt timestep for different framerates, dt = 0.1 is at 25fps */ dt *= (25.0f / fps); - // maximum timestep/"CFL" constraint: dt < dx * maxVel - maxVel = (sds->dx * 1.0); + // maximum timestep/"CFL" constraint: dt < 5.0 *dx / maxVel + maxVel = (sds->dx * 5.0); for(i = 0; i < size; i++) { @@ -1607,7 +1607,8 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps) totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps; totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps; - // totalSubsteps = 2.0f; // DEBUG + /* Disable substeps for now, since it results in numerical instability */ + totalSubsteps = 1.0f; dtSubdiv = (float)dt / (float)totalSubsteps; -- cgit v1.2.3 From b33f0ef0e3c12fcb57217d1653e60aa957b938fc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 May 2012 19:40:36 +0000 Subject: style cleanup --- source/blender/blenkernel/intern/anim_sys.c | 4 ++-- source/blender/blenkernel/intern/blender.c | 6 +++--- source/blender/blenkernel/intern/bullet.c | 2 +- source/blender/blenkernel/intern/cdderivedmesh.c | 4 ++-- source/blender/blenkernel/intern/context.c | 2 +- source/blender/blenkernel/intern/depsgraph.c | 2 +- source/blender/blenkernel/intern/editderivedmesh.c | 6 +++--- source/blender/blenkernel/intern/fmodifier.c | 4 ++-- source/blender/blenkernel/intern/group.c | 2 +- source/blender/blenkernel/intern/image.c | 4 ++-- source/blender/blenkernel/intern/lattice.c | 2 +- source/blender/blenkernel/intern/library.c | 4 ++-- source/blender/blenkernel/intern/material.c | 4 ++-- source/blender/blenkernel/intern/mball.c | 4 ++-- source/blender/blenkernel/intern/mesh.c | 4 ++-- source/blender/blenkernel/intern/multires.c | 2 +- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 10 +++++----- source/blender/blenkernel/intern/sequencer.c | 4 ++-- source/blender/blenkernel/intern/subsurf_ccg.c | 2 +- source/blender/blenkernel/intern/text.c | 12 ++++++------ 22 files changed, 44 insertions(+), 44 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index b66a90ab911..805db8f5171 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1577,7 +1577,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N PropertyRNA *prop; PointerRNA new_ptr; char *path = NULL; - /* short free_path=0; */ + /* short free_path = 0; */ /* sanity checks */ if (channels == NULL) @@ -1585,7 +1585,7 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N /* get RNA pointer+property info from F-Curve for more convenient handling */ /* get path, remapped as appropriate to work in its new environment */ - /* free_path= */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path); + /* free_path = */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path); /* a valid property must be available, and it must be animatable */ if (RNA_path_resolve(ptr, path, &new_ptr, &prop) == 0) { diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index e6333ed74aa..0def299c24a 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -518,7 +518,7 @@ void BKE_write_undo(bContext *C, const char *name) if ( (U.uiflag & USER_GLOBALUNDO) == 0) return; if (U.undosteps == 0) return; - /* remove all undos after (also when curundo==NULL) */ + /* remove all undos after (also when curundo == NULL) */ while (undobase.last != curundo) { uel = undobase.last; BLI_remlink(&undobase, uel); @@ -564,7 +564,7 @@ void BKE_write_undo(bContext *C, const char *name) BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); BLI_make_file_string("/", filepath, BLI_temporary_dir(), numstr); - /* success= */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); + /* success = */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); BLI_strncpy(curundo->str, filepath, sizeof(curundo->str)); } @@ -574,7 +574,7 @@ void BKE_write_undo(bContext *C, const char *name) if (curundo->prev) prevfile = &(curundo->prev->memfile); memused = MEM_get_memory_in_use(); - /* success= */ /* UNUSED */ BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags); + /* success = */ /* UNUSED */ BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags); curundo->undosize = MEM_get_memory_in_use() - memused; } diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c index 9fcb4389c62..7defa7e1be3 100644 --- a/source/blender/blenkernel/intern/bullet.c +++ b/source/blender/blenkernel/intern/bullet.c @@ -45,7 +45,7 @@ BulletSoftBody *bsbNew(void) { BulletSoftBody *bsb; - bsb= MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody"); + bsb = MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody"); bsb->flag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT; bsb->linStiff = 0.5f; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index f6eee44b92c..4e6a4b4a43c 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -927,7 +927,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, //int actualFace = dm->drawObject->triangle_to_mface[i]; int actualFace = next_actualFace; MFace *mface = mf + actualFace; - /*int drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mface->flag & ME_SMOOTH);*/ /* UNUSED */ + /*int drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mface->flag & ME_SMOOTH);*/ /* UNUSED */ DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL; int flush = 0; @@ -1208,7 +1208,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, else { /* if the buffer was set, don't use it again. * prevdraw was assumed true but didnt run so set to false - [#21036] */ - /* prevdraw= 0; */ /* UNUSED */ + /* prevdraw = 0; */ /* UNUSED */ buffer = NULL; } } diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 4cdb4e1b66e..3c8f29d8440 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -267,7 +267,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res * loops requesting data from ourselfs in a context callback */ /* Ok, this looks evil... - * if (ret) done= -(-ret | -done); + * if (ret) done = -(-ret | -done); * * Values in order of importance * (0, -1, 1) - Where 1 is highest priority diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 2b08c085417..a6ce5daf247 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2938,7 +2938,7 @@ void DAG_pose_sort(Object *ob) queue_delete(nqueue); // printf("\nordered\n"); -// for (pchan = pose->chanbase.first; pchan; pchan= pchan->next) { +// for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { // printf(" %s\n", pchan->name); // } diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index e0c3b257273..335758fec11 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -594,7 +594,7 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, float (*vertexCos)[3] = bmdm->vertexCos; float (*vertexNos)[3] = bmdm->vertexNos; float (*polyNos)[3] = bmdm->polyNos; - // int *triPolyMap= bmdm->triPolyMap; + // int *triPolyMap = bmdm->triPolyMap; BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT | BM_FACE); @@ -802,7 +802,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, BMLoop **ls = em->looptris[i]; MTexPoly *tp = has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL; MTFace mtf = {{{0}}}; - /*unsigned char *cp= NULL;*/ /*UNUSED*/ + /*unsigned char *cp = NULL;*/ /*UNUSED*/ int drawSmooth = BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH); DMDrawOption draw_option; @@ -874,7 +874,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, BMLoop **ls = em->looptris[i]; MTexPoly *tp = has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL; MTFace mtf = {{{0}}}; - /*unsigned char *cp= NULL;*/ /*UNUSED*/ + /*unsigned char *cp = NULL;*/ /*UNUSED*/ int drawSmooth = BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH); DMDrawOption draw_option; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 59c8a529d85..b7ede15d00b 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -613,7 +613,7 @@ static float fcm_cycles_time(FCurve *fcu, FModifier *fcm, float UNUSED(cvalue), /* check that cyclic is still enabled for the specified time */ if (cycles == 0) { - /* catch this case so that we don't exit when we have cycles=0 + /* catch this case so that we don't exit when we have (cycles = 0) * as this indicates infinite cycles... */ } @@ -810,7 +810,7 @@ static void fcm_python_copy(FModifier *fcm, FModifier *src) static void fcm_python_evaluate(FCurve *UNUSED(fcu), FModifier *UNUSED(fcm), float *UNUSED(cvalue), float UNUSED(evaltime)) { #ifdef WITH_PYTHON - //FMod_Python *data= (FMod_Python *)fcm->data; + //FMod_Python *data = (FMod_Python *)fcm->data; /* FIXME... need to implement this modifier... * It will need it execute a script using the custom properties diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 8f077ab107c..0725b1732d3 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -196,7 +196,7 @@ int add_to_group(Group *group, Object *object, Scene *scene, Base *base) } } -/* also used for ob==NULL */ +/* also used for (ob == NULL) */ static int rem_from_group_internal(Group *group, Object *ob) { GroupObject *go, *gon; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 80b192c7a42..a2b1fb10500 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -290,7 +290,7 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame) else ibuf->flags &= ~IB_cm_predivide; - /* this function accepts link==NULL */ + /* this function accepts (link == NULL) */ BLI_insertlinkbefore(&ima->ibufs, link, ibuf); /* now we don't want copies? */ @@ -802,7 +802,7 @@ void BKE_image_free_all_textures(void) { Tex *tex; Image *ima; - /* unsigned int totsize= 0; */ + /* unsigned int totsize = 0; */ for (ima = G.main->image.first; ima; ima = ima->id.next) ima->id.flag &= ~LIB_DOIT; diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 15db290ff14..e3495a15871 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -305,7 +305,7 @@ void init_latt_deform(Object *oblatt, Object *ob) fp = lt->latticedata = MEM_mallocN(sizeof(float) * 3 * lt->pntsu * lt->pntsv * lt->pntsw, "latticedata"); - /* for example with a particle system: ob==0 */ + /* for example with a particle system: (ob == NULL) */ if (ob == NULL) { /* in deformspace, calc matrix */ invert_m4_m4(lt->latmat, oblatt->obmat); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 26516b62aa3..de67119d850 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -645,7 +645,7 @@ static ID *alloc_libblock_notest(short type) id = MEM_callocN(sizeof(Text), "text"); break; case ID_SCRIPT: - //XXX id= MEM_callocN(sizeof(Script), "script"); + //XXX id = MEM_callocN(sizeof(Script), "script"); break; case ID_SPK: id = MEM_callocN(sizeof(Speaker), "speaker"); @@ -1032,7 +1032,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor /* used by headerbuttons.c buttons.c editobject.c editseq.c */ -/* if nr==NULL no MAX_IDPUP, this for non-header browsing */ +/* if (nr == NULL) no MAX_IDPUP, this for non-header browsing */ void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) { DynStr *pupds = BLI_dynstr_new(); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 0eeb16be699..55ae7e4d11a 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -607,7 +607,7 @@ Material *give_current_material(Object *ob, short act) if (ob == NULL) return NULL; - /* if object cannot have material, totcolp==NULL */ + /* if object cannot have material, (totcolp == NULL) */ totcolp = give_totcolp(ob); if (totcolp == NULL || ob->totcol == 0) return NULL; @@ -1179,7 +1179,7 @@ int object_remove_material_slot(Object *ob) } -/* r_col = current value, col = new value, fac==0 is no change */ +/* r_col = current value, col = new value, (fac == 0) is no change */ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) { float tmp, facm = 1.0f - fac; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index bef5f2e18a3..b5b03a8924f 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -816,7 +816,7 @@ static int totindex, curindex; static void accum_mballfaces(int i1, int i2, int i3, int i4) { int *newi, *cur; - /* static int i=0; I would like to delete altogether, but I don't dare to, yet */ + /* static int i = 0; I would like to delete altogether, but I don't dare to, yet */ if (totindex == curindex) { totindex += 256; @@ -1701,7 +1701,7 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */ MetaBall *mb; MetaElem *ml; float size, totsize, obinv[4][4], obmat[4][4], vec[3]; - //float max=0.0; + //float max = 0.0f; int a, obnr, zero_size = 0; char obname[MAX_ID_NAME]; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 9eb74986b29..fd952b7b518 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1823,7 +1823,7 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, } if (origIndexFace && - /* fnors==faceNors_r */ /* NO NEED TO ALLOC YET */ + /* fnors == faceNors_r */ /* NO NEED TO ALLOC YET */ fnors != NULL && numFaces) { @@ -2004,7 +2004,7 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex, if (corners == 0) { /* Empty MDisp layers appear in at least one of the sintel.blend files. * Not sure why this happens, but it seems fine to just ignore them here. - * If corners==0 for a non-empty layer though, something went wrong. */ + * If (corners == 0) for a non-empty layer though, something went wrong. */ BLI_assert(fd->totdisp == 0); } else { diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 4e8b67bd55b..d818ca09f20 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -685,7 +685,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl) multires_set_tot_level(ob, mmd, lvl); } -/* direction=1 for delete higher, direction=0 for lower (not implemented yet) */ +/* (direction = 1) for delete higher, (direction = 0) for lower (not implemented yet) */ void multiresModifier_del_levels(MultiresModifierData *mmd, Object *ob, int direction) { Mesh *me = BKE_mesh_from_object(ob); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index cd5efb9951b..9537a31838c 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2411,7 +2411,7 @@ static void get_strand_normal(Material *ma, const float surfnor[3], float surfdi static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float cfra, int editupdate) { ParticleThreadContext *ctx = threads[0].ctx; -/* Object *ob= ctx->sim.ob; */ +/* Object *ob = ctx->sim.ob; */ ParticleSystem *psys = ctx->sim.psys; ParticleSettings *part = psys->part; /* ParticleEditSettings *pset = &scene->toolsettings->particle; */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index f2b963a7edb..63efd194932 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -604,7 +604,7 @@ void BKE_scene_set_background(Main *bmain, Scene *scene) base->flag |= flag; /* not too nice... for recovering objects with lost data */ - //if (ob->pose==NULL) base->flag &= ~OB_POSEMODE; + //if (ob->pose == NULL) base->flag &= ~OB_POSEMODE; ob->flag = base->flag; ob->ctime = -1234567.0; /* force ipo to be calculated later */ diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 915f5557925..252ddb78887 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -143,7 +143,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) BLI_dynlib_get_error_as_string(NULL); /* if (pis->handle) BLI_dynlib_close(pis->handle); */ - /* pis->handle= 0; */ + /* pis->handle = 0; */ /* open the needed object */ pis->handle = BLI_dynlib_open(pis->name); @@ -1480,8 +1480,8 @@ static void do_mul_effect_byte(float facf0, float facf1, int x, int y, fac3 = (int)(256.0f * facf1); /* formula: - * fac*(a*b) + (1-fac)*a => fac*a*(b-1)+axaux= c*px + py*s ;//+centx - * yaux= -s*px + c*py;//+centy + * fac * (a * b) + (1-fac)*a => fac * a * (b - 1) + axaux = c * px + py * s; //+centx + * yaux = -s * px + c * py; //+centy */ while (y--) { @@ -2339,7 +2339,7 @@ static void RVBlurBitmap2_byte(unsigned char *map, int width, int height, /* Swap buffers */ - swap = temp; temp = map; /* map=swap; */ /* UNUSED */ + swap = temp; temp = map; /* map = swap; */ /* UNUSED */ /* Tidy up */ MEM_freeN(filter); @@ -2509,7 +2509,7 @@ static void RVBlurBitmap2_float(float *map, int width, int height, /* Swap buffers */ - swap = temp; temp = map; /* map=swap; */ /* UNUSED */ + swap = temp; temp = map; /* map = swap; */ /* UNUSED */ /* Tidy up */ MEM_freeN(filter); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 8fbb3ee9800..8cb8a5a1bf1 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -612,8 +612,8 @@ void calc_sequence(Scene *scene, Sequence *seq) /* we take the largest start and smallest end */ - // seq->start= seq->startdisp= MAX2(seq->seq1->startdisp, seq->seq2->startdisp); - // seq->enddisp= MIN2(seq->seq1->enddisp, seq->seq2->enddisp); + // seq->start = seq->startdisp = MAX2(seq->seq1->startdisp, seq->seq2->startdisp); + // seq->enddisp = MIN2(seq->seq1->enddisp, seq->seq2->enddisp); if (seq->seq1) { /* XXX These resets should not be necessary, but users used to be able to diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 22e702d5930..5c387e8cee0 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -125,7 +125,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useArena = flags & CCG_USE_ARENA; int normalOffset = 0; - /* subdivLevels==0 is not allowed */ + /* (subdivLevels == 0) is not allowed */ subdivLevels = MAX2(subdivLevels, 1); if (prevSS) { diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 7bfd4189cc3..eefdb31c001 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -813,7 +813,7 @@ void txt_move_up(Text *text, short sel) if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; - /* old= *charp; */ /* UNUSED */ + /* old = *charp; */ /* UNUSED */ if ((*linep)->prev) { int index = txt_utf8_offset_to_index((*linep)->line, *charp); @@ -841,7 +841,7 @@ void txt_move_down(Text *text, short sel) if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; - /* old= *charp; */ /* UNUSED */ + /* old = *charp; */ /* UNUSED */ if ((*linep)->next) { int index = txt_utf8_offset_to_index((*linep)->line, *charp); @@ -3226,8 +3226,8 @@ short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, in } /* Clears all markers in the specified group (if given) with at least the - * specified flags set. Useful for clearing temporary markers (group=0, - * flags=TMARK_TEMP) */ + * specified flags set. Useful for clearing temporary markers (group = 0, + * flags = TMARK_TEMP) */ short txt_clear_markers(Text *text, int group, int flags) { TextMarker *marker, *next; @@ -3276,7 +3276,7 @@ TextMarker *txt_prev_marker(Text *text, TextMarker *marker) if (tmp->group == marker->group) return tmp; } - return NULL; /* Only if marker==NULL */ + return NULL; /* Only if (marker == NULL) */ } /* Finds the next marker in the same group. If no other is found, the same @@ -3290,7 +3290,7 @@ TextMarker *txt_next_marker(Text *text, TextMarker *marker) if (tmp->group == marker->group) return tmp; } - return NULL; /* Only if marker==NULL */ + return NULL; /* Only if (marker == NULL) */ } -- cgit v1.2.3 From 032d83ecc411428a768e0b405fe73066dc6640ea Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 May 2012 20:13:59 +0000 Subject: style cleanup: defines with braces --- source/blender/blenkernel/intern/anim_sys.c | 13 ++-- source/blender/blenkernel/intern/constraint.c | 92 +++++++++++++-------------- source/blender/blenkernel/intern/ipo.c | 12 ++-- 3 files changed, 59 insertions(+), 58 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 805db8f5171..1358c2e34a8 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -744,7 +744,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u for (id = first; id; id = id->next) { \ AnimData *adt = BKE_animdata_from_id(id); \ if (adt) func(id, adt, user_data); \ - } + } (void)0 /* "embedded" nodetree cases (i.e. scene/material/texture->nodetree) */ #define ANIMDATA_NODETREE_IDS_CB(first, NtId_Type) \ @@ -756,7 +756,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u if (adt2) func(id, adt2, user_data); \ } \ if (adt) func(id, adt, user_data); \ - } + } (void)0 /* nodes */ ANIMDATA_IDS_CB(mainptr->nodetree.first); @@ -828,7 +828,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha for (id = first; id; id = id->next) { \ AnimData *adt = BKE_animdata_from_id(id); \ BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \ - } + } (void)0 /* another version of this macro for nodetrees */ #define RENAMEFIX_ANIM_NODETREE_IDS(first, NtId_Type) \ @@ -840,7 +840,7 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha BKE_animdata_fix_paths_rename((ID *)ntp, adt2, ref_id, prefix, oldName, newName, 0, 0, 1); \ } \ BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \ - } + } (void)0 /* nodes */ RENAMEFIX_ANIM_IDS(mainptr->nodetree.first); @@ -2266,7 +2266,8 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime) AnimData *adt = BKE_animdata_from_id(id); \ BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag); \ } \ - } + } (void)0 + /* another macro for the "embedded" nodetree cases * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees" * (i.e. scene/material/texture->nodetree) which we need a special exception @@ -2284,7 +2285,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime) } \ BKE_animsys_evaluate_animdata(scene, id, adt, ctime, aflag); \ } \ - } + } (void)0 /* optimization: * when there are no actions, don't go over database and loop over heaps of datablocks, diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index da9350cc7b9..c6a0ecc057a 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -701,7 +701,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo } \ \ BLI_addtail(list, ct); \ - } + } (void)0 /* This following macro should be used for all standard single-target *_get_tars functions * to save typing and reduce maintenance woes. It does not do the subtarget related operations @@ -720,7 +720,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo if (ct->tar) ct->type = CONSTRAINT_OBTYPE_OBJECT; \ \ BLI_addtail(list, ct); \ - } + } (void)0 /* This following macro should be used for all standard single-target *_flush_tars functions * to save typing and reduce maintenance woes. @@ -741,7 +741,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo BLI_freelinkN(list, ct); \ ct = ctn; \ } \ - } + } (void)0 /* This following macro should be used for all standard single-target *_flush_tars functions * to save typing and reduce maintenance woes. It does not do the subtarget related operations. @@ -761,7 +761,7 @@ static void default_get_tarmat(bConstraint *con, bConstraintOb *UNUSED(cob), bCo BLI_freelinkN(list, ct); \ ct = ctn; \ } \ - } + } (void)0 /* --------- ChildOf Constraint ------------ */ @@ -790,7 +790,7 @@ static int childof_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -805,7 +805,7 @@ static void childof_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -925,7 +925,7 @@ static int trackto_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -940,7 +940,7 @@ static void trackto_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -1108,8 +1108,8 @@ static int kinematic_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints is used twice here */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) - SINGLETARGET_GET_TARS(con, data->poletar, data->polesubtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); + SINGLETARGET_GET_TARS(con, data->poletar, data->polesubtarget, ct, list); return 2; } @@ -1124,8 +1124,8 @@ static void kinematic_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) - SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); + SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, nocopy); } } @@ -1197,7 +1197,7 @@ static int followpath_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list) + SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); return 1; } @@ -1212,7 +1212,7 @@ static void followpath_flush_tars(bConstraint *con, ListBase *list, short nocopy bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); } } @@ -1543,7 +1543,7 @@ static int loclike_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -1558,7 +1558,7 @@ static void loclike_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -1633,7 +1633,7 @@ static int rotlike_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -1648,7 +1648,7 @@ static void rotlike_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -1745,7 +1745,7 @@ static int sizelike_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -1760,7 +1760,7 @@ static void sizelike_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -1834,7 +1834,7 @@ static int translike_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -1849,7 +1849,7 @@ static void translike_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2093,7 +2093,7 @@ static int actcon_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2108,7 +2108,7 @@ static void actcon_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2255,7 +2255,7 @@ static int locktrack_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2270,7 +2270,7 @@ static void locktrack_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2565,7 +2565,7 @@ static int distlimit_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2580,7 +2580,7 @@ static void distlimit_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2692,7 +2692,7 @@ static int stretchto_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2707,7 +2707,7 @@ static void stretchto_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -2866,7 +2866,7 @@ static int minmax_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -2881,7 +2881,7 @@ static void minmax_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -3009,7 +3009,7 @@ static int rbj_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list) + SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); return 1; } @@ -3024,7 +3024,7 @@ static void rbj_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); } } @@ -3060,7 +3060,7 @@ static int clampto_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list) + SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); return 1; } @@ -3075,7 +3075,7 @@ static void clampto_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); } } @@ -3244,7 +3244,7 @@ static int transform_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -3259,7 +3259,7 @@ static void transform_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -3380,7 +3380,7 @@ static int shrinkwrap_get_tars(bConstraint *con, ListBase *list) bShrinkwrapConstraint *data = con->data; bConstraintTarget *ct; - SINGLETARGETNS_GET_TARS(con, data->target, ct, list) + SINGLETARGETNS_GET_TARS(con, data->target, ct, list); return 1; } @@ -3395,7 +3395,7 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, short nocopy bShrinkwrapConstraint *data = con->data; bConstraintTarget *ct = list->first; - SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, nocopy); } } @@ -3545,7 +3545,7 @@ static int damptrack_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -3560,7 +3560,7 @@ static void damptrack_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } @@ -3690,7 +3690,7 @@ static int splineik_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list) + SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); return 1; } @@ -3705,7 +3705,7 @@ static void splineik_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy) + SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy); } } @@ -3762,7 +3762,7 @@ static int pivotcon_get_tars(bConstraint *con, ListBase *list) bConstraintTarget *ct; /* standard target-getting macro for single-target constraints */ - SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list) + SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); return 1; } @@ -3777,7 +3777,7 @@ static void pivotcon_flush_tars(bConstraint *con, ListBase *list, short nocopy) bConstraintTarget *ct = list->first; /* the following macro is used for all standard single-target constraints */ - SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy) + SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy); } } diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 1077b5ad7c3..9737888e0b2 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -162,14 +162,14 @@ static AdrBit2Path ma_mode_bits[] = { static AdrBit2Path *adrcode_bitmaps_to_paths(int blocktype, int adrcode, int *tot) { /* Object layers */ - if ((blocktype == ID_OB) && (adrcode == OB_LAY)) + if ((blocktype == ID_OB) && (adrcode == OB_LAY)) RET_ABP(ob_layer_bits) - else if ((blocktype == ID_MA) && (adrcode == MA_MODE)) - RET_ABP(ma_mode_bits) - // XXX TODO: add other types... + else if ((blocktype == ID_MA) && (adrcode == MA_MODE)) + RET_ABP(ma_mode_bits) + // XXX TODO: add other types... - /* Normal curve */ - return NULL; + /* Normal curve */ + return NULL; } /* *************************************************** */ -- cgit v1.2.3 From 4474a90d8b1137409e0ff158f5682c409d2e52c6 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 27 May 2012 20:57:24 +0000 Subject: == Sequencer / Color balance == Make the color balance inner working more accurate in the byte -> byte case, probably also fixing (can't check I'm on 32bit) the bug mentioned on yellow's blog: http://blendervse.wordpress.com/2012/04/02/waiving-the-fullrange-flag/ --- source/blender/blenkernel/intern/sequencer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 8cb8a5a1bf1..5892a6a7b3e 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1553,7 +1553,7 @@ static void make_cb_table_byte(float lift, float gain, float gamma, for (y = 0; y < 256; y++) { float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul); CLAMP(v, 0.0f, 1.0f); - table[y] = v * 255; + table[y] = round(v * 255); } } -- cgit v1.2.3 From 9ed75681b68edf7c8620fd3f18547ea19e3506cd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 28 May 2012 10:39:22 +0000 Subject: Sequencer: replace clamp+round of multiplied color value with FTOCHAR macro, Should solve issues with building blender in release environment, should be no functional changes. --- source/blender/blenkernel/intern/sequencer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 5892a6a7b3e..63cabf80eae 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1552,8 +1552,7 @@ static void make_cb_table_byte(float lift, float gain, float gamma, for (y = 0; y < 256; y++) { float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul); - CLAMP(v, 0.0f, 1.0f); - table[y] = round(v * 255); + table[y] = FTOCHAR(v); } } -- cgit v1.2.3 From ee854f581aa2a7e9e610ba9be99d7c3839475bad Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Mon, 28 May 2012 14:31:08 +0000 Subject: Smoke: Fix messed up shadow display with OpenMP. This needs fixing. For now disable openmp for that function. Shadow calculation would be better raytraced on GPU or using shaders for the future. Part of my Blender Smoke Development Phase III. (accidently commited this to smoke2 branch first) --- source/blender/blenkernel/intern/smoke.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index ce739a00bb4..46286eb6cf9 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1868,7 +1868,7 @@ static float calc_voxel_transp(float *result, float *input, int res[3], int *pix if(result[index] < 0.0f) { -#pragma omp critical +// #pragma omp critical result[index] = *tRay; } @@ -2012,7 +2012,7 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa bv[4] = p0[2]; bv[5] = p1[2]; -#pragma omp parallel for schedule(static,1) +// #pragma omp parallel for schedule(static,1) for(z = 0; z < res[2]; z++) { size_t index = z*slabsize; -- cgit v1.2.3 From 666667bd8360b1a4d3f3a63a999f67bcf4153a2b Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Mon, 28 May 2012 16:58:12 +0000 Subject: Fix #29846, Dynamic rotation of particles not affected by forcefields 2.61 64 bit. Patch by Arno Mayrhofer (azrael3000). Minor fix by me to initialize the effector point angular velocity vector correctly. --- source/blender/blenkernel/intern/effect.c | 1 + source/blender/blenkernel/intern/particle_system.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 1d109d5f616..eb84f4ae9c0 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -929,6 +929,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected } } + zero_v3(point->ave); if (pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) { float xvec[3] = {1.0f, 0.0f, 0.0f}; float dave[3]; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index fa47600deb2..cdedd818b43 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2673,6 +2673,9 @@ static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, flo force[1] += (BLI_frand()-0.5f) * part->brownfac; force[2] += (BLI_frand()-0.5f) * part->brownfac; } + + if(part->flag & PART_ROT_DYN && epoint.ave) + copy_v3_v3(pa->state.ave, epoint.ave); } /* gathers all forces that effect particles and calculates a new state for the particle */ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, float cfra) @@ -2730,7 +2733,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa } static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, float timestep) { - float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep; + float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac; if ((part->flag & PART_ROTATIONS)==0) { pa->state.rot[0]=1.0f; @@ -2738,7 +2741,9 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f return; } - if ((part->flag & PART_ROT_DYN)==0 && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) { + extrotfac = len_v3(pa->state.ave); + + if ((part->flag & PART_ROT_DYN) && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) { float angle; float len1 = len_v3(pa->prev_state.vel); float len2 = len_v3(pa->state.vel); @@ -2758,7 +2763,7 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f } rotfac = len_v3(pa->state.ave); - if (rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */ + if (rotfac == 0.0f || (part->flag & PART_ROT_DYN)==0 || extrotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */ rot1[0]=1.0f; rot1[1]=rot1[2]=rot1[3]=0; } -- cgit v1.2.3 From c2be2fd4083845a381c2462a65dc0856dc6efb8e Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Mon, 28 May 2012 19:10:57 +0000 Subject: Fix 2 #29846. Effector point ave variable can be NULL. --- source/blender/blenkernel/intern/effect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index eb84f4ae9c0..b5254b97844 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -929,7 +929,8 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected } } - zero_v3(point->ave); + if (point->ave) + zero_v3(point->ave); if (pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) { float xvec[3] = {1.0f, 0.0f, 0.0f}; float dave[3]; -- cgit v1.2.3 From 3d98da9b0fcd9d1b61357656cdc448e495be14f2 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Mon, 28 May 2012 21:02:44 +0000 Subject: Fix for bug [#31613] Cycles 3d viewport material display mode + skin modifier related crash When in material display mode, mesh_calc_modifiers() calculates the orco DerivedMesh, which uses a different CustomDataMask. In particular, it does not necessarily include the current modifier's requiredDataMask, so those layers might get set to NO_COPY. For the skin modifier, this resulted in a crash when the modifier internally copies the DerivedMesh and the output does not contain the expected MVertSkin layer. Fixed by adding the requiredDataMask to the orco DM's CustomDataMask. Also added a debugging function to customdata.c: customData_mask_layers__print(CustomDataMask mask); This will print out the names of all the CD layer types in the mask. --- source/blender/blenkernel/intern/DerivedMesh.c | 4 +++- source/blender/blenkernel/intern/customdata.c | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 7e2d881689c..5774dd7b1ba 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1651,7 +1651,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos orcodm = create_orco_dm(ob, me, NULL, CD_ORCO); nextmask &= ~CD_MASK_ORCO; - DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX); + DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX | + (mti->requiredDataMask ? + mti->requiredDataMask(ob, md) : 0)); ndm = mti->applyModifier(md, ob, orcodm, app_flags & ~MOD_APPLY_USECACHE); if (ndm) { diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 4e7653e2473..3802d532c5b 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1193,6 +1193,17 @@ static const char *layerType_getName(int type) return LAYERTYPENAMES[type]; } +void customData_mask_layers__print(CustomDataMask mask) +{ + int i; + + printf("mask=0x%lx:\n", mask); + for (i = 0; i < CD_NUMTYPES; i++) { + if (mask & CD_TYPE_AS_MASK(i)) + printf(" %s\n", layerType_getName(i)); + } +} + /********************* CustomData functions *********************/ static void customData_update_offsets(CustomData *data); -- cgit v1.2.3 From 4e0492e3bc59a4adca8ea5075a96bc78cd6bb67a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 28 May 2012 21:25:17 +0000 Subject: fix compiler error --- source/blender/blenkernel/intern/customdata.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 3802d532c5b..5dc50dca45a 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1197,10 +1197,11 @@ void customData_mask_layers__print(CustomDataMask mask) { int i; - printf("mask=0x%lx:\n", mask); + printf("mask=0x%lx:\n", (long unsigned int)mask); for (i = 0; i < CD_NUMTYPES; i++) { - if (mask & CD_TYPE_AS_MASK(i)) + if (mask & CD_TYPE_AS_MASK(i)) { printf(" %s\n", layerType_getName(i)); + } } } -- cgit v1.2.3 From dfc19a1ff7968e547c33ef3304849f69ddf76f4f Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Mon, 28 May 2012 21:36:29 +0000 Subject: BGE patch #28476: Character object physics type =============================================== This patch adds a new "Character" BGE physics type which uses Bullet's btKinematicCharacter for simulation instead of full-blown dynamics. It is appropiate for (player-controlled) characters, for which the other physics types often result unexpected results (bouncing off walls, sliding etc.) and for which simple kinematics offers much more precision. "Character" can be chosen like any other physics type in the "Physics" section of the properties window. Current settings for tweaking are "Step Height" (to make the object automatically climb small steps if it collides with them), "Fall Speed" (the maximum speed that the object can have when falling) and "Jump Speed", which is currently not used. See http://projects.blender.org/tracker/?func=detail&atid=127&aid=28476&group_id=9 for sample blends and a discussion on the patch: how to use it and what influences the behavior of the character object. Known problem: there is a crash if the "compound" option is set in the physics panel of the Character object. --- source/blender/blenkernel/intern/object.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 098d702a7e2..04631729d7a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -835,6 +835,9 @@ Object *BKE_object_add_only_object(int type, const char *name) /* ob->pad3 == Contact Processing Threshold */ ob->m_contactProcessingThreshold = 1.0f; ob->obstacleRad = 1.0f; + ob->step_height = 0.15f; + ob->jump_speed = 10.0f; + ob->fall_speed = 55.0f; /* NT fluid sim defaults */ ob->fluidsimSettings = NULL; -- cgit v1.2.3 From d8d3a6455f73f4e2fe9d8413004144da0295ac97 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 29 May 2012 09:37:23 +0000 Subject: remove pynodes, were not working in 2.5, not ported to py3.x --- source/blender/blenkernel/intern/node.c | 56 ++------------------------------- 1 file changed, 3 insertions(+), 53 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 445105d254a..f457cf9b9c2 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -135,20 +135,9 @@ void ntreeInitTypes(bNodeTree *ntree) for (node= ntree->nodes.first; node; node= next) { next= node->next; - node->typeinfo= node_get_type(ntree, node->type); - - if (node->type==NODE_DYNAMIC) { - /* needed info if the pynode script fails now: */ - node->storage= ntree; - if (node->id!=NULL) { /* not an empty script node */ - node->custom1 = 0; - node->custom1 = BSET(node->custom1, NODE_DYNAMIC_ADDEXIST); - } -// if (node->typeinfo) -// node->typeinfo->initfunc(node); - } + node->typeinfo = node_get_type(ntree, node->type); - if (node->typeinfo==NULL) { + if (node->typeinfo == NULL) { printf("Error: Node type %s doesn't exist anymore, removed\n", node->name); nodeFreeNode(ntree, node); } @@ -354,26 +343,6 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp) return node; } -void nodeMakeDynamicType(bNode *node) -{ - /* find SH_DYNAMIC_NODE ntype */ - bNodeType *ntype= ntreeGetType(NTREE_SHADER)->node_types.first; - while (ntype) { - if (ntype->type==NODE_DYNAMIC) - break; - ntype= ntype->next; - } - - /* make own type struct to fill */ - if (ntype) { - /*node->typeinfo= MEM_dupallocN(ntype);*/ - bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType"); - *newtype= *ntype; - BLI_strncpy(newtype->name, ntype->name, sizeof(newtype->name)); - node->typeinfo= newtype; - } -} - /* keep socket listorder identical, for copying links */ /* ntree is the target tree */ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node) @@ -1976,7 +1945,6 @@ static void registerShaderNodes(bNodeTreeType *ttype) register_node_type_sh_math(ttype); register_node_type_sh_vect_math(ttype); register_node_type_sh_squeeze(ttype); - //register_node_type_sh_dynamic(ttype); register_node_type_sh_material_ext(ttype); register_node_type_sh_invert(ttype); register_node_type_sh_seprgb(ttype); @@ -2069,30 +2037,12 @@ static void registerTextureNodes(bNodeTreeType *ttype) register_node_type_tex_proc_distnoise(ttype); } -static void free_dynamic_typeinfo(bNodeType *ntype) -{ - if (ntype->type==NODE_DYNAMIC) { - if (ntype->inputs) { - MEM_freeN(ntype->inputs); - } - if (ntype->outputs) { - MEM_freeN(ntype->outputs); - } - if (ntype->name) { - MEM_freeN((void *)ntype->name); - } - } -} - static void free_typeinfos(ListBase *list) { bNodeType *ntype, *next; for (ntype=list->first; ntype; ntype=next) { next = ntype->next; - - if (ntype->type==NODE_DYNAMIC) - free_dynamic_typeinfo(ntype); - + if (ntype->needs_free) MEM_freeN(ntype); } -- cgit v1.2.3 From 0c7fa76e59666d85f07482af522ff7d28cc37deb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 29 May 2012 09:42:11 +0000 Subject: remove some more pynode references in the code --- source/blender/blenkernel/intern/node.c | 7 ------- source/blender/blenkernel/intern/text.c | 3 --- 2 files changed, 10 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index f457cf9b9c2..02d0ef5ea6a 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -29,13 +29,6 @@ * \ingroup bke */ - -#if 0 /* pynodes commented for now */ -# ifdef WITH_PYTHON -# include -# endif -#endif - #include "MEM_guardedalloc.h" #include diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index eefdb31c001..7de5f97588b 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -570,9 +570,6 @@ void BKE_text_unlink(Main *bmain, Text *text) if (update) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } - - /* pynodes */ - // XXX nodeDynamicUnlinkText(&text->id); /* text space */ for (scr = bmain->screen.first; scr; scr = scr->id.next) { -- cgit v1.2.3 From 16117143d8f12dac65caa8368f56a7e8af8f0db2 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Tue, 29 May 2012 10:21:07 +0000 Subject: Massive Code cleanup: * Remove all code for Texture and Sequencer plugin system, this never worked in 2.5x / 2.6x and is therefore not needed anymore. * DNA structures are kept, all read/writefile code is gone. --- source/blender/blenkernel/intern/material.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 297 -------------------------- source/blender/blenkernel/intern/sequencer.c | 10 - source/blender/blenkernel/intern/texture.c | 166 +------------- 4 files changed, 3 insertions(+), 472 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 55ae7e4d11a..adf268d4d02 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -903,7 +903,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) ma->mapto |= mtex->mapto; /* always get derivatives for these textures */ - if (ELEM3(mtex->tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)) ma->texco |= TEXCO_OSA; + if (ELEM(mtex->tex->type, TEX_IMAGE, TEX_ENVMAP)) ma->texco |= TEXCO_OSA; else if (mtex->texflag & (MTEX_COMPAT_BUMP | MTEX_3TAP_BUMP | MTEX_5TAP_BUMP | MTEX_BICUBIC_BUMP)) ma->texco |= TEXCO_OSA; if (ma->texco & (TEXCO_ORCO | TEXCO_REFL | TEXCO_NORM | TEXCO_STRAND | TEXCO_STRESS)) needuv = 1; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 252ddb78887..cea041eb294 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -47,7 +47,6 @@ #include "BKE_fcurve.h" #include "BKE_main.h" -#include "BKE_plugin_types.h" #include "BKE_sequencer.h" #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -60,11 +59,6 @@ /* **** XXX **** */ static void error(const char *UNUSED(error), ...) {} -#define INT 96 -#define FLO 128 - -/* **** XXX **** */ - /* Glow effect */ enum { GlowR = 0, @@ -121,281 +115,6 @@ static ImBuf *prepare_effect_imbufs( return out; } -/* ********************************************************************** - * PLUGINS - * ********************************************************************** */ - -static void open_plugin_seq(PluginSeq *pis, const char *seqname) -{ - int (*version)(void); - void * (*alloc_private)(void); - char *cp; - - /* to be sure: (is tested for) */ - pis->doit = NULL; - pis->pname = NULL; - pis->varstr = NULL; - pis->cfra = NULL; - pis->version = 0; - pis->instance_private_data = NULL; - - /* clear the error list */ - BLI_dynlib_get_error_as_string(NULL); - - /* if (pis->handle) BLI_dynlib_close(pis->handle); */ - /* pis->handle = 0; */ - - /* open the needed object */ - pis->handle = BLI_dynlib_open(pis->name); - if (test_dlerr(pis->name, pis->name)) return; - - if (pis->handle != NULL) { - /* find the address of the version function */ - version = (int (*)(void))BLI_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); - if (test_dlerr(pis->name, "plugin_seq_getversion")) return; - - if (version != NULL) { - pis->version = version(); - if (pis->version >= 2 && pis->version <= 6) { - int (*info_func)(PluginInfo *); - PluginInfo *info = (PluginInfo *) MEM_mallocN(sizeof(PluginInfo), "plugin_info"); - - info_func = (int (*)(PluginInfo *))BLI_dynlib_find_symbol(pis->handle, "plugin_getinfo"); - - if (info_func == NULL) error("No info func"); - else { - info_func(info); - - pis->pname = info->name; - pis->vars = info->nvars; - pis->cfra = info->cfra; - - pis->varstr = info->varstr; - - pis->doit = (void (*)(void))info->seq_doit; - if (info->init) - info->init(); - } - MEM_freeN(info); - - cp = BLI_dynlib_find_symbol(pis->handle, "seqname"); - if (cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR); - } - else { - printf("Plugin returned unrecognized version number\n"); - return; - } - } - alloc_private = (void * (*)(void))BLI_dynlib_find_symbol( - pis->handle, "plugin_seq_alloc_private_data"); - if (alloc_private) { - pis->instance_private_data = alloc_private(); - } - - pis->current_private_data = (void **) - BLI_dynlib_find_symbol(pis->handle, "plugin_private_data"); - } -} - -static PluginSeq *add_plugin_seq(const char *str, const char *seqname) -{ - PluginSeq *pis; - VarStruct *varstr; - int a; - - pis = MEM_callocN(sizeof(PluginSeq), "PluginSeq"); - - BLI_strncpy(pis->name, str, FILE_MAX); - open_plugin_seq(pis, seqname); - - if (pis->doit == NULL) { - if (pis->handle == NULL) error("no plugin: %s", str); - else error("in plugin: %s", str); - MEM_freeN(pis); - return NULL; - } - - /* default values */ - varstr = pis->varstr; - for (a = 0; a < pis->vars; a++, varstr++) { - if ( (varstr->type & FLO) == FLO) - pis->data[a] = varstr->def; - else if ( (varstr->type & INT) == INT) - *((int *)(pis->data + a)) = (int) varstr->def; - } - - return pis; -} - -static void free_plugin_seq(PluginSeq *pis) -{ - if (pis == NULL) return; - - /* no BLI_dynlib_close: same plugin can be opened multiple times with 1 handle */ - - if (pis->instance_private_data) { - void (*free_private)(void *); - - free_private = (void (*)(void *))BLI_dynlib_find_symbol( - pis->handle, "plugin_seq_free_private_data"); - if (free_private) { - free_private(pis->instance_private_data); - } - } - - MEM_freeN(pis); -} - -static void init_plugin(Sequence *seq, const char *fname) -{ - seq->plugin = (PluginSeq *)add_plugin_seq(fname, seq->name + 2); -} - -/* - * FIXME: should query plugin! Could be generator, that needs zero inputs... - */ -static int num_inputs_plugin(void) -{ - return 1; -} - -static void load_plugin(Sequence *seq) -{ - if (seq) { - open_plugin_seq(seq->plugin, seq->name + 2); - } -} - -static void copy_plugin(Sequence *dst, Sequence *src) -{ - if (src->plugin) { - dst->plugin = MEM_dupallocN(src->plugin); - open_plugin_seq(dst->plugin, dst->name + 2); - } -} - -static ImBuf *IMB_cast_away_list(ImBuf *i) -{ - if (!i) { - return NULL; - } - return (ImBuf *) (((void **) i) + 2); -} - -static ImBuf *do_plugin_effect( - SeqRenderData context, Sequence *seq, float cfra, - float facf0, float facf1, - struct ImBuf *ibuf1, struct ImBuf *ibuf2, - struct ImBuf *ibuf3) -{ - char *cp; - int float_rendering; - int use_temp_bufs = FALSE; /* Are needed since blur.c (and maybe some other - * old plugins) do very bad stuff - * with imbuf-internals */ - - struct ImBuf *out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3); - int x = context.rectx; - int y = context.recty; - - if (seq->plugin && seq->plugin->doit) { - - if (seq->plugin->cfra) - *(seq->plugin->cfra) = cfra; - - cp = BLI_dynlib_find_symbol( - seq->plugin->handle, "seqname"); - - /* XXX: it's crappy to limit copying buffer by it's lemgth, - * but assuming plugin stuff is using correct buffer size - * it should be fine */ - if (cp) strncpy(cp, seq->name + 2, sizeof(seq->name) - 2); - - if (seq->plugin->current_private_data) { - *seq->plugin->current_private_data = seq->plugin->instance_private_data; - } - - float_rendering = (out->rect_float != NULL); - - if (seq->plugin->version <= 3 && float_rendering) { - use_temp_bufs = TRUE; - - if (ibuf1) { - ibuf1 = IMB_dupImBuf(ibuf1); - IMB_rect_from_float(ibuf1); - imb_freerectfloatImBuf(ibuf1); - ibuf1->flags &= ~IB_rectfloat; - } - if (ibuf2) { - ibuf2 = IMB_dupImBuf(ibuf2); - IMB_rect_from_float(ibuf2); - imb_freerectfloatImBuf(ibuf2); - ibuf2->flags &= ~IB_rectfloat; - } - if (ibuf3) { - ibuf3 = IMB_dupImBuf(ibuf3); - IMB_rect_from_float(ibuf3); - imb_freerectfloatImBuf(ibuf3); - ibuf3->flags &= ~IB_rectfloat; - } - if (!out->rect) imb_addrectImBuf(out); - imb_freerectfloatImBuf(out); - out->flags &= ~IB_rectfloat; - } - - if (seq->plugin->version <= 2) { - if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1); - if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2); - if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3); - } - - if (seq->plugin->version <= 4) { - ((SeqDoit)seq->plugin->doit)( - seq->plugin->data, facf0, facf1, x, y, - IMB_cast_away_list(ibuf1), - IMB_cast_away_list(ibuf2), - IMB_cast_away_list(out), - IMB_cast_away_list(ibuf3)); - } - else { - ((SeqDoit)seq->plugin->doit)( - seq->plugin->data, facf0, facf1, x, y, - ibuf1, ibuf2, out, ibuf3); - } - - if (seq->plugin->version <= 2) { - if (!use_temp_bufs) { - if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1); - if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2); - if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3); - } - IMB_convert_rgba_to_abgr(out); - } - if (seq->plugin->version <= 3 && float_rendering) { - IMB_float_from_rect_simple(out); - } - - if (use_temp_bufs) { - if (ibuf1) IMB_freeImBuf(ibuf1); - if (ibuf2) IMB_freeImBuf(ibuf2); - if (ibuf3) IMB_freeImBuf(ibuf3); - } - } - return out; -} - -static int do_plugin_early_out(struct Sequence *UNUSED(seq), - float UNUSED(facf0), float UNUSED(facf1)) -{ - return 0; -} - -static void free_plugin(struct Sequence *seq) -{ - free_plugin_seq(seq->plugin); - seq->plugin = NULL; -} - /* ********************************************************************** * ALPHA OVER * ********************************************************************** */ @@ -3158,11 +2877,6 @@ static void load_noop(struct Sequence *UNUSED(seq)) } -static void init_plugin_noop(struct Sequence *UNUSED(seq), const char *UNUSED(fname)) -{ - -} - static void free_noop(struct Sequence *UNUSED(seq)) { @@ -3264,7 +2978,6 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type) int sequence_type = seq_type; rval.init = init_noop; - rval.init_plugin = init_plugin_noop; rval.num_inputs = num_inputs_default; rval.load = load_noop; rval.free = free_noop; @@ -3352,16 +3065,6 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type) rval.copy = copy_solid_color; rval.execute = do_solid_color; break; - case SEQ_PLUGIN: - rval.init_plugin = init_plugin; - rval.num_inputs = num_inputs_plugin; - rval.load = load_plugin; - rval.free = free_plugin; - rval.copy = copy_plugin; - rval.execute = do_plugin_effect; - rval.early_out = do_plugin_early_out; - rval.get_default_fac = get_default_fac_fade; - break; case SEQ_MULTICAM: rval.num_inputs = num_inputs_multicam; rval.early_out = early_out_multicam; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 63cabf80eae..5318c5514ca 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -929,16 +929,6 @@ const char *give_seqname(Sequence *seq) if (seq->type < SEQ_EFFECT) { return seq->strip->dir; } - else if (seq->type == SEQ_PLUGIN) { - if (!(seq->flag & SEQ_EFFECT_NOT_LOADED) && - seq->plugin && seq->plugin->doit) - { - return seq->plugin->pname; - } - else { - return "Plugin"; - } - } else { return "Effect"; } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 2ec42b47e5c..7081a642b8a 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -56,7 +56,6 @@ #include "IMB_imbuf.h" -#include "BKE_plugin_types.h" #include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_main.h" @@ -72,137 +71,6 @@ #include "BKE_animsys.h" #include "BKE_colortools.h" - -/* ------------------------------------------------------------------------- */ - -/* All support for plugin textures: */ -int test_dlerr(const char *name, const char *symbol) -{ - char *err; - - err = BLI_dynlib_get_error_as_string(NULL); - if (err) { - printf("var1: %s, var2: %s, var3: %s\n", name, symbol, err); - return 1; - } - - return 0; -} - -/* ------------------------------------------------------------------------- */ - -void open_plugin_tex(PluginTex *pit) -{ - int (*version)(void); - - /* init all the happy variables */ - pit->doit = NULL; - pit->pname = NULL; - pit->stnames = NULL; - pit->varstr = NULL; - pit->result = NULL; - pit->cfra = NULL; - pit->version = 0; - pit->instance_init = NULL; - - /* clear the error list */ - BLI_dynlib_get_error_as_string(NULL); - - /* no BLI_dynlib_close! multiple opened plugins... */ - /* if (pit->handle) BLI_dynlib_close(pit->handle); */ - /* pit->handle= 0; */ - - /* open the needed object */ - pit->handle = BLI_dynlib_open(pit->name); - if (test_dlerr(pit->name, pit->name)) return; - - if (pit->handle != NULL) { - /* find the address of the version function */ - version = (int (*)(void))BLI_dynlib_find_symbol(pit->handle, "plugin_tex_getversion"); - if (test_dlerr(pit->name, "plugin_tex_getversion")) return; - - if (version != NULL) { - pit->version = version(); - if (pit->version >= 2 && pit->version <= 6) { - int (*info_func)(PluginInfo *); - PluginInfo *info = (PluginInfo *) MEM_mallocN(sizeof(PluginInfo), "plugin_info"); - - info_func = (int (*)(PluginInfo *))BLI_dynlib_find_symbol(pit->handle, "plugin_getinfo"); - if (!test_dlerr(pit->name, "plugin_getinfo")) { - info->instance_init = NULL; - - info_func(info); - - pit->doit = (int (*)(void))info->tex_doit; - pit->callback = (void (*)(unsigned short))info->callback; - pit->stypes = info->stypes; - pit->vars = info->nvars; - pit->pname = info->name; - pit->stnames = info->snames; - pit->varstr = info->varstr; - pit->result = info->result; - pit->cfra = info->cfra; - pit->instance_init = info->instance_init; - if (info->init) info->init(); - } - MEM_freeN(info); - } - else { - printf("Plugin returned unrecognized version number\n"); - return; - } - } - } -} - -/* ------------------------------------------------------------------------- */ - -/* very badlevel define to bypass linking with BIF_interface.h */ -#define INT 96 -#define FLO 128 - -PluginTex *add_plugin_tex(char *str) -{ - PluginTex *pit; - VarStruct *varstr; - int a; - - pit = MEM_callocN(sizeof(PluginTex), "plugintex"); - - BLI_strncpy(pit->name, str, sizeof(pit->name)); - open_plugin_tex(pit); - - if (pit->doit == NULL) { - if (pit->handle == NULL) {; } //XXX error("no plugin: %s", str); - else {; } //XXX error("in plugin: %s", str); - MEM_freeN(pit); - return NULL; - } - - varstr = pit->varstr; - for (a = 0; a < pit->vars; a++, varstr++) { - if ( (varstr->type & FLO) == FLO) - pit->data[a] = varstr->def; - else if ( (varstr->type & INT) == INT) - *((int *)(pit->data + a)) = (int) varstr->def; - } - - if (pit->instance_init) - pit->instance_init((void *) pit->data); - - return pit; -} - -/* ------------------------------------------------------------------------- */ - -void free_plugin_tex(PluginTex *pit) -{ - if (pit == NULL) return; - - /* no BLI_dynlib_close: same plugin can be opened multiple times, 1 handle */ - MEM_freeN(pit); -} - /* ****************** Mapping ******************* */ TexMapping *add_tex_mapping(void) @@ -550,8 +418,6 @@ int colorband_element_remove(struct ColorBand *coba, int index) void BKE_texture_free(Tex *tex) { - free_plugin_tex(tex->plugin); - if (tex->coba) MEM_freeN(tex->coba); if (tex->env) BKE_free_envmap(tex->env); if (tex->pd) BKE_free_pointdensity(tex->pd); @@ -573,10 +439,6 @@ void BKE_texture_free(Tex *tex) void default_tex(Tex *tex) { - PluginTex *pit; - VarStruct *varstr; - int a; - tex->type = TEX_CLOUDS; tex->stype = 0; tex->flag = TEX_CHECKER_ODD; @@ -644,15 +506,6 @@ void default_tex(Tex *tex) tex->ot->output = TEX_OCN_DISPLACEMENT; tex->ot->object = NULL; } - pit = tex->plugin; - if (pit) { - varstr = pit->varstr; - if (varstr) { - for (a = 0; a < pit->vars; a++, varstr++) { - pit->data[a] = varstr->def; - } - } - } tex->iuser.fie_ima = 2; tex->iuser.ok = 1; @@ -833,11 +686,6 @@ Tex *BKE_texture_copy(Tex *tex) if (texn->type == TEX_IMAGE) id_us_plus((ID *)texn->ima); else texn->ima = NULL; - if (texn->plugin) { - texn->plugin = MEM_dupallocN(texn->plugin); - open_plugin_tex(texn->plugin); - } - if (texn->coba) texn->coba = MEM_dupallocN(texn->coba); if (texn->env) texn->env = BKE_copy_envmap(texn->env); if (texn->pd) texn->pd = BKE_copy_pointdensity(texn->pd); @@ -865,11 +713,6 @@ Tex *localize_texture(Tex *tex) /* image texture: BKE_texture_free also doesn't decrease */ - if (texn->plugin) { - texn->plugin = MEM_dupallocN(texn->plugin); - open_plugin_tex(texn->plugin); - } - if (texn->coba) texn->coba = MEM_dupallocN(texn->coba); if (texn->env) { texn->env = BKE_copy_envmap(texn->env); @@ -1058,7 +901,7 @@ void autotexname(Tex *tex) { Main *bmain = G.main; char texstr[20][15] = {"None", "Clouds", "Wood", "Marble", "Magic", "Blend", - "Stucci", "Noise", "Image", "Plugin", "EnvMap", "Musgrave", + "Stucci", "Noise", "Image", "EnvMap", "Musgrave", "Voronoi", "DistNoise", "Point Density", "Voxel Data", "Ocean", "", "", ""}; Image *ima; char di[FILE_MAXDIR], fi[FILE_MAXFILE]; @@ -1079,7 +922,6 @@ void autotexname(Tex *tex) } else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); } - else if (tex->type == TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname); else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); } } @@ -1565,11 +1407,7 @@ void BKE_free_oceantex(struct OceanTex *ot) /* ------------------------------------------------------------------------- */ int BKE_texture_dependsOnTime(const struct Tex *texture) { - if (texture->plugin) { - // assume all plugins depend on time - return 1; - } - else if (texture->ima && + if (texture->ima && ELEM(texture->ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { return 1; -- cgit v1.2.3 From 0b7593a3dc22552396a02fd06bd9cc2d6151af74 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 29 May 2012 10:31:42 +0000 Subject: finish cleanup for plugins --- source/blender/blenkernel/intern/seqeffects.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index cea041eb294..4b6c362cd85 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -57,7 +57,6 @@ #include "RNA_access.h" /* **** XXX **** */ -static void error(const char *UNUSED(error), ...) {} /* Glow effect */ enum { -- cgit v1.2.3 From 3495479b4fd35668e7e0b7ca495a3a9146843c00 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Tue, 29 May 2012 19:12:49 +0000 Subject: Bugfix [#31629] Cloth simulation results are much different from older ones This is only a partial bugfix, reducing the repulse to 1/3. Cloth collision will still behave different because it is now catching more collisions. --- source/blender/blenkernel/intern/collision.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 7c5cf68affa..e680d9889cd 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -332,7 +332,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // stay on the safe side and clamp repulse float repulse = d*1.0f/spf; - float impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // original 2.0 / 0.25 + float impulse = repulse / (3.0f * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25 VECADDMUL ( i1, collpair->normal, impulse ); VECADDMUL ( i2, collpair->normal, impulse ); VECADDMUL ( i3, collpair->normal, impulse ); -- cgit v1.2.3 From 58bc424b3c46ee3ee6644ff578671670c2a1c8ec Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Tue, 29 May 2012 20:30:33 +0000 Subject: BGE #30734: add support for physics linear and angular thresholds and deactivation time from python and GUI. ======================== The linear and angular thresholds set the speed limit (in m/s) and rotation limit (in rad/s) under which a rigid body will go to sleep (stop moving) if it stays below the limits for a time equal or longer than the deactivation time (sleeping is disabled is deactivation time is set to 0). These settings help reducing the processing spent on Physics during the game. Previously they were only accessible from python but not working because of a bug. Now the python functions are working and the settings are available in the Physics panel of the World settings when using the Blender Game render engine. Python API: import PhysicsConstraints PhysicsConstraints.setDeactivationLinearTreshold(float) PhysicsConstraints.setDeactivationAngularTreshold(float) --- source/blender/blenkernel/intern/scene.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 63efd194932..62d5459336b 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -516,6 +516,9 @@ Scene *BKE_scene_add(const char *name) sce->gm.maxlogicstep = 5; sce->gm.physubstep = 1; sce->gm.maxphystep = 5; + sce->gm.lineardeactthreshold = 0.8f; + sce->gm.angulardeactthreshold = 1.0f; + sce->gm.deactivationtime = 0.0f; sce->gm.flag = GAME_DISPLAY_LISTS; sce->gm.matmode = GAME_MAT_MULTITEX; -- cgit v1.2.3 From be21080cb66194c3ccfe5a6b3ca9853b2b9601de Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Wed, 30 May 2012 12:53:13 +0000 Subject: Provide ray hit/nearest information on which side of the quad the ray hit. Patch by MiikaH. --- source/blender/blenkernel/intern/bvhutils.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 24583c124e6..752bdab2c00 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -383,6 +383,9 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3 nearest->dist = dist; copy_v3_v3(nearest->co, nearest_tmp); normal_tri_v3(nearest->no, t0, t1, t2); + + if (t1 == vert[face->v3].co) + nearest->flags |= BVH_ONQUAD; } t1 = t2; @@ -420,6 +423,9 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist); normal_tri_v3(hit->no, t0, t1, t2); + + if (t1 == vert[face->v3].co) + hit->flags |= BVH_ONQUAD; } t1 = t2; -- cgit v1.2.3 From 9547b76c2e8e0f6aa07858e94e4f0c404b86ac7d Mon Sep 17 00:00:00 2001 From: Jason Hays Date: Thu, 31 May 2012 17:22:52 +0000 Subject: This fixes a precision issue in multi-paint so that near zero values do not cause flickering as you paint. It also changes multi-paint's "zero weight color" to black again--it was unintentionally changed to red some time late last year when an aspect of the colors were changed. --- source/blender/blenkernel/intern/DerivedMesh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 5774dd7b1ba..7130776d05a 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1054,10 +1054,10 @@ static void calc_weightpaint_vert_color( } if (make_black) { /* TODO, theme color */ - r_col[3] = 0; + r_col[3] = 255; r_col[2] = 0; r_col[1] = 0; - r_col[0] = 255; + r_col[0] = 0; } else { CLAMP(input, 0.0f, 1.0f); -- cgit v1.2.3 From 02b927b8c4702cadf089f3e26fa553bdc66483b1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 31 May 2012 18:40:06 +0000 Subject: style cleanup --- source/blender/blenkernel/intern/material.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index adf268d4d02..48d629a2944 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -840,7 +840,7 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol) int actcol_orig = ob->actcol; short i; - while (object_remove_material_slot(ob)) {}; + while (object_remove_material_slot(ob)) {} /* now we have the right number of slots */ for (i = 0; i < totcol; i++) -- cgit v1.2.3 From 17935168c07937f9b1d1db1874a9f7ba5d3ae540 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Fri, 1 Jun 2012 12:38:03 +0000 Subject: Reroute nodes, by Jeroen Bakker (patch #28443). By holding shift and "cutting" a node link a new reroute helper node can be inserted. This consists of a single socket that can be used to insert additional connection points into a link. This can be used to keep a connection point in the tree when deleting a node, or to control the path of long connections for layout cleanup. --- source/blender/blenkernel/intern/node.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 02d0ef5ea6a..22286e57c0a 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1822,6 +1822,7 @@ void nodeRegisterType(bNodeTreeType *ttype, bNodeType *ntype) static void registerCompositNodes(bNodeTreeType *ttype) { register_node_type_frame(ttype); + register_node_type_reroute(ttype); register_node_type_cmp_group(ttype); // register_node_type_cmp_forloop(ttype); @@ -1914,6 +1915,7 @@ static void registerCompositNodes(bNodeTreeType *ttype) static void registerShaderNodes(bNodeTreeType *ttype) { register_node_type_frame(ttype); + register_node_type_reroute(ttype); register_node_type_sh_group(ttype); //register_node_type_sh_forloop(ttype); @@ -1986,6 +1988,7 @@ static void registerShaderNodes(bNodeTreeType *ttype) static void registerTextureNodes(bNodeTreeType *ttype) { register_node_type_frame(ttype); + register_node_type_reroute(ttype); register_node_type_tex_group(ttype); // register_node_type_tex_forloop(ttype); -- cgit v1.2.3 From 1ced3560099b66d70399b4a5cfbb343b36562979 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 1 Jun 2012 13:54:44 +0000 Subject: Action Group Colors for Bones (Part 2) Colors used by Bone Groups are now copied/assigned to Action Groups too when they're created now. This completes the work started in r.46960 to restore this functionality from 2.48. Currently, there is no control over when/whether these colors are copied over (although it is possible to disable the display of these colors for relevant animation editors if desired). Originally I was going to make this a more generic Keying Sets feature, though that turned out to be a bit too complex to manage. Other notes: * Split out the code for copying colors to a common library function --- source/blender/blenkernel/intern/action.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 233647c9ec6..b3d2e3371f4 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -252,6 +252,31 @@ void set_active_action_group(bAction *act, bActionGroup *agrp, short select) } } +/* Sync colors used for action/bone group with theme settings */ +void action_group_colors_sync(bActionGroup *grp) +{ + /* only do color copying if using a custom color (i.e. not default color) */ + if (grp->customCol) { + if (grp->customCol > 0) { + /* copy theme colors on-to group's custom color in case user tries to edit color */ + bTheme *btheme = U.themes.first; + ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)]; + + memcpy(&grp->cs, col_set, sizeof(ThemeWireColor)); + } + else { + /* init custom colors with a generic multi-color rgb set, if not initialized already + * (for custom color set) */ + if (grp->cs.solid[0] == 0) { + /* define for setting colors in theme below */ + rgba_char_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255); + rgba_char_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255); + rgba_char_args_set(grp->cs.active, 0x18, 0xb6, 0xe0, 255); + } + } + } +} + /* Add a new action group with the given name to the action */ bActionGroup *action_groups_add_new(bAction *act, const char name[]) { @@ -409,10 +434,9 @@ void action_groups_clear_tempflags(bAction *act) /* *************** Pose channels *************** */ -/* usually used within a loop, so we got a N^2 slowdown */ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name) { - if (ELEM(NULL, pose, name) || (name[0] == 0)) + if (ELEM(NULL, pose, name) || (name[0] == '\0')) return NULL; if (pose->chanhash) -- cgit v1.2.3 From 3ea554e0a26857bb8bc37792b665f63cef3689d5 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Fri, 1 Jun 2012 15:49:39 +0000 Subject: Smoke Bugfix: Velocity of moving objects was too high after scaling patch. Spoted by MiikaH. --- source/blender/blenkernel/intern/smoke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 46286eb6cf9..7a5465edf02 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1172,7 +1172,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, sub_v3_v3v3(vel, pos, oldpos); /* Scale velocity to incorperate the object movement during this step */ - mul_v3_fl(vel, 1.0 / (totalsteps * dt)); + mul_v3_fl(vel, 1.0 / (totalsteps * dt * sds->scale)); // mul_v3_fl(vel, 1.0 / dt); // DG TODO: cap velocity to maxVelMag (or maxvel) -- cgit v1.2.3 From 9efc294d457c974cc8626ec50c90f755ed25c9e5 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Fri, 1 Jun 2012 16:50:12 +0000 Subject: Followup fix Bugfix [#31629]: Cloth simulation collisions used still too high repulsions. --- source/blender/blenkernel/intern/collision.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index e680d9889cd..b90cc9d5958 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -302,6 +302,10 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // Apply repulse impulse if distance too short // I_r = -min(dt*kd, m(0, 1d/dt - v_n)) + // DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this: + // v += impulse; x_new = x + v; + // We don't use dt!! + // DG TODO: Fix usage of dt here! spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; @@ -324,15 +328,18 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM else { // Apply repulse impulse if distance too short - // I_r = -min(dt*kd, m(0, 1d/dt - v_n)) + // I_r = -min(dt*kd, max(0, 1d/dt - v_n)) + // DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this: + // v += impulse; x_new = x + v; + // We don't use dt!! float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; if ( d > ALMOST_ZERO) { // stay on the safe side and clamp repulse - float repulse = d*1.0f/spf; + float repulse = d; - float impulse = repulse / (3.0f * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25 + float impulse = repulse / (( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25 VECADDMUL ( i1, collpair->normal, impulse ); VECADDMUL ( i2, collpair->normal, impulse ); VECADDMUL ( i3, collpair->normal, impulse ); -- cgit v1.2.3 From 4fa34b5cf78df4347264d75a59cd0a245619a559 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 1 Jun 2012 17:47:05 +0000 Subject: Commenting out unused var, prevents my debug Blender to build... ;) --- source/blender/blenkernel/intern/collision.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index b90cc9d5958..4911ca46018 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -332,7 +332,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this: // v += impulse; x_new = x + v; // We don't use dt!! - float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; + /* float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; */ /* XXX UNUSED */ float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; if ( d > ALMOST_ZERO) { -- cgit v1.2.3 From 76af5fb50d303e96ead71fa63eaf71aa49a5ee4e Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Sat, 2 Jun 2012 22:01:04 +0000 Subject: Cloth collisions: Revert 47335. --- source/blender/blenkernel/intern/collision.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 4911ca46018..ddb01875767 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -337,9 +337,10 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; if ( d > ALMOST_ZERO) { // stay on the safe side and clamp repulse - float repulse = d; + float repulse = d*1.0f/spf; + + float impulse = repulse / ( 3.0 * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25 - float impulse = repulse / (( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25 VECADDMUL ( i1, collpair->normal, impulse ); VECADDMUL ( i2, collpair->normal, impulse ); VECADDMUL ( i3, collpair->normal, impulse ); -- cgit v1.2.3 From f69cec4596f3444863a8c683dc64ed7c29824a94 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 2 Jun 2012 22:47:33 +0000 Subject: Compile fix - "spf" was undefined --- source/blender/blenkernel/intern/collision.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index ddb01875767..32e9dd7508b 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -332,7 +332,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM // DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this: // v += impulse; x_new = x + v; // We don't use dt!! - /* float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; */ /* XXX UNUSED */ + float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale; float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance; if ( d > ALMOST_ZERO) { -- cgit v1.2.3 From 1aa27e240c7d7020489124e933db47ed18167560 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 3 Jun 2012 11:16:13 +0000 Subject: code cleanup: replace some non utf8 chars --- source/blender/blenkernel/intern/DerivedMesh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 7130776d05a..3f28a4afe8d 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -426,7 +426,7 @@ void DM_update_tessface_data(DerivedMesh *dm) /* Find out loop indices. */ /* XXX Is there a better way to do this? */ - /* NOTE: This assumes tessface are valid and in sync with loop/poly… Else, most likely, segfault! */ + /* NOTE: This assumes tessface are valid and in sync with loop/poly... Else, most likely, segfault! */ for (i = mp[polyindex[mf_idx]].loopstart, not_done = mf_len; not_done; i++) { MLoop *tml = &ml[i]; if (tml->v == mf->v1) { -- cgit v1.2.3