diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-08-22 06:45:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-08-24 00:34:43 +0300 |
commit | acdb14d264c8b4eced645673f8ae8af1a96b1a90 (patch) | |
tree | 0be0b3490fe79105892e309be48f608e6ed19fc5 /source/blender/blenkernel/intern/curve.c | |
parent | 71c43e92257c671065125330f93ed4d03b2b8250 (diff) |
Transform: option to transform origins in object mode
Currently supports mesh, armature, lattice, curve & metaballs.
Access from pivot popover.
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 1f21d796220..0126c261fa1 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -4641,7 +4641,50 @@ float (*BKE_curve_nurbs_vert_coords_alloc(ListBase *lb, int *r_vert_len))[3] return vert_coords; } -void BKE_curve_nurbs_vert_coords_apply(ListBase *lb, const float (*vert_coords)[3]) +void BKE_curve_nurbs_vert_coords_apply_with_mat4(ListBase *lb, + const float (*vert_coords)[3], + const float mat[4][4], + const bool constrain_2d) +{ + const float *co = vert_coords[0]; + Nurb *nu; + int i; + + for (nu = lb->first; nu; nu = nu->next) { + if (nu->type == CU_BEZIER) { + BezTriple *bezt = nu->bezt; + + for (i = 0; i < nu->pntsu; i++, bezt++) { + mul_v3_m4v3(bezt->vec[0], mat, co); + co += 3; + mul_v3_m4v3(bezt->vec[1], mat, co); + co += 3; + mul_v3_m4v3(bezt->vec[2], mat, co); + co += 3; + } + } + else { + BPoint *bp = nu->bp; + + for (i = 0; i < nu->pntsu * nu->pntsv; i++, bp++) { + mul_v3_m4v3(bp->vec, mat, co); + co += 3; + } + } + + if (constrain_2d) { + if (nu->flag & CU_2D) { + BKE_nurb_test_2d(nu); + } + } + + calchandlesNurb_intern(nu, true); + } +} + +void BKE_curve_nurbs_vert_coords_apply(ListBase *lb, + const float (*vert_coords)[3], + const bool constrain_2d) { const float *co = vert_coords[0]; @@ -4667,6 +4710,12 @@ void BKE_curve_nurbs_vert_coords_apply(ListBase *lb, const float (*vert_coords)[ } } + if (constrain_2d) { + if (nu->flag & CU_2D) { + BKE_nurb_test_2d(nu); + } + } + calchandlesNurb_intern(nu, true); } } |