[Bf-extensions-cvs] [4aa3f51b] master: space_view3d_pie_menus: fix edit selection modes

meta-androcto noreply at git.blender.org
Sat Jun 1 05:42:46 CEST 2019


Commit: 4aa3f51bbae93a7a2c410730401e0764ba9dba88
Author: meta-androcto
Date:   Sat Jun 1 13:42:17 2019 +1000
Branches: master
https://developer.blender.org/rBA4aa3f51bbae93a7a2c410730401e0764ba9dba88

space_view3d_pie_menus: fix edit selection modes

===================================================================

M	space_view3d_pie_menus/pie_modes_menu.py
M	space_view3d_pie_menus/pie_select_menu.py

===================================================================

diff --git a/space_view3d_pie_menus/pie_modes_menu.py b/space_view3d_pie_menus/pie_modes_menu.py
index 566c3cc3..e32a160a 100644
--- a/space_view3d_pie_menus/pie_modes_menu.py
+++ b/space_view3d_pie_menus/pie_modes_menu.py
@@ -51,51 +51,6 @@ class PIE_OT_ClassObject(Operator):
         return {'FINISHED'}
 
 
-class PIE_OT_ClassVertex(Operator):
-    bl_idname = "class.vertex"
-    bl_label = "Class Vertex"
-    bl_description = "Vert Select"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    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')
-        if bpy.ops.mesh.select_mode != "EDGE, FACE":
-            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
-            return {'FINISHED'}
-
-
-class PIE_OT_ClassEdge(Operator):
-    bl_idname = "class.edge"
-    bl_label = "Class Edge"
-    bl_description = "Edge Select"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    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')
-        if bpy.ops.mesh.select_mode != "VERT, FACE":
-            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
-            return {'FINISHED'}
-
-
-class PIE_OT_ClassFace(Operator):
-    bl_idname = "class.face"
-    bl_label = "Class Face"
-    bl_description = "Face Select"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    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'}
-
-
 class PIE_OT_ClassTexturePaint(Operator):
     bl_idname = "class.pietexturepaint"
     bl_label = "Class Texture Paint"
@@ -177,64 +132,118 @@ class PIE_OT_SetObjectModePie(Operator):
         return {'FINISHED'}
 
 
-# Components Selection Mode
+# Edit Selection Modes 
+class PIE_OT_ClassVertex(Operator):
+    bl_idname = "class.vertex"
+    bl_label = "Class Vertex"
+    bl_description = "Vert Select Mode"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    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')
+        if bpy.ops.mesh.select_mode != "EDGE, FACE":
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
+            return {'FINISHED'}
+
+
+class PIE_OT_ClassEdge(Operator):
+    bl_idname = "class.edge"
+    bl_label = "Class Edge"
+    bl_description = "Edge Select Mode"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    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')
+        if bpy.ops.mesh.select_mode != "VERT, FACE":
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
+            return {'FINISHED'}
+
+
+class PIE_OT_ClassFace(Operator):
+    bl_idname = "class.face"
+    bl_label = "Class Face"
+    bl_description = "Face Select Mode"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    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'}
+
+
 class PIE_OT_VertsEdges(Operator):
     bl_idname = "verts.edges"
     bl_label = "Verts Edges"
-    bl_description = "Vert/Edge Select"
+    bl_description = "Vert/Edge Select Mode"
     bl_options = {'REGISTER', 'UNDO'}
 
     def execute(self, context):
         if context.object.mode != "EDIT":
             bpy.ops.object.mode_set(mode="EDIT")
-            context.tool_settings.mesh_select_mode = (True, True, False)
-        if context.object.mode == "EDIT":
-            context.tool_settings.mesh_select_mode = (True, True, False)
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
+        if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE":
+            bpy.ops.object.mode_set(mode="EDIT")
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
+            bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='EDGE')
             return {'FINISHED'}
 
 
 class PIE_OT_EdgesFaces(Operator):
     bl_idname = "edges.faces"
     bl_label = "EdgesFaces"
-    bl_description = "Edge/Face Select"
+    bl_description = "Edge/Face Select Mode"
     bl_options = {'REGISTER', 'UNDO'}
 
     def execute(self, context):
         if context.object.mode != "EDIT":
             bpy.ops.object.mode_set(mode="EDIT")
-            context.tool_settings.mesh_select_mode = (False, True, True)
-        if context.object.mode == "EDIT":
-            context.tool_settings.mesh_select_mode = (False, True, True)
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
+        if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE":
+            bpy.ops.object.mode_set(mode="EDIT")
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
+            bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE')
             return {'FINISHED'}
 
 
 class PIE_OT_VertsFaces(Operator):
     bl_idname = "verts.faces"
     bl_label = "Verts Faces"
-    bl_description = "Vert/Face Select"
+    bl_description = "Vert/Face Select Mode"
     bl_options = {'REGISTER', 'UNDO'}
 
     def execute(self, context):
         if context.object.mode != "EDIT":
             bpy.ops.object.mode_set(mode="EDIT")
-            context.tool_settings.mesh_select_mode = (True, False, True)
-        if context.object.mode == "EDIT":
-            context.tool_settings.mesh_select_mode = (True, False, True)
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
+        if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE":
+            bpy.ops.object.mode_set(mode="EDIT")
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
+            bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE')
             return {'FINISHED'}
 
 
 class PIE_OT_VertsEdgesFaces(Operator):
     bl_idname = "verts.edgesfaces"
     bl_label = "Verts Edges Faces"
-    bl_description = "Vert/Edge/Face Select"
+    bl_description = "Vert/Edge/Face Select Mode"
     bl_options = {'REGISTER', 'UNDO'}
 
     def execute(self, context):
         if context.object.mode != "EDIT":
             bpy.ops.object.mode_set(mode="EDIT")
-            context.tool_settings.mesh_select_mode = (True, True, True)
-        if context.object.mode == "EDIT":
-            context.tool_settings.mesh_select_mode = (True, True, True)
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
+        if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE":
+            bpy.ops.object.mode_set(mode="EDIT")
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
+            bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='EDGE')
+            bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE')
             return {'FINISHED'}
 
 
diff --git a/space_view3d_pie_menus/pie_select_menu.py b/space_view3d_pie_menus/pie_select_menu.py
index 4f5f8c0b..48819c13 100644
--- a/space_view3d_pie_menus/pie_select_menu.py
+++ b/space_view3d_pie_menus/pie_select_menu.py
@@ -31,7 +31,11 @@ bl_info = {
     }
 
 import bpy
-from bpy.types import Menu
+from bpy.types import (
+    Menu,
+    Operator
+)
+
 
 
 # Pie Selection Object Mode - A
@@ -106,7 +110,7 @@ class PIE_MT_SelectionsEM(Menu):
         pie.operator("view3d.select_circle", text="Circle Select",
                     icon='NONE')
         # 3 - BOTTOM - RIGHT
-        pie.menu("PIE_MT_selectallbyselection", text="Multi Select Menu", icon='SNAP_EDGE')
+        pie.menu("PIE_MT_selectallbyselection", text="Edit Modes", icon='VERTEXSEL')
 
 
 # Select All By Selection
@@ -117,28 +121,78 @@ class PIE_MT_SelectAllBySelection(Menu):
 
     def draw(self, context):
         layout = self.layout
-        layout.operator_context = 'INVOKE_REGION_WIN'
+        pie = layout.menu_pie()
+        box = pie.split().column()
+
+        box.operator("class.vertexop", text="Vertex", icon='VERTEXSEL')
+        box.operator("class.edgeop", text="Edge", icon='EDGESEL')
+        box.operator("class.faceop", text="Face", icon='FACESEL')
+        box.operator("verts.edgesfacesop", text="Vertex/Edges/Faces", icon='OBJECT_DATAMODE')
+
+
+# Edit Selection Modes
+class PIE_OT_classvertexop(Operator):
+    bl_idname = "class.vertexop"
+    bl_label = "Class Vertex"
+    bl_description = "Vert Select Mode"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    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')
+        if bpy.ops.mesh.select_mode != "EDGE, FACE":
+            bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
+            return {'FINISHED'}
 
-        prop = layout.operator("wm.context_set_value", text="Vertex Select",
-                               icon='VERTEXSEL')
-        prop.value = "(True, False, False)"
-        prop.data_path = "tool_settings.mesh_select_mode"
 
-        prop = layout.operator("wm.context_set_value", text="Edge Select",
-                               icon='EDGESEL')
-        prop.value = "(False, True, False)"

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list