Is there a way to create an arbitrary transform orientation in Python?
The API function bpy.ops.transform.create_orientation() only allows the orientation to be created from the current view or the selected object. In my particular case, I want it along the line between two objects.
My initial thought is to create the transform orientation (call it 'mytransform') with bpy.ops.transform.create_orientation(), and then directly set bpy.context.scene.orientations['mytransform'].matrix. But:
- I don't know if this is kosher (I try to avoid mucking directly with the data structures when possible).
- It has some disadvantages, mainly that I can't run it from the Python console for testing (
create_orientation()only works in a 3DView context).
bpy.context.area.typewill tell me if the current context is correct; but if it's not, and I have more than one VIEW_3D open, how do I tell which is which (maybe this warrants a separate question)? – Jabberwock Jan 01 '17 at 15:47