[Bf-blender-cvs] [81f24dd781d] blender2.8: UI: re-arrange object mode and 3D view buttons
Campbell Barton
noreply at git.blender.org
Tue Jun 12 21:10:35 CEST 2018
Commit: 81f24dd781d99a60a736c3155eb53704ef1ca63e
Author: Campbell Barton
Date: Tue Jun 12 21:06:54 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB81f24dd781d99a60a736c3155eb53704ef1ca63e
UI: re-arrange object mode and 3D view buttons
After some consideration we're moving 3D view settings
that impact the 3D view back.
See T55386 for details.
===================================================================
M release/scripts/startup/bl_ui/space_topbar.py
M release/scripts/startup/bl_ui/space_view3d.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 0126fcfc26a..54a68971612 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -90,20 +90,6 @@ class TOPBAR_HT_lower_bar(Header):
self.draw_center(context)
def draw_left(self, context):
- layout = self.layout
- layer = context.view_layer
- object = layer.objects.active
-
- # Object Mode
- # -----------
- object_mode = 'OBJECT' if object is None else object.mode
- act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[object_mode]
-
- layout.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon)
-
- layout.template_header_3D_mode()
-
- def draw_center(self, context):
layout = self.layout
mode = context.mode
@@ -143,6 +129,9 @@ class TOPBAR_HT_lower_bar(Header):
elif mode == 'PARTICLE':
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="")
+ def draw_center(self, context):
+ pass
+
def draw_right(self, context):
layout = self.layout
@@ -169,99 +158,6 @@ class TOPBAR_HT_lower_bar(Header):
elif mode == 'PARTICLE':
layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".particlemode", category="")
- # 3D View Options, tsk. maybe users aren't always using 3D view?
- toolsettings = context.tool_settings
- scene = context.scene
- obj = context.active_object
-
- object_mode = 'OBJECT' if obj is None else obj.mode
-
- # Pivot & Orientation
- pivot_point = context.tool_settings.transform_pivot_point
- act_pivot_point = bpy.types.ToolSettings.bl_rna.properties['transform_pivot_point'].enum_items[pivot_point]
-
- row = layout.row(align=True)
- row.popover(
- space_type='TOPBAR',
- region_type='HEADER',
- panel_type="TOPBAR_PT_pivot_point",
- icon=act_pivot_point.icon,
- text="",
- )
-
- if obj:
- # Proportional editing
- if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
- row = layout.row(align=True)
- row.prop(toolsettings, "proportional_edit", icon_only=True)
-
- sub = row.row(align=True)
- sub.active = toolsettings.proportional_edit != 'DISABLED'
- sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
-
- elif object_mode in {'EDIT', 'PARTICLE_EDIT'}:
- row = layout.row(align=True)
- row.prop(toolsettings, "proportional_edit", icon_only=True)
- sub = row.row(align=True)
- sub.active = toolsettings.proportional_edit != 'DISABLED'
- sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
-
- elif object_mode == 'OBJECT':
- row = layout.row(align=True)
- row.prop(toolsettings, "use_proportional_edit_objects", icon_only=True)
- sub = row.row(align=True)
- sub.active = toolsettings.use_proportional_edit_objects
- sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
- else:
- # Proportional editing
- if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
- row = layout.row(align=True)
- row.prop(toolsettings, "proportional_edit", icon_only=True)
- sub = row.row(align=True)
- sub.active = toolsettings.proportional_edit != 'DISABLED'
- sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
-
- # Snap
- show_snap = False
- if obj is None:
- show_snap = True
- else:
- if object_mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}:
- show_snap = True
- else:
-
- from .properties_paint_common import UnifiedPaintPanel
- paint_settings = UnifiedPaintPanel.paint_settings(context)
-
- if paint_settings:
- brush = paint_settings.brush
- if brush and brush.stroke_method == 'CURVE':
- show_snap = True
-
- if show_snap:
- snap_items = bpy.types.ToolSettings.bl_rna.properties['snap_elements'].enum_items
- for elem in toolsettings.snap_elements:
- # TODO: Display multiple icons.
- # (Currently only one of the enabled modes icons is displayed)
- icon = snap_items[elem].icon
- break
- else:
- icon = 'NONE'
-
- row = layout.row(align=True)
- row.prop(toolsettings, "use_snap", text="")
-
- sub = row.row(align=True)
- sub.popover(
- space_type='TOPBAR',
- region_type='HEADER',
- panel_type="TOPBAR_PT_snapping",
- icon=icon,
- text=""
- )
-
- layout.prop(scene, "transform_orientation", text="")
-
class _draw_left_context_mode:
@staticmethod
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 0f708ac350c..c97ae9b7eea 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -45,14 +45,11 @@ class VIEW3D_HT_header(Header):
mode = 'OBJECT' if obj is None else obj.mode
- # Testing move mode to topbar.
- '''
act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[mode]
layout.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon)
del act_mode_item
layout.template_header_3D_mode()
- '''
# Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
shading_type = view.shading.type
@@ -97,6 +94,90 @@ class VIEW3D_HT_header(Header):
layout.separator_spacer()
+ # Mode & Transform Settings
+ object_mode = 'OBJECT' if obj is None else obj.mode
+ scene = context.scene
+
+ # Pivot & Orientation
+ pivot_point = context.tool_settings.transform_pivot_point
+ act_pivot_point = bpy.types.ToolSettings.bl_rna.properties['transform_pivot_point'].enum_items[pivot_point]
+
+ if obj:
+ # Proportional editing
+ if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
+ row = layout.row(align=True)
+ row.prop(toolsettings, "proportional_edit", icon_only=True)
+
+ sub = row.row(align=True)
+ sub.active = toolsettings.proportional_edit != 'DISABLED'
+ sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
+
+ elif object_mode in {'EDIT', 'PARTICLE_EDIT'}:
+ row = layout.row(align=True)
+ row.prop(toolsettings, "proportional_edit", icon_only=True)
+ sub = row.row(align=True)
+ sub.active = toolsettings.proportional_edit != 'DISABLED'
+ sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
+
+ elif object_mode == 'OBJECT':
+ row = layout.row(align=True)
+ row.prop(toolsettings, "use_proportional_edit_objects", icon_only=True)
+ sub = row.row(align=True)
+ sub.active = toolsettings.use_proportional_edit_objects
+ sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
+ else:
+ # Proportional editing
+ if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
+ row = layout.row(align=True)
+ row.prop(toolsettings, "proportional_edit", icon_only=True)
+ sub = row.row(align=True)
+ sub.active = toolsettings.proportional_edit != 'DISABLED'
+ sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
+
+ # Snap
+ show_snap = False
+ if obj is None:
+ show_snap = True
+ else:
+ if object_mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}:
+ show_snap = True
+ else:
+
+ from .properties_paint_common import UnifiedPaintPanel
+ paint_settings = UnifiedPaintPanel.paint_settings(context)
+
+ if paint_settings:
+ brush = paint_settings.brush
+ if brush and brush.stroke_method == 'CURVE':
+ show_snap = True
+
+ if show_snap:
+ snap_items = bpy.types.ToolSettings.bl_rna.properties['snap_elements'].enum_items
+ for elem in toolsettings.snap_elements:
+ # TODO: Display multiple icons.
+ # (Currently only one of the enabled modes icons is displayed)
+ icon = snap_items[elem].icon
+ break
+ else:
+ icon = 'NONE'
+
+ row = layout.row(align=True)
+ row.prop(toolsettings, "use_snap", text="")
+
+ sub = row.row(align=True)
+ sub.popover(
+ space_type='TOPBAR',
+ region_type='HEADER',
+ panel_type="TOPBAR_PT_snapping",
+ icon=icon,
+ text=""
+ )
+
+ layout.prop(scene, "transform_orientation", text="")
+
+ layout.separator()
+
+ # Viewport Settings
row = layout.row(align=True)
row.prop(shading, "type", text="", expand=True)
@@ -126,54 +207,56 @@ class VIEW3D_MT_editor_menus(Menu):
edit_object = context.edit_object
gp_edit = context.gpencil_data and context.gpencil_data.use_stroke_edit_mode
- layout.menu("VIEW3D_MT_view")
+ # Use ali
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list