From a755f9f7ede2e60afa964460e00f613790bf064e Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 9 Sep 2010 07:52:35 +0000 Subject: Fix for [#23734] Force Fields Min/Max don't work *Special case for planar vortex field --- source/blender/blenkernel/intern/effect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 6f6d405dd90..05fcabd371f 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -667,10 +667,10 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin /* for vortex the shape chooses between old / new force */ if(eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) { /* efd->loc is closes point on effector xy-plane */ - float temp[3]; + float temp[3], translate[3]; sub_v3_v3v3(temp, point->loc, ob->obmat[3]); - project_v3_v3v3(efd->loc, temp, efd->nor); - sub_v3_v3v3(efd->loc, point->loc, efd->loc); + project_v3_v3v3(translate, temp, efd->nor); + add_v3_v3v3(efd->loc, ob->obmat[3], translate); } else { VECCOPY(efd->loc, ob->obmat[3]); -- cgit v1.2.3 From 9234f29e673632d15f6a19cf5eda675cde392e44 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 15 Sep 2010 06:43:36 +0000 Subject: bugfix [#23405] PNG Images bigger then 2gig wont load with blender. all image formats should be able to load files bigger then 2gig (when its supported) --- source/blender/blenkernel/intern/effect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 05fcabd371f..0da5e0da2c4 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -29,6 +29,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include #include "BLI_storage.h" /* _LARGEFILE_SOURCE */ #include -- cgit v1.2.3 From dea59cc5eb6562272df361c062f7ed226c2b7a36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 18 Sep 2010 03:55:56 +0000 Subject: warning fixes and minor cmake changes. --- source/blender/blenkernel/intern/effect.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 0da5e0da2c4..4860e7d8eed 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -86,7 +86,6 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_scene.h" -#include "BKE_screen.h" #include "BKE_utildefines.h" #include "RE_render_ext.h" -- cgit v1.2.3 From 8268a4be71fe326b5b7b43e5e55ef751844dddbc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Oct 2010 14:32:17 +0000 Subject: most unused arg warnings corrected. - removed deprecated bitmap arg from IMB_allocImBuf (plugins will need updating). - mostly tagged UNUSED() since some of these functions look like they may need to have the arguments used later. --- source/blender/blenkernel/intern/effect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 4860e7d8eed..f4fae3ed3c6 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -410,7 +410,7 @@ void pd_point_from_soft(Scene *scene, float *loc, float *vel, int index, Effecte /************************************************/ // triangle - ray callback function -static void eff_tri_ray_hit(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) +static void eff_tri_ray_hit(void *UNUSED(userData), int UNUSED(index), const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit) { // whenever we hit a bounding box, we don't check further hit->dist = -1; @@ -515,7 +515,7 @@ static float falloff_func_rad(PartDeflect *pd, float fac) return falloff_func(fac, pd->flag&PFIELD_USEMINR, pd->minrad, pd->flag&PFIELD_USEMAXR, pd->maxrad, pd->f_power_r); } -float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, EffectorWeights *weights) +float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNUSED(point), EffectorWeights *weights) { float temp[3]; float falloff = weights ? weights->weight[0] * weights->weight[eff->pd->forcefield] : 1.0f; -- cgit v1.2.3 From c092a18fcbfead6ed2936c74f504ece9f08e96d2 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 18 Oct 2010 08:17:04 +0000 Subject: [#24209] Texture Forcefields: Use Object Coordinates produces incorrect results (patch included) * Original patch provided by Alexander Beels and modified a bit by me. --- source/blender/blenkernel/intern/effect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index f4fae3ed3c6..70e814ef956 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -264,6 +264,9 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector eff = new_effector_cache(scene, ob, NULL, ob->pd); + /* make sure imat is up to date */ + invert_m4_m4(ob->imat, ob->obmat); + BLI_addtail(*effectors, eff); } static void add_particles_to_effectors(ListBase **effectors, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src) @@ -774,7 +777,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP } if(eff->pd->flag & PFIELD_TEX_OBJECT) { - mul_m4_v3(eff->ob->obmat, tex_co); + mul_m4_v3(eff->ob->imat, tex_co); } hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL,NULL, 0, result); -- cgit v1.2.3 From 1de1d6537ee208b9e57b293c816bacc2e8fb990f Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Sun, 24 Oct 2010 00:09:23 +0000 Subject: Fully disable AUD's FFTW3 usage. --- source/blender/blenkernel/intern/effect.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 70e814ef956..47606c39937 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -1007,8 +1007,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we else if(eff->pd->forcefield == PFIELD_TEXTURE) do_texture_effector(eff, &efd, point, force); else { - float temp1[3]={0,0,0}, temp2[3]; - VECCOPY(temp1, force); + float temp1[3]={force[0], force[1], force[2]}, temp2[3]; do_physical_effector(eff, &efd, point, force); -- cgit v1.2.3 From 715fa82769a2d239bdf73701719ae354ca527c59 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 24 Oct 2010 12:45:47 +0000 Subject: Make sure separation between modifier keys is communicated from GHOST upwards too (BGE at least uses this). --- source/blender/blenkernel/intern/effect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 47606c39937..70e814ef956 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -1007,7 +1007,8 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we else if(eff->pd->forcefield == PFIELD_TEXTURE) do_texture_effector(eff, &efd, point, force); else { - float temp1[3]={force[0], force[1], force[2]}, temp2[3]; + float temp1[3]={0,0,0}, temp2[3]; + VECCOPY(temp1, force); do_physical_effector(eff, &efd, point, force); -- cgit v1.2.3 From fe8d5b81b09462d2344a50b32bfd2d8df5c6d886 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 3 Nov 2010 06:31:53 +0000 Subject: use c90 compatible static initializers. --- source/blender/blenkernel/intern/effect.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 70e814ef956..24a95c58e36 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -628,7 +628,6 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin } } else if(eff->psys) { - ParticleSimulationData sim = {eff->scene, eff->ob, eff->psys, NULL, NULL}; ParticleData *pa = eff->psys->particles + *efd->index; ParticleKey state; @@ -636,6 +635,11 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin if(eff->psys == point->psys && *efd->index == point->index) ; else { + ParticleSimulationData sim= {0}; + sim.scene= eff->scene; + sim.ob= eff->ob; + sim.psys= eff->psys; + /* TODO: time from actual previous calculated frame (step might not be 1) */ state.time = cfra - 1.0; ret = psys_get_particle_state(&sim, *efd->index, &state, 0); -- cgit v1.2.3 From fe19e5336bfa819be3ed018cb7e05ca835ed72be Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 10 Dec 2010 08:29:46 +0000 Subject: Fix for [#25095] Particle systems and object with collision modifier bug * Collisions didn't take emitter object layer into account --- source/blender/blenkernel/intern/effect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 24a95c58e36..51f2203b525 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -432,7 +432,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect return visibility; if(!colls) - colls = get_collider_cache(eff->scene, NULL, NULL); + colls = get_collider_cache(eff->scene, eff->ob, NULL); if(!colls) return visibility; -- cgit v1.2.3 From 8f21a43535cb200c0569566a1b012aec883aa53c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Jan 2011 18:36:47 +0000 Subject: split BKE_utildefines.h, now it only has blender specific defines like GS() MAKE_ID, FILE_MAXDIR, moved the generic defines to BLI_utildefines.h. no functional changes. --- source/blender/blenkernel/intern/effect.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 51f2203b525..aeec2a588c7 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -59,6 +59,7 @@ #include "BLI_listbase.h" #include "BLI_noise.h" #include "BLI_rand.h" +#include "BLI_utildefines.h" #include "PIL_time.h" -- cgit v1.2.3 From 89c9aaaa25cc7ce60c305d8e30e1c008cb117cf1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Jan 2011 19:18:31 +0000 Subject: remove references to BKE_utildefines where its not needed. - move GS() define into DNA_ID.h - add BLI_utildefines as an automatic include with makesrna generated files. --- source/blender/blenkernel/intern/effect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index aeec2a588c7..a79a5fddf00 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -87,7 +87,7 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_scene.h" -#include "BKE_utildefines.h" + #include "RE_render_ext.h" #include "RE_shader_ext.h" -- cgit v1.2.3 From 0a83817672a6ec908eb5f4dd85a48ffa6e97736c Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sat, 12 Feb 2011 17:54:24 +0000 Subject: Small particle effectors update: * Greetings from farsthary: particle rotation is now taken into account for particle effector direction. ** This gives all kinds of new possibilities as he shows in his blog http://farsthary.wordpress.com/2011/02/08/vortex-particle-simple-tut/. **The only modification I made to his patch was to use the actual rotated particle direction as the effector direction as this defaults to the particle velocity vector, so no actual new options are needed. * I also added an "effector amount" setting for particle effectors so that only a part of the particles can be considered as effectors. This makes it possible to create simple "farsthary vortexes" with only one particle system. * Also some tiny reorganization of the falloff min/max values for a nicer ui. --- source/blender/blenkernel/intern/effect.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index a79a5fddf00..43ca7435712 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -651,11 +651,15 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin // eff->flag |= PE_VELOCITY_TO_IMPULSE; //} - VECCOPY(efd->loc, state.co); - VECCOPY(efd->nor, state.vel); - if(real_velocity) { - VECCOPY(efd->vel, state.vel); - } + copy_v3_v3(efd->loc, state.co); + + /* rather than use the velocity use rotated x-axis (defaults to velocity) */ + efd->nor[0] = 1.f; + efd->nor[1] = efd->nor[2] = 0.f; + mul_qt_v3(state.rot, efd->nor); + + if(real_velocity) + copy_v3_v3(efd->vel, state.vel); efd->size = pa->size; } @@ -720,7 +724,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin return ret; } -static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p) +static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step) { if(eff->pd->shape == PFIELD_SHAPE_POINTS) { efd->index = p; @@ -753,6 +757,13 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin *p= point->index % eff->psys->totpart; *tot= *p + 1; } + + if(eff->psys->part->effector_amount) { + int totpart = eff->psys->totpart; + int amount = eff->psys->part->effector_amount; + + *step = (totpart > amount) ? totpart/amount : 1; + } } else { *p = 0; @@ -990,7 +1001,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we */ EffectorCache *eff; EffectorData efd; - int p=0, tot = 1; + int p=0, tot = 1, step = 1; /* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */ /* Check for min distance here? (yes would be cool to add that, ton) */ @@ -998,9 +1009,9 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we if(effectors) for(eff = effectors->first; eff; eff=eff->next) { /* object effectors were fully checked to be OK to evaluate! */ - get_effector_tot(eff, &efd, point, &tot, &p); + get_effector_tot(eff, &efd, point, &tot, &p, &step); - for(; p Date: Sun, 13 Feb 2011 10:52:18 +0000 Subject: fix for warnings from Sparse static source code checker, mostly BKE/BLI and python functions. - use NULL rather then 0 where possible (makes code & function calls more readable IMHO). - set static variables and functions (exposed some unused vars/funcs). - use func(void) rather then func() for definitions. --- source/blender/blenkernel/intern/effect.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/effect.c') diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 43ca7435712..ddfc58b7491 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -166,7 +166,7 @@ PartEff *give_parteff(Object *ob) if(paf->type==EFF_PARTICLE) return paf; paf= paf->next; } - return 0; + return NULL; } void free_effect(Effect *eff) @@ -636,7 +636,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin if(eff->psys == point->psys && *efd->index == point->index) ; else { - ParticleSimulationData sim= {0}; + ParticleSimulationData sim= {NULL}; sim.scene= eff->scene; sim.ob= eff->ob; sim.psys= eff->psys; @@ -781,7 +781,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP if(!eff->pd->tex) return; - result[0].nor = result[1].nor = result[2].nor = result[3].nor = 0; + result[0].nor = result[1].nor = result[2].nor = result[3].nor = NULL; strength= eff->pd->f_strength * efd->falloff; @@ -845,7 +845,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP add_v3_v3(total_force, force); } -void do_physical_effector(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force) +static void do_physical_effector(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force) { PartDeflect *pd = eff->pd; RNG *rng = pd->rng; -- cgit v1.2.3