UI:
authorNicholas Bishop <nicholasbishop@gmail.com>
Sat, 28 Nov 2009 22:35:56 +0000 (22:35 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Sat, 28 Nov 2009 22:35:56 +0000 (22:35 +0000)
* Started moving buttons out of the C 3dview header template and into the python UI script

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

index 751653d..72191e8 100644 (file)
@@ -31,6 +31,7 @@ class VIEW3D_HT_header(bpy.types.Header):
         mode_string = context.mode
         edit_object = context.edit_object
         object = context.active_object
+        toolsettings = context.scene.tool_settings
 
         row = layout.row(align=True)
         row.template_header()
@@ -55,6 +56,41 @@ class VIEW3D_HT_header(bpy.types.Header):
 
         layout.template_header_3D()
 
+        # Proportional editing
+        if object.mode in ('OBJECT', 'EDIT'):
+            row = layout.row(align=True)
+            row.prop(toolsettings, "proportional_editing", text="", icon_only=True)
+            if toolsettings.proportional_editing != 'DISABLED':
+                row.prop(toolsettings, "proportional_editing_falloff", text="", icon_only=True)
+
+        # Snap
+        row = layout.row(align=True)
+        row.prop(toolsettings, "snap", text="")
+        row.prop(toolsettings, "snap_element", text="", icon_only=True)
+        if toolsettings.snap_element != 'INCREMENT':
+            row.prop(toolsettings, "snap_target", text="", icon_only=True)
+            if object.mode == 'OBJECT':
+                row.prop(toolsettings, "snap_align_rotation", text="")
+        if toolsettings.snap_element == 'VOLUME':
+            row.prop(toolsettings, "snap_peel_object", text="")
+        elif toolsettings.snap_element == 'FACE':
+            row.prop(toolsettings, "snap_project", text="")
+
+        # OpenGL render
+        row = layout.row(align=True)
+        row.operator("screen.opengl_render", text="", icon='ICON_RENDER_STILL')
+        props = row.operator("screen.opengl_render", text="", icon='ICON_RENDER_ANIMATION')
+        props.animation = True
+
+        # Pose
+        if object.mode == 'POSE':
+            row = layout.row(align=True)
+            row.operator("pose.copy", text="", icon='ICON_COPYDOWN')
+            row.operator("pose.paste", text="", icon='ICON_PASTEDOWN')
+            props = row.operator("pose.paste", text="", icon='ICON_PASTEFLIPDOWN')
+            props.flipped = 1
+
+
 # ********** Menu **********
 
 # ********** Utilities **********
index bee5e63..74f08d2 100644 (file)
@@ -2058,39 +2058,4 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
        /* Occlude geometry */
        if(v3d->drawtype > OB_WIRE && ((ob && ob->mode & OB_MODE_PARTICLE_EDIT) || (obedit && (obedit->type == OB_MESH))))
                uiItemR(layout, "", 0, &v3dptr, "occlude_geometry", UI_ITEM_R_ICON_ONLY);
-       /* Proportional editing */
-       if((obedit == NULL || (obedit->type == OB_MESH || obedit->type == OB_CURVE || obedit->type == OB_SURF || obedit->type == OB_LATTICE)) || (ob && ob->mode & OB_MODE_PARTICLE_EDIT)) {
-               row= uiLayoutRow(layout, 1);
-               uiItemR(row, "", 0, &toolsptr, "proportional_editing", UI_ITEM_R_ICON_ONLY);
-               if(ts->proportional)
-                       uiItemR(row, "", 0, &toolsptr, "proportional_editing_falloff", UI_ITEM_R_ICON_ONLY);
-       }
-
-       /* Snap */
-       row= uiLayoutRow(layout, 1);
-       uiItemR(row, "", 0, &toolsptr, "snap", UI_ITEM_R_ICON_ONLY);
-       uiItemR(row, "", 0, &toolsptr, "snap_element", UI_ITEM_R_ICON_ONLY);
-
-       if(ts->snap_mode != SCE_SNAP_MODE_INCREMENT) {
-               uiItemR(row, "", 0, &toolsptr, "snap_target", UI_ITEM_R_ICON_ONLY);
-               if(v3d->modeselect == OB_MODE_OBJECT)
-                       uiItemR(row, "", 0, &toolsptr, "snap_align_rotation", UI_ITEM_R_ICON_ONLY);
-       }
-       if(ts->snap_mode == SCE_SNAP_MODE_VOLUME)
-               uiItemR(row, "", 0, &toolsptr, "snap_peel_object", UI_ITEM_R_ICON_ONLY);
-       else if(ts->snap_mode == SCE_SNAP_MODE_FACE)
-               uiItemR(row, "", 0, &toolsptr, "snap_project", UI_ITEM_R_ICON_ONLY);
-
-       /* OpenGL Render */
-       row= uiLayoutRow(layout, 1);
-       uiItemO(row, "", ICON_RENDER_STILL, "SCREEN_OT_opengl_render");
-       uiItemBooleanO(row, "", ICON_RENDER_ANIMATION, "SCREEN_OT_opengl_render", "animation", 1);
-               
-       if(ob && (ob->mode & OB_MODE_POSE)) {
-               row= uiLayoutRow(layout, 1);
-               uiItemO(row, "", ICON_COPYDOWN, "POSE_OT_copy");
-               uiItemO(row, "", ICON_PASTEDOWN, "POSE_OT_paste");
-               uiItemBooleanO(row, "", ICON_PASTEFLIPDOWN, "POSE_OT_paste", "flipped", 1);
-       }
 }