[Bf-extensions-cvs] [fdc03fd] master: merged add objects panel (superseded by create tab) to dynanic toolshelf addon.

Brendon Murphy noreply at git.blender.org
Mon Jul 14 14:41:59 CEST 2014


Commit: fdc03fdf30cfe30dd5a123150f455f6f8855db6e
Author: Brendon Murphy
Date:   Mon Jul 14 22:40:39 2014 +1000
https://developer.blender.org/rBACfdc03fdf30cfe30dd5a123150f455f6f8855db6e

merged add objects panel (superseded by create tab) to dynanic toolshelf addon.

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

D	space_view3d_objects_panel.py
A	space_view3d_toolshelf_menu.py

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

diff --git a/space_view3d_objects_panel.py b/space_view3d_objects_panel.py
deleted file mode 100644
index 98c198c..0000000
--- a/space_view3d_objects_panel.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public License
-#  as published by the Free Software Foundation; either version 2
-#  of the License, or (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software Foundation,
-#  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-bl_info = {
-    "name": "Add Objects Panel",
-    "author": "Murat Egretli (Demohero)",
-    "version": (1, 2),
-    "blender": (2, 71, 0),
-    "location": "View3D > Toolshelf > Addons",
-    "description": "add objects(mesh, curve etc.) from Toolbar",
-    "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
-        "Scripts/",
-    "tracker_url": "https://developer.blender.org/T22154",
-    "category": "3D View"}
-
-
-import bpy
-
-
-class View3DPanel():
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'TOOLS'
-
-
-class VIEW3D_PT_add_menu(View3DPanel,bpy.types.Panel):
-    bl_context = "objectmode"
-    bl_label = "Add Objects"
-    bl_category = 'Addons'
-    bl_options = {'DEFAULT_CLOSED'}
-
-    def draw(self, context):
-        layout = self.layout
-        layout.label("Primitive Object")
-        layout.menu("INFO_MT_mesh_add", text="Mesh", icon='OUTLINER_OB_MESH')
-        layout.menu("INFO_MT_curve_add", text="Curve", icon='OUTLINER_OB_CURVE')
-        layout.menu("INFO_MT_surface_add", text="Surface", icon='OUTLINER_OB_SURFACE')
-        layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
-        layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
-        layout.label("Object Helpers")
-        layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
-        layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
-        layout.operator("object.add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'EMPTY'
-        layout.operator_menu_enum("object.group_instance_add", "group",
-                                  text="Group Instance",
-                                  icon='OUTLINER_OB_EMPTY')
-        layout.label("3d View Objects")
-        layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
-        layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
-        layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
-
-
-# register the class
-def register():
-    bpy.utils.register_module(__name__)
-
-    pass
-
-def unregister():
-    bpy.utils.unregister_module(__name__)
-
-    pass
-
-if __name__ == "__main__":
-    register()
diff --git a/space_view3d_toolshelf_menu.py b/space_view3d_toolshelf_menu.py
new file mode 100644
index 0000000..93a65fd
--- /dev/null
+++ b/space_view3d_toolshelf_menu.py
@@ -0,0 +1,1402 @@
+# ##### 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 #####
+# some parts based on 3d_cursor_menu.py by Jonathan Smith (JayDez) & work by sim88 & sam. 
+# view3d_advanced_dynamic_toolshelf_menu byBrendon Murphy (meta-androcto)
+
+bl_info = {
+    "name": "Dynamic Toolshelf Menu",
+    "author": "meta-androcto",
+    "version": (3, 0, 0),
+    "blender": (2, 7, 1),
+    "location": "View3D > Spacebar Key, Dynamic Tab",
+    "description": "Context Sensitive Toolshelf Menu",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
+                "Scripts/3D_interaction/Dynamic_Spacebar_Menu",
+    "category": "3D View",
+}
+
+import bpy
+from bpy import *
+
+class View3DPanel():
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
+
+class VIEW3D_PT_add_menu(View3DPanel,bpy.types.Panel):
+    bl_label = "Dynamic Toolshelf"
+    bl_category = "Dynamic"
+
+    def draw(self, context):
+        layout = self.layout
+        settings = context.tool_settings
+        layout.operator_context = 'INVOKE_REGION_WIN'
+
+        ob = context
+        if ob.mode == 'OBJECT':
+            # Object mode
+
+            # Search Menu
+            layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
+            layout.separator()
+
+            # Add Menu block
+            layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
+
+            # Transform block
+            layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
+
+            # Mirror block
+            layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
+
+            # Cursor Block
+            layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
+
+            # Parent block
+            layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
+
+            # Group block
+            layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
+
+            # Modifier block
+            layout.operator_menu_enum("object.modifier_add", "type",
+                                      icon='MODIFIER')
+
+            # Align block
+            layout.menu("VIEW3D_MT_AlignMenu", icon='ALIGN')
+
+            # Select block
+            layout.menu("VIEW3D_MT_SelectMenu", icon='RESTRICT_SELECT_OFF')
+
+            # Toolshelf block
+            layout.operator("view3d.toolshelf", text= 'hide toolshelf', icon='MENU_PANEL')
+
+            # Properties block
+            layout.operator("view3d.properties", icon='MENU_PANEL')
+
+            #TODO: Add if statement to test whether editmode switch needs to
+            #be added to the menu, since certain object can't enter edit mode
+            #In which case we don't need the toggle
+            # Toggle Editmode
+            layout.operator("object.editmode_toggle", text="Enter Edit Mode",
+                            icon='EDITMODE_HLT')
+
+            # Delete block
+            layout.operator("object.delete", text="Delete Object",
+                            icon='CANCEL')
+
+
+        elif ob.mode == 'EDIT_MESH':
+            # Edit mode
+
+            # Search Menu
+            layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
+            layout.separator()
+
+            # Add block
+            layout.menu("INFO_MT_mesh_add", text="Add Mesh",
+                        icon='OUTLINER_OB_MESH')
+
+            # Transform block
+            layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
+
+            # Mirror block
+            layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
+
+            # Cursor block
+            layout.menu("VIEW3D_MT_EditCursorMenu", icon='CURSOR')
+
+            # Proportional block
+            layout.prop_menu_enum(settings, "proportional_edit",
+                                  icon="PROP_CON")
+            layout.prop_menu_enum(settings, "proportional_edit_falloff",
+                                  icon="SMOOTHCURVE")
+
+            # Edit block
+            layout.menu("VIEW3D_MT_edit_TK", icon='EDITMODE_HLT')
+
+            # Multi Select
+            layout.menu("VIEW3D_MT_edit_multi", icon='VERTEXSEL')
+
+            # Extrude block
+            layout.menu("VIEW3D_MT_edit_mesh_extrude", icon='EDIT_VEC')
+
+            # Tools block
+            layout.menu("VIEW3D_MT_edit_mesh_specials", icon='MODIFIER')
+
+			# UV Map block
+            layout.menu("VIEW3D_MT_uv_map", icon='MOD_UVPROJECT')
+
+            # Select block
+            layout.menu("VIEW3D_MT_SelectEditMenu",
+                        icon='RESTRICT_SELECT_OFF')
+
+            # Toolshelf block
+            layout.operator("view3d.toolshelf", icon='MENU_PANEL')
+
+            # Properties block
+            layout.operator("view3d.properties", icon='MENU_PANEL')
+
+            # Toggle Object Mode
+            layout.operator("object.editmode_toggle",
+                            text="Enter Object Mode", icon='OBJECT_DATAMODE')
+
+            # Delete Block
+            layout.operator("mesh.delete", icon='CANCEL')
+
+        if ob.mode == 'EDIT_CURVE':
+            # Curve menu
+
+            # Search Menu
+            layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
+            layout.separator()
+
+            # Add block
+            layout.menu("INFO_MT_curve_add", text="Add Curve",
+                        icon='OUTLINER_OB_CURVE')
+
+            # Transform block
+            layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
+
+            # Mirror block
+            layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
+
+            # Cursor block
+            layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
+
+            # Proportional block
+            layout.prop_menu_enum(settings, "proportional_edit",
+                                  icon="PROP_CON")
+            layout.prop_menu_enum(settings, "proportional_edit_falloff",
+                                  icon="SMOOTHCURVE")
+
+            # Edit Control Points
+    

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list