diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-03-25 11:47:41 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-03-25 11:47:41 +0300 |
commit | 5f5d091554141ae886a6f5b25422f1b8d8a0fc95 (patch) | |
tree | 90a545e1d0faafcf4cdeb3b8597edb81a3df31a4 /source/blender/editors/physics | |
parent | 8b6b5341a55541110684e5272f8856559b89337f (diff) |
Switched the fluid fix from yesterday into using the existing compatible eulers function rather than a custom function. Thanks for the tip Campbell!
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r-- | source/blender/editors/physics/physics_fluid.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 67d2184dc69..c4c30df87ed 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -349,16 +349,6 @@ static void free_all_fluidobject_channels(ListBase *fobjects) } } -static void continuous_rotation(float *rot, const float *old_rot) -{ - *rot += (int)(*old_rot/360.f)*360.f; - - if(*old_rot - *rot > 180.f) - *rot += 360.f; - else if(*old_rot - *rot < -180.f) - *rot -= 360.f; -} - static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects) { Scene *scene = CTX_data_scene(C); @@ -453,22 +443,20 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid Object *ob = fobj->object; FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); float active= (float)(fluidmd->fss->flag & OB_FLUIDSIM_ACTIVE); - float rot_d[3], rot_360[3] = {360.f, 360.f, 360.f}; + float rot_d[3], old_rot[3] = {0.f, 0.f, 0.f}; if (ELEM(fluidmd->fss->type, OB_FLUIDSIM_DOMAIN, OB_FLUIDSIM_PARTICLE)) continue; /* init euler rotation values and convert to elbeem format */ /* get the rotation from ob->obmat rather than ob->rot to account for parent animations */ - mat4_to_eul(rot_d, ob->obmat); - mul_v3_fl(rot_d, -180.f/M_PI); if(i) { - /* the rotation values have to be continuous, so compare with previous rotation and adjust accordingly */ - /* note: the unfortunate side effect of this is that it filters out rotations of over 180 degrees/frame */ - continuous_rotation(rot_d, fobj->Rotation + 4*(i-1)); - continuous_rotation(rot_d+1, fobj->Rotation + 4*(i-1)+1); - continuous_rotation(rot_d+2, fobj->Rotation + 4*(i-1)+2); + copy_v3_v3(old_rot, fobj->Rotation + 4*(i-1)); + mul_v3_fl(old_rot, -M_PI/180.f); } + + mat4_to_compatible_eulO(rot_d, old_rot, 0, ob->obmat); + mul_v3_fl(rot_d, -180.f/M_PI); set_channel(fobj->Translation, timeAtFrame, ob->loc, i, CHANNEL_VEC); set_channel(fobj->Rotation, timeAtFrame, rot_d, i, CHANNEL_VEC); |