Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-26 11:11:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-26 11:12:26 +0300
commitc22bc472b870c8f5a486a674275a5026f7a9a32b (patch)
treef7a0ec5fbf6cbb12ac5e537832ddaa13876fe76b /space_view3d_pie_menus
parente842685504bfeafe59d1ce47d7db8ba7a5b82306 (diff)
space_view3d_pie_menus: use gizmos for pie menu switching
Animators in the studio prefer this over tools.
Diffstat (limited to 'space_view3d_pie_menus')
-rw-r--r--space_view3d_pie_menus/pie_manipulator_menu.py54
1 files changed, 45 insertions, 9 deletions
diff --git a/space_view3d_pie_menus/pie_manipulator_menu.py b/space_view3d_pie_menus/pie_manipulator_menu.py
index d06e4bf7..2c0af6a5 100644
--- a/space_view3d_pie_menus/pie_manipulator_menu.py
+++ b/space_view3d_pie_menus/pie_manipulator_menu.py
@@ -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 = (