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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormeta-androcto <meta.androcto1@gmail.com>2016-09-12 16:04:35 +0300
committermeta-androcto <meta.androcto1@gmail.com>2016-09-12 16:04:35 +0300
commitfaf22cf36f3ff8ddf7d7efdb62eb2cc4c7dbfe3c (patch)
tree61c37807e571c1ca216c5d59108a589ddeda2efe /space_view3d_pie_menus
parent88359b9a4d20a89b486a58e1d37c3177331015e1 (diff)
pie menus addon revert last commit
Diffstat (limited to 'space_view3d_pie_menus')
-rw-r--r--space_view3d_pie_menus/pie_modes_menu.py177
1 files changed, 45 insertions, 132 deletions
diff --git a/space_view3d_pie_menus/pie_modes_menu.py b/space_view3d_pie_menus/pie_modes_menu.py
index ea4f0f61..69506b76 100644
--- a/space_view3d_pie_menus/pie_modes_menu.py
+++ b/space_view3d_pie_menus/pie_modes_menu.py
@@ -21,45 +21,49 @@
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",
+ # "version": (0, 1, 0),
"blender": (2, 77, 0),
"location": "3D View",
"warning": "",
"wiki_url": "",
"category": "Mode Switch Pie"
-}
+ }
import bpy
from bpy.types import (
- Menu,
- Operator
-)
+ Menu,
+ Operator,
+ )
+
+# Define Class Object Mode
class ClassObject(Operator):
- """Object Mode"""
bl_idname = "class.object"
bl_label = "Class Object"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Edit/Object Mode Switch"
def execute(self, context):
+
if context.object.mode == "OBJECT":
bpy.ops.object.mode_set(mode="EDIT")
else:
bpy.ops.object.mode_set(mode="OBJECT")
return {'FINISHED'}
+# Define Class Vertex
+
class ClassVertex(Operator):
- """Vertex"""
bl_idname = "class.vertex"
bl_label = "Class Vertex"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Vert Select"
def execute(self, context):
+
if context.object.mode != "EDIT":
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
@@ -67,15 +71,17 @@ class ClassVertex(Operator):
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
return {'FINISHED'}
+# Define Class Edge
+
class ClassEdge(Operator):
- """Edge"""
bl_idname = "class.edge"
bl_label = "Class Edge"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Edge Select"
def execute(self, context):
+
if context.object.mode != "EDIT":
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
@@ -83,31 +89,34 @@ class ClassEdge(Operator):
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
return {'FINISHED'}
+# Define Class Face
+
class ClassFace(Operator):
- """Face"""
bl_idname = "class.face"
bl_label = "Class Face"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Face Select"
def execute(self, context):
+
if context.object.mode != "EDIT":
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
if bpy.ops.mesh.select_mode != "VERT, EDGE":
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
return {'FINISHED'}
+# Define Class Texture Paint
class ClassTexturePaint(Operator):
- """Texture Paint"""
bl_idname = "class.pietexturepaint"
bl_label = "Class Texture Paint"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Texture Paint"
def execute(self, context):
+
if context.object.mode == "EDIT":
bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.paint.texture_paint_toggle()
@@ -115,15 +124,17 @@ class ClassTexturePaint(Operator):
bpy.ops.paint.texture_paint_toggle()
return {'FINISHED'}
+# Define Class Weight Paint
+
class ClassWeightPaint(Operator):
- """Weight Paint"""
bl_idname = "class.pieweightpaint"
bl_label = "Class Weight Paint"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Weight Paint"
def execute(self, context):
+
if context.object.mode == "EDIT":
bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.paint.weight_paint_toggle()
@@ -131,15 +142,17 @@ class ClassWeightPaint(Operator):
bpy.ops.paint.weight_paint_toggle()
return {'FINISHED'}
+# Define Class Vertex Paint
+
class ClassVertexPaint(Operator):
- """Vertex Paint"""
bl_idname = "class.pievertexpaint"
bl_label = "Class Vertex Paint"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Vertex Paint"
def execute(self, context):
+
if context.object.mode == "EDIT":
bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.paint.vertex_paint_toggle()
@@ -147,38 +160,25 @@ class ClassVertexPaint(Operator):
bpy.ops.paint.vertex_paint_toggle()
return {'FINISHED'}
+# Define Class Particle Edit
+
class ClassParticleEdit(Operator):
- """Particle Edit"""
bl_idname = "class.pieparticleedit"
bl_label = "Class Particle Edit"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Particle Edit (must have active particle system)"
def execute(self, context):
+
if context.object.mode == "EDIT":
bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.particle.particle_edit_toggle()
else:
bpy.ops.particle.particle_edit_toggle()
- return {'FINISHED'}
-
-class ClassStrokeEdit(Operator):
- bl_idname = "class.piestrokeedit"
- bl_label = "Class Stroke Edit"
- bl_options = {'REGISTER', 'UNDO'}
- bl_description = "Stroke Edit"
-
- def execute(self, context):
- if context.object.mode == "EDIT":
- bpy.ops.object.mode_set(mode='OBJECT')
- bpy.ops.gpencil.editmode_toggle()
- else:
- bpy.ops.gpencil.editmode_toggle()
return {'FINISHED'}
-
# Components Selection Mode
@@ -241,9 +241,10 @@ class VertsEdgesFaces(Operator):
context.tool_settings.mesh_select_mode = (True, True, True)
return {'FINISHED'}
+# Pie Edit/Object Others modes - Tab
+
class PieObjectEditotherModes(Menu):
- """Edit/Object Others modes"""
bl_idname = "menu.objecteditmodeothermodes"
bl_label = "Edit Selection Modes"
@@ -261,10 +262,10 @@ class PieObjectEditotherModes(Menu):
box.operator("verts.edgesfaces", text="Vertex/Edges/Faces", icon='OBJECT_DATAMODE')
box.operator("wm.context_toggle", text="Limit to Visible",
icon="ORTHO").data_path = "space_data.use_occlude_geometry"
+# Pie Modes Switch- Tab key
class PieObjectEditMode(Menu):
- """Modes Switch"""
bl_idname = "pie.objecteditmode"
bl_label = "Modes Menu (Tab)"
@@ -272,7 +273,7 @@ class PieObjectEditMode(Menu):
layout = self.layout
ob = context.object
- if ob and ob.type == 'MESH' and ob.mode in {'OBJECT', 'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', 'PARTICLE_EDIT'}:
+ if ob and ob.type == 'MESH' and ob.mode in {'OBJECT', 'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT', 'PARTICLE'}:
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("class.pievertexpaint", text="Vertex Paint", icon='VPAINT_HLT')
@@ -289,15 +290,9 @@ class PieObjectEditMode(Menu):
# 1 - BOTTOM - LEFT
if context.object.particle_systems:
pie.operator("class.pieparticleedit", text="Particle Edit", icon='PARTICLEMODE')
- else:
- pie.separator()
# 3 - BOTTOM - RIGHT
- if context.gpencil_data:
- pie.operator("class.piestrokeedit", text="Stroke Edit", icon='GREASEPENCIL')
- else:
- pie.separator()
- elif ob and ob.type == 'MESH' and ob.mode in {'EDIT'}:
+ if ob and ob.type == 'MESH' and ob.mode in {'EDIT'}:
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("class.pievertexpaint", text="Vertex Paint", icon='VPAINT_HLT')
@@ -311,107 +306,37 @@ class PieObjectEditMode(Menu):
pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT')
# 9 - TOP - RIGHT
pie.operator("class.pieweightpaint", text="Weight Paint", icon='WPAINT_HLT')
-
+
# 1 - BOTTOM - LEFT
if context.object.particle_systems:
pie.operator("class.pieparticleedit", text="Particle Edit", icon='PARTICLEMODE')
- else:
- pie.separator()
# 3 - BOTTOM - RIGHT
- if context.gpencil_data:
- pie.operator("class.piestrokeedit", text="Stroke Edit", icon='GREASEPENCIL')
- else:
- pie.separator()
- elif ob and ob.type == 'CURVE':
+ if ob and ob.type == 'CURVE':
pie = layout.menu_pie()
- pie.separator()
- pie.separator()
- pie.separator()
pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')
- pie.separator()
- pie.separator()
- pie.separator()
- # 3 - BOTTOM - RIGHT
- if context.gpencil_data:
- pie.operator("class.piestrokeedit", text="Stroke Edit", icon='GREASEPENCIL')
- else:
- pie.separator()
- elif ob and ob.type == 'ARMATURE':
+ if ob and ob.type == 'ARMATURE':
pie = layout.menu_pie()
- pie.separator()
- pie.operator("object.posemode_toggle", text="Pose", icon='POSE_HLT')
- pie.separator()
pie.operator("object.editmode_toggle", text="Edit Mode", icon='OBJECT_DATAMODE')
- pie.separator()
- pie.separator()
- pie.separator()
- # 3 - BOTTOM - RIGHT
- if context.gpencil_data:
- pie.operator("class.piestrokeedit", text="Stroke Edit", icon='GREASEPENCIL')
- else:
- pie.separator()
+ pie.operator("object.posemode_toggle", text="Pose", icon='POSE_HLT')
+ pie.operator("class.object", text="Object Mode", icon='OBJECT_DATAMODE')
- elif ob and ob.type == 'FONT':
+ if ob and ob.type == 'FONT':
pie = layout.menu_pie()
- pie.separator()
- pie.separator()
- pie.separator()
pie.operator("object.editmode_toggle", text="Edit/Object Toggle", icon='OBJECT_DATAMODE')
- pie.separator()
- pie.separator()
- pie.separator()
- # 3 - BOTTOM - RIGHT
- if context.gpencil_data:
- pie.operator("class.piestrokeedit", text="Stroke Edit", icon='GREASEPENCIL')
- else:
- pie.separator()
- elif ob and ob.type == 'SURFACE':
+ if ob and ob.type == 'SURFACE':
pie = layout.menu_pie()
- pie.separator()
- pie.separator()
- pie.separator()
pie.operator("object.editmode_toggle", text="Edit/Object Toggle", icon='OBJECT_DATAMODE')
- pie.separator()
- pie.separator()
- pie.separator()
- # 3 - BOTTOM - RIGHT
- if context.gpencil_data:
- pie.operator("class.piestrokeedit", text="Stroke Edit", icon='GREASEPENCIL')
- else:
- pie.separator()
- elif ob and ob.type == 'META':
+ if ob and ob.type == 'META':
pie = layout.menu_pie()
- pie.separator()
- pie.separator()
- pie.separator()
pie.operator("object.editmode_toggle", text="Edit/Object Toggle", icon='OBJECT_DATAMODE')
- pie.separator()
- pie.separator()
- pie.separator()
- # 3 - BOTTOM - RIGHT
- if context.gpencil_data:
- pie.operator("class.piestrokeedit", text="Stroke Edit", icon='GREASEPENCIL')
- else:
- pie.separator()
- elif ob and ob.type == 'LATTICE':
+ if ob and ob.type == 'LATTICE':
pie = layout.menu_pie()
- pie.separator()
- pie.separator()
- pie.separator()
pie.operator("object.editmode_toggle", text="Edit/Object Toggle", icon='OBJECT_DATAMODE')
- pie.separator()
- pie.separator()
- pie.separator()
- # 3 - BOTTOM - RIGHT
- if context.gpencil_data:
- pie.operator("class.piestrokeedit", text="Stroke Edit", icon='GREASEPENCIL')
- else:
- pie.separator()
classes = (
PieObjectEditMode,
@@ -424,12 +349,11 @@ classes = (
ClassWeightPaint,
ClassVertexPaint,
ClassParticleEdit,
- ClassStrokeEdit,
VertsEdges,
EdgesFaces,
VertsFaces,
VertsEdgesFaces
-)
+ )
addon_keymaps = []
@@ -444,12 +368,7 @@ def register():
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')
- kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
- kmi.properties.name = "pie.objecteditmode"
+# kmi.active = True
addon_keymaps.append((km, kmi))
@@ -466,11 +385,5 @@ def unregister():
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)
-
if __name__ == "__main__":
register()