I am currently using the following to set my transfrom orientation and pivot point at once:
import bpy
for area in bpy.context.screen.areas:
if area.type == ‘VIEW_3D’:
area.spaces[0].transform_orientation = ‘GLOBAL’
for area in bpy.context.screen.areas:
if area.type == ‘VIEW_3D’:
area.spaces[0].pivot_point = 'CURSOR’How to set Macro in a custom Pie?
trying this (but this is en error):
import bpy
from bpy.types import Menu
class Global_Cursor(bpy.types.Operator):
bl_idname = “Global_Cursor”
bl_label = “Global_Cursor”
def execute(self, context):
for area in bpy.context.screen.areas:
if area.type == ‘VIEW_3D’:
area.spaces[0].transform_orientation = ‘GLOBAL’
for area in bpy.context.screen.areas:
if area.type == ‘VIEW_3D’:
area.spaces[0].pivot_point = ‘CURSOR’
class OrientationPivotPoint(Menu):
bl_idname = “OrientationPivotPoint”
bl_label = “OrientationPivotPoint”
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
pie.operator("Global_Cursor", text="Sphere", icon='SPHERECURVE')
def register():
bpy.utils.register_class(Global_Cursor)
bpy.utils.register_class(OrientationPivotPoint)
def unregister():
bpy.utils.unregister_class(Global_Cursor)
bpy.utils.unregister_class(OrientationPivotPoint)
if name == “main”:
register()
bpy.ops.wm.call_menu_pie(name="OrientationPivotPoint")