Skip to content
Permalink
Browse files
pie menus 2.81 update
  • Loading branch information
meta-androcto committed Aug 2, 2019
1 parent 759a209 commit 5e5dfae
Show file tree
Hide file tree
Showing 10 changed files with 307 additions and 166 deletions.
@@ -18,6 +18,7 @@

# <pep8 compliant>

# Contributed to by meta-androcto, pitiwazou, chromoly, italic

import bpy
from bpy.props import (
@@ -32,10 +33,10 @@

bl_info = {
"name": "3D Viewport Pie Menus",
"author": "meta-androcto, pitiwazou, chromoly, italic",
"version": (1, 1, 9),
"author": "meta-androcto",
"version": (1, 2, 8),
"blender": (2, 80, 0),
"description": "Individual Pie Menu Activation List",
"description": "Pie Menu Activation",
"location": "Addons Preferences",
"warning": "",
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
@@ -51,7 +52,6 @@
"pie_cursor",
"pie_manipulator_menu",
"pie_snap_menu",
"pie_orientation_menu",
"pie_shading_menu",
"pie_proportional_menu",
"pie_align_menu",
@@ -64,8 +64,7 @@
)


sub_modules = [__import__(__package__ + "." + submod, {}, {}, submod) for
submod in sub_modules_names]
sub_modules = [__import__(__package__ + "." + submod, {}, {}, submod) for submod in sub_modules_names]
sub_modules.sort(key=lambda mod: (mod.bl_info['category'], mod.bl_info['name']))


@@ -91,20 +90,22 @@ def get_addon_preferences(name=''):
cls = _get_pref_class(mod)
if cls:
prop = PointerProperty(type=cls)
setattr(PieToolsPreferences, name, prop)
bpy.utils.unregister_class(PieToolsPreferences)
bpy.utils.register_class(PieToolsPreferences)
create_property(PIEToolsPreferences, name, prop)
bpy.utils.unregister_class(PIEToolsPreferences)
bpy.utils.register_class(PIEToolsPreferences)
return getattr(addon_prefs, name, None)
else:
return addon_prefs

def create_property(cls, name, prop):
if not hasattr(cls, '__annotations__'):
cls.__annotations__ = dict()
cls.__annotations__[name] = prop


def register_submodule(mod):
if not hasattr(mod, '__addon_enabled__'):
mod.__addon_enabled__ = False
if not mod.__addon_enabled__:
mod.register()
mod.__addon_enabled__ = True
mod.register()
mod.__addon_enabled__ = True


def unregister_submodule(mod):
@@ -114,91 +115,20 @@ def unregister_submodule(mod):

prefs = get_addon_preferences()
name = mod.__name__.split('.')[-1]
if hasattr(PieToolsPreferences, name):
delattr(PieToolsPreferences, name)
if hasattr(PIEToolsPreferences, name):
delattr(PIEToolsPreferences, name)
if prefs:
bpy.utils.unregister_class(PieToolsPreferences)
bpy.utils.register_class(PieToolsPreferences)
bpy.utils.unregister_class(PIEToolsPreferences)
bpy.utils.register_class(PIEToolsPreferences)
if name in prefs:
del prefs[name]


def enable_all_modules(self, context):
for mod in sub_modules:
mod_name = mod.__name__.split('.')[-1]
setattr(self, 'use_' + mod_name, False)
if not mod.__addon_enabled__:
setattr(self, 'use_' + mod_name, True)
mod.__addon_enabled__ = True

return None


def disable_all_modules(self, context):
for mod in sub_modules:
mod_name = mod.__name__.split('.')[-1]

if mod.__addon_enabled__:
setattr(self, 'use_' + mod_name, False)
mod.__addon_enabled__ = False

return None


class PieToolsPreferences(AddonPreferences):
class PIEToolsPreferences(AddonPreferences):
bl_idname = __name__

enable_all: BoolProperty(
name="Enable all",
description="Enable all Pie Modules",
default=False,
update=enable_all_modules
)
disable_all: BoolProperty(
name="Disable all",
description="Disable all Pie Modules",
default=False,
update=disable_all_modules
)

for mod in sub_modules:
mod_name = mod.__name__.split('.')[-1]

def gen_update(mod, use_prop_name):
def update(self, context):
if getattr(self, use_prop_name):
if not mod.__addon_enabled__:
register_submodule(mod)
else:
if mod.__addon_enabled__:
unregister_submodule(mod)
return update

use_prop_name = 'use_' + mod_name
__annotations__[use_prop_name] = BoolProperty(
name=mod.bl_info['name'],
description=mod.bl_info.get('description', ''),
update=gen_update(mod, use_prop_name),
)

__annotations__['show_expanded_' + mod_name] = BoolProperty()

def draw(self, context):
layout = self.layout
split = layout.split(factor=0.5, align=True)
row = split.row()
row.alignment = "LEFT"
sub_box = row.box()
sub_box.prop(self, "enable_all", emboss=False,
icon="HIDE_OFF", icon_only=True)
row.label(text="Enable All")

row = split.row()
row.alignment = "RIGHT"
row.label(text="Disable All")
sub_box = row.box()
sub_box.prop(self, "disable_all", emboss=False,
icon="HIDE_ON", icon_only=True)

for mod in sub_modules:
mod_name = mod.__name__.split('.')[-1]
@@ -237,7 +167,7 @@ def draw(self, context):
if info.get('author'):
split = col.row().split(factor=0.15)
split.label(text='Author:')
split.label(info['author'])
split.label(text=info['author'])
"""
if info.get('version'):
split = col.row().split(factor=0.15)
@@ -276,12 +206,41 @@ def draw(self, context):
del prefs.layout

row = layout.row()
row.label(text="End of 3D Viewport Pie Menus Activations",
icon="FILE_PARENT")
row.label(text="End of Pie Menu Activations", icon="FILE_PARENT")


for mod in sub_modules:
info = mod.bl_info
mod_name = mod.__name__.split('.')[-1]

def gen_update(mod):
def update(self, context):
enabled = getattr(self, 'use_' + mod.__name__.split('.')[-1])
if enabled:
register_submodule(mod)
else:
unregister_submodule(mod)
mod.__addon_enabled__ = enabled
return update

create_property(
PIEToolsPreferences,
'use_' + mod_name,
BoolProperty(
name=info['name'],
description=info.get('description', ''),
update=gen_update(mod),
default=True,
))

create_property(
PIEToolsPreferences,
'show_expanded_' + mod_name,
BoolProperty())


classes = (
PieToolsPreferences,
PIEToolsPreferences,
)


@@ -19,7 +19,7 @@
# <pep8 compliant>

bl_info = {
"name": "Hotkey: 'Ctrl Shift Spacebar'",
"name": "Hotkey: 'Shift Spacebar'",
"description": "Pie menu for Timeline controls",
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
@@ -102,7 +102,7 @@ def register():
if wm.keyconfigs.addon:
# Animation
km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', ctrl=True, shift=True)
kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', shift=True)
kmi.properties.name = "PIE_MT_animation"
addon_keymaps.append((km, kmi))

@@ -43,27 +43,28 @@ def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("mesh.delete", text="Delete Vertices", icon='VERTEXSEL').type = 'VERT'
pie.operator("mesh.dissolve_edges", text="Dissolve Edges", icon='SNAP_EDGE')
# 6 - RIGHT
pie.operator("mesh.delete", text="Delete Faces", icon='FACESEL').type = 'FACE'
pie.operator("mesh.dissolve_faces", text="Dissolve Faces", icon='SNAP_FACE')
# 2 - BOTTOM
pie.operator("mesh.delete", text="Delete Edges", icon='EDGESEL').type = 'EDGE'
pie.operator("mesh.dissolve_verts", text="Dissolve Vertices", icon='SNAP_VERTEX')
# 8 - TOP
pie.operator("mesh.dissolve_edges", text="Dissolve Edges", icon='SNAP_EDGE')
pie.operator("mesh.delete", text="Delete Vertices", icon='VERTEXSEL').type = 'VERT'
# 7 - TOP - LEFT
pie.operator("mesh.dissolve_verts", text="Dissolve Vertices", icon='SNAP_VERTEX')
pie.operator("mesh.delete", text="Delete Edges", icon='EDGESEL').type = 'EDGE'
# 9 - TOP - RIGHT
pie.operator("mesh.dissolve_faces", text="Dissolve Faces", icon='SNAP_FACE')
pie.operator("mesh.delete", text="Delete Faces", icon='FACESEL').type = 'FACE'
# 1 - BOTTOM - LEFT
box = pie.split().column()
box.operator("mesh.dissolve_limited", text="Limited Dissolve", icon='STICKY_UVS_LOC')
box.operator("mesh.delete_edgeloop", text="Delete Edge Loops", icon='NONE')
box.operator("mesh.edge_collapse", text="Edge Collapse", icon='UV_EDGESEL')
# 3 - BOTTOM - RIGHT
box = pie.split().column()
box.operator("mesh.remove_doubles", text="Merge By Distance", icon='NONE')
box.operator("mesh.delete", text="Only Edge & Faces", icon='NONE').type = 'EDGE_FACE'
box.operator("mesh.delete", text="Only Faces", icon='UV_FACESEL').type = 'ONLY_FACE'
box.operator("mesh.remove_doubles", text="Merge By Distance", icon='NONE')



classes = (
@@ -19,7 +19,7 @@
# <pep8 compliant>

bl_info = {
"name": "Hotkey: 'Ctrl Alt S ",
"name": "Hotkey: 'Ctrl Alt S' ",
"description": "Switch Editor Type Menu",
"author": "saidenka, meta-androcto",
"version": (0, 1, 0),
@@ -111,6 +111,16 @@ def execute(self, context):
context.area.type = self.types
return {'FINISHED'}

class PIE_OT_Timeline(Operator):
bl_idname = "wm.set_timeline"
bl_label = "Change Editor Type"
bl_description = "Change Editor Type"
bl_options = {'REGISTER'}

def execute(self, context):
bpy.context.area.ui_type = 'TIMELINE'
return {'FINISHED'}


class PIE_MT_AreaTypePieAnim(Menu):
bl_idname = "TOPBAR_MT_window_pie_area_type_anim"
@@ -121,7 +131,7 @@ def draw(self, context):
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="NLA Editor", icon="NLA").types = "NLA_EDITOR"
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="DopeSheet", icon="ACTION").types = "DOPESHEET_EDITOR"
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="Graph Editor", icon="GRAPH").types = "GRAPH_EDITOR"
# self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="Timeline", icon="TIME").types = "TIMELINE"
self.layout.operator(PIE_OT_Timeline.bl_idname, text="Timeline", icon="TIME")
self.layout.operator(PIE_OT_SetAreaType.bl_idname,
text="Video Sequence Editor", icon="SEQUENCE").types = "SEQUENCE_EDITOR"
self.layout.operator(PIE_OT_SetAreaType.bl_idname,
@@ -135,6 +145,7 @@ def draw(self, context):
PIE_MT_AreaTypePieOther,
PIE_OT_SetAreaType,
PIE_MT_AreaTypePieAnim,
PIE_OT_Timeline
)

addon_keymaps = []
@@ -19,8 +19,8 @@
# <pep8 compliant>

bl_info = {
"name": "Hotkey: 'Ctrl Space'",
"description": "Extended Manipulator Menu",
"name": "Hotkey: 'Alt Spacebar'",
"description": "Manipulator Menu",
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 80, 0),
@@ -92,14 +92,15 @@ def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("w.manipulators", text="Translate", icon='NONE').type = 'TRANSLATE'
# 6 - RIGHT
pie.operator("w.manipulators", text="Rotate", icon='NONE').type = 'ROTATE'
# 2 - BOTTOM
# 6 - RIGHT
pie.operator("w.manipulators", text="Scale", icon='NONE').type = 'SCALE'
# 8 - TOP
# 2 - BOTTOM
props = pie.operator("wm.context_toggle", text="Show/Hide Toggle", icon='NONE')
props.data_path = "space_data.show_gizmo_context"
# 8 - TOP
pie.operator("w.manipulators", text="Translate", icon='NONE').type = 'TRANSLATE'



classes = (
@@ -118,7 +119,7 @@ def register():
if wm.keyconfigs.addon:
# Manipulators
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', ctrl=True)
kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', alt=True)
kmi.properties.name = "PIE_MT_manipulator"
addon_keymaps.append((km, kmi))

0 comments on commit 5e5dfae

Please sign in to comment.