def set_transform_orientation(self, context, transform_orientation):
#print("catching space: " + transform_orientation)
#op.create_orientation doesn't work if nothing is selected, so I missuse the view orientation a bit to cicumvent
use_view = transform_orientation == "VIEW" or transform_orientation.endswith("_EMPTY")
bpy.ops.transform.create_orientation(name=work_plane, use=True, use_view=use_view, overwrite=True)
current = context.space_data.current_orientation
if transform_orientation.startswith("GLOBAL"):
current.matrix = Matrix().to_3x3()
if transform_orientation.startswith("LOCAL"):
active_object = context.active_object
current.matrix = active_object.matrix_world.to_3x3()
return current.matrix
评论列表
文章目录