3D View: add initial view.shading and view.overlay in RNA.

These are mostly empty still, many properties need to be renamed and moved there.
This commit is contained in:
2018-04-29 09:44:57 +02:00
parent 03957b9487
commit e017876f78
8 changed files with 118 additions and 55 deletions

View File

@@ -586,11 +586,11 @@ kmi.properties.nr = 9
kmi = km.keymap_items.new('view3d.layers', 'ZERO', 'PRESS', any=True)
kmi.properties.nr = 10
kmi = km.keymap_items.new('wm.context_toggle_enum', 'F3', 'PRESS')
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.data_path = 'space_data.shading.type'
kmi.properties.value_1 = 'SOLID'
kmi.properties.value_2 = 'WIREFRAME'
kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.data_path = 'space_data.shading.type'
kmi.properties.value_1 = 'SOLID'
kmi.properties.value_2 = 'TEXTURED'
kmi = km.keymap_items.new('view3d.select_or_deselect_all', 'SELECTMOUSE', 'CLICK')

View File

@@ -987,11 +987,11 @@ kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=
kmi.properties.type = 'ORBITDOWN'
kmi = km.keymap_items.new('view3d.localview', 'I', 'PRESS', shift=True)
kmi = km.keymap_items.new('wm.context_toggle_enum', 'FOUR', 'PRESS')
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.data_path = 'space_data.shading.type'
kmi.properties.value_1 = 'WIREFRAME'
kmi.properties.value_2 = 'WIREFRAME'
kmi = km.keymap_items.new('wm.context_toggle_enum', 'FIVE', 'PRESS')
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.data_path = 'space_data.shading.type'
kmi.properties.value_1 = 'TEXTURED'
kmi.properties.value_2 = 'SOLID'
kmi = km.keymap_items.new('view3d.select_or_deselect_all', 'SELECTMOUSE', 'CLICK')
@@ -1080,7 +1080,7 @@ kmi.properties.rotate = True
kmi = km.keymap_items.new('view3d.enable_manipulator', 'R', 'PRESS')
kmi.properties.scale = True
kmi = km.keymap_items.new('wm.context_toggle_enum', 'SIX', 'PRESS')
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.data_path = 'space_data.shading.type'
kmi.properties.value_1 = 'TEXTURED'
kmi.properties.value_2 = 'TEXTURED'
kmi = km.keymap_items.new('wm.context_set_enum', 'X', 'PRESS')

View File

@@ -34,6 +34,7 @@ class VIEW3D_HT_header(Header):
layout = self.layout
view = context.space_data
shading = view.shading
# mode_string = context.mode
obj = context.active_object
toolsettings = context.tool_settings
@@ -46,7 +47,7 @@ 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")
row.popover(space_type='VIEW_3D', region_type='UI', panel_type="VIEW3D_PT_overlay", text="Overlay")
layout.template_header_3D()
@@ -57,7 +58,7 @@ class VIEW3D_HT_header(Header):
row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
# Occlude geometry
if ((view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH'))) or
if ((shading.type not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH'))) or
(mode in {'WEIGHT_PAINT', 'VERTEX_PAINT'})):
row.prop(view, "use_occlude_geometry", text="")
@@ -3529,15 +3530,16 @@ class VIEW3D_PT_shading(Panel):
layout = self.layout
view = context.space_data
shading = view.shading
col = layout.column()
col.prop(view, "viewport_shade", expand=True)
col.prop(shading, "type", expand=True)
if view.viewport_shade == 'SOLID':
if shading.type == 'SOLID':
col.separator()
col.row().prop(view, "viewport_lighting", expand=True)
col.row().prop(shading, "light", expand=True)
if view.viewport_lighting == 'STUDIO':
if shading.light == 'STUDIO':
# TODO: don't store these settings in the scene
scene = context.scene
props = scene.layer_properties['BLENDER_WORKBENCH']
@@ -3576,15 +3578,17 @@ class VIEW3D_PT_overlay(Panel):
layout = self.layout
view = context.space_data
overlay = view.overlay
shading = view.shading
scene = context.scene
col = layout.column()
col.prop(view, "show_only_render", text="Show Overlays")
col.prop(overlay, "show_overlays")
col.separator()
col.prop(view, "show_world")
if view.viewport_shade == "SOLID":
if shading.type == "SOLID":
col.prop(view, "show_random_object_colors")
col.prop(view, "show_object_overlap")
@@ -3592,7 +3596,7 @@ class VIEW3D_PT_overlay(Panel):
col.prop(view, "show_mode_shade_override")
col = layout.column()
display_all = not view.show_only_render
display_all = overlay.show_overlays
col.active = display_all
col.prop(view, "show_outline_selected")
col.prop(view, "show_all_objects_origin")
@@ -4059,7 +4063,7 @@ classes = (
VIEW3D_PT_view3d_meshstatvis,
VIEW3D_PT_view3d_curvedisplay,
VIEW3D_PT_shading,
VIEW3D_PT_overlays,
VIEW3D_PT_overlay,
VIEW3D_PT_transform_orientations,
VIEW3D_PT_context_properties,
)