[Bf-blender-cvs] [153d415] master: Add Mesh buttons for 3D View Toolbar

Jonathan Williamson noreply at git.blender.org
Fri Jan 3 22:28:51 CET 2014


Commit: 153d415f1d47e8f6d4e90afefef9366505cc4669
Author: Jonathan Williamson
Date:   Tue Dec 31 13:24:40 2013 -0600
https://developer.blender.org/rB153d415f1d47e8f6d4e90afefef9366505cc4669

Add Mesh buttons for 3D View Toolbar

This adds buttons in the 3D View toolbar to add new mesh objects to the scene. These buttons are added via the Create tab/category, soon to be populated with other object types as well.

A panel is added for both Object mode and Edit mode so as to not display in incorrect context (such as Pose Mode).

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index cca2244..d0e02a0 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -69,6 +69,30 @@ def draw_gpencil_tools(context, layout):
 
 # ********** default tools for object-mode ****************
 
+class VIEW3D_PT_tools_add_mesh(View3DPanel, Panel):
+    bl_category = "Create"
+    bl_context = "objectmode"
+    bl_label = "Add Meshes"
+    
+    def draw (self, context):
+        layout = self.layout
+        
+        col = layout.column(align=True)
+        col.label(text="Primitives:")
+        col.operator("mesh.primitive_plane_add", text="Plane", icon="MESH_PLANE")
+        col.operator("mesh.primitive_cube_add", text="Cube", icon="MESH_CUBE")
+        col.operator("mesh.primitive_circle_add", text="Circle", icon="MESH_CIRCLE")
+        col.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon="MESH_UVSPHERE")
+        col.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon="MESH_ICOSPHERE")
+        col.operator("mesh.primitive_cylinder_add", text="Cylinder", icon="MESH_CYLINDER")
+        col.operator("mesh.primitive_cone_add", text="Cone", icon="MESH_CONE")
+        col.operator("mesh.primitive_torus_add", text="Torus", icon="MESH_TORUS")   
+        
+        col = layout.column(align=True)
+        col.label(text="Special:")
+        col.operator("mesh.primitive_grid_add", text="Grid", icon="MESH_GRID")
+        col.operator("mesh.primitive_monkey_add", text="Monkey", icon="MESH_MONKEY")
+
 class VIEW3D_PT_tools_basic(View3DPanel, Panel):
     bl_category = "Basic"
     bl_context = "objectmode"
@@ -107,6 +131,7 @@ class VIEW3D_PT_tools_basic(View3DPanel, Panel):
             row.operator("object.shade_smooth", text="Smooth")
             row.operator("object.shade_flat", text="Flat")
 
+
 class VIEW3D_PT_tools_animation(View3DPanel, Panel):
     bl_category = "Animation"
     bl_context = "objectmode"
@@ -172,6 +197,30 @@ class VIEW3D_PT_tools_objectmode(View3DPanel, Panel):
 
 # ********** default tools for editmode_mesh ****************
 
+class VIEW3D_PT_tools_add_mesh_edit(View3DPanel, Panel):
+    bl_category = "Create"
+    bl_context = "mesh_edit"
+    bl_label = "Add Meshes"
+    
+    def draw (self, context):
+        layout = self.layout
+        
+        col = layout.column(align=True)
+        col.label(text="Primitives:")
+        col.operator("mesh.primitive_plane_add", text="Plane", icon="MESH_PLANE")
+        col.operator("mesh.primitive_cube_add", text="Cube", icon="MESH_CUBE")
+        col.operator("mesh.primitive_circle_add", text="Circle", icon="MESH_CIRCLE")
+        col.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon="MESH_UVSPHERE")
+        col.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon="MESH_ICOSPHERE")
+        col.operator("mesh.primitive_cylinder_add", text="Cylinder", icon="MESH_CYLINDER")
+        col.operator("mesh.primitive_cone_add", text="Cone", icon="MESH_CONE")
+        col.operator("mesh.primitive_torus_add", text="Torus", icon="MESH_TORUS")   
+        
+        col = layout.column(align=True)
+        col.label(text="Special:")
+        col.operator("mesh.primitive_grid_add", text="Grid", icon="MESH_GRID")
+        col.operator("mesh.primitive_monkey_add", text="Monkey", icon="MESH_MONKEY")
+
 class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
     bl_context = "mesh_edit"
     bl_label = "Mesh Tools"




More information about the Bf-blender-cvs mailing list