diff options
author | Jacques Lucke <jacques@blender.org> | 2022-07-05 15:56:04 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-05 16:06:31 +0300 |
commit | c46d4d9fad5e16daa9f50e30e6373d20b8386bbb (patch) | |
tree | f06b55f4f2d9ddc967562ddadd9e8ea788d69bc6 /source/blender/blenkernel/intern/curves.cc | |
parent | 7f24d90f11a6d26b2737bf28df1c66d169e7e8c2 (diff) |
Curves: move curves surface transforms to blenkernel
This utility struct is useful outside of sculpting code as well.
Diffstat (limited to 'source/blender/blenkernel/intern/curves.cc')
-rw-r--r-- | source/blender/blenkernel/intern/curves.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curves.cc b/source/blender/blenkernel/intern/curves.cc index 7ad83263b73..78791b55b4d 100644 --- a/source/blender/blenkernel/intern/curves.cc +++ b/source/blender/blenkernel/intern/curves.cc @@ -388,4 +388,18 @@ Curves *curves_new_nomain(CurvesGeometry curves) return curves_id; } +CurvesSurfaceTransforms::CurvesSurfaceTransforms(const Object &curves_ob, const Object *surface_ob) +{ + this->curves_to_world = curves_ob.obmat; + this->world_to_curves = this->curves_to_world.inverted(); + + if (surface_ob != nullptr) { + this->surface_to_world = surface_ob->obmat; + this->world_to_surface = this->surface_to_world.inverted(); + this->surface_to_curves = this->world_to_curves * this->surface_to_world; + this->curves_to_surface = this->world_to_surface * this->curves_to_world; + this->surface_to_curves_normal = this->surface_to_curves.inverted().transposed(); + } +} + } // namespace blender::bke |