3D Viewport Pie Menus: Cleanup, refactor, fix key register

Bumped version to 1.1.5
Pep8 cleanup
Remove the pie_origin_cursor.py since it is not needed anymore

Part of the T51547:
refactor the key unregister code so it matches the official pies
Note: using this code was crashing blender because of Bool Tool
key registration that left out some lingering keys on unregister
reload
Also there were some wrong calls with the unregister within the
pies themselves

Merge some operators where possible (around 7 less in total)
and use passing arguments instead
Add Enable All / Disable all buttons in  the preferences
Comment out the code for authors in the init instead of in
individual scripts
Remove unused imports and cameratoto scene prop
Add an icon at end of registrations line
Fix several crashes with operators being called out of context
This commit is contained in:
Vuk Gardašević 2017-07-05 01:22:14 +02:00
parent 759595b17b
commit 99ed610784
20 changed files with 550 additions and 925 deletions

View File

@ -18,19 +18,6 @@
# <pep8 compliant>
bl_info = {
"name": "3D Viewport Pie Menus",
"author": "meta-androcto, pitiwazou, chromoly, italic",
"version": (1, 1, 4),
"blender": (2, 7, 7),
"description": "Individual Pie Menu Activation List",
"location": "Addons Preferences",
"warning": "",
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/3D_interaction/viewport_pies",
"category": "Pie Menu"
}
import bpy
from bpy.props import (
@ -42,6 +29,20 @@ from bpy.types import (
AddonPreferences,
)
bl_info = {
"name": "3D Viewport Pie Menus",
"author": "meta-androcto, pitiwazou, chromoly, italic",
"version": (1, 1, 5),
"blender": (2, 7, 7),
"description": "Individual Pie Menu Activation List",
"location": "Addons Preferences",
"warning": "",
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/3D_interaction/viewport_pies",
"category": "Pie Menu"
}
sub_modules_names = (
"pie_modes_menu",
"pie_views_numpad_menu",
@ -64,7 +65,8 @@ sub_modules_names = (
)
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']))
@ -122,11 +124,60 @@ def unregister_submodule(mod):
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):
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
)
def draw(self, context):
layout = self.layout
split = layout.split(percentage=0.5, align=True)
row = split.row()
row.alignment = "LEFT"
sub_box = row.box()
sub_box.prop(self, "enable_all", emboss=False,
icon="VISIBLE_IPO_ON", icon_only=True)
row.label("Enable All")
row = split.row()
row.alignment = "RIGHT"
row.label("Disable All")
sub_box = row.box()
sub_box.prop(self, "disable_all", emboss=False,
icon="VISIBLE_IPO_OFF", icon_only=True)
for mod in sub_modules:
mod_name = mod.__name__.split('.')[-1]
@ -161,10 +212,12 @@ class PieToolsPreferences(AddonPreferences):
split = col.row().split(percentage=0.15)
split.label('Location:')
split.label(info['location'])
if info.get('author') and info.get('author') != 'chromoly':
"""
if info.get('author'):
split = col.row().split(percentage=0.15)
split.label('Author:')
split.label(info['author'])
"""
if info.get('version'):
split = col.row().split(percentage=0.15)
split.label('Version:')
@ -196,12 +249,14 @@ class PieToolsPreferences(AddonPreferences):
try:
prefs.draw(context)
except:
import traceback
traceback.print_exc()
box.label(text='Error (see console)', icon='ERROR')
del prefs.layout
row = layout.row()
row.label("End of Pie Menu Activations")
row.label(text="End of Advanced Object Panels Activations",
icon="FILE_PARENT")
for mod in sub_modules:
@ -219,10 +274,10 @@ for mod in sub_modules:
return update
prop = BoolProperty(
name=info['name'],
description=info.get('description', ''),
update=gen_update(mod),
)
name=info['name'],
description=info.get('description', ''),
update=gen_update(mod),
)
setattr(PieToolsPreferences, 'use_' + mod_name, prop)
prop = BoolProperty()
setattr(PieToolsPreferences, 'show_expanded_' + mod_name, prop)
@ -253,5 +308,6 @@ def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Alt X'",
"description": "V/E/F Align tools",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "Mesh Edit Mode",
"warning": "",
@ -35,11 +35,10 @@ from bpy.types import (
Menu,
Operator,
)
from bpy.props import EnumProperty
# Pie Align - Alt + X
class PieAlign(Menu):
bl_idname = "pie.align"
bl_label = "Pie Align"
@ -54,32 +53,46 @@ class PieAlign(Menu):
# 2 - BOTTOM
pie.operator("align.y", text="Align Y", icon='PLUS')
# 8 - TOP
pie.operator("align.2y0", text="Align To Y-0")
pie.operator("align.2xyz", text="Align To Y-0").axis = '1'
# 7 - TOP - LEFT
pie.operator("align.2x0", text="Align To X-0")
pie.operator("align.2xyz", text="Align To X-0").axis = '0'
# 9 - TOP - RIGHT
pie.operator("align.2z0", text="Align To Z-0")
pie.operator("align.2xyz", text="Align To Z-0").axis = '2'
# 1 - BOTTOM - LEFT
pie.separator()
# 3 - BOTTOM - RIGHT
# pie.menu("align.xyz")
box = pie.split().box().column()
row = box.row(align=True)
row.label("X")
row.operator("alignx.left", text="Neg")
row.operator("alignx.right", text="Pos")
align_1 = row.operator("alignxyz.all", text="Neg")
align_1.axis = '0'
align_1.side = 'NEGATIVE'
align_2 = row.operator("alignxyz.all", text="Pos")
align_2.axis = '0'
align_2.side = 'POSITIVE'
row = box.row(align=True)
row.label("Y")
row.operator("aligny.front", text="Neg")
row.operator("aligny.back", text="Pos")
align_3 = row.operator("alignxyz.all", text="Neg")
align_3.axis = '1'
align_3.side = 'NEGATIVE'
align_4 = row.operator("alignxyz.all", text="Pos")
align_4.axis = '1'
align_4.side = 'POSITIVE'
row = box.row(align=True)
row.label("Z")
row.operator("alignz.bottom", text="Neg")
row.operator("alignz.top", text="Pos")
align_5 = row.operator("alignxyz.all", text="Neg")
align_5.axis = '2'
align_5.side = 'NEGATIVE'
align_6 = row.operator("alignxyz.all", text="Pos")
align_6.axis = '2'
align_6.side = 'POSITIVE'
# Align X
class AlignX(Operator):
bl_idname = "align.x"
bl_label = "Align X"
@ -89,13 +102,17 @@ class AlignX(Operator):
def execute(self, context):
for vert in bpy.context.object.data.vertices:
bpy.ops.transform.resize(value=(0, 1, 1), constraint_axis=(True, False, False), constraint_orientation='GLOBAL',
mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.resize(
value=(0, 1, 1), constraint_axis=(True, False, False),
constraint_orientation='GLOBAL',
mirror=False, proportional='DISABLED',
proportional_edit_falloff='SMOOTH',
proportional_size=1
)
return {'FINISHED'}
# Align Y
class AlignY(Operator):
bl_idname = "align.y"
bl_label = "Align Y"
@ -105,13 +122,17 @@ class AlignY(Operator):
def execute(self, context):
for vert in bpy.context.object.data.vertices:
bpy.ops.transform.resize(value=(1, 0, 1), constraint_axis=(False, True, False), constraint_orientation='GLOBAL',
mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.resize(
value=(1, 0, 1), constraint_axis=(False, True, False),
constraint_orientation='GLOBAL',
mirror=False, proportional='DISABLED',
proportional_edit_falloff='SMOOTH',
proportional_size=1
)
return {'FINISHED'}
# Align Z
class AlignZ(Operator):
bl_idname = "align.z"
bl_label = "Align Z"
@ -121,267 +142,122 @@ class AlignZ(Operator):
def execute(self, context):
for vert in bpy.context.object.data.vertices:
bpy.ops.transform.resize(value=(1, 1, 0), constraint_axis=(False, False, True), constraint_orientation='GLOBAL',
mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.resize(
value=(1, 1, 0), constraint_axis=(False, False, True),
constraint_orientation='GLOBAL',
mirror=False, proportional='DISABLED',
proportional_edit_falloff='SMOOTH',
proportional_size=1
)
return {'FINISHED'}
#####################
# ################# #
# Align To 0 #
#####################
# ################# #
# Align to X - 0
class AlignToX0(Operator):
bl_idname = "align.2x0"
bl_label = "Align To X = 0"
bl_description = "Align Selected To Location X = 0"
class AlignToXYZ0(Operator):
bl_idname = "align.2xyz"
bl_label = "Align To X, Y or Z = 0"
bl_description = "Align Active Object To a chosen X, Y or Z equals 0 Location"
bl_options = {'REGISTER', 'UNDO'}
axis = EnumProperty(
name="Axis",
items=[
('0', "X", "X Axis"),
('1', "Y", "Y Axis"),
('2', "Z", "Z Axis")
],
description="Choose an axis for alignment",
default='0'
)
@classmethod
def poll(cls, context):
obj = context.active_object
return obj and obj.type == "MESH"
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
align = int(self.axis)
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[0] = 0
vert.co[align] = 0
bpy.ops.object.editmode_toggle()
return {'FINISHED'}
# Align to Z - 0
class AlignToY0(Operator):
bl_idname = "align.2y0"
bl_label = "Align To Y = 0"
bl_description = "Align Selected To Location Y = 0"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[1] = 0
bpy.ops.object.editmode_toggle()
return {'FINISHED'}
# Align to Z - 0
class AlignToZ0(Operator):
bl_idname = "align.2z0"
bl_label = "Align To Z = 0"
bl_description = "Align Selected To Location Z = 0"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[2] = 0
bpy.ops.object.editmode_toggle()
return {'FINISHED'}
# Align X Left
class AlignXLeft(Operator):
bl_idname = "alignx.left"
bl_label = "Align X Left"
class AlignXYZAll(Operator):
bl_idname = "alignxyz.all"
bl_label = "Align to Front/Back Axis"
bl_description = "Align to a Front or Back along the chosen Axis"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
axis = EnumProperty(
name="Axis",
items=[
('0', "X", "X Axis"),
('1', "Y", "Y Axis"),
('2', "Z", "Z Axis")
],
description="Choose an axis for alignment",
default='0'
)
side = EnumProperty(
name="Side",
items=[
('POSITIVE', "Front", "Align on the positive chosen axis"),
('NEGATIVE', "Back", "Align acriss the negative chosen axis"),
],
description="Choose a side for alignment",
default='POSITIVE'
)
bpy.ops.object.mode_set(mode='OBJECT')
count = 0
axe = 0
for vert in bpy.context.object.data.vertices:
if vert.select:
if count == 0:
max = vert.co[axe]
count += 1
continue
count += 1
if vert.co[axe] < max:
max = vert.co[axe]
bpy.ops.object.mode_set(mode='OBJECT')
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[axe] = max
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
# Align X Right
class AlignXRight(Operator):
bl_idname = "alignx.right"
bl_label = "Align X Right"
@classmethod
def poll(cls, context):
obj = context.active_object
return obj and obj.type == "MESH"
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
count = 0
axe = 0
axe = int(self.axis)
for vert in bpy.context.object.data.vertices:
if vert.select:
if count == 0:
max = vert.co[axe]
maxv = vert.co[axe]
count += 1
continue
count += 1
if vert.co[axe] > max:
max = vert.co[axe]
if self.side == 'POSITIVE':
if vert.co[axe] > maxv:
maxv = vert.co[axe]
else:
if vert.co[axe] < maxv:
maxv = vert.co[axe]
bpy.ops.object.mode_set(mode='OBJECT')
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[axe] = max
vert.co[axe] = maxv
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
# Align Y Back
class AlignYBack(Operator):
bl_idname = "aligny.back"
bl_label = "Align Y back"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
count = 0
axe = 1
for vert in bpy.context.object.data.vertices:
if vert.select:
if count == 0:
max = vert.co[axe]
count += 1
continue
count += 1
if vert.co[axe] > max:
max = vert.co[axe]
bpy.ops.object.mode_set(mode='OBJECT')
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[axe] = max
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
# Align Y Front
class AlignYFront(Operator):
bl_idname = "aligny.front"
bl_label = "Align Y Front"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
count = 0
axe = 1
for vert in bpy.context.object.data.vertices:
if vert.select:
if count == 0:
max = vert.co[axe]
count += 1
continue
count += 1
if vert.co[axe] < max:
max = vert.co[axe]
bpy.ops.object.mode_set(mode='OBJECT')
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[axe] = max
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
# Align Z Top
class AlignZTop(Operator):
bl_idname = "alignz.top"
bl_label = "Align Z Top"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
count = 0
axe = 2
for vert in bpy.context.object.data.vertices:
if vert.select:
if count == 0:
max = vert.co[axe]
count += 1
continue
count += 1
if vert.co[axe] > max:
max = vert.co[axe]
bpy.ops.object.mode_set(mode='OBJECT')
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[axe] = max
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
# Align Z Bottom
class AlignZBottom(Operator):
bl_idname = "alignz.bottom"
bl_label = "Align Z Bottom"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
count = 0
axe = 2
for vert in bpy.context.object.data.vertices:
if vert.select:
if count == 0:
max = vert.co[axe]
count += 1
continue
count += 1
if vert.co[axe] < max:
max = vert.co[axe]
bpy.ops.object.mode_set(mode='OBJECT')
for vert in bpy.context.object.data.vertices:
if vert.select:
vert.co[axe] = max
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
classes = (
PieAlign,
AlignX,
AlignY,
AlignZ,
AlignToX0,
AlignToY0,
AlignToZ0,
AlignXLeft,
AlignXRight,
AlignYBack,
AlignYFront,
AlignZTop,
AlignZBottom,
AlignToXYZ0,
AlignXYZAll,
)
addon_keymaps = []
@ -390,29 +266,27 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Align
km = wm.keyconfigs.addon.keymaps.new(name='Mesh')
kmi = km.keymap_items.new('wm.call_menu_pie', 'X', 'PRESS', alt=True)
kmi.properties.name = "pie.align"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Mesh']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.align":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Alt A'",
"description": "Pie menu for Timeline controls",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -85,6 +85,7 @@ class InsertAutoKeyframe(Operator):
return {'FINISHED'}
classes = (
PieAnimation,
InsertAutoKeyframe
@ -96,29 +97,26 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Animation
km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
kmi = km.keymap_items.new('wm.call_menu_pie', 'A', 'PRESS', alt=True)
kmi.properties.name = "pie.animation"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Object Non-modal']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.animation":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Ctrl A'",
"description": "Apply Transform Menu",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -35,10 +35,10 @@ from bpy.types import (
Menu,
Operator,
)
from bpy.props import EnumProperty
# Pie Apply Transforms - Ctrl + A
class PieApplyTransforms(Menu):
bl_idname = "pie.applytranforms"
bl_label = "Pie Apply Transforms"
@ -53,58 +53,44 @@ class PieApplyTransforms(Menu):
# 2 - BOTTOM
pie.operator("object.duplicates_make_real", text="Make Duplicates Real")
# 8 - TOP
pie.operator("apply.transformrotation", text="Rotation", icon='MAN_ROT')
pie.operator("apply.transformlocrotscale", text="Rotation", icon='MAN_ROT').option = 'ROT'
# 7 - TOP - LEFT
pie.operator("apply.transformlocation", text="Location", icon='MAN_TRANS')
pie.operator("apply.transformlocrotscale", text="Location", icon='MAN_ROT').option = 'LOC'
# 9 - TOP - RIGHT
pie.operator("apply.transformscale", text="Scale", icon='MAN_SCALE')
pie.operator("apply.transformlocrotscale", text="Scale", icon='MAN_ROT').option = 'SCALE'
# 1 - BOTTOM - LEFT
pie.operator("object.visual_transform_apply", text="Visual Transforms")
# 3 - BOTTOM - RIGHT
pie.menu("clear.menu", text="Clear Transform Menu")
# Apply Transforms
class ApplyTransformLocation(Operator):
bl_idname = "apply.transformlocation"
bl_label = "Apply Transform Location"
bl_description = "Apply Transform Location"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.transform_apply(location=True, rotation=False, scale=False)
return {'FINISHED'}
# Apply Transforms
class ApplyTransformRotation(Operator):
bl_idname = "apply.transformrotation"
bl_label = "Apply Transform Rotation"
bl_description = "Apply Transform Rotation"
class ApplyTransLocRotPie(Operator):
bl_idname = "apply.transformlocrotscale"
bl_label = "Apply Transforms"
bl_description = "Apply Transform: Location, Rotation or Scale"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
return {'FINISHED'}
# Apply Transforms
class ApplyTransformScale(Operator):
bl_idname = "apply.transformscale"
bl_label = "Apply Transform Scale"
bl_description = "Apply Transform Scale"
bl_options = {'REGISTER', 'UNDO'}
option = EnumProperty(
name="Type",
items=[
("LOC", "Location", "Apply Location"),
("ROT", "Rotation", "Apply Rotation"),
("SCALE", "Scale", "Apply Scale")
],
default="LOC",
)
def execute(self, context):
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
loc = True if self.option == "LOC" else False
rot = True if self.option == "ROT" else False
sca = True if self.option == "SCALE" else False
bpy.ops.object.transform_apply(location=loc, rotation=rot, scale=sca)
return {'FINISHED'}
# Apply Transforms
class ApplyTransformAll(Operator):
bl_idname = "apply.transformall"
bl_label = "Apply All Transforms"
@ -115,9 +101,8 @@ class ApplyTransformAll(Operator):
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
return {'FINISHED'}
# Clear Menu
class ClearMenu(Menu):
bl_idname = "clear.menu"
bl_label = "Clear Menu"
@ -129,9 +114,8 @@ class ClearMenu(Menu):
layout.operator("object.scale_clear", text="Clear Scale", icon='MAN_SCALE')
layout.operator("object.origin_clear", text="Clear Origin", icon='MANIPUL')
# Clear all
class ClearAll(Operator):
bl_idname = "clear.all"
bl_label = "Clear All"
@ -144,11 +128,10 @@ class ClearAll(Operator):
bpy.ops.object.scale_clear()
return {'FINISHED'}
classes = (
PieApplyTransforms,
ApplyTransformLocation,
ApplyTransformRotation,
ApplyTransformScale,
ApplyTransLocRotPie,
ApplyTransformAll,
ClearMenu,
ClearAll,
@ -167,22 +150,20 @@ def register():
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode')
kmi = km.keymap_items.new('wm.call_menu_pie', 'A', 'PRESS', ctrl=True)
kmi.properties.name = "pie.applytranforms"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Object Mode']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.applytranforms":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Shift S'",
"description": "Cursor Menu",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 0),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -36,23 +36,23 @@ from bpy.types import (
Operator,
)
# SnapCursSelToCenter1 thanks to Isaac Weaver (wisaac) D1963
class Snap_CursSelToCenter1(Operator):
"""Snap 3D cursor and selected objects to the center \n"""\
"""Works only in Object Mode"""
bl_idname = "view3d.snap_cursor_selected_to_center1"
bl_label = "Snap Cursor & Selection to Center"
bl_description = ("Snap 3D cursor and selected objects to the center \n"
"Works only in Object Mode")
@classmethod
def poll(cls, context):
return (context.mode == "OBJECT")
return (context.area.type == "VIEW_3D" and context.mode == "OBJECT")
def execute(self, context):
context.space_data.cursor_location = (0, 0, 0)
for obj in context.selected_objects:
obj.location = (0, 0, 0)
return {'FINISHED'}
@ -69,9 +69,10 @@ class Snap_CursorMenu(Menu):
icon='CLIPUV_HLT').use_offset = False
# 6 - RIGHT
pie.operator("view3d.snap_selected_to_cursor",
text="Selection to Cursor (Offset)", icon='CURSOR').use_offset = True
text="Selection to Cursor (Offset)", icon='CURSOR').use_offset = True
# 2 - BOTTOM
pie.operator("view3d.snap_cursor_selected_to_center1", text="Selected & Cursor to Center", icon='ALIGN')
pie.operator("view3d.snap_cursor_selected_to_center1",
text="Selected & Cursor to Center", icon='ALIGN')
# 8 - TOP
pie.operator("view3d.snap_cursor_to_center", text="Cursor to Center", icon='CLIPUV_DEHLT')
# 7 - TOP - LEFT
@ -95,8 +96,8 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Origin/Pivot
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
@ -108,15 +109,13 @@ def register():
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "snap.cursormenu":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'X'",
"description": "Edit mode V/E/F Delete Modes",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 0),
"blender": (2, 77, 0),
"location": "Mesh Edit Mode",
"warning": "",
@ -31,14 +31,10 @@ bl_info = {
}
import bpy
from bpy.types import (
Menu,
Operator,
)
from bpy.types import Menu
# Pie Delete - X
class PieDelete(Menu):
bl_idname = "pie.delete"
bl_label = "Pie Delete"
@ -60,50 +56,48 @@ class PieDelete(Menu):
pie.operator("mesh.dissolve_faces", text="Dissolve Faces", icon='SNAP_FACE')
# 1 - BOTTOM - LEFT
box = pie.split().column()
row = box.row(align=True)
box.operator("mesh.dissolve_limited", text="Limited Dissolve", icon='STICKY_UVS_LOC')
box.operator("mesh.delete_edgeloop", text="Delete Edge Loops", icon='BORDER_LASSO')
box.operator("mesh.edge_collapse", text="Edge Collapse", icon='UV_EDGESEL')
# 3 - BOTTOM - RIGHT
box = pie.split().column()
row = box.row(align=True)
box.operator("mesh.delete", text="Only Edge & Faces", icon='SPACE2').type = 'EDGE_FACE'
box.operator("mesh.delete", text="Only Faces", icon='UV_FACESEL').type = 'ONLY_FACE'
box.operator("mesh.remove_doubles", text="Remove Doubles", icon='ORTHO')
classes = (
PieDelete,
)
addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Delete
km = wm.keyconfigs.addon.keymaps.new(name='Mesh')
kmi = km.keymap_items.new('wm.call_menu_pie', 'X', 'PRESS')
kmi.properties.name = "pie.delete"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Mesh']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.delete":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Ctrl Alt S ",
"description": "Switch Editor Type Menu",
# "author": "saidenka",
# "version": (0, 1, 0),
"author": "saidenka",
"version": (0, 1, 0),
"blender": (2, 77, 0),
"location": "All Editors",
"warning": "",
@ -69,19 +69,19 @@ class AreaPieEditor(Menu):
layout = self.layout
pie = layout.menu_pie()
# 4 - LEFT
pie.operator(SetAreaType.bl_idname, text="Text Editor", icon="TEXT").type = "TEXT_EDITOR"
pie.operator(SetAreaType.bl_idname, text="Text Editor", icon="TEXT").types = "TEXT_EDITOR"
# 6 - RIGHT
pie.menu(AreaTypePieAnim.bl_idname, text="Animation Editors", icon="ACTION")
# 2 - BOTTOM
pie.operator(SetAreaType.bl_idname, text="Property", icon="BUTS").type = "PROPERTIES"
pie.operator(SetAreaType.bl_idname, text="Property", icon="BUTS").types = "PROPERTIES"
# 8 - TOP
pie.operator(SetAreaType.bl_idname, text="3D View", icon="MESH_CUBE").type = "VIEW_3D"
pie.operator(SetAreaType.bl_idname, text="3D View", icon="MESH_CUBE").types = "VIEW_3D"
# 7 - TOP - LEFT
pie.operator(SetAreaType.bl_idname, text="UV/Image Editor", icon="IMAGE_COL").type = "IMAGE_EDITOR"
pie.operator(SetAreaType.bl_idname, text="UV/Image Editor", icon="IMAGE_COL").types = "IMAGE_EDITOR"
# 9 - TOP - RIGHT
pie.operator(SetAreaType.bl_idname, text="Node Editor", icon="NODETREE").type = "NODE_EDITOR"
pie.operator(SetAreaType.bl_idname, text="Node Editor", icon="NODETREE").types = "NODE_EDITOR"
# 1 - BOTTOM - LEFT
pie.operator(SetAreaType.bl_idname, text="Outliner", icon="OOPS").type = "OUTLINER"
pie.operator(SetAreaType.bl_idname, text="Outliner", icon="OOPS").types = "OUTLINER"
# 3 - BOTTOM - RIGHT
pie.menu(AreaTypePieOther.bl_idname, text="More Editors", icon="QUESTION")
@ -93,17 +93,17 @@ class AreaTypePieOther(Menu):
def draw(self, context):
# 4 - LEFT
self.layout.operator(SetAreaType.bl_idname, text="Logic Editor", icon="LOGIC").type = "LOGIC_EDITOR"
self.layout.operator(SetAreaType.bl_idname, text="Logic Editor", icon="LOGIC").types = "LOGIC_EDITOR"
# 6 - RIGHT
self.layout.operator(SetAreaType.bl_idname, text="File Browser", icon="FILESEL").type = "FILE_BROWSER"
self.layout.operator(SetAreaType.bl_idname, text="File Browser", icon="FILESEL").types = "FILE_BROWSER"
# 2 - BOTTOM
self.layout.operator(SetAreaType.bl_idname, text="Python Console", icon="CONSOLE").type = "CONSOLE"
self.layout.operator(SetAreaType.bl_idname, text="Python Console", icon="CONSOLE").types = "CONSOLE"
# 8 - TOP
# 7 - TOP - LEFT
self.layout.operator(SetAreaType.bl_idname, text="User Setting",
icon="PREFERENCES").type = "USER_PREFERENCES"
self.layout.operator(SetAreaType.bl_idname, text="User Preferences",
icon="PREFERENCES").types = "USER_PREFERENCES"
# 9 - TOP - RIGHT
self.layout.operator(SetAreaType.bl_idname, text="Info", icon="INFO").type = "INFO"
self.layout.operator(SetAreaType.bl_idname, text="Info", icon="INFO").types = "INFO"
# 1 - BOTTOM - LEFT
# 3 - BOTTOM - RIGHT
@ -114,33 +114,33 @@ class SetAreaType(Operator):
bl_description = "Change Editor Type"
bl_options = {'REGISTER'}
type = StringProperty(name="Area Type")
types = StringProperty(name="Area Type")
def execute(self, context):
context.area.type = self.type
context.area.type = self.types
return {'FINISHED'}
class AreaTypePieAnim(Menu):
bl_idname = "INFO_MT_window_pie_area_type_anim"
bl_label = "Editor Type (Animation)"
bl_description = "Is pie menu change editor type (animation related)"
bl_description = "Menu for changing editor type (animation related)"
def draw(self, context):
# 4 - LEFT
self.layout.operator(SetAreaType.bl_idname, text="NLA Editor", icon="NLA").type = "NLA_EDITOR"
self.layout.operator(SetAreaType.bl_idname, text="NLA Editor", icon="NLA").types = "NLA_EDITOR"
# 6 - RIGHT
self.layout.operator(SetAreaType.bl_idname, text="DopeSheet", icon="ACTION").type = "DOPESHEET_EDITOR"
self.layout.operator(SetAreaType.bl_idname, text="DopeSheet", icon="ACTION").types = "DOPESHEET_EDITOR"
# 2 - BOTTOM
self.layout.operator(SetAreaType.bl_idname, text="Graph Editor", icon="IPO").type = "GRAPH_EDITOR"
self.layout.operator(SetAreaType.bl_idname, text="Graph Editor", icon="IPO").types = "GRAPH_EDITOR"
# 8 - TOP
self.layout.operator(SetAreaType.bl_idname, text="Timeline", icon="TIME").type = "TIMELINE"
self.layout.operator(SetAreaType.bl_idname, text="Timeline", icon="TIME").types = "TIMELINE"
# 7 - TOP - LEFT
self.layout.operator(SetAreaType.bl_idname,
text="Video Sequence Editor", icon="SEQUENCE").type = "SEQUENCE_EDITOR"
text="Video Sequence Editor", icon="SEQUENCE").types = "SEQUENCE_EDITOR"
# 9 - TOP - RIGHT
self.layout.operator(SetAreaType.bl_idname,
text="Video Clip Editor", icon="RENDER_ANIMATION").type = "CLIP_EDITOR"
text="Video Clip Editor", icon="RENDER_ANIMATION").types = "CLIP_EDITOR"
# 1 - BOTTOM - LEFT
self.layout.operator("wm.call_menu_pie", text="Back", icon="BACK").name = AreaPieEditor.bl_idname
# 3 - BOTTOM - RIGHT
@ -161,29 +161,26 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Snapping
km = wm.keyconfigs.addon.keymaps.new(name='Window')
kmi = km.keymap_items.new('wm.call_menu_pie', 'S', 'PRESS', ctrl=True, alt=True)
kmi.properties.name = "pie.editor"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Window']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "wm.area_type_pie_operator":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Ctrl Space'",
"description": "Extended Manipulator Menu",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -44,7 +44,7 @@ class ManipTranslate(Operator):
bl_description = " Show Translate"
def execute(self, context):
if context.space_data.show_manipulator == False:
if context.space_data.show_manipulator is False:
context.space_data.show_manipulator = True
context.space_data.transform_manipulators = {'TRANSLATE'}
if context.space_data.transform_manipulators != {'TRANSLATE'}:
@ -59,7 +59,7 @@ class ManipRotate(Operator):
bl_description = " Show Rotate"
def execute(self, context):
if context.space_data.show_manipulator == False:
if context.space_data.show_manipulator is False:
context.space_data.show_manipulator = True
context.space_data.transform_manipulators = {'ROTATE'}
if context.space_data.transform_manipulators != {'ROTATE'}:
@ -74,7 +74,7 @@ class ManipScale(Operator):
bl_description = " Show Scale"
def execute(self, context):
if context.space_data.show_manipulator == False:
if context.space_data.show_manipulator is False:
context.space_data.show_manipulator = True
context.space_data.transform_manipulators = {'SCALE'}
if context.space_data.transform_manipulators != {'SCALE'}:
@ -89,7 +89,7 @@ class TranslateRotate(Operator):
bl_description = " Show Translate/Rotate"
def execute(self, context):
if context.space_data.show_manipulator == False:
if context.space_data.show_manipulator is False:
context.space_data.show_manipulator = True
context.space_data.transform_manipulators = {'TRANSLATE', 'ROTATE'}
if context.space_data.transform_manipulators != {'TRANSLATE', 'ROTATE'}:
@ -104,7 +104,7 @@ class TranslateScale(Operator):
bl_description = " Show Translate/Scale"
def execute(self, context):
if context.space_data.show_manipulator == False:
if context.space_data.show_manipulator is False:
context.space_data.show_manipulator = True
context.space_data.transform_manipulators = {'TRANSLATE', 'SCALE'}
if context.space_data.transform_manipulators != {'TRANSLATE', 'SCALE'}:
@ -119,7 +119,7 @@ class RotateScale(Operator):
bl_description = " Show Rotate/Scale"
def execute(self, context):
if context.space_data.show_manipulator == False:
if context.space_data.show_manipulator is False:
context.space_data.show_manipulator = True
context.space_data.transform_manipulators = {'ROTATE', 'SCALE'}
if context.space_data.transform_manipulators != {'ROTATE', 'SCALE'}:
@ -134,7 +134,7 @@ class TranslateRotateScale(Operator):
bl_description = "Show All"
def execute(self, context):
if context.space_data.show_manipulator == False:
if context.space_data.show_manipulator is False:
context.space_data.show_manipulator = True
context.space_data.transform_manipulators = {'TRANSLATE', 'ROTATE', 'SCALE'}
if context.space_data.transform_manipulators != {'TRANSLATE', 'ROTATE', 'SCALE'}:
@ -150,17 +150,16 @@ class WManupulators(Operator):
def execute(self, context):
if context.space_data.show_manipulator == True:
if context.space_data.show_manipulator is True:
context.space_data.show_manipulator = False
elif context.space_data.show_manipulator == False:
elif context.space_data.show_manipulator is False:
context.space_data.show_manipulator = True
return {'FINISHED'}
# Pie Manipulators - Ctrl + Space
class PieManipulator(Menu):
bl_idname = "pie.manipulator"
bl_label = "Pie Manipulator"
@ -185,7 +184,6 @@ class PieManipulator(Menu):
# 3 - BOTTOM - RIGHT
pie.operator("manip.scale", text="Scale", icon='MAN_SCALE')
# Pie Snapping - Shift + Tab
classes = (
PieManipulator,
@ -205,29 +203,27 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
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.properties.name = "pie.manipulator"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.manipulator":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Tab'",
"description": "Switch between 3d view object/edit modes",
# "author": "pitiwazou, meta-androcto, italic",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto, italic",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -252,7 +252,8 @@ class PieInteractiveModeGreasePencil(Operator):
try:
bpy.ops.gpencil.editmode_toggle()
except:
self.report({'WARNING'}, "It is not possible to enter into the interactive mode")
self.report({'WARNING'},
"It is not possible to enter into the interactive mode")
return {'FINISHED'}
@ -453,14 +454,13 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Select Mode
km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
kmi.properties.name = "pie.objecteditmode"
# kmi.active = True
addon_keymaps.append((km, kmi))
km = wm.keyconfigs.addon.keymaps.new(name='Grease Pencil Stroke Edit Mode')
@ -472,21 +472,13 @@ def register():
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Object Non-modal']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.objecteditmode":
km.keymap_items.remove(kmi)
km = kc.keymaps['Grease Pencil Stroke Edit Mode']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.objecteditmode":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":

View File

@ -22,8 +22,8 @@
bl_info = {
"name": "Hotkey: 'Alt + Spacebar'",
# "author": "Italic_",
# "version": (1, 1, 0),
"author": "Italic_",
"version": (1, 1, 0),
"blender": (2, 77, 0),
"description": "Set Transform Orientations",
"location": "3D View",
@ -38,12 +38,13 @@ from bpy.props import (
StringProperty,
)
class OrientPoll(Operator):
bl_idname = "pie.orientation"
bl_label = "Orientation Poll"
bl_options = {'INTERNAL'}
space = bpy.props.StringProperty()
space = StringProperty()
@classmethod
def poll(cls, context):
@ -89,13 +90,11 @@ def register():
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
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', alt=True)
kmi.properties.name = "pie.orient"
# kmi.active = True
addon_keymaps.append((km, kmi))
@ -106,11 +105,9 @@ def unregister():
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.orient":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Alt Shift O'",
"description": "Origin Snap/Place Menu",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -38,33 +38,40 @@ from bpy.types import (
# Pivot to selection
class PivotToSelection(Operator):
bl_idname = "object.pivot2selection"
bl_label = "Pivot To Selection"
bl_description = "Pivot Point To Selection"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
saved_location = context.scene.cursor_location.copy()
bpy.ops.view3d.snap_cursor_to_selected()
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
context.scene.cursor_location = saved_location
return {'FINISHED'}
# Pivot to Bottom
class PivotBottom(Operator):
bl_idname = "object.pivotobottom"
bl_label = "Pivot To Bottom"
bl_description = "Set the Pivot Point To Lowest Point"
bl_description = ("Set the Pivot Point To Lowest Point\n"
"Needs an Active Object of the Mesh type")
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
@classmethod
def poll(cls, context):
obj = context.active_object
return obj is not None and obj.type == "MESH"
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
@ -82,11 +89,11 @@ class PivotBottom(Operator):
o.location.z += a
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
# Pie Origin/Pivot - Shift + S
class PieOriginPivot(Menu):
bl_idname = "origin.pivotmenu"
bl_label = "Origin Menu"
@ -100,28 +107,37 @@ class PieOriginPivot(Menu):
pie.operator("object.origin_set", text="Origin to Center of Mass",
icon='BBOX').type = 'ORIGIN_CENTER_OF_MASS'
# 6 - RIGHT
pie.operator("object.origin_set", text="Origin To 3D Cursor", icon='CURSOR').type = 'ORIGIN_CURSOR'
pie.operator("object.origin_set", text="Origin To 3D Cursor",
icon='CURSOR').type = 'ORIGIN_CURSOR'
# 2 - BOTTOM
pie.operator("object.pivotobottom", text="Origin to Bottom", icon='TRIA_DOWN')
pie.operator("object.pivotobottom", text="Origin to Bottom",
icon='TRIA_DOWN')
# 8 - TOP
pie.operator("object.pivot2selection", text="Origin To Selection", icon='SNAP_INCREMENT')
pie.operator("object.pivot2selection", text="Origin To Selection",
icon='SNAP_INCREMENT')
# 7 - TOP - LEFT
pie.operator("object.origin_set", text="Geometry To Origin", icon='BBOX').type = 'GEOMETRY_ORIGIN'
pie.operator("object.origin_set", text="Geometry To Origin",
icon='BBOX').type = 'GEOMETRY_ORIGIN'
# 9 - TOP - RIGHT
pie.operator("object.origin_set", text="Origin To Geometry", icon='ROTATE').type = 'ORIGIN_GEOMETRY'
pie.operator("object.origin_set", text="Origin To Geometry",
icon='ROTATE').type = 'ORIGIN_GEOMETRY'
else:
# 4 - LEFT
pie.operator("object.origin_set", text="Origin to Center of Mass",
icon='BBOX').type = 'ORIGIN_CENTER_OF_MASS'
# 6 - RIGHT
pie.operator("object.origin_set", text="Origin To 3D Cursor", icon='CURSOR').type = 'ORIGIN_CURSOR'
pie.operator("object.origin_set", text="Origin To 3D Cursor",
icon='CURSOR').type = 'ORIGIN_CURSOR'
# 2 - BOTTOM
pie.operator("object.pivot2selection", text="Origin To Selection", icon='SNAP_INCREMENT')
pie.operator("object.pivot2selection", text="Origin To Selection",
icon='SNAP_INCREMENT')
# 8 - TOP
pie.operator("object.origin_set", text="Origin To Geometry", icon='ROTATE').type = 'ORIGIN_GEOMETRY'
pie.operator("object.origin_set", text="Origin To Geometry",
icon='ROTATE').type = 'ORIGIN_GEOMETRY'
# 7 - TOP - LEFT
pie.operator("object.origin_set", text="Geometry To Origin", icon='BBOX').type = 'GEOMETRY_ORIGIN'
pie.operator("object.origin_set", text="Geometry To Origin",
icon='BBOX').type = 'GEOMETRY_ORIGIN'
classes = (
@ -136,29 +152,26 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Origin/Pivot
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('wm.call_menu_pie', 'O', 'PRESS', shift=True, alt=True)
kmi.properties.name = "origin.pivotmenu"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "origin.pivotmenu":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":

View File

@ -1,225 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = {
"name": "Hotkey: 'Shift S'",
"description": "Cursor & Origin Snap/Place Menu",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
"wiki_url": "",
"category": "Cursor/Origin Pie"
}
import bpy
from bpy.types import (
Menu,
Operator,
)
# SnapCursSelToCenter1 thanks to Isaac Weaver (wisaac) D1963
class SnapCursSelToCenter1(Operator):
"""Snap 3D cursor and selected objects to the center \n"""\
"""Works only in Object Mode"""
bl_idname = "view3d.snap_cursor_selected_to_center1"
bl_label = "Snap Cursor & Selection to Center"
@classmethod
def poll(cls, context):
return (context.mode == "OBJECT")
def execute(self, context):
context.space_data.cursor_location = (0, 0, 0)
for obj in context.selected_objects:
obj.location = (0, 0, 0)
return {'FINISHED'}
# Pivot to selection
class PivotToSelection(Operator):
bl_idname = "object.pivot2selection"
bl_label = "Pivot To Selection"
bl_description = "Pivot Point To Selection"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
saved_location = context.scene.cursor_location.copy()
bpy.ops.view3d.snap_cursor_to_selected()
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
context.scene.cursor_location = saved_location
return {'FINISHED'}
# Pivot to Bottom
class PivotBottom(Operator):
bl_idname = "object.pivotobottom"
bl_label = "Pivot To Bottom"
bl_description = "Set the Pivot Point To Lowest Point"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
o = context.active_object
init = 0
for x in o.data.vertices:
if init == 0:
a = x.co.z
init = 1
elif x.co.z < a:
a = x.co.z
for x in o.data.vertices:
x.co.z -= a
o.location.z += a
bpy.ops.object.mode_set(mode='EDIT')
return {'FINISHED'}
# Pie Origin/Pivot - Shift + S
class PieOriginPivot(Menu):
bl_idname = "pie.originpivot"
bl_label = "Origin Menu"
def draw(self, context):
layout = self.layout
obj = context.object
pie = layout.menu_pie()
if obj and obj.type == 'MESH':
# 4 - LEFT
pie.operator("object.origin_set", text="Origin to Center of Mass",
icon='BBOX').type = 'ORIGIN_CENTER_OF_MASS'
# 6 - RIGHT
pie.operator("object.origin_set", text="Origin To 3D Cursor", icon='CURSOR').type = 'ORIGIN_CURSOR'
# 2 - BOTTOM
pie.operator("object.pivotobottom", text="Origin to Bottom", icon='TRIA_DOWN')
# 8 - TOP
pie.operator("object.pivot2selection", text="Origin To Selection", icon='SNAP_INCREMENT')
# 7 - TOP - LEFT
pie.operator("object.origin_set", text="Geometry To Origin", icon='BBOX').type = 'GEOMETRY_ORIGIN'
# 9 - TOP - RIGHT
pie.operator("object.origin_set", text="Origin To Geometry", icon='ROTATE').type = 'ORIGIN_GEOMETRY'
else:
# 4 - LEFT
pie.operator("object.origin_set", text="Origin to Center of Mass",
icon='BBOX').type = 'ORIGIN_CENTER_OF_MASS'
# 6 - RIGHT
pie.operator("object.origin_set", text="Origin To 3D Cursor", icon='CURSOR').type = 'ORIGIN_CURSOR'
# 2 - BOTTOM
pie.operator("object.pivot2selection", text="Origin To Selection", icon='SNAP_INCREMENT')
# 8 - TOP
pie.operator("object.origin_set", text="Origin To Geometry", icon='ROTATE').type = 'ORIGIN_GEOMETRY'
# 7 - TOP - LEFT
pie.operator("object.origin_set", text="Geometry To Origin", icon='BBOX').type = 'GEOMETRY_ORIGIN'
# Origin/Pivot menu1 - Shift + S
class OriginPivotMenu(Menu):
bl_idname = "origin.pivotmenu"
bl_label = "Cursor Menu"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor",
icon='CLIPUV_HLT').use_offset = False
# 6 - RIGHT
pie.operator("view3d.snap_selected_to_cursor",
text="Selection to Cursor (Offset)", icon='CURSOR').use_offset = True
# 2 - BOTTOM
pie.operator("wm.call_menu_pie", text="Origin Pie", icon='ROTATECOLLECTION').name = "pie.originpivot"
# 8 - TOP
pie.operator("view3d.snap_cursor_to_center", text="Cursor to Center", icon='CLIPUV_DEHLT')
# 7 - TOP - LEFT
pie.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected", icon='ROTACTIVE')
# 9 - TOP - RIGHT
pie.operator("view3d.snap_cursor_to_active", text="Cursor to Active", icon='BBOX')
# 1 - BOTTOM - LEFT
pie.operator("view3d.snap_cursor_selected_to_center1", text="Selected & Cursor to Center", icon='ALIGN')
# 3 - BOTTOM - RIGHT
pie.menu("snapgrid.menu", text="Snap Grid", icon='GRID')
# More Menu
class Snap_CursorGrid(Menu):
bl_idname = "snapgrid.menu"
bl_label = "More Menu"
def draw(self, context):
layout = self.layout
layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid", icon='GRID')
layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid", icon='GRID')
classes = (
OriginPivotMenu,
PieOriginPivot,
PivotToSelection,
PivotBottom,
SnapCursSelToCenter1,
Snap_CursorGrid,
)
addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Origin/Pivot
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('wm.call_menu_pie', 'S', 'PRESS', shift=True)
kmi.properties.name = "origin.pivotmenu"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "origin.pivotmenu":
km.keymap_items.remove(kmi)
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: ' . key' ",
"description": "Set Pivot Point Menu",
# "author": "seb_k, meta-androcto",
# "version": (0, 1, 0),
"author": "seb_k, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -57,29 +57,27 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Pivot Point
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('wm.call_menu_pie', 'PERIOD', 'PRESS')
kmi.properties.name = "pie.pivot"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.pivot":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'O'",
"description": "Proportional Object/Edit Tools",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View Object & Edit modes",
"warning": "",
@ -36,11 +36,8 @@ from bpy.types import (
Operator,
)
#####################################
# Proportional Edit Object #
#####################################
# Proportional Edit Object
class ProportionalEditObj(Operator):
bl_idname = "proportional_obj.active"
bl_label = "Proportional Edit Object"
@ -49,10 +46,10 @@ class ProportionalEditObj(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_proportional_edit_objects == True:
if ts.use_proportional_edit_objects is True:
ts.use_proportional_edit_objects = False
elif ts.use_proportional_edit_objects == False:
elif ts.use_proportional_edit_objects is False:
ts.use_proportional_edit_objects = True
return {'FINISHED'}
@ -65,7 +62,7 @@ class ProportionalSmoothObj(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_proportional_edit_objects == False:
if ts.use_proportional_edit_objects is False:
ts.use_proportional_edit_objects = True
ts.proportional_edit_falloff = 'SMOOTH'
@ -81,7 +78,7 @@ class ProportionalSphereObj(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_proportional_edit_objects == False:
if ts.use_proportional_edit_objects is False:
ts.use_proportional_edit_objects = True
ts.proportional_edit_falloff = 'SPHERE'
@ -97,7 +94,7 @@ class ProportionalRootObj(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_proportional_edit_objects == False:
if ts.use_proportional_edit_objects is False:
ts.use_proportional_edit_objects = True
ts.proportional_edit_falloff = 'ROOT'
@ -113,7 +110,7 @@ class ProportionalSharpObj(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_proportional_edit_objects == False:
if ts.use_proportional_edit_objects is False:
ts.use_proportional_edit_objects = True
ts.proportional_edit_falloff = 'SHARP'
@ -129,7 +126,7 @@ class ProportionalLinearObj(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_proportional_edit_objects == False:
if ts.use_proportional_edit_objects is False:
ts.use_proportional_edit_objects = True
ts.proportional_edit_falloff = 'LINEAR'
@ -145,7 +142,7 @@ class ProportionalConstantObj(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_proportional_edit_objects == False:
if ts.use_proportional_edit_objects is False:
ts.use_proportional_edit_objects = True
ts.proportional_edit_falloff = 'CONSTANT'
@ -161,7 +158,7 @@ class ProportionalRandomObj(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_proportional_edit_objects == False:
if ts.use_proportional_edit_objects is False:
ts.use_proportional_edit_objects = True
ts.proportional_edit_falloff = 'RANDOM'
@ -169,11 +166,8 @@ class ProportionalRandomObj(Operator):
ts.proportional_edit_falloff = 'RANDOM'
return {'FINISHED'}
#######################################
# Proportional Edit Edit Mode #
#######################################
# Proportional Edit Edit Mode
class ProportionalEditEdt(Operator):
bl_idname = "proportional_edt.active"
bl_label = "Proportional Edit EditMode"
@ -325,9 +319,8 @@ class ProportionalRandomEdt(Operator):
ts.proportional_edit_falloff = 'RANDOM'
return {'FINISHED'}
# Pie ProportionalEditObj - O
class PieProportionalObj(Menu):
bl_idname = "pie.proportional_obj"
bl_label = "Pie Proportional Obj"
@ -352,9 +345,8 @@ class PieProportionalObj(Menu):
# 3 - BOTTOM - RIGHT
pie.operator("proportional_obj.random", text="Random", icon='RNDCURVE')
# Pie ProportionalEditEdt - O
class PieProportionalEdt(Menu):
bl_idname = "pie.proportional_edt"
bl_label = "Pie Proportional Edit"
@ -379,9 +371,8 @@ class PieProportionalEdt(Menu):
# 3 - BOTTOM - RIGHT
pie.menu("pie.proportional_more", text="More", icon='LINCURVE')
# Pie ProportionalEditEdt - O
class PieProportionalMore(Menu):
bl_idname = "pie.proportional_more"
bl_label = "Pie Proportional More"
@ -390,11 +381,11 @@ class PieProportionalMore(Menu):
layout = self.layout
pie = layout.menu_pie()
box = pie.split().column()
row = box.row(align=True)
box.operator("proportional_edt.linear", text="Linear", icon='LINCURVE')
box.operator("proportional_edt.sharp", text="Sharp", icon='SHARPCURVE')
box.operator("proportional_edt.random", text="Random", icon='RNDCURVE')
classes = (
ProportionalEditObj,
ProportionalSmoothObj,
@ -425,44 +416,33 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# ProportionalEditObj
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode')
kmi = km.keymap_items.new('wm.call_menu_pie', 'O', 'PRESS')
kmi.properties.name = "pie.proportional_obj"
# kmi.active = True
addon_keymaps.append((km, kmi))
# ProportionalEditEdt
km = wm.keyconfigs.addon.keymaps.new(name='Mesh')
kmi = km.keymap_items.new('wm.call_menu_pie', 'O', 'PRESS')
kmi.properties.name = "pie.proportional_edt"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Object Mode']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.proportional_obj":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Mesh']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.proportional_edt":
km.keymap_items.remove(kmi)
if __name__ == "__main__":
register()

View File

@ -71,7 +71,6 @@ class pie_link(Menu):
layout = self.layout
pie = layout.menu_pie()
box = pie.split().column()
row = box.row(align=True)
box.operator("wm.link", text="Link", icon='LINK_BLEND')
box.operator("wm.append", text="Append", icon='APPEND_BLEND')
box.menu("external.data", text="External Data", icon='EXTERNAL_DATA')
@ -85,7 +84,6 @@ class pie_recover(Menu):
layout = self.layout
pie = layout.menu_pie()
box = pie.split().column()
row = box.row(align=True)
box.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO')
box.operator("wm.recover_last_session", text="Recover Last Session", icon='RECOVER_LAST')
box.operator("wm.revert_mainfile", text="Revert", icon='FILE_REFRESH')
@ -99,7 +97,6 @@ class pie_fileio(Menu):
layout = self.layout
pie = layout.menu_pie()
box = pie.split().column()
row = box.row(align=True)
box.menu("INFO_MT_file_import", icon='IMPORT')
box.separator()
box.menu("INFO_MT_file_export", icon='EXPORT')
@ -128,7 +125,7 @@ class ExternalData(Menu):
class FileIncrementalSave(Operator):
bl_idname = "file.save_incremental"
bl_label = "Save Incremental"
bl_description = "Save First!then Incremental, .blend will get _001 extension"
bl_description = "Save First! then Incremental, .blend will get _001 extension"
bl_options = {"REGISTER"}
@classmethod
@ -163,7 +160,8 @@ class FileIncrementalSave(Operator):
try:
bpy.ops.wm.save_as_mainfile(filepath=output)
except:
self.report({'WARNING'}, "File could not be saved. Check the System Console for errors")
self.report({'WARNING'},
"File could not be saved. Check the System Console for errors")
return {'CANCELLED'}
self.report(
@ -189,29 +187,27 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Save/Open/...
km = wm.keyconfigs.addon.keymaps.new(name='Window')
kmi = km.keymap_items.new('wm.call_menu_pie', 'S', 'PRESS', ctrl=True)
kmi.properties.name = "pie.saveopen"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Window']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.saveopen":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'W'",
"description": "Sculpt Brush Menu",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 0),
"blender": (2, 77, 0),
"location": "W key",
"warning": "",
@ -38,8 +38,6 @@ from bpy.types import (
# Sculpt Draw
class SculptSculptDraw(Operator):
bl_idname = "sculpt.sculptraw"
bl_label = "Sculpt SculptDraw"
@ -49,9 +47,8 @@ class SculptSculptDraw(Operator):
context.tool_settings.sculpt.brush = bpy.data.brushes['SculptDraw']
return {'FINISHED'}
# Pie Sculp Pie Menus - W
class PieSculptPie(Menu):
bl_idname = "pie.sculpt"
bl_label = "Pie Sculpt"
@ -60,57 +57,75 @@ class PieSculptPie(Menu):
layout = self.layout
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("paint.brush_select", text="Crease", icon='BRUSH_CREASE').sculpt_tool = 'CREASE'
pie.operator("paint.brush_select",
text="Crease", icon='BRUSH_CREASE').sculpt_tool = 'CREASE'
# 6 - RIGHT
pie.operator("paint.brush_select", text='Blob', icon='BRUSH_BLOB').sculpt_tool = 'BLOB'
pie.operator("paint.brush_select",
text='Blob', icon='BRUSH_BLOB').sculpt_tool = 'BLOB'
# 2 - BOTTOM
pie.menu(PieSculpttwo.bl_idname, text="More Brushes", icon='BRUSH_SMOOTH')
pie.menu(PieSculpttwo.bl_idname,
text="More Brushes", icon='BRUSH_SMOOTH')
# 8 - TOP
pie.operator("sculpt.sculptraw", text='SculptDraw', icon='BRUSH_SCULPT_DRAW')
pie.operator("sculpt.sculptraw",
text='SculptDraw', icon='BRUSH_SCULPT_DRAW')
# 7 - TOP - LEFT
pie.operator("paint.brush_select", text="Clay", icon='BRUSH_CLAY').sculpt_tool = 'CLAY'
pie.operator("paint.brush_select",
text="Clay", icon='BRUSH_CLAY').sculpt_tool = 'CLAY'
# 9 - TOP - RIGHT
pie.operator("paint.brush_select", text='Claystrips', icon='BRUSH_CLAY_STRIPS').sculpt_tool = 'CLAY_STRIPS'
pie.operator("paint.brush_select",
text='Claystrips', icon='BRUSH_CLAY_STRIPS').sculpt_tool = 'CLAY_STRIPS'
# 1 - BOTTOM - LEFT
pie.operator("paint.brush_select", text='Inflate/Deflate', icon='BRUSH_INFLATE').sculpt_tool = 'INFLATE'
pie.operator("paint.brush_select",
text='Inflate/Deflate', icon='BRUSH_INFLATE').sculpt_tool = 'INFLATE'
# 3 - BOTTOM - RIGHT
pie.menu(PieSculptthree.bl_idname, text="Grab Brushes", icon='BRUSH_GRAB')
pie.menu(PieSculptthree.bl_idname,
text="Grab Brushes", icon='BRUSH_GRAB')
# Pie Sculpt 2
class PieSculpttwo(Menu):
bl_idname = "pie.sculpttwo"
bl_label = "Pie Sculpt 2"
def draw(self, context):
layout = self.layout
layout.operator("paint.brush_select", text='Smooth', icon='BRUSH_SMOOTH').sculpt_tool = 'SMOOTH'
layout.operator("paint.brush_select", text='Flatten', icon='BRUSH_FLATTEN').sculpt_tool = 'FLATTEN'
layout.operator("paint.brush_select", text='Scrape/Peaks', icon='BRUSH_SCRAPE').sculpt_tool = 'SCRAPE'
layout.operator("paint.brush_select", text='Fill/Deepen', icon='BRUSH_FILL').sculpt_tool = 'FILL'
layout.operator("paint.brush_select", text='Pinch/Magnify', icon='BRUSH_PINCH').sculpt_tool = 'PINCH'
layout.operator("paint.brush_select", text='Layer', icon='BRUSH_LAYER').sculpt_tool = 'LAYER'
layout.operator("paint.brush_select", text='Mask', icon='BRUSH_MASK').sculpt_tool = 'MASK'
layout.operator("paint.brush_select", text='Simplify', icon='BRUSH_DATA').sculpt_tool = 'SIMPLIFY'
layout.operator("paint.brush_select", text='Smooth',
icon='BRUSH_SMOOTH').sculpt_tool = 'SMOOTH'
layout.operator("paint.brush_select", text='Flatten',
icon='BRUSH_FLATTEN').sculpt_tool = 'FLATTEN'
layout.operator("paint.brush_select", text='Scrape/Peaks',
icon='BRUSH_SCRAPE').sculpt_tool = 'SCRAPE'
layout.operator("paint.brush_select", text='Fill/Deepen',
icon='BRUSH_FILL').sculpt_tool = 'FILL'
layout.operator("paint.brush_select", text='Pinch/Magnify',
icon='BRUSH_PINCH').sculpt_tool = 'PINCH'
layout.operator("paint.brush_select", text='Layer',
icon='BRUSH_LAYER').sculpt_tool = 'LAYER'
layout.operator("paint.brush_select", text='Mask',
icon='BRUSH_MASK').sculpt_tool = 'MASK'
layout.operator("paint.brush_select", text='Simplify',
icon='BRUSH_DATA').sculpt_tool = 'SIMPLIFY'
# Pie Sculpt Three
class PieSculptthree(Menu):
bl_idname = "pie.sculptthree"
bl_label = "Pie Sculpt 3"
def draw(self, context):
layout = self.layout
layout.operator("paint.brush_select", text='Grab', icon='BRUSH_GRAB').sculpt_tool = 'GRAB'
layout.operator("paint.brush_select", text='Nudge', icon='BRUSH_NUDGE').sculpt_tool = 'NUDGE'
layout.operator("paint.brush_select", text='Thumb', icon='BRUSH_THUMB').sculpt_tool = 'THUMB'
layout.operator("paint.brush_select", text='Snakehook', icon='BRUSH_SNAKE_HOOK').sculpt_tool = 'SNAKE_HOOK'
layout.operator("paint.brush_select", text='Twist', icon='BRUSH_ROTATE').sculpt_tool = 'ROTATE'
layout.operator("paint.brush_select",
text='Grab', icon='BRUSH_GRAB').sculpt_tool = 'GRAB'
layout.operator("paint.brush_select",
text='Nudge', icon='BRUSH_NUDGE').sculpt_tool = 'NUDGE'
layout.operator("paint.brush_select",
text='Thumb', icon='BRUSH_THUMB').sculpt_tool = 'THUMB'
layout.operator("paint.brush_select",
text='Snakehook', icon='BRUSH_SNAKE_HOOK').sculpt_tool = 'SNAKE_HOOK'
layout.operator("paint.brush_select",
text='Twist', icon='BRUSH_ROTATE').sculpt_tool = 'ROTATE'
classes = (
@ -126,44 +141,33 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Sculpt Pie Menu
km = wm.keyconfigs.addon.keymaps.new(name='Sculpt')
kmi = km.keymap_items.new('wm.call_menu_pie', 'W', 'PRESS')
kmi.properties.name = "pie.sculpt"
# kmi.active = True
addon_keymaps.append((km, kmi))
# Sculpt Pie Menu 2
km = wm.keyconfigs.addon.keymaps.new(name='Sculpt')
kmi = km.keymap_items.new('wm.call_menu_pie', 'W', 'PRESS', alt=True)
kmi.properties.name = "pie.sculpttwo"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Sculpt']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.sculpt":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Sculpt']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.sculpttwo":
km.keymap_items.remove(kmi)
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'A'",
"description": "Object/Edit mode Selection Menu",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -31,14 +31,10 @@ bl_info = {
}
import bpy
from bpy.types import (
Menu,
Operator,
)
from bpy.types import Menu
# Pie Selection Object Mode - A
class PieSelectionsMore(Menu):
bl_idname = "pie.selectionsmore"
bl_label = "Pie Selections Object Mode"
@ -47,15 +43,13 @@ class PieSelectionsMore(Menu):
layout = self.layout
pie = layout.menu_pie()
box = pie.split().column()
row = box.row(align=True)
box.operator("object.select_by_type", text="Select By Type", icon='SNAP_VOLUME')
box.operator("object.select_grouped", text="Select Grouped", icon='ROTATE')
box.operator("object.select_linked", text="Select Linked", icon='CONSTRAINT_BONE')
box.menu("VIEW3D_MT_select_object_more_less", text="More/Less")
# Pie Selection Object Mode - A
class PieSelectionsOM(Menu):
bl_idname = "pie.selectionsom"
bl_label = "Pie Selections Object Mode"
@ -68,9 +62,11 @@ class PieSelectionsOM(Menu):
# 6 - RIGHT
pie.operator("object.select_random", text="Select Random", icon='GROUP_VERTEX')
# 2 - BOTTOM
pie.operator("object.select_all", text="Invert Selection", icon='ZOOM_PREVIOUS').action = 'INVERT'
pie.operator("object.select_all", text="Invert Selection",
icon='ZOOM_PREVIOUS').action = 'INVERT'
# 8 - TOP
pie.operator("object.select_all", text="Select All Toggle", icon='RENDER_REGION').action = 'TOGGLE'
pie.operator("object.select_all", text="Select All Toggle",
icon='RENDER_REGION').action = 'TOGGLE'
# 7 - TOP - LEFT
pie.operator("view3d.select_circle", text="Circle Select", icon='BORDER_LASSO')
# 9 - TOP - RIGHT
@ -80,9 +76,8 @@ class PieSelectionsOM(Menu):
# 3 - BOTTOM - RIGHT
pie.menu("pie.selectionsmore", text="Select Menu", icon='RESTRICT_SELECT_OFF')
# Pie Selection Edit Mode
class PieSelectionsEM(Menu):
bl_idname = "pie.selectionsem"
bl_label = "Pie Selections Edit Mode"
@ -91,25 +86,30 @@ class PieSelectionsEM(Menu):
layout = self.layout
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("view3d.select_border", text="Border Select", icon='BORDER_RECT')
pie.operator("view3d.select_border", text="Border Select",
icon='BORDER_RECT')
# 6 - RIGHT
pie.menu("object.selectloopselection", text="Select Loop Menu", icon='LOOPSEL')
# 2 - BOTTOM
pie.operator("mesh.select_all", text="Select None", icon='RESTRICT_SELECT_ON').action = 'DESELECT'
pie.operator("mesh.select_all", text="Select None",
icon='RESTRICT_SELECT_ON').action = 'DESELECT'
# 8 - TOP
pie.operator("mesh.select_all", text="Select All", icon='RESTRICT_SELECT_OFF').action = 'SELECT'
pie.operator("mesh.select_all", text="Select All",
icon='RESTRICT_SELECT_OFF').action = 'SELECT'
# 7 - TOP - LEFT
pie.operator("mesh.select_all", text="Select All Toggle", icon='ARROW_LEFTRIGHT').action = 'TOGGLE'
pie.operator("mesh.select_all", text="Select All Toggle",
icon='ARROW_LEFTRIGHT').action = 'TOGGLE'
# 9 - TOP - RIGHT
pie.operator("mesh.select_all", text="Invert Selection", icon='FULLSCREEN_EXIT').action = 'INVERT'
pie.operator("mesh.select_all", text="Invert Selection",
icon='FULLSCREEN_EXIT').action = 'INVERT'
# 1 - BOTTOM - LEFT
pie.operator("view3d.select_circle", text="Circle Select", icon='BORDER_LASSO')
pie.operator("view3d.select_circle", text="Circle Select",
icon='BORDER_LASSO')
# 3 - BOTTOM - RIGHT
pie.menu("object.selectallbyselection", text="Multi Select Menu", icon='SNAP_EDGE')
# Select All By Selection
class SelectAllBySelection(Menu):
bl_idname = "object.selectallbyselection"
bl_label = "Verts Edges Faces"
@ -140,6 +140,7 @@ class SelectAllBySelection(Menu):
prop.value = "(True, True, True)"
prop.data_path = "tool_settings.mesh_select_mode"
class SelectLoopSelection(Menu):
bl_idname = "object.selectloopselection"
bl_label = "Verts Edges Faces"
@ -153,12 +154,13 @@ class SelectLoopSelection(Menu):
layout.operator("mesh.loop_multi_select", text="Select Ring", icon='EDGESEL').ring = True
layout.operator("mesh.loop_to_region", text="Select Loop Inner Region", icon='FACESEL')
classes = (
PieSelectionsOM,
PieSelectionsEM,
SelectAllBySelection,
PieSelectionsMore,
SelectLoopSelection
SelectLoopSelection,
)
addon_keymaps = []
@ -167,8 +169,8 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Selection Object Mode
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode')
@ -186,23 +188,14 @@ def register():
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Object Mode']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.selectionsom":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['Mesh']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.selectionsem":
km.keymap_items.remove(kmi)
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Z'",
"description": "Viewport Shading Menus",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
@ -33,9 +33,8 @@ bl_info = {
import bpy
from bpy.types import Menu
# Pie Shading - Z
class PieShadingView(Menu):
bl_idname = "pie.shadingview"
bl_label = "Pie Shading"
@ -47,7 +46,7 @@ class PieShadingView(Menu):
pie.prop(context.space_data, "viewport_shade", expand=True)
if context.active_object:
if(context.mode == 'EDIT_MESH'):
if context.mode == 'EDIT_MESH':
pie.operator("MESH_OT_faces_shade_smooth")
pie.operator("MESH_OT_faces_shade_flat")
else:
@ -65,29 +64,26 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Shading
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('wm.call_menu_pie', 'Z', 'PRESS')
kmi.properties.name = "pie.shadingview"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.shadingview":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Ctrl Shift Tab'",
"description": "Snap Element Menu",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "3d View",
"warning": "",
@ -36,9 +36,8 @@ from bpy.types import (
Operator,
)
# Pie Snap - Shift + Tab
class PieSnaping(Menu):
bl_idname = "pie.snapping"
bl_label = "Pie Snapping"
@ -72,10 +71,10 @@ class SnapActive(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_snap == True:
if ts.use_snap is True:
ts.use_snap = False
elif ts.use_snap == False:
elif ts.use_snap is False:
ts.use_snap = True
return {'FINISHED'}
@ -88,7 +87,7 @@ class SnapVolume(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_snap == False:
if ts.use_snap is False:
ts.use_snap = True
ts.snap_element = 'VOLUME'
@ -105,7 +104,7 @@ class SnapFace(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_snap == False:
if ts.use_snap is False:
ts.use_snap = True
ts.snap_element = 'FACE'
@ -122,7 +121,7 @@ class SnapEdge(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_snap == False:
if ts.use_snap is False:
ts.use_snap = True
ts.snap_element = 'EDGE'
@ -139,7 +138,7 @@ class SnapVertex(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_snap == False:
if ts.use_snap is False:
ts.use_snap = True
ts.snap_element = 'VERTEX'
@ -156,7 +155,7 @@ class SnapIncrement(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_snap == False:
if ts.use_snap is False:
ts.use_snap = True
ts.snap_element = 'INCREMENT'
@ -173,10 +172,10 @@ class SnapAlignRotation(Operator):
def execute(self, context):
ts = context.tool_settings
if ts.use_snap_align_rotation == True:
if ts.use_snap_align_rotation is True:
ts.use_snap_align_rotation = False
elif ts.use_snap_align_rotation == False:
elif ts.use_snap_align_rotation is False:
ts.use_snap_align_rotation = True
return {'FINISHED'}
@ -220,6 +219,8 @@ class SnapTargetMenu(Menu):
# 9 - TOP - RIGHT
# 1 - BOTTOM - LEFT
# 3 - BOTTOM - RIGHT
# Pie Snapping - Shift + Tab
classes = (
@ -241,29 +242,27 @@ addon_keymaps = []
def register():
for cls in classes:
bpy.utils.register_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Snapping
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS', ctrl=True, shift=True)
kmi.properties.name = "pie.snapping"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.snapping":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()

View File

@ -21,8 +21,8 @@
bl_info = {
"name": "Hotkey: 'Q'",
"description": "Viewport Numpad Menus",
# "author": "pitiwazou, meta-androcto",
# "version": (0, 1, 0),
"author": "pitiwazou, meta-androcto",
"version": (0, 1, 1),
"blender": (2, 77, 0),
"location": "Q key",
"warning": "",
@ -35,47 +35,42 @@ from bpy.types import (
Menu,
Operator,
)
from bpy.props import (
StringProperty,
)
# Lock Camera Transforms
class LockTransforms(Operator):
bl_idname = "object.locktransforms"
bl_label = "Lock Object Transforms"
bl_description = ("Enable or disable the editing of objects transforms in the 3D View\n"
"Needs an existing Active Object")
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
obj = context.object
if obj.lock_rotation[0] == False:
obj = context.active_object
if obj.lock_rotation[0] is False:
obj.lock_rotation[0] = True
obj.lock_rotation[1] = True
obj.lock_rotation[2] = True
obj.lock_location[0] = True
obj.lock_location[1] = True
obj.lock_location[2] = True
obj.lock_scale[0] = True
obj.lock_scale[1] = True
obj.lock_scale[2] = True
elif context.object.lock_rotation[0] == True:
elif context.object.lock_rotation[0] is True:
obj.lock_rotation[0] = False
obj.lock_rotation[1] = False
obj.lock_rotation[2] = False
obj.lock_location[0] = False
obj.lock_location[1] = False
obj.lock_location[2] = False
obj.lock_scale[0] = False
obj.lock_scale[1] = False
obj.lock_scale[2] = False
return {'FINISHED'}
# Pie View All Sel Glob Etc - Q
class PieViewallSelGlobEtc(Menu):
bl_idname = "pie.vieallselglobetc"
bl_label = "Pie View All Sel Glob..."
@ -99,16 +94,15 @@ class PieViewallSelGlobEtc(Menu):
layout.operator("screen.screen_full_area", text="Full Screen", icon='FULLSCREEN_ENTER')
# 3 - BOTTOM - RIGHT
# Pie views numpad - Q
class PieViewNumpad(Menu):
bl_idname = "pie.viewnumpad"
bl_label = "Pie Views Ortho"
def draw(self, context):
layout = self.layout
ob = context.object
ob = context.active_object
pie = layout.menu_pie()
scene = context.scene
rd = scene.render
@ -128,10 +122,11 @@ class PieViewNumpad(Menu):
# 1 - BOTTOM - LEFT
box = pie.split().column()
row = box.row(align=True)
if context.space_data.lock_camera == False:
if context.space_data.lock_camera is False:
row.operator("wm.context_toggle", text="Lock Cam to View",
icon='UNLOCKED').data_path = "space_data.lock_camera"
elif context.space_data.lock_camera == True:
elif context.space_data.lock_camera is True:
row.operator("wm.context_toggle", text="Lock Cam to View",
icon='LOCKED').data_path = "space_data.lock_camera"
@ -139,18 +134,18 @@ class PieViewNumpad(Menu):
row.operator("view3d.viewnumpad", text="View Cam", icon='VISIBLE_IPO_ON').type = 'CAMERA'
row.operator("view3d.camera_to_view", text="Cam to view", icon='MAN_TRANS')
if ob.lock_rotation[0] == False:
row = box.row(align=True)
row.operator("object.locktransforms", text="Lock Transforms", icon='LOCKED')
icon_locked = 'LOCKED' if ob and ob.lock_rotation[0] is False else \
'UNLOCKED' if ob and ob.lock_rotation[0] is True else 'LOCKED'
row = box.row(align=True)
row.operator("object.locktransforms", text="Lock Transforms", icon=icon_locked)
elif ob.lock_rotation[0] == True:
row = box.row(align=True)
row.operator("object.locktransforms", text="UnLock Transforms", icon='UNLOCKED')
row = box.row(align=True)
row.prop(rd, "use_border", text="Border")
# 3 - BOTTOM - RIGHT
pie.menu(PieViewallSelGlobEtc.bl_idname, text="View Menu", icon='BBOX')
classes = (
PieViewNumpad,
LockTransforms,
@ -164,34 +159,26 @@ def register():
for cls in classes:
bpy.utils.register_class(cls)
# Active Camera
bpy.types.Scene.cameratoto = bpy.props.StringProperty(default="")
wm = bpy.context.window_manager
if wm.keyconfigs.addon:
# Views numpad
km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D')
kmi = km.keymap_items.new('wm.call_menu_pie', 'Q', 'PRESS')
kmi.properties.name = "pie.viewnumpad"
# kmi.active = True
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
wm = bpy.context.window_manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps['3D View Generic']
for kmi in km.keymap_items:
if kmi.idname == 'wm.call_menu_pie':
if kmi.properties.name == "pie.viewnumpad":
km.keymap_items.remove(kmi)
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
del bpy.types.Scene.cameratoto
if __name__ == "__main__":
register()