Instantly share code, notes, and snippets.
Created
January 28, 2016 08:52
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save zeffii/1bdf347be8169216a620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ##### 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 ##### | |
bl_info = { | |
"name": "studioTools Pie Menus", | |
"author": "Claas Kuhnen", | |
"version": (1, 0), | |
"blender": (2, 73, 1), | |
"description": "Product Design Workflow Pie Menus", | |
"warning": "Beta - Concept Study", | |
"category": "User Interface", | |
} | |
from bpy_extras import view3d_utils | |
import bpy, os | |
from bpy.types import Menu, Header | |
from bpy.props import IntProperty, FloatProperty, BoolProperty | |
import bmesh | |
from mathutils import * | |
import math | |
from math import radians | |
#from mesh_offset_edges import OffsetEdges | |
class ClaasPieMenuPrefs(bpy.types.AddonPreferences): | |
bl_idname = __name__ | |
bpy.types.Scene.Enable_Tab_01 = bpy.props.BoolProperty(default=False) | |
bpy.types.Scene.Enable_Tab_02 = bpy.props.BoolProperty(default=False) | |
bpy.types.Scene.Enable_Tab_03 = bpy.props.BoolProperty(default=False) | |
def draw(self, context): | |
layout = self.layout | |
layout.prop(context.scene, "Enable_Tab_01", text="About", icon="ERROR") | |
if context.scene.Enable_Tab_01: | |
row = layout.row() | |
layout.label(text="These pie menus provide access to frequently used functions suiteable for product design.") | |
layout.label(text="This tailors a workflow found in other CAD applications") | |
layout.prop(context.scene, "Enable_Tab_02", text="Shortcuts", icon="QUESTION") | |
if context.scene.Enable_Tab_02: | |
row = layout.row() | |
layout.label(text="– Select > A") | |
layout.label(text="– Manipualte > W") | |
layout.label(text="– Manipualte Ext. Edit Mode > Alt + W") | |
layout.label(text="– Manipualte Ext. Modifiers Object Mode > Alt + W") | |
layout.label(text="– Transform > Q") | |
layout.label(text="– Snapping > Shift + S") | |
layout.label(text="– Snap Settings > ALT + Space") | |
layout.label(text="– Undo Redo ... > CTRL + Z") | |
layout.label(text="– Views > SHIFT + Space") | |
layout.label(text="– Modes > SHIFT + CTRL + Space") | |
layout.label(text="– Shade > Z") | |
layout.label(text="– Undo Redo ... > CTRL + Z") | |
layout.prop(context.scene, "Enable_Tab_02", text="URL's", icon="URL") | |
if context.scene.Enable_Tab_03: | |
row = layout.row() | |
row.operator("wm.url_open", text="Google+ Profile").url = "https://plus.google.com/101076135528517730950" | |
###################### | |
# Command # | |
###################### | |
# Modes --------------------------------------------------------------------- | |
class Modes(bpy.types.Operator): | |
bl_idname = "modes.type" | |
bl_label = "Modes" | |
bl_options = {'INTERNAL'} | |
variable = bpy.props.StringProperty() | |
@classmethod | |
def poll(cls, context): | |
return True | |
def execute(self, context): | |
bpy.context.area.type = self.variable | |
return {'FINISHED'} | |
# UV Transformations -------------------------------------------------------- | |
#UV Scale X | |
class UV_Scale_X(bpy.types.Operator): | |
bl_idname = "uv.scale_x" | |
bl_label = "UV Scale X" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
bpy.ops.transform.resize(value=(0, 1, 1), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SPHERE', proportional_size=0.0323492) | |
return{'FINISHED'} | |
#UV Scale Y | |
class UV_Scale_X(bpy.types.Operator): | |
bl_idname = "uv.scale_y" | |
bl_label = "UV Scale Y" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
bpy.ops.transform.resize(value=(1, 0, 1), constraint_axis=(False, True, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SPHERE', proportional_size=0.0323492) | |
return{'FINISHED'} | |
#UV Mirror X | |
class UV_Scale_X(bpy.types.Operator): | |
bl_idname = "uv.mirror_x" | |
bl_label = "UV Mirror X" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
bpy.ops.transform.mirror(constraint_axis=(True, False, False), constraint_orientation='GLOBAL', proportional='DISABLED', proportional_edit_falloff='SPHERE', proportional_size=0.0323492) | |
return{'FINISHED'} | |
#UV Mirror Y | |
class UV_Scale_Y(bpy.types.Operator): | |
bl_idname = "uv.mirror_y" | |
bl_label = "UV Mirror Y" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
bpy.ops.transform.mirror(constraint_axis=(False, True, False), constraint_orientation='GLOBAL', proportional='DISABLED', proportional_edit_falloff='SPHERE', proportional_size=0.0323492) | |
return{'FINISHED'} | |
# Crease Bevel Weight ---------------------------------------- | |
#Clear Edge Crease | |
class ClearEdgeCrease(bpy.types.Operator): | |
bl_idname = "clear.edge_crease" | |
bl_label = "Clear Edge Crease" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self,context): | |
bpy.ops.transform.edge_crease(value=-1) | |
return {'FINISHED'} | |
#Clear Bevel Weight | |
class ClearBevelWeight(bpy.types.Operator): | |
bl_idname = "clear.bevel_weight" | |
bl_label = "Clear Bevel Weight" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self,context): | |
bpy.ops.transform.edge_bevelweight(value=-1) | |
return {'FINISHED'} | |
# Snap --------------------------------------------------- | |
#Snap Types | |
class SnapType(bpy.types.Operator): | |
bl_idname = "snap.type" | |
bl_label = "Snap Type" | |
bl_options = {'REGISTER', 'UNDO'} | |
variable = bpy.props.StringProperty() | |
@classmethod | |
def poll(cls, context): | |
return True | |
def execute(self, context): | |
bpy.context.scene.tool_settings.snap_element=self.variable | |
return {'FINISHED'} | |
#Snap Target Types | |
class SnapTarget(bpy.types.Operator): | |
bl_idname = "snap.target_type" | |
bl_label = "Snap Target Type" | |
bl_options = {'REGISTER', 'UNDO'} | |
variable = bpy.props.StringProperty() | |
@classmethod | |
def poll(cls, context): | |
return True | |
def execute(self, context): | |
bpy.context.scene.tool_settings.snap_target=self.variable | |
return {'FINISHED'} | |
class Snap_Grid(bpy.types.Operator): | |
bl_idname = "snap.grid" | |
bl_label = "Snap Grid" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self, context): | |
layout = self.layout | |
if bpy.context.scene.tool_settings.use_snap_grid_absolute == (False): | |
bpy.context.scene.tool_settings.use_snap_grid_absolute = True | |
elif bpy.context.scene.tool_settings.use_snap_grid_absolute == (True): | |
bpy.context.scene.tool_settings.use_snap_grid_absolute = False | |
return {'FINISHED'} | |
class Snap_Project(bpy.types.Operator): | |
bl_idname = "snap.project" | |
bl_label = "Snap Project" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self, context): | |
layout = self.layout | |
if bpy.context.scene.tool_settings.use_snap_project == (False): | |
bpy.context.scene.tool_settings.use_snap_project = True | |
elif bpy.context.scene.tool_settings.use_snap_project == (True): | |
bpy.context.scene.tool_settings.use_snap_project = False | |
return {'FINISHED'} | |
class Snap_Rotate(bpy.types.Operator): | |
bl_idname = "snap.rotate" | |
bl_label = "Snap Rotate" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self, context): | |
layout = self.layout | |
if bpy.context.scene.tool_settings.use_snap_align_rotation == (False): | |
bpy.context.scene.tool_settings.use_snap_align_rotation = True | |
elif bpy.context.scene.tool_settings.use_snap_align_rotation == (True): | |
bpy.context.scene.tool_settings.use_snap_align_rotation = False | |
return {'FINISHED'} | |
# Transformation ----------------------------------------- | |
def LocX(context): | |
for i in bpy.context.selected_objects: | |
i.location.x = bpy.context.active_object.location.x | |
def LocY(context): | |
for i in bpy.context.selected_objects: | |
i.location.y = bpy.context.active_object.location.y | |
def LocZ(context): | |
for i in bpy.context.selected_objects: | |
i.location.z = bpy.context.active_object.location.z | |
def RotX(context): | |
for i in bpy.context.selected_objects: | |
i.rotation_euler.x = bpy.context.active_object.rotation_euler.x | |
def RotY(context): | |
for i in bpy.context.selected_objects: | |
i.rotation_euler.y = bpy.context.active_object.rotation_euler.y | |
def RotZ(context): | |
for i in bpy.context.selected_objects: | |
i.rotation_euler.z = bpy.context.active_object.rotation_euler.z | |
## AlignX Object | |
class AlignObjectX(bpy.types.Operator): | |
bl_idname = "object.copy_location_x" | |
bl_label = "Copy X Location From Active" | |
@classmethod | |
def poll(cls, context): | |
return context.active_object != None | |
def execute(self, context): | |
LocX(context) | |
return {'FINISHED'} | |
## AlignY Object | |
class AlignObjectY(bpy.types.Operator): | |
bl_idname = "object.copy_location_y" | |
bl_label = "Copy Y Location From Active" | |
@classmethod | |
def poll(cls, context): | |
return context.active_object != None | |
def execute(self, context): | |
LocY(context) | |
return {'FINISHED'} | |
## AlignZ Object | |
class AlignObjectZ(bpy.types.Operator): | |
bl_idname = "object.copy_location_z" | |
bl_label = "Copy Z Location From Active" | |
@classmethod | |
def poll(cls, context): | |
return context.active_object != None | |
def execute(self, context): | |
LocZ(context) | |
return {'FINISHED'} | |
# Copy Object Rot Z | |
class CopyObjectRotX(bpy.types.Operator): | |
bl_idname = "object.copy_rotation_x" | |
bl_label = "Copy X Rotation From Active" | |
@classmethod | |
def poll(cls, context): | |
return context.active_object != None | |
def execute(self, context): | |
RotX(context) | |
return {'FINISHED'} | |
# Copy Object Rot Y | |
class CopyObjectRotY(bpy.types.Operator): | |
bl_idname = "object.copy_rotation_y" | |
bl_label = "Copy Y Rotation From Active" | |
@classmethod | |
def poll(cls, context): | |
return context.active_object != None | |
def execute(self, context): | |
RotY(context) | |
return {'FINISHED'} | |
# Copy Object Rot Z | |
class CopyObjectRotZ(bpy.types.Operator): | |
bl_idname = "object.copy_rotation_z" | |
bl_label = "Copy Z Rotation From Active" | |
@classmethod | |
def poll(cls, context): | |
return context.active_object != None | |
def execute(self, context): | |
RotZ(context) | |
return {'FINISHED'} | |
#AlignX Mesh | |
class AlignX(bpy.types.Operator): | |
bl_idname = "align.x" | |
bl_label = "Align X" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self,context): | |
scene = context.scene | |
#bpy.context.space_data.pivot_point = 'CURSOR' | |
bpy.ops.transform.resize(value=(0, 1, 1), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='ROOT', proportional_size=0.0323492) | |
return {'FINISHED'} | |
#AlignY Mesh | |
class AlignY(bpy.types.Operator): | |
bl_idname = "align.y" | |
bl_label = "Align Y" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self,context): | |
scene = context.scene | |
#bpy.context.space_data.pivot_point = 'CURSOR' | |
bpy.ops.transform.resize(value=(1, 0, 1), constraint_axis=(False, True, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='ROOT', proportional_size=0.0323492) | |
return {'FINISHED'} | |
#AlignZ Mesh | |
class AlignZ(bpy.types.Operator): | |
bl_idname = "align.z" | |
bl_label = "Align Z" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self,context): | |
scene = context.scene | |
#bpy.context.space_data.pivot_point = 'CURSOR' | |
bpy.ops.transform.resize(value=(1, 1, 0), constraint_axis=(False, False, True), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='ROOT', proportional_size=0.0323492) | |
#PivotPointType | |
class PivotPointType(bpy.types.Operator): | |
bl_idname = "pivotpoint.type" | |
bl_label = "PivotPointType" | |
bl_options = {'REGISTER', 'UNDO'} | |
variable = bpy.props.StringProperty() | |
@classmethod | |
def poll(cls, context): | |
return True | |
def execute(self, context): | |
bpy.context.space_data.pivot_point = self.variable | |
return {'FINISHED'} | |
#Orientation Types | |
class OrientationType(bpy.types.Operator): | |
bl_idname = "orientation.type" | |
bl_label = "OrientationType" | |
bl_options = {'REGISTER', 'UNDO'} | |
variable = bpy.props.StringProperty() | |
@classmethod | |
def poll(cls, context): | |
return True | |
def execute(self, context): | |
bpy.context.space_data.transform_orientation=self.variable | |
return {'FINISHED'} | |
#Set Object BoundingBox | |
class ObjectBoundingBox(bpy.types.Operator): | |
bl_idname = "set.bounding_box" | |
bl_label = "Set Bounding Box" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
if bpy.context.object.draw_type == 'SOLID': | |
bpy.context.object.draw_type = 'BOUNDS' | |
elif bpy.context.object.draw_type == 'WIRE': | |
bpy.context.object.draw_type = 'BOUNDS' | |
else: | |
bpy.context.object.draw_type = 'SOLID' | |
return{'FINISHED'} | |
#Set Object WireFrame | |
class ObjectWireFrame(bpy.types.Operator): | |
bl_idname = "set.wireframe" | |
bl_label = "Set Wireframe" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
if bpy.context.object.draw_type == 'SOLID': | |
bpy.context.object.draw_type = 'WIRE' | |
elif bpy.context.object.draw_type == 'BOUNDS': | |
bpy.context.object.draw_type = 'WIRE' | |
else: | |
bpy.context.object.draw_type = 'SOLID' | |
return{'FINISHED'} | |
#Set AutoSmooth | |
class SetAutoSmooth(bpy.types.Operator): | |
bl_idname = "set.autosmooth" | |
bl_label = "Set Auto Smooth" | |
bl_options = {'REGISTER'} | |
@classmethod | |
def poll(cls, context): | |
return context.active_object is not None | |
def execute(self, context): | |
for obj in bpy.context.selected_objects: | |
if obj.data.use_auto_smooth == (True): | |
obj.data.use_auto_smooth = False | |
print('AutoSmooth Off') | |
elif obj.data.use_auto_smooth == (False): | |
obj.data.use_auto_smooth = True | |
print('AutoSmooth On') | |
if round(obj.data.auto_smooth_angle, 5) == (3.14159): | |
obj.data.auto_smooth_angle = 0.523599 | |
print('Compare Degree Numbers') | |
bpy.ops.object.shade_smooth() | |
print('Shade Smooth') | |
return{'FINISHED'} | |
#Set Only Render | |
class SetOnlyRender(bpy.types.Operator): | |
bl_idname = "set.only_render" | |
bl_label = "Set Only Render" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
if bpy.context.space_data.show_only_render == (True): | |
bpy.context.space_data.show_only_render = False | |
elif bpy.context.space_data.show_only_render == (False): | |
bpy.context.space_data.show_only_render = True | |
return{'FINISHED'} | |
#Set World Background | |
class SetWorldBackground(bpy.types.Operator): | |
bl_idname = "set.world_background" | |
bl_label = "Set World Background" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
if bpy.context.space_data.show_world == (True): | |
bpy.context.space_data.show_world = False | |
elif bpy.context.space_data.show_world == (False): | |
bpy.context.space_data.show_world = True | |
return{'FINISHED'} | |
# Manipulation ---------------------------------------- | |
#Set Origin to 3D cursor | |
class SetOrigin(bpy.types.Operator): | |
bl_idname = "set.origin" | |
bl_label = "Set Mesh Origin" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
if bpy.context.mode != 'EDIT_MESH': | |
bpy.ops.object.editmode_toggle() | |
return{'FINISHED'} | |
bpy.ops.view3d.snap_cursor_to_selected() | |
bpy.ops.object.editmode_toggle() | |
bpy.ops.object.origin_set(type='ORIGIN_CURSOR') | |
bpy.ops.object.editmode_toggle() | |
return{'FINISHED'} | |
#SolidifyDialog | |
class SolidifyDialog(bpy.types.Operator): | |
bl_idname = "solidify.dialog" | |
bl_label = "Solidify Dialog" | |
bl_options = {'REGISTER', 'UNDO'} | |
thickness = FloatProperty( | |
name = "Thickness", | |
default = 0.01, | |
min = -10, | |
max = 10, | |
unit ='LENGTH' | |
) | |
def execute(self, context): | |
bpy.ops.mesh.solidify(thickness = self.thickness) | |
return {'FINISHED'} | |
def draw(self, context): | |
layout = self.layout | |
row = layout.row() | |
row.prop(self,"thickness") | |
def invoke(self, context, event): | |
wm = context.window_manager | |
return wm.invoke_props_popup(self, event) | |
#MakeSingleUser | |
class MakeSingleUser(bpy.types.Operator): | |
bl_idname = "make.singleuser" | |
bl_label = "Make Single User" | |
bl_options = {'REGISTER', 'UNDO'} | |
def execute(self, context): | |
bpy.ops.object.make_single_user(type='SELECTED_OBJECTS', object=True, obdata=True, material=False, texture=False, animation=False) | |
return {'FINISHED'} | |
#AddBoolean Union | |
class AddBooleanUnion(bpy.types.Operator): | |
bl_idname = "add.boolean_union" | |
bl_label = "Modifier Boolean" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
target_obj = bpy.context.active_object | |
tool_objs = [obj for obj in bpy.context.selected_objects if obj != target_obj] | |
for obj in tool_objs: | |
bool_mod = target_obj.modifiers.new(obj.name+' ', 'BOOLEAN') | |
bool_mod.operation = 'UNION' | |
bool_mod.object = obj | |
obj.draw_type = "BOUNDS" | |
return{'FINISHED'} | |
#AddBoolean Difference | |
class AddBooleanDifference(bpy.types.Operator): | |
bl_idname = "add.boolean_difference" | |
bl_label = "Modifier Boolean" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
target_obj = bpy.context.active_object | |
tool_objs = [obj for obj in bpy.context.selected_objects if obj != target_obj] | |
for obj in tool_objs: | |
bool_mod = target_obj.modifiers.new(obj.name+' ', 'BOOLEAN') | |
bool_mod.operation = 'DIFFERENCE' | |
bool_mod.object = obj | |
obj.draw_type = "BOUNDS" | |
return{'FINISHED'} | |
#AddBoolean Intersect | |
class AddBooleanIntersect(bpy.types.Operator): | |
bl_idname = "add.boolean_intersect" | |
bl_label = "Modifier Boolean" | |
bl_options = {'REGISTER'} | |
def execute(self, context): | |
target_obj = bpy.context.active_object | |
tool_objs = [obj for obj in bpy.context.selected_objects if obj != target_obj] | |
for obj in tool_objs: | |
bool_mod = target_obj.modifiers.new(obj.name+' ', 'BOOLEAN') | |
bool_mod.operation = 'INTERSECT' | |
bool_mod.object = obj | |
obj.draw_type = "BOUNDS" | |
return{'FINISHED'} | |
#CursorFollowEmpty | |
class CursorFollowEmpty(bpy.types.Operator): | |
bl_idname = "cursor.follow_empty" | |
bl_label = "Cursor Follow Empty" | |
count = 0 | |
def __init__(self): | |
print("Start") | |
def __del__(self): | |
print("End") | |
# get the context arguments | |
def modal(self, context, event): | |
self.count += 1 | |
if self.count == 1: | |
bpy.ops.transform.translate('INVOKE_DEFAULT') | |
if event.type == 'LEFTMOUSE': # Confirm | |
bpy.ops.view3d.snap_cursor_to_selected() | |
bpy.ops.object.delete() | |
return {'FINISHED'} | |
elif event.type in {'RIGHTMOUSE', 'ESC'}: # Cancel | |
bpy.ops.object.delete() | |
return {'CANCELLED'} | |
return {'RUNNING_MODAL'} | |
def invoke(self, context, event): | |
if context.space_data.type == 'VIEW_3D': | |
self.scene = context.scene | |
self.region = context.region | |
self.rv3d = context.region_data | |
self.mouse_co = event.mouse_region_x, event.mouse_region_y | |
self.depth = view3d_utils.region_2d_to_vector_3d(self.region, self.rv3d, self.mouse_co) | |
self.emp_co = view3d_utils.region_2d_to_location_3d(self.region, self.rv3d, self.mouse_co, self.depth) | |
bpy.ops.object.select_all(action='DESELECT') | |
bpy.ops.object.empty_add() | |
context.object.location = self.emp_co | |
context.window_manager.modal_handler_add(self) | |
return {'RUNNING_MODAL'} | |
else: | |
self.report({'WARNING'}, "Active space must be a View3d") | |
return {'CANCELLED'} | |
###################### | |
# Pie Menus # | |
###################### | |
# Pie Delete --------------------------------------------------------------------------- | |
class PieDelete(Menu): | |
bl_idname = "pie.delete" | |
bl_label = "Pie Delete" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("mesh.delete", text="Delete Vertices", icon='VERTEXSEL').type='VERT' | |
#6 - RIGHT | |
pie.operator("mesh.delete", text="Delete Edges", icon='EDGESEL').type='EDGE' | |
#2 - BOTTOM | |
pie.operator("mesh.delete", text="Only Faces", icon='UV_FACESEL').type='ONLY_FACE' | |
#8 - TOP | |
pie.operator("mesh.delete", text="Delete Faces", icon='FACESEL').type='FACE' | |
#7 - TOP - LEFT | |
pie.operator("mesh.dissolve_verts", text="Dissolve Vertices", icon='SNAP_VERTEX') | |
#9 - TOP - RIGHT | |
pie.operator("mesh.dissolve_edges", text="Dissolve Edges", icon='SNAP_EDGE') | |
#1 - BOTTOM - LEFT | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
#3 - BOTTOM - RIGHT | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
# PIE TRANSFORMATION ------------------------------------------------------------------- | |
class PieTransform(Menu): | |
bl_idname = "pie.transform" | |
bl_label = "Transformation" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
if context.active_object: | |
if(context.mode == 'EDIT_MESH'): | |
#4 - LEFT | |
pie.operator("transform.translate", text="Move", icon="MAN_TRANS") | |
#6 - RIGHT | |
pie.operator("transform.shrink_fatten", icon="MAN_TRANS") | |
#2 - BOTTOM | |
box = pie.box() | |
col = box.column() | |
col.operator("view3d.snap_cursor_to_selected", text="Snap Cursor to ", icon="SNAP_ON") | |
col.operator("wm.call_menu_pie", text="Snap Menu", icon="SNAP_OFF").name="pie.snap_menu" | |
col.separator() | |
col.operator("transform.mirror", icon="UV_ISLANDSEL") | |
col.separator() | |
col.operator("align.x", text="Align X", icon="MANIPUL") | |
col.operator("align.y", text="Align y", icon="MANIPUL") | |
col.operator("align.z", text="Align Z", icon="MANIPUL") | |
#8 - TOP | |
pie.operator("transform.rotate", text="Rotate", icon="MAN_ROT") | |
#7 - TOP - LEFT | |
pie.operator("transform.resize", text="Scale", icon="MAN_SCALE") | |
#9 - TOP - RIGHT | |
pie.operator("transform.shear", icon="MAN_TRANS") | |
#1 - BOTTOM - LEFT | |
pie.operator("pivotpoint.type", text="Pivot Bounding Box", icon="ROTATE").variable = 'BOUNDING_BOX_CENTER' | |
#3 - BOTTOM - RIGHT | |
pie.operator("pivotpoint.type", text="Pivot 3D Cursor", icon="CURSOR").variable = 'CURSOR' | |
else: | |
#4 - LEFT | |
pie.operator("transform.translate", text="Move", icon="MAN_TRANS") | |
#6 - RIGHT | |
pie.operator("wm.call_menu", text="Clear Tansformation", icon="CANCEL").name="VIEW3D_MT_object_clear" | |
#2 - BOTTOM | |
box = pie.box() | |
col = box.column() | |
col.operator("view3d.snap_cursor_to_selected", text="Snap Cursor to ", icon="SNAP_ON") | |
col.operator("wm.call_menu_pie", text="Snap Menu", icon="SNAP_OFF").name="pie.snap_menu" | |
col.separator() | |
col.operator("transform.mirror", icon="UV_ISLANDSEL") | |
col.separator() | |
col.operator("object.copy_location_x", text="Copy Loc X", icon="MANIPUL") | |
col.operator("object.copy_location_y", text="Copy Loc Y", icon="MANIPUL") | |
col.operator("object.copy_location_z", text="Copy Loc Z", icon="MANIPUL") | |
col.separator() | |
col.operator("object.copy_rotation_x", text="Copy Rot X", icon="MANIPUL") | |
col.operator("object.copy_rotation_y", text="Copy Rot Y", icon="MANIPUL") | |
col.operator("object.copy_rotation_z", text="Copy Rot Z", icon="MANIPUL") | |
#8 - TOP | |
pie.operator("transform.rotate", text="Rotate", icon="MAN_ROT") | |
#7 - TOP - LEFT | |
pie.operator("transform.resize", text="Scale", icon="MAN_SCALE") | |
#9 - TOP - RIGHT | |
pie.operator("wm.call_menu", text="Apply Tansformation", icon="MANIPUL").name="VIEW3D_MT_object_apply" | |
#1 - BOTTOM - LEFT | |
pie.operator("pivotpoint.type", text="Pivot Bounding Box", icon="ROTATE").variable = 'BOUNDING_BOX_CENTER' | |
#3 - BOTTOM - RIGHT | |
pie.operator("pivotpoint.type", text="Pivot 3D Cursor", icon="CURSOR").variable = 'CURSOR' | |
# PIE SELECT ------------------------------------------------------------------- | |
class PieSelectObject(Menu): | |
bl_idname = "pie.selectobject" | |
bl_label = "Object Select" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
scene = context.scene | |
#4 - LEFT | |
pie.operator("view3d.select_border", text="Border Select", icon="BORDER_RECT") | |
#6 - RIGHT | |
pie.operator("object.select_all", text="Select All", icon="BORDER_RECT") | |
#2 - BOTTOM | |
pie.operator("object.select_all", text="Invert Selection", icon="BORDER_RECT").action='INVERT' | |
#8 - TOP | |
pie.operator("object.select_grouped", text="Siblings", icon="GROUP").type="SIBLINGS" | |
#7 - TOP - LEFT | |
pie.operator("object.select_grouped", text="Group", icon="GROUP").type="GROUP" | |
#9 - TOP - RIGHT | |
pie.operator("object.select_grouped", text="Children", icon="GROUP").type="CHILDREN_RECURSIVE" | |
#1 - BOTTOM - LEFT | |
pie.operator("view3d.select_circle", text="Brush Select", icon="BORDER_RECT") | |
#3 - BOTTOM - RIGHT | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
class PieSelectEdit(Menu): | |
bl_idname = "pie.selectedit" | |
bl_label = "Mesh Select" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
mesh = context.active_object.data | |
scene = context.scene | |
#4 - LEFT | |
pie.operator("view3d.select_border", text="Border Select", icon="BORDER_RECT") | |
#6 - RIGHT | |
pie.operator("mesh.select_all", text="De/Select All", icon="BORDER_RECT").action='TOGGLE' | |
#2 - BOTTOM | |
pie.operator("mesh.select_all", text="Invert Select", icon="BORDER_RECT").action='INVERT' | |
#8 - TOP | |
pie.operator("mesh.select_mode", text="Edge", icon="EDGESEL").type='EDGE' | |
#7 - TOP - LEFT | |
pie.operator("mesh.select_mode", text="Vertex", icon="VERTEXSEL").type='VERT' | |
#9 - TOP - RIGHT | |
pie.operator("mesh.select_mode", text="Face", icon="FACESEL").type='FACE' | |
#1 - BOTTOM - LEFT | |
pie.operator("view3d.select_circle", text="Brush Select", icon="BORDER_RECT") | |
#3 - BOTTOM - RIGHT | |
pie.menu("select.more", text="Select Linked/Loop", icon="FORWARD") | |
class SelectMore(bpy.types.Menu): | |
bl_idname = "select.more" | |
bl_label = "Select More" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator("mesh.loop_multi_select", text="Edge Loop", icon="UV_EDGESEL") | |
layout.operator("mesh.select_linked", text="Linked Mesh", icon="LOOPSEL") | |
# PIE MANIPULATE ------------------------------------------------------------------- | |
class PieManipulateEdit(Menu): | |
bl_idname = "pie.manipulateedit" | |
bl_label = "Mesh Edit" | |
def draw(self, context): | |
layout = self.layout | |
toolsettings = context.tool_settings | |
mesh = context.active_object.data | |
scene = context.scene | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude", icon="FACESEL") | |
#6 - RIGHT | |
pie.operator("mesh.bevel", icon="EDGESEL") | |
#2 - BOTTOM | |
pie.operator("mesh.loopcut_slide", text="Loop Cut", icon="EDGESEL") | |
#8 - TOP | |
pie.operator("mesh.bridge_edge_loops", text="Bridge", icon="FACESEL") | |
#7 - TOP - LEFT | |
box = pie.box() | |
col = box.column() | |
col.operator("mesh.edge_face_add", text="Fill") | |
col.operator("mesh.fill_grid", text="Grid Fill") | |
col.operator("mesh.inset", text="Insert Face") | |
#9 - TOP - RIGHT | |
box = pie.box() | |
col = box.column() | |
col.operator("mesh.remove_doubles") | |
col.operator("mesh.merge", text="Merge") | |
col.prop(toolsettings, "use_mesh_automerge", text="Auto Merge") | |
col.operator("mesh.bevel", text="Bevel Vertex").vertex_only=True | |
#1 - BOTTOM - LEFT | |
box = pie.box() | |
col = box.column() | |
col.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual") | |
col.operator("mesh.extrude_region_shrink_fatten", text="Extrude Offset") | |
col.operator("solidify.dialog") | |
#3 - BOTTOM - RIGHT | |
box = pie.box() | |
col = box.column() | |
col.operator("mesh.offset_edge_loops_slide", text="Offset LoopCut") | |
col.operator("mesh.subdivide") | |
col.operator("mesh.knife_tool", text="Knife") | |
col.operator("mesh.vert_connect") | |
class PieManipulateEdit_Ext(Menu): | |
bl_idname = "pie.manipulateedit_ext" | |
bl_label = "Mesh Edit Ext" | |
def draw(self, context): | |
layout = self.layout | |
toolsettings = context.tool_settings | |
mesh = context.active_object.data | |
scene = context.scene | |
pie = layout.menu_pie() | |
#4 - LEFT | |
box = pie.box() | |
col = box.column() | |
col.operator("transform.edge_crease", text="Set Crease Weight") | |
col.operator("transform.edge_bevelweight", text="Set Bevel Weight") | |
#6 - RIGHT | |
box = pie.box() | |
col = box.column() | |
col.operator("clear.edge_crease", text="Clear Crease Weight") | |
col.operator("clear.bevel_weight", text="Clear Bevel Weight") | |
#2 - BOTTOM | |
pie.operator("set.origin", text="Set Origin to Selected", icon="SPACE2") | |
#8 - TOP | |
box = pie.box() | |
col = box.column() | |
col.prop(mesh, "show_edge_crease", text="Creases") | |
col.prop(mesh, "show_edge_sharp", text="Sharp") | |
col.prop(mesh, "show_edge_bevel_weight", text="Bevel") | |
#7 - TOP - LEFT | |
box = pie.box() | |
col = box.column() | |
col.operator("mesh.separate", text="Sepatate Mesh") | |
col.operator("mesh.split", text="Split Mesh") | |
col.operator("mesh.rip_move", text="Rip Edges") | |
#9 - TOP - RIGHT | |
box = pie.box() | |
col = box.column() | |
col.operator("mesh.intersect_boolean", text="Boolean Union").operation='UNION' | |
col.operator("mesh.intersect_boolean", text="Boolean Difference").operation='DIFFERENCE' | |
col.operator("mesh.intersect_boolean", text="Boolean Intersect").operation='INTERSECT' | |
#1 - BOTTOM - LEFT | |
box = pie.box() | |
col = box.column() | |
col.operator("mesh.mark_seam", text="Mark Seam").clear=False | |
col.operator("mesh.mark_seam", text="Clear Seam").clear=True | |
#3 - BOTTOM - RIGHT | |
box = pie.box() | |
col = box.column() | |
col.operator("mesh.mark_sharp", text="Mark Shrap") | |
col.operator("mesh.mark_sharp", text="Clear Shrap").clear=True | |
# pie.operator("screen.redo_last") | |
# pie.operator("wm.call_menu_pie", text="Edge Menu", icon='PLUS').name = "EdgeMenu" | |
# pie.menu("edge.menu2", text="Edge Menu") | |
class PieManipulateObject(Menu): | |
bl_idname = "pie.manipulateobject" | |
bl_label = "Object Edit" | |
def draw(self, context): | |
layout = self.layout | |
scene = context.scene | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("object.duplicate_move_linked", icon="LINK_AREA") | |
#6 - RIGHT | |
pie.operator("add.boolean_difference", text="Boolean Difference", icon="MOD_BOOLEAN") | |
#2 - BOTTOM | |
box = pie.box() | |
col = box.column() | |
col.operator("object.move_to_layer") | |
col.separator() | |
col.operator("object.join", text="Join Objects") | |
col.separator() | |
col.operator("object.parent_set") | |
col.operator("object.parent_clear") | |
col.separator() | |
col.operator("group.create") | |
col.operator("group.objects_add_active") | |
col.operator("group.objects_remove") | |
col.separator() | |
col.operator("cursor.follow_empty", text="Drag 3D Cursor", icon="OUTLINER_DATA_EMPTY") | |
col.operator("object.origin_set", text="Set Origin to 3D Cursor", icon="SPACE2").type='ORIGIN_CURSOR' | |
col.operator("object.origin_set", text="Set Origin to Geometry", icon="SPACE2").type='ORIGIN_GEOMETRY' | |
#8 - TOP | |
pie.operator("make.singleuser", text="Make Single User", icon="UNLINKED") | |
#7 - TOP - LEFT | |
pie.operator("object.make_links_data", text="Link Mesh Data", icon="LINKED") | |
#9 - TOP - RIGHT | |
pie.operator("add.boolean_union", text="Boolean Union", icon="MOD_BOOLEAN") | |
#1 - BOTTOM - LEFT | |
pie.operator("object.duplicate_move", icon="GROUP") | |
#3 - BOTTOM - RIGHT | |
pie.operator("add.boolean_intersect", text="Boolean Intersect", icon="MOD_BOOLEAN") | |
class PieManipulateObject_Ext(Menu): | |
bl_idname = "pie.manipulateobject_ext" | |
bl_label = "Add Modifier" | |
def draw(self, context): | |
layout = self.layout | |
scene = context.scene | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("object.modifier_add", text="Array", icon="MOD_ARRAY").type='ARRAY' | |
#6 - RIGHT | |
pie.operator("object.modifier_add", text="Sub-Surface", icon="MOD_SUBSURF").type='SUBSURF' | |
#2 - BOTTOM | |
box = pie.box() | |
col = box.column() | |
col.label("Deformations:") | |
col.operator("object.modifier_add", text="Shrinkwrap", icon="MOD_SHRINKWRAP").type='SHRINKWRAP' | |
col.operator("object.modifier_add", text="Curve", icon="MOD_CURVE").type='CURVE' | |
col.operator("object.modifier_add", text="Deform", icon="MOD_SIMPLEDEFORM").type='SIMPLE_DEFORM' | |
col.operator("object.modifier_add", text="Displace", icon="MOD_DISPLACE").type='DISPLACE' | |
col.operator("object.modifier_add", text="Lattice", icon="MOD_LATTICE").type='LATTICE' | |
#8 - TOP | |
pie.operator("object.modifier_add", text="Screw", icon="MOD_SCREW").type='SCREW' | |
#7 - TOP - LEFT | |
pie.operator("object.modifier_add", text="Solidify", icon="MOD_SOLIDIFY").type='SOLIDIFY' | |
#9 - TOP - RIGHT | |
pie.operator("object.modifier_add", text="Mirror", icon="MOD_SUBSURF").type='MIRROR' | |
#1 - BOTTOM - LEFT | |
pie.operator("object.modifier_add", text="Edge Split", icon="MOD_EDGESPLIT").type='EDGE_SPLIT' | |
#3 - BOTTOM - RIGHT | |
pie.operator("object.modifier_add", text="Bevel", icon="MOD_BEVEL").type='BEVEL' | |
# PIE EDGE | |
class EdgeMenu(Menu): | |
bl_label = "More" | |
def draw(self, context): | |
layout = self.layout | |
mesh = context.active_object.data | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("transform.edge_crease", text="Crease Weight") | |
#6 - RIGHT | |
pie.operator("mesh.mark_sharp", text="Mark Shrap") | |
#2 - BOTTOM | |
box = pie.box() | |
col = box.column() | |
col.prop(mesh, "show_edge_crease", text="Creases") | |
col.prop(mesh, "show_edge_sharp", text="Sharp") | |
col.prop(mesh, "show_edge_bevel_weight", text="Bevel") | |
col.separator() | |
col.prop(mesh, "show_faces", text="Faces") | |
col.prop(mesh, "show_edges", text="Edges") | |
#8 - TOP | |
pie.operator("mesh.mark_seam", text="Mark Seam").clear=False | |
#7 - TOP - LEFT | |
pie.operator("transform.edge_bevelweight", text="Bevel Weight") | |
#9 - TOP - RIGHT | |
pie.operator("mesh.mark_seam", text="Clear Seam").clear=True | |
#1 - BOTTOM - LEFT | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
#3 - BOTTOM - RIGHT | |
pie.operator("mesh.mark_sharp", text="Clear Shrap").clear=True | |
# Clear Menu | |
class EdgeMenu2(bpy.types.Menu): | |
bl_idname = "edge.menu2" | |
bl_label = "Edge Menu" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator("transform.edge_crease", text="Crease Weight") | |
layout.operator("mesh.mark_sharp", text="Mark Shrap") | |
layout.operator("mesh.mark_seam", text="Mark Seam").clear=False | |
layout.operator("transform.edge_bevelweight", text="Bevel Weight") | |
layout.operator("mesh.mark_seam", text="Clear Seam").clear=True | |
layout.operator("mesh.mark_sharp", text="Clear Shrap").clear=True | |
# PIE VIEWPORT SHADING ------------------------------------------------------------------- | |
class PieShadingObject(Menu): | |
bl_idname = "pie.shadingobject" | |
bl_label = "Shading " | |
def draw(self, context): | |
layout = self.layout | |
scene = context.scene | |
view = context.space_data | |
pie = layout.menu_pie() | |
#4 - LEFT | |
f = pie.operator("wm.context_set_enum", icon='WIRE', text='Wires') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'WIREFRAME' | |
#6 - RIGHT | |
pie.operator("object.hide_view_clear", text="Show Object", icon="RESTRICT_VIEW_OFF") | |
#2 - BOTTOM | |
group = pie.column() | |
box = group.box() | |
col = box.column() | |
col.operator("set.autosmooth", text="Set Auto Smooth", icon="MOD_EDGESPLIT") | |
col.operator("OBJECT_OT_shade_smooth", text="Object Smooth", icon="MESH_UVSPHERE") | |
col.operator("OBJECT_OT_shade_flat", text="Object Flat", icon="MESH_ICOSPHERE" ) | |
col.separator() | |
col.operator("set.bounding_box", text="Object Bounding Box", icon="GHOST_ENABLED") | |
col.operator("set.wireframe", text="Object Wireframe", icon="GHOST_ENABLED") | |
col.separator() | |
col.prop(view, "use_matcap") | |
col.template_icon_view(view, "matcap_icon") | |
group.separator() | |
box = group.box() | |
col = box.column() | |
col.operator("set.only_render", icon="SCENE") | |
col.operator("set.world_background", icon="WORLD") | |
#8 - TOP | |
f = pie.operator("wm.context_set_enum", icon='SMOOTH', text='Rendered') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'RENDERED' | |
#7 - TOP - LEFT | |
f = pie.operator("wm.context_set_enum", icon='SOLID', text='Solid') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'SOLID' | |
#9 - TOP - RIGHT | |
f = pie.operator("wm.context_set_enum", icon='MATERIAL', text='Material') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'MATERIAL' | |
#1 - BOTTOM - LEFT | |
pie.operator("object.hide_view_set", text="Hide Object Unselected", icon="RESTRICT_VIEW_ON").unselected=True | |
#3 - BOTTOM - RIGHT | |
pie.operator("object.hide_view_set", text="Hide Object Selected", icon="RESTRICT_VIEW_ON") | |
class PieShadingEdit(Menu): | |
bl_idname = "pie.shadingedit" | |
bl_label = "Shading " | |
def draw(self, context): | |
layout = self.layout | |
mesh = context.active_object.data | |
scene = context.scene | |
view = context.space_data | |
pie = layout.menu_pie() | |
#4 - LEFT | |
f = pie.operator("wm.context_set_enum", icon='WIRE', text='Wires') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'WIREFRAME' | |
#6 - RIGHT | |
pie.operator("object.hide_view_clear", text="Show Object", icon="RESTRICT_VIEW_OFF") | |
#2 - BOTTOM | |
group = pie.column() | |
box = group.box() | |
col = box.column() | |
col.prop(mesh, "use_auto_smooth", text="Angle") | |
col.prop(mesh, "auto_smooth_angle", text="Angle") | |
col.operator("mesh.faces_shade_smooth", text="Mesh Smooth", icon="MESH_UVSPHERE") | |
col.operator("mesh.faces_shade_flat", text="Mesh Flat", icon="MESH_ICOSPHERE") | |
col.separator() | |
col.operator("mesh.normals_make_consistent", text="Normals Outside").inside=False | |
col.operator("mesh.flip_normals", text="Flip Normals") | |
col.prop(mesh, "show_normal_face", text="Show Face Normal") | |
col.prop(scene.tool_settings, "normal_size", text="Size") | |
col.prop(view, "use_occlude_geometry", text="Hide Back Geometry") | |
col.separator() | |
col.prop(view, "use_matcap") | |
col.template_icon_view(view, "matcap_icon") | |
group.separator() | |
box = group.box() | |
col = box.column() | |
col.operator("set.only_render", icon="SCENE") | |
col.operator("set.world_background", icon="WORLD") | |
f = pie.operator("wm.context_set_enum", icon='SMOOTH', text='Rendered') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'RENDERED' | |
#7 - TOP - LEFT | |
f = pie.operator("wm.context_set_enum", icon='SOLID', text='Solid') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'SOLID' | |
#9 - TOP - RIGHT | |
f = pie.operator("wm.context_set_enum", icon='MATERIAL', text='Material') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'MATERIAL' | |
#1 - BOTTOM - LEFT | |
pie.operator("object.hide_view_set", text="Hide Object Selected", icon="RESTRICT_VIEW_ON") | |
#3 - BOTTOM - RIGHT | |
pie.operator("object.hide_view_set", text="Hide Object Unselected", icon="RESTRICT_VIEW_ON").unselected=True | |
# PIE VIEW -------------------------------------------------------------------------------------- | |
class View(Menu): | |
bl_idname = "pie.view" | |
bl_label = "View" | |
def draw(self, context): | |
layout = self.layout | |
mesh = context.active_object.data | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("view3d.view_all", text="View All", icon="VIEWZOOM") | |
#6 - RIGHT | |
pie.operator("view3d.view_selected", text="View Selected", icon="BORDERMOVE") | |
#2 - BOTTOM | |
pie.operator("screen.screen_full_area", text="Full Screen",icon='FULLSCREEN_ENTER') | |
#8 - TOP | |
pie.operator("view3d.viewnumpad", text="View Top", icon="TRIA_UP").type='TOP' | |
#7 - TOP - LEFT | |
pie.operator("view3D.object_as_camera", text="Set As Active Camera", icon="OUTLINER_DATA_CAMERA") | |
#9 - TOP - RIGHT | |
pie.operator("view3d.viewnumpad", text="View Camera", icon="OUTLINER_DATA_CAMERA").type='CAMERA' | |
#1 - BOTTOM - LEFT | |
pie.operator("view3d.viewnumpad", text="View Front", icon="TRIA_LEFT").type='LEFT' | |
#3 - BOTTOM - RIGHT | |
pie.operator("view3d.viewnumpad", text="View Right", icon="TRIA_RIGHT").type='RIGHT' | |
# PIE Modes -------------------------------------------------------------------------------------- | |
class PieModes(Menu): | |
bl_idname = "pie.modes" | |
bl_label = "Modes" | |
def draw(self, context): | |
layout = self.layout | |
#space_data = area.spaces.active | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("modes.type", text="UV Image", icon='IMAGE_COL').variable = "IMAGE_EDITOR" | |
pie.operator("modes.type", text="Nodes", icon='NODETREE').variable = "NODE_EDITOR" | |
pie.operator("screen.header_flip", text="Flip Menu Position", icon="FILE_REFRESH") | |
pie.operator("modes.type", text="3D View", icon='VIEW3D').variable = "VIEW_3D" | |
# PIE ORIGIN_TRANSFORM ORIENTATION -------------------------------------------------------------------------------------- | |
class Origin_Trans_Orientation(Menu): | |
bl_idname = "pie.origin_trans_orientation" | |
bl_label = "Origin Transform Orientation" | |
def draw(self, context): | |
layout = self.layout | |
mesh = context.active_object.data | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("pivotpoint.type", text="Pivot Bounding Box", icon="ROTATE").variable = 'BOUNDING_BOX_CENTER' | |
#6 - RIGHT | |
pie.operator("transform.create_orientation", text="Custom Orientation", icon="MANIPUL").use=True | |
#2 - BOTTOM | |
pie.operator("pivotpoint.type", text="Individual Origin", icon='ROTATECOLLECTION').variable ='INDIVIDUAL_ORIGINS' | |
#8 - TOP | |
pie.operator("orientation.type", text="Local", icon="MANIPUL").variable = 'LOCAL' | |
#7 - TOP - LEFT | |
pie.operator("orientation.type", text="Global", icon="MANIPUL").variable = 'GLOBAL' | |
#9 - TOP - RIGHT | |
pie.operator("orientation.type", text="Normal", icon="MANIPUL").variable = 'NORMAL' | |
#1 - BOTTOM - LEFT | |
pie.operator("pivotpoint.type", text="3D Cursor", icon='CURSOR').variable ='CURSOR' | |
#3 - BOTTOM - RIGHT | |
pie.operator("pivotpoint.type", text="Active Element", icon='ROTACTIVE').variable ='ACTIVE_ELEMENT' | |
# PIE UNDO REDO -------------------------------------------------------------------------------------- | |
class Undo_Redo(Menu): | |
bl_idname = "pie.undo_redo" | |
bl_label = "Undo Redo" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("ed.undo", text="Undo", icon="LOOP_BACK") | |
#6 - RIGHT | |
pie.operator("ed.redo", text="Redo", icon="LOOP_FORWARDS") | |
#2 - BOTTOM | |
pie.operator("ed.undo_history", text="History", icon="COLLAPSEMENU") | |
#8 - TOP | |
pie.operator("screen.redo_last", text="Redo Last", icon='FILE_PARENT') | |
#7 | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
#9 - TOP - LEFT | |
pie.operator("screen.repeat_last", text="Repeat", icon="LOOP_FORWARDS") | |
#1 | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
#3 | |
pie.operator("screen.repeat_history", text="Repeat History", icon="LOOP_FORWARDS") | |
# PIE SNAP TYPES -------------------------------------------------------------------------------------- | |
class Snap_Types(Menu): | |
bl_idname = "pie.snap_types" | |
bl_label = "Snap Types" | |
def draw(self, context): | |
layout = self.layout | |
mesh = context.active_object.data | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("snap.type", text="Vertex", icon="SNAP_VERTEX").variable = 'VERTEX' | |
#6 - RIGHT | |
pie.menu("snap.targets", text="Snap Targets", icon='FORWARD') | |
#2 - BOTTOM | |
pie.operator("snap.rotate", text="Snap Rotate", icon='SNAP_NORMAL') | |
#8 - TOP | |
pie.operator("snap.type", text="Face", icon="SNAP_FACE").variable = 'FACE' | |
#7 - TOP - LEFT | |
pie.operator("snap.type", text="Edge", icon="SNAP_EDGE").variable = 'EDGE' | |
#9 - TOP - RIGHT | |
pie.operator("snap.type", text="Increment", icon="SNAP_INCREMENT").variable = 'INCREMENT' | |
#1 - BOTTOM - LEFT | |
pie.operator("snap.project", text="Snap Project", icon='RETOPO') | |
#3 - BOTTOM - RIGHT | |
pie.operator("snap.grid", text="Use Grid", icon="SNAP_GRID") | |
# Snap Target Menu | |
class SnapTargets(bpy.types.Menu): | |
bl_idname = "snap.targets" | |
bl_label = "Snap Targets" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator("snap.target_type", text="Closest").variable = 'CLOSEST' | |
layout.operator("snap.target_type", text="Center").variable = 'CENTER' | |
layout.operator("snap.target_type", text="Median").variable = 'MEDIAN' | |
layout.operator("snap.target_type", text="Active").variable = 'ACTIVE' | |
# PIE Sculpt -------------------------------------------------------------------------------------- | |
class Sculpt(Menu): | |
bl_idname = "pie.sculpt" | |
bl_label = "Sculpt" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("paint.brush_select", text="Clay", icon='BRUSH_CLAY').sculpt_tool='CLAY' | |
#6 - RIGHT | |
pie.operator("paint.brush_select", text='Brush', icon='BRUSH_SCULPT_DRAW').sculpt_tool='DRAW' | |
#2 - BOTTOM | |
pie.operator("paint.brush_select", text='Flatten', icon='BRUSH_FLATTEN').sculpt_tool='FLATTEN' | |
#8 - TOP | |
pie.operator("paint.brush_select", text='Smooth', icon='BRUSH_SMOOTH').sculpt_tool= 'SMOOTH' | |
#7 - TOP - LEFT | |
pie.operator("paint.brush_select", text="Crease", icon='BRUSH_CREASE').sculpt_tool='CREASE' | |
#9 - TOP - RIGHT | |
pie.operator("paint.brush_select", text='Pinch/Magnify', icon='BRUSH_PINCH').sculpt_tool= 'PINCH' | |
#1 - BOTTOM - LEFT | |
pie.operator("paint.brush_select", text='Inflate/Deflate', icon='BRUSH_INFLATE').sculpt_tool='INFLATE' | |
#3 - BOTTOM - RIGHT | |
pie.operator("paint.brush_select", text='Mask', icon='BRUSH_MASK').sculpt_tool='MASK' | |
#Pie Sculp Ext | |
class Sculpt_Ext(Menu): | |
bl_idname = "pie.sculpt_ext" | |
bl_label = "Pie Sculpt Ext" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("paint.brush_select", text='Claystrips', icon='BRUSH_CLAY_STRIPS').sculpt_tool= 'CLAY_STRIPS' | |
#6 - RIGHT | |
pie.operator("paint.brush_select", text='Layer', icon='BRUSH_LAYER').sculpt_tool= 'LAYER' | |
#2 - BOTTOM | |
pie.operator("paint.brush_select", text='Twist', icon='BRUSH_ROTATE').sculpt_tool= 'ROTATE' | |
#8 - TOP | |
pie.operator("paint.brush_select", text='Scrape/Peaks', icon='BRUSH_SCRAPE').sculpt_tool= 'SCRAPE' | |
#7 - TOP - LEFT | |
pie.operator("paint.brush_select", text='Fill/Deepen', icon='BRUSH_FILL').sculpt_tool='FILL' | |
#9 - TOP - RIGHT | |
pie.operator("paint.brush_select", text='Nudge', icon='BRUSH_NUDGE').sculpt_tool= 'NUDGE' | |
#1 - BOTTOM - LEFT | |
pie.operator("paint.brush_select", text='Twist', icon='BRUSH_ROTATE').sculpt_tool= 'ROTATE' | |
#3 - BOTTOM - RIGHT | |
pie.operator("paint.brush_select", text='Thumb', icon='BRUSH_THUMB').sculpt_tool= 'THUMB' | |
# PIE UV Image -------------------------------------------------------------------------------------- | |
class Pie_UV_Image(Menu): | |
bl_idname = "pie.uv_image" | |
bl_label = "UV" | |
def draw(self, context): | |
layout = self.layout | |
#space_data = area.spaces.active | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("uv.scale_x", text="Align X", icon="MAN_SCALE") | |
#6 - RIGHT | |
pie.operator("uv.scale_y", text="Align Y", icon="MAN_SCALE") | |
#2 - BOTTOM | |
box = pie.box() | |
col = box.column() | |
col.operator("uv.snap_cursor", text="Cursor to Selected", icon="EMPTY_DATA").target='SELECTED' | |
col.operator("uv.snap_cursor", text="Cursor to Pixel", icon="EMPTY_DATA").target='PIXELS' | |
col.separator() | |
col.operator("uv.snap_selected", text="Selected to Cursor", icon="UV_VERTEXSEL").target='CURSOR' | |
col.operator("uv.snap_selected", text="Selected to Pixel", icon="UV_VERTEXSEL").target='PIXELS' | |
col.separator() | |
col.operator("wm.context_toggle", text="Snap Pixel On/Off", icon="SNAP_OFF").data_path = ("space_data.uv_editor.use_snap_to_pixels") | |
#8 - TOP | |
pie.operator("uv.export_layout", text="Export UV Iamge", icon="FILE_IMAGE") | |
#7 - TOP - LEFT | |
pie.operator("uv.mirror_x", text="Mirror X", icon="UV_ISLANDSEL") | |
#9 - TOP - RIGHT | |
pie.operator("uv.mirror_y", text="Mirror Y", icon="UV_ISLANDSEL") | |
#1 - BOTTOM - LEFT | |
pie.operator("pivotpoint.type", text="Pivot 2D Cursor", icon="CURSOR").variable = 'CURSOR' | |
#3 - BOTTOM - RIGHT | |
#pie.menu("uv.pivot_types") | |
pie.operator("pivotpoint.type", text="Pivot Bounding Box", icon="ROTATE").variable = 'CENTER' | |
# PIE UV SELECT | |
class Pie_UV_Select(Menu): | |
bl_idname = "pie.uv_select" | |
bl_label = "UV Select" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
mesh = context.active_object.data | |
scene = context.scene | |
#4 - LEFT | |
pie.operator("uv.select_border", text="Border Select", icon="BORDER_RECT") | |
#6 - RIGHT | |
pie.operator("uv.select_all", text="De/Select All", icon="BORDER_RECT").action='TOGGLE' | |
#2 - BOTTOM | |
pie.operator("uv.select_all", text="Invert Select", icon="BORDER_RECT").action='INVERT' | |
#8 - TOP | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
#7 - TOP - LEFT | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
#9 - TOP - RIGHT | |
pie = pie.row() | |
pie.label('') | |
pie = layout.menu_pie() | |
#1 - BOTTOM - LEFT | |
pie.operator("uv.circle_select", text="Brush Select", icon="BORDER_RECT") | |
#3 - BOTTOM - RIGHT | |
pie.operator("uv.select_linked", text="Linked UV", icon="UV_VERTEXSEL") | |
# PIE Snap Menu -------------------------------------------------------------------------------------- | |
class Pie_Snap_Menu(Menu): | |
bl_idname = "pie.snap_menu" | |
bl_label = "Snap Menu" | |
def draw(self, context): | |
layout = self.layout | |
#space_data = area.spaces.active | |
pie = layout.menu_pie() | |
#4 - LEFT | |
pie.operator("view3d.snap_selected_to_cursor", text="Selected to Cursor", icon="CURSOR") | |
#6 - RIGHT | |
pie.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected", icon="EDITMODE_HLT") | |
#2 - BOTTOM | |
pie.operator("view3d.snap_cursor_to_center", text="Cursor to Center", icon="MANIPUL") | |
#8 - TOP | |
pie.operator("view3d.snap_selected_to_grid", text="Selected to Grid", icon="SNAP_GRID") | |
#7 - TOP - LEFT | |
pie.operator("view3d.snap_selected_to_cursor", text="Selected to Cursor Offset", icon="CURSOR").use_offset=True | |
#9 - TOP - RIGHT | |
pie.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid", icon="SNAP_GRID") | |
#1 - BOTTOM - LEFT | |
pie.operator("object.location_clear", text="Selection to Center", icon="MANIPUL") | |
#3 - BOTTOM - RIGHT | |
pie.operator("view3d.snap_cursor_to_active", text="Cursor to Active", icon="OBJECT_DATA") | |
addon_keymaps = [] | |
def register(): | |
bpy.utils.register_module(__name__) | |
###################### | |
# Config # | |
###################### | |
# Keympa Config | |
wm = bpy.context.window_manager | |
if wm.keyconfigs.addon: | |
#Pie Transform | |
km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'Q', 'PRESS') | |
kmi.properties.name = "pie.transform" | |
#Pie Select Object | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Object Mode') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'A', 'PRESS') | |
kmi.properties.name = "pie.selectobject" | |
#Pie Select Edit | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Mesh') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'A', 'PRESS') | |
kmi.properties.name = "pie.selectedit" | |
#Pie 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" | |
#Pie Manipulate Edit | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Mesh') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'W', 'PRESS') | |
kmi.properties.name = "pie.manipulateedit" | |
#Pie Manipulate Edit Ext | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Mesh') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'W', 'PRESS', alt=True) | |
kmi.properties.name = "pie.manipulateedit_ext" | |
#Pie Manipulate Object | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Object Mode') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'W', 'PRESS') | |
kmi.properties.name = "pie.manipulateobject" | |
#Pie Manipulate Object Ext | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Object Mode') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'W', 'PRESS', alt=True) | |
kmi.properties.name = "pie.manipulateobject_ext" | |
#Pie Shading Object | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Object Mode') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'Z', 'PRESS') | |
kmi.properties.name = "pie.shadingobject" | |
#SPie hading Object | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Mesh') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'Z', 'PRESS') | |
kmi.properties.name = "pie.shadingedit" | |
#Pie View | |
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', shift=True) | |
kmi.properties.name = "pie.view" | |
#Pie Modes | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Screen') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', shift=True, ctrl=True) | |
kmi.properties.name = "pie.modes" | |
#Pie Origin Transfrom Orientation | |
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.origin_trans_orientation" | |
#SPie nap Menu | |
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 = "pie.snap_menu" | |
#Pie Snap Types | |
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.snap_types" | |
#UPie ndo Redo | |
km = wm.keyconfigs.addon.keymaps.new(name = 'Screen') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'Z', 'PRESS', ctrl=True) | |
kmi.properties.name = "pie.undo_redo" | |
#Pie Sculpt | |
km = wm.keyconfigs.addon.keymaps.new(name='Sculpt') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'W', 'PRESS') | |
kmi.properties.name = "pie.sculpt" | |
#Pie Sculpt Ext | |
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.sculpt_ext" | |
#Pie UV Manipulate | |
km = wm.keyconfigs.addon.keymaps.new(name='UV Editor') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'Q', 'PRESS') | |
kmi.properties.name = "pie.uv_image" | |
#Pie UV Select | |
km = wm.keyconfigs.addon.keymaps.new(name='UV Editor') | |
kmi = km.keymap_items.new('wm.call_menu_pie', 'A', 'PRESS') | |
kmi.properties.name = "pie.uv_select" | |
addon_keymaps.append(km) | |
# Register / Unregister Classes | |
def unregister(): | |
bpy.utils.unregister_module(__name__) | |
wm = bpy.context.window_manager | |
if wm.keyconfigs.addon: | |
for km in addon_keymaps: | |
for kmi in km.keymap_items: | |
km.keymap_items.remove(kmi) | |
wm.keyconfigs.addon.keymaps.remove(km) | |
# clear the list | |
del addon_keymaps[:] | |
if __name__ == "__main__": | |
register() | |
# pie = pie.row() | |
# pie.label('') | |
# pie = layout.menu_pie() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment