2.5 3DView Header:
authorThomas Dinges <blender@dingto.org>
Sun, 16 Aug 2009 12:52:57 +0000 (12:52 +0000)
committerThomas Dinges <blender@dingto.org>
Sun, 16 Aug 2009 12:52:57 +0000 (12:52 +0000)
* Sculpt Menu is now written in python.
* Select Menus are only for Object, Edit and Particle Mode, added code to check on that, fixed Console warnings.

* Fixed a typo in armature buttons, reported in IRC by "ebrain".

release/ui/buttons_data_armature.py
release/ui/space_view3d.py
source/blender/editors/space_view3d/view3d_header.c

index 6f467ee30da6ba22168a40d1e34f425902775ad8..681b8ba89544cd370d3f68131a2517f0a5aee623 100644 (file)
@@ -43,7 +43,7 @@ class DATA_PT_skeleton(DataButtonsPanel):
                col = split.column()
                col.itemR(arm, "rest_position")
                col.itemL(text="Deform:")
-               col.itemR(arm, "deform_vertexgroups", text="Vertes Groups")
+               col.itemR(arm, "deform_vertexgroups", text="Vertex Groups")
                col.itemR(arm, "deform_envelope", text="Envelopes")
                col.itemR(arm, "deform_quaternion", text="Quaternion")
                col.itemR(arm, "deform_bbone_rest", text="B-Bones Rest")
index 796c04dafbe25613bef38717fb6eb5b8991a06f4..20c949889e0c3d0d8ba2bb6eb471f84d45c26f15 100644 (file)
@@ -21,11 +21,14 @@ class VIEW3D_HT_header(bpy.types.Header):
                        row.itemM("VIEW3D_MT_view")
                        
                        # Select Menu
-                       if mode_string not in ('EDIT_TEXT', ):
+                       if mode_string not in ('EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE', 'PARTICLE'):
+                               # XXX: Particle Mode has Select Menu.
                                row.itemM("VIEW3D_MT_select_%s" % mode_string)
                        
                        if mode_string == 'OBJECT':
                                row.itemM("VIEW3D_MT_object")
+                       elif mode_string == 'SCULPT':
+                               row.itemM("VIEW3D_MT_sculpt")
 
                layout.template_header_3D()
 
@@ -461,6 +464,42 @@ class VIEW3D_MT_object_show(bpy.types.Menu):
                layout.itemO("object.restrictview_set")
                layout.item_booleanO("object.restrictview_set", "unselected", True, text="Hide Unselected")
 
+# ********** Sculpt menu **********    
+       
+class VIEW3D_MT_sculpt(bpy.types.Menu):
+       __space_type__ = "VIEW_3D"
+       __label__ = "Sculpt"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               sculpt = context.tool_settings.sculpt
+               brush = context.tool_settings.sculpt.brush
+               
+               layout.itemR(sculpt, "symmetry_x")
+               layout.itemR(sculpt, "symmetry_y")
+               layout.itemR(sculpt, "symmetry_z")
+               layout.itemS()
+               layout.itemR(sculpt, "lock_x")
+               layout.itemR(sculpt, "lock_y")
+               layout.itemR(sculpt, "lock_z")
+               layout.itemS()
+               layout.item_menu_enumO("brush.curve_preset", property="shape")
+               layout.itemS()
+               
+               if brush.sculpt_tool != 'GRAB':
+                       layout.itemR(brush, "airbrush")
+                       
+                       if brush.sculpt_tool != 'LAYER':
+                               layout.itemR(brush, "anchored")
+                       
+                       if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
+                               layout.itemR(brush, "flip_direction")
+
+                       if brush.sculpt_tool == 'LAYER':
+                               layout.itemR(brush, "persistent")
+                               layout.itemO("sculpt.set_persistent_base")
+
 # ********** Panel **********
 
 class VIEW3D_PT_3dview_properties(bpy.types.Panel):
@@ -589,6 +628,8 @@ bpy.types.register(VIEW3D_MT_object_group)
 bpy.types.register(VIEW3D_MT_object_constraints)
 bpy.types.register(VIEW3D_MT_object_show)
 
+bpy.types.register(VIEW3D_MT_sculpt) # Sculpt Menu
+
 bpy.types.register(VIEW3D_PT_3dview_properties) # Panels
 bpy.types.register(VIEW3D_PT_3dview_display)
 bpy.types.register(VIEW3D_PT_background_image)
index 2d6a3600f247da446a91ea43d67b2d4099fe47cd..e8a6f1b36ae29f4447ffdade4f1d6716f0a5ab33 100644 (file)
@@ -2933,91 +2933,6 @@ uiBlock *view3d_sculpt_inputmenu(bContext *C, ARegion *ar, void *arg_unused)
        return block;
 }
 
-static void view3d_sculpt_menu(bContext *C, uiLayout *layout, void *arg_unused)
-{
-       bScreen *sc= CTX_wm_screen(C);
-       Sculpt *s = CTX_data_tool_settings(C)->sculpt;
-       PointerRNA rna;
-
-       RNA_pointer_create(&sc->id, &RNA_Sculpt, s, &rna);
-
-       uiItemR(layout, NULL, 0, &rna, "symmetry_x", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "symmetry_y", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "symmetry_z", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "lock_x", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "lock_y", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "lock_z", 0, 0, 0);
-
-       /* Brush settings */
-       RNA_pointer_create(&sc->id, &RNA_Brush, s->brush, &rna);
-
-       /* Curve */
-       uiItemS(layout);
-       uiItemEnumO(layout, NULL, 0, "BRUSH_OT_curve_preset", "shape", BRUSH_PRESET_SHARP);
-       uiItemEnumO(layout, NULL, 0, "BRUSH_OT_curve_preset", "shape", BRUSH_PRESET_SMOOTH);
-       uiItemEnumO(layout, NULL, 0, "BRUSH_OT_curve_preset", "shape", BRUSH_PRESET_MAX);
-
-       uiItemS(layout);
-
-       uiItemR(layout, NULL, 0, &rna, "airbrush", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "rake", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "anchored", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "space", 0, 0, 0);
-       uiItemR(layout, NULL, 0, &rna, "smooth_stroke", 0, 0, 0);
-
-       uiItemR(layout, NULL, 0, &rna, "flip_direction", 0, 0, 0);
-}
-
-uiBlock *view3d_sculptmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-       ScrArea *sa= CTX_wm_area(C);
-       View3D *v3d= sa->spacedata.first;
-       uiBlock *block;
-       Sculpt *sd= CTX_data_tool_settings(C)->sculpt;
-// XXX const BrushData *br= sculptmode_brush();
-       short yco= 0, menuwidth= 120;
-       
-       block= uiBeginBlock(C, ar, "view3d_sculptmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_sculptmenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Sculpt Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBlockBut(block, view3d_sculpt_inputmenu, NULL, ICON_RIGHTARROW_THIN, "Input Settings", 0, yco-=20, 120, 19, "");
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_DRAW_BRUSH) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Display Brush", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-       uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_DRAW_FAST) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Partial Redraw", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-       if(v3d)
-               uiDefIconTextBut(block, BUTM, 1, (v3d->pivot_last ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Pivot Last", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
-
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Brush|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Strengthen Brush|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate Brush|Ctrl F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
-       
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       /* XXX uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==FLATTEN_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Flatten|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-       uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==LAYER_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Layer|L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-       uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==GRAB_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Grab|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-       uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==INFLATE_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Inflate|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-       uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==PINCH_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Pinch|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==SMOOTH_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Smooth|S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==DRAW_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Draw|D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");*/
-       
-
-       if(ar->alignment==RGN_ALIGN_TOP) {
-               uiBlockSetDirection(block, UI_DOWN);
-       }
-       else {
-               uiBlockSetDirection(block, UI_TOP);
-               uiBlockFlipOrder(block);
-       }
-
-       uiTextBoundsBlock(block, 50);
-
-       return block;
-}
-
 static void do_view3d_facesel_showhidemenu(bContext *C, void *arg, int event)
 {
 #if 0
@@ -3579,11 +3494,6 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
                uiDefPulldownBut(block, view3d_tpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, "");
                xco+= xmax;
        }
-       else if (ob && ob->mode & OB_MODE_SCULPT) {
-               xmax= GetButStringLength("Sculpt");
-               uiDefMenuBut(block, view3d_sculpt_menu, NULL, "Sculpt", xco, yco, xmax-3, 20, "");
-               xco+= xmax;
-       }
        else if (paint_facesel_test(ob)) {
                if (ob && ob->type == OB_MESH) {
                        xmax= GetButStringLength("Face");