diff options
author | Jacques Lucke <jacques@blender.org> | 2022-06-17 17:57:20 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-06-17 17:57:36 +0300 |
commit | 0d43117a40c5f330264fbf032abb3ff2f71e3544 (patch) | |
tree | fdc29d3183d5ad1b0723f2dcae6184605108af51 /source/blender/editors/sculpt_paint/curves_sculpt_brush.cc | |
parent | 23662a9a848bf6b4a20043e430970d068fe2c28d (diff) |
Cleanup: deduplicate generating transform matrices in curves brushes
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_brush.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/curves_sculpt_brush.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc index 2dd0da9d21a..5955c349eae 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc @@ -324,4 +324,18 @@ CurvesSculptCommonContext::CurvesSculptCommonContext(const bContext &C) this->rv3d = CTX_wm_region_view3d(&C); } +CurvesSculptTransforms::CurvesSculptTransforms(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::ed::sculpt_paint |