2.5 3DView:
authorThomas Dinges <blender@dingto.org>
Sat, 15 Aug 2009 20:21:49 +0000 (20:21 +0000)
committerThomas Dinges <blender@dingto.org>
Sat, 15 Aug 2009 20:21:49 +0000 (20:21 +0000)
* Renaming of edit mode context types.
* Code cleanup.

release/ui/space_view3d.py
release/ui/space_view3d_toolbar.py
source/blender/blenkernel/intern/context.c

index a595cba52c4cb947bbae92b19848393b9234ac55..bbb3861b868c0237b6b9e75346e057c955d28cbe 100644 (file)
@@ -1,45 +1,35 @@
 
 import bpy
 
-# ********** Header ****************
+# ********** Header **********
 
 class VIEW3D_HT_header(bpy.types.Header):
        __space_type__ = "VIEW_3D"
 
        def draw(self, context):
                layout = self.layout
+               
+               view = context.space_data
+               mode_string = context.mode_string
 
                layout.template_header()
-
-               # menus
+               
+               # Menus
                if context.area.show_menus:
                        row = layout.row()
+
                        row.itemM("VIEW3D_MT_view")
+                       
+                       # Select Menu
+                       selectmenu = "VIEW3D_MT_select_%s" % mode_string
+                       if selectmenu in dir(bpy.types):
+                               layout.itemM(selectmenu)
 
                layout.template_header_3D()
 
-# ********** Menu ****************
+# ********** Menu **********
 
-class VIEW3D_MT_view_navigation(bpy.types.Menu):
-       __space_type__ = "VIEW_3D"
-       __label__ = "Navigation"
-
-       def draw(self, context):
-               layout = self.layout
-
-               # layout.itemO("view3d.view_fly_mode")
-               # layout.itemS()
-               
-               layout.items_enumO("view3d.view_orbit", "type")
-               
-               layout.itemS()
-               
-               layout.items_enumO("view3d.view_pan", "type")
-               
-               layout.itemS()
-               
-               layout.item_floatO("view3d.zoom", "delta", 1.0, text="Zoom In")
-               layout.item_floatO("view3d.zoom", "delta", -1.0, text="Zoom Out")
+# ********** View menus **********
 
 class VIEW3D_MT_view(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
@@ -94,8 +84,29 @@ class VIEW3D_MT_view(bpy.types.Menu):
                
                layout.itemO("screen.region_foursplit", text="Toggle Quad View")
                layout.itemO("screen.screen_full_area", text="Toggle Full Screen")
+               
+class VIEW3D_MT_view_navigation(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Navigation"
+
+       def draw(self, context):
+               layout = self.layout
 
-# ********** Select menus ****************
+               # layout.itemO("view3d.view_fly_mode")
+               # layout.itemS()
+               
+               layout.items_enumO("view3d.view_orbit", "type")
+               
+               layout.itemS()
+               
+               layout.items_enumO("view3d.view_pan", "type")
+               
+               layout.itemS()
+               
+               layout.item_floatO("view3d.zoom", "delta", 1.0, text="Zoom In")
+               layout.item_floatO("view3d.zoom", "delta", -1.0, text="Zoom Out")
+
+# ********** Select menus **********
 
 class VIEW3D_MT_select_objectmode(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
@@ -161,7 +172,7 @@ class VIEW3D_MT_select_particlemode(bpy.types.Menu):
                layout.itemO("particle.select_more")
                layout.itemO("particle.select_less")
 
-class VIEW3D_MT_select_meshedit(bpy.types.Menu):
+class VIEW3D_MT_select_mesh_edit(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
        __label__ = "Select"
 
@@ -205,7 +216,7 @@ class VIEW3D_MT_select_meshedit(bpy.types.Menu):
                layout.itemO("mesh.loop_to_region")
                layout.itemO("mesh.region_to_loop")
 
-class VIEW3D_MT_select_curveedit(bpy.types.Menu):
+class VIEW3D_MT_select_curve_edit(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
        __label__ = "Select"
 
@@ -234,7 +245,7 @@ class VIEW3D_MT_select_curveedit(bpy.types.Menu):
                layout.itemO("curve.select_more")
                layout.itemO("curve.select_less")
 
-class VIEW3D_MT_select_surfaceedit(bpy.types.Menu):
+class VIEW3D_MT_select_surface_edit(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
        __label__ = "Select"
 
@@ -260,7 +271,7 @@ class VIEW3D_MT_select_surfaceedit(bpy.types.Menu):
                layout.itemO("curve.select_more")
                layout.itemO("curve.select_less")
 
-class VIEW3D_MT_select_mballedit(bpy.types.Menu):
+class VIEW3D_MT_select_mball_edit(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
        __label__ = "Select"
 
@@ -278,7 +289,7 @@ class VIEW3D_MT_select_mballedit(bpy.types.Menu):
                
                layout.itemL(text="Random")
 
-class VIEW3D_MT_select_latticeedit(bpy.types.Menu):
+class VIEW3D_MT_select_lattice_edit(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
        __label__ = "Select"
 
@@ -291,7 +302,7 @@ class VIEW3D_MT_select_latticeedit(bpy.types.Menu):
                
                layout.itemO("lattice.select_all_toggle", text="Select/Deselect All")
 
-class VIEW3D_MT_select_armatureedit(bpy.types.Menu):
+class VIEW3D_MT_select_armature_edit(bpy.types.Menu):
        __space_type__ = "VIEW_3D"
        __label__ = "Select"
 
@@ -323,29 +334,8 @@ class VIEW3D_MT_select_facesel(bpy.types.Menu):
 
                layout.view3d_select_faceselmenu()
 
-class VIEW3D_HT_header(bpy.types.Header):
-       __space_type__ = "VIEW_3D"
 
-       def draw(self, context):
-               view = context.space_data
-               mode_string = context.mode_string
-               layout = self.layout
-
-               layout.template_header()
-               
-               # menus
-               if context.area.show_menus:
-                       row = layout.row()
-
-                       row.itemM("VIEW3D_MT_view")
-                       
-                       selectmenu = "VIEW3D_MT_select_%s" % mode_string
-                       if selectmenu in dir(bpy.types):
-                               layout.itemM(selectmenu)
-
-               layout.template_header_3D()
-
-# ********** Panel ****************
+# ********** Panel **********
 
 class VIEW3D_PT_3dview_properties(bpy.types.Panel):
        __space_type__ = "VIEW_3D"
@@ -448,19 +438,22 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
                        col.itemR(bg, "x_offset", text="X")
                        col.itemR(bg, "y_offset", text="Y")
 
+bpy.types.register(VIEW3D_HT_header) # Header
+
+bpy.types.register(VIEW3D_MT_view) #View Menus
 bpy.types.register(VIEW3D_MT_view_navigation)
-bpy.types.register(VIEW3D_MT_view)
-bpy.types.register(VIEW3D_MT_select_objectmode)
+
+bpy.types.register(VIEW3D_MT_select_objectmode) # Select Menus
 bpy.types.register(VIEW3D_MT_select_posemode)
 bpy.types.register(VIEW3D_MT_select_particlemode)
-bpy.types.register(VIEW3D_MT_select_meshedit)
-bpy.types.register(VIEW3D_MT_select_curveedit)
-bpy.types.register(VIEW3D_MT_select_surfaceedit)
-bpy.types.register(VIEW3D_MT_select_mballedit)
-bpy.types.register(VIEW3D_MT_select_latticeedit)
-bpy.types.register(VIEW3D_MT_select_armatureedit)
+bpy.types.register(VIEW3D_MT_select_mesh_edit)
+bpy.types.register(VIEW3D_MT_select_curve_edit)
+bpy.types.register(VIEW3D_MT_select_surface_edit)
+bpy.types.register(VIEW3D_MT_select_mball_edit)
+bpy.types.register(VIEW3D_MT_select_lattice_edit)
+bpy.types.register(VIEW3D_MT_select_armature_edit)
 bpy.types.register(VIEW3D_MT_select_facesel)
-bpy.types.register(VIEW3D_HT_header)
-bpy.types.register(VIEW3D_PT_3dview_properties)
+
+bpy.types.register(VIEW3D_PT_3dview_properties) # Panels
 bpy.types.register(VIEW3D_PT_3dview_display)
 bpy.types.register(VIEW3D_PT_background_image)
index 18ae7b2290d44409e18d4db2b4cc1b97b9483ad3..1316df8d2ee8709662795325a545ee96070bc4d7 100644 (file)
@@ -1,7 +1,6 @@
 
 import bpy
 
-
 class View3DPanel(bpy.types.Panel):
        __space_type__ = "VIEW_3D"
        __region_type__ = "TOOLS"
@@ -45,7 +44,7 @@ class VIEW3D_PT_tools_objectmode(View3DPanel):
 # ********** default tools for editmode_mesh ****************
 
 class VIEW3D_PT_tools_meshedit(View3DPanel):
-       __context__ = "meshedit"
+       __context__ = "mesh_edit"
        __label__ = "Mesh Tools"
 
        def draw(self, context):
@@ -88,7 +87,7 @@ class VIEW3D_PT_tools_meshedit(View3DPanel):
 # ********** default tools for editmode_curve ****************
 
 class VIEW3D_PT_tools_curveedit(View3DPanel):
-       __context__ = "curveedit"
+       __context__ = "curve_edit"
        __label__ = "Curve Tools"
 
        def draw(self, context):
@@ -118,7 +117,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel):
 # ********** default tools for editmode_surface ****************
 
 class VIEW3D_PT_tools_surfaceedit(View3DPanel):
-       __context__ = "surfaceedit"
+       __context__ = "surface_edit"
        __label__ = "Surface Tools"
 
        def draw(self, context):
@@ -148,7 +147,7 @@ class VIEW3D_PT_tools_surfaceedit(View3DPanel):
 # ********** default tools for editmode_text ****************
 
 class VIEW3D_PT_tools_textedit(View3DPanel):
-       __context__ = "textedit"
+       __context__ = "text_edit"
        __label__ = "Text Tools"
 
        def draw(self, context):
@@ -165,7 +164,7 @@ class VIEW3D_PT_tools_textedit(View3DPanel):
 # ********** default tools for editmode_armature ****************
 
 class VIEW3D_PT_tools_armatureedit(View3DPanel):
-       __context__ = "armatureedit"
+       __context__ = "armature_edit"
        __label__ = "Armature Tools"
 
        def draw(self, context):
@@ -191,7 +190,7 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel):
 # ********** default tools for editmode_mball ****************
 
 class VIEW3D_PT_tools_mballedit(View3DPanel):
-       __context__ = "mballedit"
+       __context__ = "mball_edit"
        __label__ = "Meta Tools"
 
        def draw(self, context):
@@ -207,7 +206,7 @@ class VIEW3D_PT_tools_mballedit(View3DPanel):
 # ********** default tools for editmode_lattice ****************
 
 class VIEW3D_PT_tools_latticeedit(View3DPanel):
-       __context__ = "latticeedit"
+       __context__ = "lattice_edit"
        __label__ = "Lattice Tools"
 
        def draw(self, context):
index df5b0d766b5317ff200524f4b23c7a5a0ddfd235..280ea6eca53a82bf501a20b4381d9bbd327ae4c0 100644 (file)
@@ -668,19 +668,19 @@ char *CTX_data_mode_string(const bContext *C)
        if(obedit) {
                switch(obedit->type) {
                        case OB_MESH:
-                               return "meshedit";
+                               return "mesh_edit";
                        case OB_CURVE:
-                               return "curveedit";
+                               return "curve_edit";
                        case OB_SURF:
-                               return "surfaceedit";
+                               return "surface_edit";
                        case OB_FONT:
-                               return "textedit";
+                               return "text_edit";
                        case OB_ARMATURE:
-                               return "armatureedit";
+                               return "armature_edit";
                        case OB_MBALL:
-                               return "mballedit";
+                               return "mball_edit";
                        case OB_LATTICE:
-                               return "latticeedit";
+                               return "lattice_edit";
                }
        }
        else {