2
$\begingroup$

I've created a custom Transform Orientation (named Side). I also have an object A in which the Local Transform Orientation is set to Global Transform Orientation. I want object A's Local Transform Orientation to be equal to Sides Orientation. How do I do that? I would prefer a manual solution, but one using Python would work too.

I did some digging and found that You can set Transform Orientation in bpy.context.screen.areas[?].spaces[0].transform_orientation but it is just an enum with the name of a active transform. Where is the quaternion stored?

$\endgroup$
  • $\begingroup$ What do you mean with 'local transform orientation' that is set to 'Global Transform orientation', because these are the different options right? $\endgroup$ – Faceb Faceb Nov 12 '15 at 20:29
  • $\begingroup$ If You create an object its rotation is set to [0,0,0] (and this matches the world orientation) and location to 3Dcursor position. If You will rotate the object it's local rotation will be set to that amount (i.e. [0,0,45]), but the mesh is rotated too. So let's say Side transform is [0, 0, 90]. I want my object to be rotated +[0, 0, 90] and the mesh to be rotated +[0, 0, -90] so that it looks like it wasn't rotated, yet it local rotation to be [0, 0, 90]. You can think of it as rotation of local transform of an object instead of object itself. $\endgroup$ – Parchandri Nov 12 '15 at 21:10
1
$\begingroup$

As I discovered while working on Blender function to transform a selected edge along a custom axis the transforms are stored in bpy.context.scene.orientations[i].matrix. You can use orientations[0] or orientations[name].

If you want the rotation component as a quaternion use orientations[i].matrix.to_quaternion() .

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.