bf-blender-cvs  

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22559] branches/blender2.5/blender: 2. 5 3DView:

Thomas Dinges
Mon, 17 Aug 2009 03:13:33 -0700

Revision: 22559
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22559
Author:   dingto
Date:     2009-08-17 12:13:24 +0200 (Mon, 17 Aug 2009)

Log Message:
-----------
2.5 3DView:
* Ported Edit Menus to python.
Many thanks to Lorenzo Pierfederici (lento) for this patch. 

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/space_view3d.py
    
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c

Modified: branches/blender2.5/blender/release/ui/space_view3d.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_view3d.py      2009-08-17 
09:20:14 UTC (rev 22558)
+++ branches/blender2.5/blender/release/ui/space_view3d.py      2009-08-17 
10:13:24 UTC (rev 22559)
@@ -11,7 +11,8 @@
                
                view = context.space_data
                mode_string = context.mode
-
+               edit_object = context.edit_object
+               
                layout.template_header()
                
                # Menus
@@ -29,6 +30,8 @@
                                row.itemM("VIEW3D_MT_object")
                        elif mode_string == 'SCULPT':
                                row.itemM("VIEW3D_MT_sculpt")
+                       elif edit_object:
+                               row.itemM("VIEW3D_MT_edit_%s" % 
edit_object.type)
 
                layout.template_header_3D()
 
@@ -500,6 +503,436 @@
                                layout.itemR(brush, "persistent")
                                layout.itemO("sculpt.set_persistent_base")
 
+# ********** Edit Menus, suffix from ob.type **********
+
+class VIEW3D_MT_edit_snap(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Snap"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.itemO("view3d.snap_selected_to_grid")
+               layout.itemO("view3d.snap_selected_to_cursor")
+               layout.itemO("view3d.snap_selected_to_center")
+               
+               layout.itemS()
+               
+               layout.itemO("view3d.snap_cursor_to_selected")
+               layout.itemO("view3d.snap_cursor_to_grid")
+               layout.itemO("view3d.snap_cursor_to_active")
+
+# Edit MESH
+class VIEW3D_MT_edit_MESH(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Mesh"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               settings = context.tool_settings
+
+               layout.itemO("ed.undo")
+               layout.itemO("ed.redo")
+               
+               layout.itemS()
+               
+               layout.itemM("VIEW3D_MT_edit_snap")
+               
+               layout.itemS()
+               
+               layout.itemO("uv.mapping_menu")
+               
+               layout.itemS()
+               
+               layout.itemO("mesh.extrude")
+               layout.itemO("mesh.duplicate")
+               layout.itemO("mesh.delete")
+               
+               layout.itemS()
+               
+               layout.itemM("VIEW3D_MT_edit_MESH_vertices")
+               layout.itemM("VIEW3D_MT_edit_MESH_edges")
+               layout.itemM("VIEW3D_MT_edit_MESH_faces")
+               layout.itemM("VIEW3D_MT_edit_MESH_normals")
+               
+               layout.itemS()
+               
+               layout.itemR(settings, "automerge_editing")
+               layout.itemR(settings, "proportional_editing")
+               layout.item_menu_enumR(settings, "proportional_editing_falloff")
+               
+               layout.itemS()
+               
+               layout.itemM("VIEW3D_MT_edit_MESH_showhide")
+
+class VIEW3D_MT_edit_MESH_vertices(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Vertices"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.itemO("mesh.merge")
+               layout.itemO("mesh.rip")
+               layout.itemO("mesh.split")
+               layout.itemO("mesh.separate")
+
+               layout.itemS()
+               
+               layout.itemO("mesh.vertices_smooth")
+               layout.itemO("mesh.remove_doubles")
+               
+class VIEW3D_MT_edit_MESH_edges(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Edges"
+
+       def draw(self, context):
+               layout = self.layout
+
+               layout.itemO("mesh.edge_face_add")
+               layout.itemO("mesh.subdivide")
+               layout.item_floatO("mesh.subdivide", "smoothness", 1.0, 
text="Subdivide Smooth")
+
+               layout.itemS()
+               
+               layout.itemO("mesh.mark_seam")
+               layout.item_booleanO("mesh.mark_seam", "clear", True, 
text="Clear Seam")
+               
+               layout.itemS()
+               
+               layout.itemO("mesh.mark_sharp")
+               layout.item_booleanO("mesh.mark_sharp", "clear", True, 
text="Clear Sharp")
+               
+               layout.itemS()
+               
+               layout.item_enumO("mesh.edge_rotate", "direction", 'CW', 
text="Rotate Edge CW")
+               layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', 
text="Rotate Edge CCW")
+               
+class VIEW3D_MT_edit_MESH_faces(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Faces"
+
+       def draw(self, context):
+               layout = self.layout
+
+               layout.itemO("mesh.edge_face_add")
+               layout.itemO("mesh.fill")
+               layout.itemO("mesh.beauty_fill")
+
+               layout.itemS()
+               
+               layout.itemO("mesh.quads_convert_to_tris")
+               layout.itemO("mesh.tris_convert_to_quads")
+               layout.itemO("mesh.edge_flip")
+               
+               layout.itemS()
+               
+               layout.itemO("mesh.faces_shade_smooth")
+               layout.itemO("mesh.faces_shade_flat")
+
+class VIEW3D_MT_edit_MESH_normals(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Normals"
+
+       def draw(self, context):
+               layout = self.layout
+
+               layout.itemO("mesh.normals_make_consistent", text="Recalculate 
Outside")
+               layout.item_booleanO("mesh.normals_make_consistent", "inside", 
True, text="Recalculate Inside")
+
+               layout.itemS()
+               
+               layout.itemO("mesh.flip_normals")
+               
+class VIEW3D_MT_edit_MESH_showhide(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Show/Hide"
+
+       def draw(self, context):
+               layout = self.layout
+
+               layout.itemO("mesh.reveal")
+               layout.itemO("mesh.hide")
+               layout.item_booleanO("mesh.hide", "unselected", True, 
text="Hide Unselected")
+
+# Edit CURVE
+
+# draw_CURVE is used by VIEW3D_MT_edit_CURVE and VIEW3D_MT_edit_SURFACE
+def draw_CURVE(self, context):
+       layout = self.layout
+       
+       settings = context.tool_settings
+
+       layout.itemM("VIEW3D_MT_edit_snap")
+       
+       layout.itemS()
+       
+       layout.itemO("curve.extrude")
+       layout.itemO("curve.duplicate")
+       layout.itemO("curve.separate")
+       layout.itemO("curve.make_segment")
+       layout.itemO("curve.cyclic_toggle")
+       layout.itemO("curve.delete")
+       
+       layout.itemS()
+       
+       layout.itemM("VIEW3D_MT_edit_CURVE_ctrlpoints")
+       layout.itemM("VIEW3D_MT_edit_CURVE_segments")
+       
+       layout.itemS()
+       
+       layout.itemR(settings, "proportional_editing")
+       layout.item_menu_enumR(settings, "proportional_editing_falloff")
+       
+       layout.itemS()
+       
+       layout.itemM("VIEW3D_MT_edit_CURVE_showhide")
+
+class VIEW3D_MT_edit_CURVE(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Curve"
+
+       draw = draw_CURVE
+       
+class VIEW3D_MT_edit_CURVE_ctrlpoints(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Control Points"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               edit_object = context.edit_object
+               
+               if edit_object.type == 'CURVE':
+                       layout.item_enumO("tfm.transform", "mode", 'TILT')
+                       layout.itemO("curve.tilt_clear")
+                       layout.itemO("curve.separate")
+                       
+                       layout.itemS()
+                       
+                       layout.item_menu_enumO("curve.handle_type_set", "type")
+               
+class VIEW3D_MT_edit_CURVE_segments(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Segments"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.itemO("curve.subdivide")
+               layout.itemO("curve.switch_direction")
+
+class VIEW3D_MT_edit_CURVE_showhide(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Show/Hide"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.itemO("curve.reveal")
+               layout.itemO("curve.hide")
+               layout.item_booleanO("curve.hide", "unselected", True, 
text="Hide Unselected")
+
+# Edit SURFACE
+class VIEW3D_MT_edit_SURFACE(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Surface"
+
+       draw = draw_CURVE
+
+# Edit TEXT
+class VIEW3D_MT_edit_TEXT(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Text"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.itemO("font.file_paste")
+               
+               layout.itemS()
+               
+               layout.itemM("VIEW3D_MT_edit_TEXT_chars")
+
+class VIEW3D_MT_edit_TEXT_chars(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Special Characters"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xA9'.decode(), text="Copyright|Alt C")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xAE'.decode(), text="Registered Trademark|Alt R")
+               
+               layout.itemS()
+               
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xB0'.decode(), text="Degree Sign|Alt G")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC3\x97'.decode(), text="Multiplication Sign|Alt x")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\x8A'.decode(), text="Circle|Alt .")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xB9'.decode(), text="Superscript 1|Alt 1")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xB2'.decode(), text="Superscript 2|Alt 2")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xB3'.decode(), text="Superscript 3|Alt 3")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xBB'.decode(), text="Double >>|Alt >")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xAB'.decode(), text="Double <<|Alt <")
+               layout.item_stringO("font.text_insert", "text", 
b'\xE2\x80\xB0'.decode(), text="Promillage|Alt %")
+               
+               layout.itemS()
+               
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xA4'.decode(), text="Dutch Florin|Alt F")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xA3'.decode(), text="British Pound|Alt L")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xA5'.decode(), text="Japanese Yen|Alt Y")
+               
+               layout.itemS()
+               
+               layout.item_stringO("font.text_insert", "text", 
b'\xC3\x9F'.decode(), text="German S|Alt S")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xBF'.decode(), text="Spanish Question Mark|Alt ?")
+               layout.item_stringO("font.text_insert", "text", 
b'\xC2\xA1'.decode(), text="Spanish Exclamation Mark|Alt !")
+
+# Edit META
+class VIEW3D_MT_edit_META(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Metaball"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               settings = context.tool_settings
+
+               layout.itemO("ed.undo")
+               layout.itemO("ed.redo")
+               
+               layout.itemS()
+               
+               layout.itemM("VIEW3D_MT_edit_snap")
+               
+               layout.itemS()
+               
+               layout.itemO("mball.delete_metaelems")
+               layout.itemO("mball.duplicate_metaelems")
+               
+               layout.itemS()
+               
+               layout.itemR(settings, "proportional_editing")
+               layout.item_menu_enumR(settings, "proportional_editing_falloff")
+               
+               layout.itemS()
+               
+               layout.itemM("VIEW3D_MT_edit_META_showhide")
+
+class VIEW3D_MT_edit_META_showhide(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Show/Hide"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               layout.itemO("mball.reveal_metaelems")
+               layout.itemO("mball.hide_metaelems")
+               layout.item_booleanO("mball.hide_metaelems", "unselected", 
True, text="Hide Unselected")
+
+# Edit LATTICE
+class VIEW3D_MT_edit_LATTICE(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Lattice"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               settings = context.tool_settings
+
+               layout.itemM("VIEW3D_MT_edit_snap")
+               
+               layout.itemS()
+               
+               layout.itemO("lattice.make_regular")
+               
+               layout.itemS()
+               
+               layout.itemR(settings, "proportional_editing")
+               layout.item_menu_enumR(settings, "proportional_editing_falloff")
+
+# Edit ARMATURE
+class VIEW3D_MT_edit_ARMATURE(bpy.types.Menu):

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs
  • [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22559] branches/blender2.5/blender: 2. 5 3DView: Thomas Dinges