diff options
author | Lucas Veber <lucky3> | 2020-03-10 14:47:43 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-03-10 14:49:08 +0300 |
commit | 915998111bc45336247a7aaf91eaa1dcd5e8881b (patch) | |
tree | 3f28ac772f105748e38e89fceb423122207ddb33 /source/blender/modifiers | |
parent | 982b498c22a3f4c7dc9c8ec8827d24724e16d9c6 (diff) |
Modifiers: Corrective Smooth modifier, new Scale parameter
When scaling the root bone of a rig to apply a global scale, the
corrective smooth modifier results in wrong deformation due to incorrect
scaling. The delta calculations are not taking into account any scale
value.
To fix it, a scale property is added to the modifier, allowing to set
manually the scale value for the deltas by simply multiplying the
vectors by this value. There is a similar implementation in Maya's Delta
Mush deformer. This property can be for example driven by the scale of
the root bone of the rig, to dynamically update when the animator scale
this bone.
Reviewed By: brecht, sybren
Differential Revision: https://developer.blender.org/D6622
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_correctivesmooth.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index 0afe95a3ca3..d35873728db 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -64,6 +64,7 @@ static void initData(ModifierData *md) csmd->bind_coords_num = 0; csmd->lambda = 0.5f; + csmd->scale = 1.0f; csmd->repeat = 5; csmd->flag = 0; csmd->smooth_type = MOD_CORRECTIVESMOOTH_SMOOTH_SIMPLE; @@ -696,7 +697,7 @@ static void correctivesmooth_modifier_do(ModifierData *md, uint i; float(*tangent_spaces)[3][3]; - + const float scale = csmd->scale; /* calloc, since values are accumulated */ tangent_spaces = MEM_calloc_arrayN(numVerts, sizeof(float[3][3]), __func__); @@ -710,7 +711,7 @@ static void correctivesmooth_modifier_do(ModifierData *md, #endif mul_v3_m3v3(delta, tangent_spaces[i], csmd->delta_cache.deltas[i]); - add_v3_v3(vertexCos[i], delta); + madd_v3_v3fl(vertexCos[i], delta, scale); } MEM_freeN(tangent_spaces); |