[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4610] contrib/py/scripts/addons: Initial commit of PieMenu addon

Sean Olson seanolson at gmail.com
Wed Jun 26 21:10:39 CEST 2013


Revision: 4610
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4610
Author:   liquidape
Date:     2013-06-26 19:10:39 +0000 (Wed, 26 Jun 2013)
Log Message:
-----------
Initial commit of PieMenu addon

Added Paths:
-----------
    contrib/py/scripts/addons/piemenus/
    contrib/py/scripts/addons/piemenus/__init__.py
    contrib/py/scripts/addons/piemenus/icon_util.py
    contrib/py/scripts/addons/piemenus/icons/
    contrib/py/scripts/addons/piemenus/icons/blender_icons/
    contrib/py/scripts/addons/piemenus/icons/blender_icons/blender_icons_x2.png
    contrib/py/scripts/addons/piemenus/modal_behavior.py
    contrib/py/scripts/addons/piemenus/pie_BrushControl.py
    contrib/py/scripts/addons/piemenus/pie_deleteMenu.py
    contrib/py/scripts/addons/piemenus/pie_greyBrushes.py
    contrib/py/scripts/addons/piemenus/pie_manipulatorMenu.py
    contrib/py/scripts/addons/piemenus/pie_menu.py
    contrib/py/scripts/addons/piemenus/pie_menu_utils.py
    contrib/py/scripts/addons/piemenus/pie_modeMenu.py
    contrib/py/scripts/addons/piemenus/pie_particleCombMenu.py
    contrib/py/scripts/addons/piemenus/pie_pivotMenu.py
    contrib/py/scripts/addons/piemenus/pie_proportionalMenu.py
    contrib/py/scripts/addons/piemenus/pie_redBrushes.py
    contrib/py/scripts/addons/piemenus/pie_sculptTextureMenu.py
    contrib/py/scripts/addons/piemenus/pie_selectionMenu.py
    contrib/py/scripts/addons/piemenus/pie_shadeMenu.py
    contrib/py/scripts/addons/piemenus/pie_strokesMenu.py
    contrib/py/scripts/addons/piemenus/pie_tanBrushes.py
    contrib/py/scripts/addons/piemenus/pie_viewMenu.py

Added: contrib/py/scripts/addons/piemenus/__init__.py
===================================================================
--- contrib/py/scripts/addons/piemenus/__init__.py	                        (rev 0)
+++ contrib/py/scripts/addons/piemenus/__init__.py	2013-06-26 19:10:39 UTC (rev 4610)
@@ -0,0 +1,592 @@
+# ##### 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 #####
+
+
+""" Copyright 2011 GPL licence applies"""
+
+bl_info = {
+    "name": "Pie: Menus",
+    "description": "Pie Menus for various functionality",
+    "author": "Dan Eicher, Sean Olson, Patrick Moore",
+    "version": (1, 0, 1),
+    "blender": (2, 6, 6),
+    "location": "View3D - Set Keybindings in File->Userprefs->Input Tab->(Search: \"pie\")",
+    "warning": '',  # used for warning icon and text in addons panel
+    "wiki_url": "",
+    "tracker_url": "https://bitbucket.org/liquidape/blender-pie-menus/issues",
+    "category": "3D View"}
+
+#we need to add the piemenus subdirectory to be searched for imports
+import sys, os
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'piemenus'))
+
+#this is the guts of the script
+import pie_menu
+import pie_menu_utils
+
+#import the individual menus
+import pie_viewMenu
+import pie_modeMenu
+import pie_selectionMenu
+import pie_shadeMenu
+import pie_pivotMenu
+import pie_strokesMenu
+import pie_sculptTextureMenu
+import pie_greyBrushes
+import pie_redBrushes
+import pie_tanBrushes
+import pie_deleteMenu
+import pie_proportionalMenu
+import pie_BrushControl
+import pie_manipulatorMenu
+import pie_particleCombMenu
+#import pie_PiePan
+#import pie_repeatMenu
+
+import bpy
+import addon_utils
+from bpy.props import *
+from bpy.app.handlers import persistent
+from rna_prop_ui import PropertyPanel
+from bpy.types import AddonPreferences
+
+ 
+ 
+class PieMenuPreferences(AddonPreferences):
+    bl_idname = __name__
+    
+
+        
+    PiePrefs = BoolProperty(
+                name="Preferences",
+                description="Show Pie Options",
+                default=True
+                )
+                
+    pieInnerRadius = IntProperty(
+                name="Pie Inner Radius",
+                description="Amount that mouse can travel before activating pie slices",
+                default=20
+                )
+    pieOuterRadius = IntProperty(
+                name="Pie Outer Radius",
+                description="Amount that mouse can travel beyond pies before deactivating menu",
+                default=300
+                )
+    
+    double_size = BoolProperty(
+                name="Double Size",
+                description="Hack for IPS displays",
+                default=False
+                )
+            
+    clockBool = BoolProperty(
+                name="Clock",
+                description="Show pointer at center of pie",
+                default=True
+                )
+                
+    pieIconBindcode = IntProperty(
+                name = "GL Bind Code",
+                description = "used so we only have to load texture to openGL as few times as possible",
+                default = 0
+                )
+    
+    pieRobustCleanup = BoolProperty(
+                name = "Delete icon image before saving file",
+                description = "False if you are working with it otherwise it will be gone",
+                default = True
+                )
+    
+    pieBorderDelay = FloatProperty(
+                name = "Border Delay",
+                description = "How long to wait for border shift to take effect",
+                default = .3,
+                min = 0,
+                max = 5,
+                step = 5,
+                precision = 2  
+                )
+    
+    pieSquish = FloatProperty(
+                name = "Pie Squish",
+                description = "0 more oval, 1 more circular",
+                default = .5,
+                min = 0,
+                max = 1,
+                step = 10,
+                precision = 1  
+                )
+    
+    pieDiamond = FloatProperty(
+                name = "Pie Diamond",
+                description = "0 more circular, 1 more diamond",
+                default = .8,
+                min = 0,
+                max = 1,
+                step = 10,
+                precision = 1  
+                )
+    
+    pieThetaShift = FloatProperty(
+                name = "Pie Theta Shift",
+                description = "Just Gotta Play with this one",
+                default = .3,
+                min = 0,
+                max = 1,
+                step = 10,
+                precision = 1  
+                )
+        
+    def draw(self, context):
+        layout = self.layout
+        #split = layout.split()
+ 
+        box = layout.box().column(align=False)
+        box.prop(self,'PiePrefs')
+        if self.PiePrefs:
+            #boxrow=box.row()
+            #boxrow.template_list("SCENE_UL_pie_menus","",context.scene, "pie_settings", context.scene, "pie_settings_index", rows=5)
+            
+            #boxrow=box.row()
+            #subrow = boxrow.row(align=True)
+            #subrow.operator("activatepie.button", text="On")
+            #subrow.operator("disactivatepie.button", text="Off")
+            
+            #boxrow=box.row()
+            #boxrow.operator("pie.keybinding", text="Keybindings")
+
+            boxrow=box.row()
+            boxrow.label(text="General Preferences")
+
+            boxrow=box.row()
+            boxrow.prop(self, 'clockBool')
+            
+            boxrow=box.row()
+            boxrow.prop(self, 'pieOuterRadius')
+            
+            boxrow=box.row()
+            boxrow.prop(self, 'pieInnerRadius')
+            
+            boxrow=box.row()
+            boxrow.prop(self, 'double_size')
+            
+            boxrow=box.row()
+            boxrow.prop(self, 'pieRobustCleanup')
+            
+            boxrow=box.row()
+            boxrow.prop(self, 'pieBorderDelay')
+            
+            boxrow=box.row()
+            boxrow.prop(self, 'pieSquish')
+            
+            boxrow=box.row()
+            boxrow.prop(self, 'pieDiamond')
+            
+            boxrow=box.row()
+            boxrow.prop(self, 'pieThetaShift')
+#collection class to keep track of individual pie menu variables
+class PiePropertyGroup(bpy.types.PropertyGroup):
+    name = StringProperty(default="")    
+    activate = BoolProperty(default=True)
+
+
+class PieMenuSettings(bpy.types.PropertyGroup):
+    
+    @classmethod
+    def register(cls):
+        bpy.types.Scene.piemenus = PointerProperty(
+                name="Pie Settings",
+                description="Pie settings & Tools",
+                type=cls,
+                )
+    @classmethod
+    def initSceneProperties(scn):
+        if not bpy.data.scenes[0].pie_settings:
+            pie_set = bpy.data.scenes[0].pie_settings
+            
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] 3DView - View Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] 3DView - Mode Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] 3DView - Shade Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] 3DView - Pivot Menu"
+            
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] 3dView - Proportional Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] Edit - Delete Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] Edit - Selection Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] Sculpt - Grey Brushes Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] Sculpt - Red Brushes Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] Sculpt - Tan Brushes Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] Sculpt - Texture Menu"
+
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] Sculpt - Strokes Menu"
+            
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] Sculpt - Brush Control Menu"
+            
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] 3DView - Manipulator Menu"
+            
+            pie_item = pie_set.add()
+            pie_item.name = "[ON] 3DView - Particle Comb Menu"
+            
+            #pie_item = pie_set.add()
+            #pie_item.name = "[ON] 3DView - Repeat Menu"
+            
+            #pie_item = pie_set.add()
+            #pie_item.name = "[OFF] 3DView - PiePan Menu"
+        
+    #Updated all the keybindings..seems like the decorator isn't required yet it works for initSceneProperties so whatever
+    @classmethod
+    def updateBinds(scn): 
+
+        for i in range(len(bpy.data.scenes[0].pie_settings)):
+            name=bpy.data.scenes[0].pie_settings[i].name
+            if not name.find('View Menu')==-1:
+                if bpy.data.scenes[0].pie_settings[i].activate:               
+                    pie_viewMenu.setBind()
+                else:               
+                    pie_viewMenu.removeBind()
+
+            if not name.find('Mode Menu')==-1:
+                if bpy.data.scenes[0].pie_settings[i].activate:               
+                    pie_modeMenu.setBind()
+                else:               
+                    pie_modeMenu.removeBind()
+
+            if not name.find('Shade Menu')==-1:
+                if bpy.data.scenes[0].pie_settings[i].activate:               
+                    pie_shadeMenu.setBind()
+                else:               
+                    pie_shadeMenu.removeBind()
+
+            if not name.find('Pivot Menu')==-1:

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list