space_view3d_pie_menus: use gizmos for pie menu switching
Animators in the studio prefer this over tools.
This commit is contained in:
parent
e842685504
commit
c22bc472b8
|
@ -32,21 +32,56 @@ bl_info = {
|
|||
|
||||
import bpy
|
||||
from bpy.types import (
|
||||
Menu,
|
||||
Operator,
|
||||
)
|
||||
Menu,
|
||||
Operator,
|
||||
)
|
||||
from bpy.props import (
|
||||
BoolProperty,
|
||||
EnumProperty,
|
||||
)
|
||||
|
||||
|
||||
class WManupulators(Operator):
|
||||
bl_idname = "w.manupulators"
|
||||
bl_idname = "w.manipulators"
|
||||
bl_label = "W Manupulators"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
bl_description = " Show/Hide Manipulator"
|
||||
|
||||
extend: BoolProperty(
|
||||
default=False,
|
||||
)
|
||||
type: EnumProperty(
|
||||
items=(
|
||||
('TRANSLATE', "Move", ""),
|
||||
('ROTATE', "Rotate", ""),
|
||||
('SCALE', "Scale", ""),
|
||||
)
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
context.space_data.show_gizmo_tool = not context.space_data.show_gizmo_tool
|
||||
space_data = context.space_data
|
||||
space_data.show_gizmo_context = True
|
||||
|
||||
attrs = (
|
||||
"show_gizmo_object_translate",
|
||||
"show_gizmo_object_rotate",
|
||||
"show_gizmo_object_scale",
|
||||
)
|
||||
attr_t, attr_r, attr_s = attrs
|
||||
attr_index = ('TRANSLATE', 'ROTATE', 'SCALE').index(self.type)
|
||||
attr_active = attrs[attr_index]
|
||||
|
||||
if self.extend:
|
||||
setattr(space_data, attr_active, not getattr(space_data, attr_active))
|
||||
else:
|
||||
for attr in attrs:
|
||||
setattr(space_data, attr, attr == attr_active)
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
self.extend = event.shift
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
# Pie Manipulators - Ctrl + Space
|
||||
class PieManipulator(Menu):
|
||||
|
@ -57,13 +92,14 @@ class PieManipulator(Menu):
|
|||
layout = self.layout
|
||||
pie = layout.menu_pie()
|
||||
# 4 - LEFT
|
||||
pie.operator("wm.tool_set_by_id", text="Translate", icon='NONE').name = "builtin.move"
|
||||
pie.operator("w.manipulators", text="Translate", icon='NONE').type = 'TRANSLATE'
|
||||
# 6 - RIGHT
|
||||
pie.operator("wm.tool_set_by_id", text="Rotate", icon='NONE').name = "builtin.rotate"
|
||||
pie.operator("w.manipulators", text="Rotate", icon='NONE').type = 'ROTATE'
|
||||
# 2 - BOTTOM
|
||||
pie.operator("wm.tool_set_by_id", text="Scale", icon='NONE').name = "builtin.scale"
|
||||
pie.operator("w.manipulators", text="Scale", icon='NONE').type = 'SCALE'
|
||||
# 8 - TOP
|
||||
pie.operator("w.manupulators", text="Show/Hide Toggle", icon='NONE')
|
||||
props = pie.operator("wm.context_toggle", text="Show/Hide Toggle", icon='NONE')
|
||||
props.data_path = "space_data.show_gizmo_context"
|
||||
|
||||
|
||||
classes = (
|
||||
|
|
Loading…
Reference in New Issue