Page MenuHome

Add cursor rotation to 3D cursor snapping
Changes PlannedPublic

Authored by Andrew Charlton (Scaredyfish) on Mar 14 2019, 1:28 AM.



This is my first try at a patch, so I hope everything's okay.

This patch adds 3D cursor rotation support to 'snap 3d cursor to selection'. In edit mode, it snaps to the average normal direction, in object mode it snaps to the average object rotation.

Diff Detail

rB Blender

Event Timeline

Campbell Barton (campbellbarton) requested changes to this revision.Mar 14 2019, 2:21 AM

This is calculating a normal then converting into an orientation, when transform code already has logic to calculate an orientation from transform data, see: TransData.axismtx and getTransformOrientation_ex usage.

The purpose of ED_transverts API is to generalize manipulating vertices, so I'm not sure its a good idea to extend it to duplicate behavior we already have elsewhere.

The rotation can be calculated from: ED_getTransformOrientationMatrix(C, matrix, V3D_AROUND_CENTER_MEDIAN)

This revision now requires changes to proceed.Mar 14 2019, 2:21 AM

Now uses existing transform orientation function.

Not sure if you handle it already, but I'd suggest to make the orientation alignment optional.

Andrew Charlton (Scaredyfish) planned changes to this revision.Mar 23 2019, 6:22 AM

Good point @Benjamin Sauder (kioku) , I will update this patch to make the feature either optional, or a separate operator.