[Bf-blender-cvs] [03957b9487d] blender2.8: 3D View: move shading and overlay settings into popovers.
Brecht Van Lommel
noreply at git.blender.org
Sun Apr 29 09:24:33 CEST 2018
Commit: 03957b9487d3ab6ee6e14fb8848d08ca97cd3d70
Author: Brecht Van Lommel
Date: Sun Apr 29 08:47:14 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB03957b9487d3ab6ee6e14fb8848d08ca97cd3d70
3D View: move shading and overlay settings into popovers.
* This is just moving buttons to get a bit closer to the intended design,
better naming and layout is needed.
* Popovers currently work best when the 3D view header is at the top, with
the most important settings nearest to the mouse. Open design question is
if we should flip (part of) the buttons if header is at the bottom.
* Another question is if selecintg a shading mode enum should immediately
close the popover since those are changed often, unlike the other settings
for which it seems more convenient to keep the popover open.
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/editors/space_view3d/view3d_header.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 4ccd8d37cf8..ed62aed2411 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -45,6 +45,9 @@ class VIEW3D_HT_header(Header):
# Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
row = layout
+ row.popover(space_type='VIEW_3D', region_type='UI', panel_type="VIEW3D_PT_shading", text="Shading")
+ row.popover(space_type='VIEW_3D', region_type='UI', panel_type="VIEW3D_PT_overlays", text="Overlay")
+
layout.template_header_3D()
if obj:
@@ -3513,16 +3516,61 @@ class VIEW3D_PT_view3d_name(Panel):
row.prop(bone, "name", text="")
-class VIEW3D_PT_view3d_display(Panel):
+class VIEW3D_PT_shading(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
- bl_label = "Display"
- bl_options = {'DEFAULT_CLOSED'}
+ bl_label = "Shading"
@classmethod
def poll(cls, context):
+ return False
+
+ def draw(self, context):
+ layout = self.layout
+
view = context.space_data
- return (view)
+
+ col = layout.column()
+ col.prop(view, "viewport_shade", expand=True)
+
+ if view.viewport_shade == 'SOLID':
+ col.separator()
+ col.row().prop(view, "viewport_lighting", expand=True)
+
+ if view.viewport_lighting == 'STUDIO':
+ # TODO: don't store these settings in the scene
+ scene = context.scene
+ props = scene.layer_properties['BLENDER_WORKBENCH']
+
+ col.separator()
+
+ sub = col.column()
+ sub.label(text="Left/Right:")
+ row = sub.row(align=True)
+ row.prop(props, "diffuse_light_x_neg", text="")
+ row.prop(props, "diffuse_light_x_pos", text="")
+
+ sub = col.column()
+ sub.label(text="Up/Down:")
+ row = sub.row(align=True)
+ row.prop(props, "diffuse_light_y_neg", text="")
+ row.prop(props, "diffuse_light_y_pos", text="")
+
+ sub = col.column()
+ sub.label(text="Front/Back:")
+ row = sub.row(align=True)
+ row.prop(props, "diffuse_light_z_neg", text="")
+ row.prop(props, "diffuse_light_z_pos", text="")
+
+
+class VIEW3D_PT_overlay(Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Overlay"
+
+ @classmethod
+ def poll(cls, context):
+ return False
def draw(self, context):
layout = self.layout
@@ -3531,7 +3579,9 @@ class VIEW3D_PT_view3d_display(Panel):
scene = context.scene
col = layout.column()
- col.prop(view, "show_only_render")
+ col.prop(view, "show_only_render", text="Show Overlays")
+ col.separator()
+
col.prop(view, "show_world")
if view.viewport_shade == "SOLID":
@@ -3569,20 +3619,32 @@ class VIEW3D_PT_view3d_display(Panel):
subsub.active = scene.unit_settings.system == 'NONE'
subsub.prop(view, "grid_subdivisions", text="Subdivisions")
- layout.separator()
- layout.operator("screen.region_quadview", text="Toggle Quad View")
+class VIEW3D_PT_quad_view(Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Quad View"
+ bl_options = {'DEFAULT_CLOSED'}
- if view.region_quadviews:
- region = view.region_quadviews[2]
- col = layout.column()
- col.prop(region, "lock_rotation")
- row = col.row()
- row.enabled = region.lock_rotation
- row.prop(region, "show_sync_view")
- row = col.row()
- row.enabled = region.lock_rotation and region.show_sync_view
- row.prop(region, "use_box_clip")
+ @classmethod
+ def poll(cls, context):
+ view = context.space_data
+ return view.region_quadviews
+
+ def draw(self, context):
+ layout = self.layout
+
+ view = context.space_data
+
+ region = view.region_quadviews[2]
+ col = layout.column()
+ col.prop(region, "lock_rotation")
+ row = col.row()
+ row.enabled = region.lock_rotation
+ row.prop(region, "show_sync_view")
+ row = col.row()
+ row.enabled = region.lock_rotation and region.show_sync_view
+ row.prop(region, "use_box_clip")
class VIEW3D_PT_view3d_stereo(Panel):
@@ -3990,12 +4052,14 @@ classes = (
VIEW3D_PT_view3d_properties,
VIEW3D_PT_view3d_cursor,
VIEW3D_PT_view3d_name,
- VIEW3D_PT_view3d_display,
+ VIEW3D_PT_quad_view,
VIEW3D_PT_view3d_stereo,
VIEW3D_PT_view3d_motion_tracking,
VIEW3D_PT_view3d_meshdisplay,
VIEW3D_PT_view3d_meshstatvis,
VIEW3D_PT_view3d_curvedisplay,
+ VIEW3D_PT_shading,
+ VIEW3D_PT_overlays,
VIEW3D_PT_transform_orientations,
VIEW3D_PT_context_properties,
)
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 6038a53f8a2..8f6f0b70fdc 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -303,12 +303,6 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* other buttons: */
UI_block_emboss_set(block, UI_EMBOSS);
- /* Draw type */
- uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- if (v3d->drawtype == OB_SOLID) {
- uiItemR(layout, &v3dptr, "viewport_lighting", 0, "", ICON_NONE);
- }
-
row = uiLayoutRow(layout, true);
uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (!ob || ELEM(ob->mode, OB_MODE_OBJECT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT)) {
More information about the Bf-blender-cvs
mailing list