Page MenuHome

3D cursor tool: improve rotation for Orientation set to 'Geometry'
Needs RevisionPublic

Authored by Philipp Oeser (lichtwerk) on Tue, Sep 24, 12:36 PM.

Details

Summary

The 3D cursor was already aligning properly to the geometry normal but wasnt creating a proper face tangent.
This now uses 'BM_face_calc_tangent_auto()' from the face we are hitting, and creates an orientation matrix from that plus the normal we are getting from snap, which is then applied to the cursor.
This is similar to what the editmode face transform gizmo does.
This leads to a much better experience e.g. when adding objects aligned to the 3D cursor (now aligning properly with the underlying face)

Resolves T63804

Diff Detail

Repository
rB Blender
Branch
3D_cursor_geometry_orientation (branched from master)
Build Status
Buildable 5074
Build 5074: arc lint + arc unit

Event Timeline

  • cleanup: remove comment
Campbell Barton (campbellbarton) requested changes to this revision.Wed, Sep 25, 9:35 AM

The bmesh conversion for calculating the face normal seems excessive, otherwise LGTM.

This revision now requires changes to proceed.Wed, Sep 25, 9:35 AM

The bmesh conversion for calculating the face normal seems excessive, otherwise LGTM.

Thx for having a look.
We are getting the normal already from snap, but for the tangent I will look into a replacement for BM_face_calc_tangent_auto.

Since createSpaceNormalTangent is no longer just used by bf_transform,
I think it would be better to move it to BLI_math_matrix (nor_tan_to_mat3).
But this may be for another patch.