0
$\begingroup$

I am creating a script to rotate a vertex selection in a very specific way. I have so far figured out how to set the pivot point to ACTIVE ELEMENT, following a hint from this thread on context overrides:

However, the transform.rotate command doesn't take into account whether the constraint_orientation is GLOBAL or LOCAL or any other. My Edit Mode vertex selection always rotates around Global axis.

I have also looked into transforming with object.matrix_world and mathutils.Matrix.Rotation but I'm not sure if this is going to work for vertex selections? It seems to be working only for Object, not Mesh Data?

Could anyone help me figure out how I can use Local or Custom Transformation as the constraint_orientation when rotating a Vertex Selection in Edit Mode, or whether there's another path to this. Thanks!

$\endgroup$
2
  • $\begingroup$ For Local Transform I managed to get rotation to work by using transform.rotate where the axis parameter is axis=Vector(self.my_axis)*bpy.context.object.matrix_world.inverted(). However I am still looking for a way to get the Custom Transforms to work for rotations in Edit Mode. $\endgroup$ Commented Sep 9, 2018 at 16:48
  • $\begingroup$ If you are using operators, look at the constraint_orientation parameter to bpy.ops.transform.rotate. For bmesh.ops.rotate I think space is the matrix you want to set. $\endgroup$
    – sambler
    Commented Sep 10, 2018 at 16:31

0

You must log in to answer this question.

Browse other questions tagged .