diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-09-05 16:17:59 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-09-20 11:52:42 +0300 |
commit | 12788906113c4f2b304b368001bd2ef68c4dc6b8 (patch) | |
tree | 866371adf7cb11e65b3809ec2fb9358799d2656e /source/blender/blenkernel/intern/displist.c | |
parent | 1789c1e90df373293338dadd4f7140c9995c456f (diff) |
Put the Radius property of Curve points under shape key control.
Since shape keys are stored as raw floating point data, this
unfortunately requires changes to all code that works with it.
An additional complication is that bezier and nurbs control
points have different entry size, and can be mixed in the same
object (and hence shape key buffer).
Shape key entries are changed from:
bezier: float v1[3], v2[3], v3[3], tilt, pad, pad;
nurbs: float vec[3], tilt;
To:
bezier: float v1[3], v2[3], v3[3], tilt, radius, pad;
nurbs: float vec[3], tilt, radius, pad;
The official shape key element size is changed to 3 floats,
with 4 elements for bezier nodes, and 2 for nurbs. This also
means that the element count is not equal to the vertex count
anymore.
While searching for all curve Shape Key code, I also found that
BKE_curve_transform_ex and BKE_curve_translate were broken. This
can be seen by trying to change the Origin of a Curve with keys.
Reviewers: campbellbarton, sergey
Differential Revision: https://developer.blender.org/D3676
Diffstat (limited to 'source/blender/blenkernel/intern/displist.c')
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index c9051313481..fdcf38c7d41 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -813,7 +813,7 @@ static void curve_calc_modifiers_pre( ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); ModifierData *pretessellatePoint; Curve *cu = ob->data; - int numVerts = 0; + int numElems = 0, numVerts = 0; const bool editmode = (!for_render && (cu->editnurb || cu->editfont)); ModifierApplyFlag app_flag = 0; float (*deformedVerts)[3] = NULL; @@ -839,15 +839,17 @@ static void curve_calc_modifiers_pre( required_mode |= eModifierMode_Editmode; if (!editmode) { - keyVerts = BKE_key_evaluate_object(ob, &numVerts); + keyVerts = BKE_key_evaluate_object(ob, &numElems); if (keyVerts) { + BLI_assert(BKE_keyblock_curve_element_count(nurb) == numElems); + /* split coords from key data, the latter also includes * tilts, which is passed through in the modifier stack. * this is also the reason curves do not use a virtual * shape key modifier yet. */ deformedVerts = BKE_curve_nurbs_keyVertexCos_get(nurb, keyVerts); - BLI_assert(BKE_nurbList_verts_count(nurb) == numVerts); + numVerts = BKE_nurbList_verts_count(nurb); } } |