[Bf-blender-cvs] [3f114cd2298] vr_scene_inspection: Revert changes to generalize 3D View Shading options button layout

Julian Eisel noreply at git.blender.org
Tue Mar 17 16:38:26 CET 2020


Commit: 3f114cd2298166c6f02f08ee017605ed3ddc5dba
Author: Julian Eisel
Date:   Tue Mar 17 16:36:34 2020 +0100
Branches: vr_scene_inspection
https://developer.blender.org/rB3f114cd2298166c6f02f08ee017605ed3ddc5dba

Revert changes to generalize 3D View Shading options button layout

===================================================================

M	release/scripts/startup/bl_ui/properties_render.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/startup/bl_ui/utils.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 80a278b1562..fa9778da53b 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -19,13 +19,13 @@
 
 # <pep8 compliant>
 from bpy.types import Panel
+from bl_ui.space_view3d import (
+    VIEW3D_PT_shading_lighting,
+    VIEW3D_PT_shading_color,
+    VIEW3D_PT_shading_options,
+)
 
 from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel
-from bl_ui.utils import (
-    View3DShadingLightingLayout,
-    View3DShadingColorLayout,
-    View3DShadingOptionsLayout,
-)
 
 
 class RenderButtonsPanel:
@@ -579,7 +579,7 @@ class RENDER_PT_opengl_film(RenderButtonsPanel, Panel):
 
 
 class RENDER_PT_opengl_lighting(RenderButtonsPanel, Panel):
-    bl_label = View3DShadingLightingLayout.bl_label
+    bl_label = "Lighting"
     COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
 
     @classmethod
@@ -587,12 +587,11 @@ class RENDER_PT_opengl_lighting(RenderButtonsPanel, Panel):
         return (context.engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
-        shading = context.scene.display.shading
-        View3DShadingLightingLayout.draw(context, shading, self.layout)
+        VIEW3D_PT_shading_lighting.draw(self, context)
 
 
 class RENDER_PT_opengl_color(RenderButtonsPanel, Panel):
-    bl_label = View3DShadingLightingLayout.bl_label
+    bl_label = "Color"
     COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
 
     @classmethod
@@ -600,12 +599,11 @@ class RENDER_PT_opengl_color(RenderButtonsPanel, Panel):
         return (context.engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
-        shading = context.scene.display.shading
-        View3DShadingColorLayout._draw_color_type(shading, self.layout)
+        VIEW3D_PT_shading_color._draw_color_type(self, context)
 
 
 class RENDER_PT_opengl_options(RenderButtonsPanel, Panel):
-    bl_label = View3DShadingOptionsLayout.bl_label
+    bl_label = "Options"
     COMPAT_ENGINES = {'BLENDER_WORKBENCH'}
 
     @classmethod
@@ -613,8 +611,7 @@ class RENDER_PT_opengl_options(RenderButtonsPanel, Panel):
         return (context.engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
-        shading = context.scene.display.shading
-        View3DShadingOptionsLayout.draw(context, shading, self.layout)
+        VIEW3D_PT_shading_options.draw(self, context)
 
 
 class RENDER_PT_simplify(RenderButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index b60df161a40..f8b291c0c5f 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -36,13 +36,6 @@ from bl_ui.properties_grease_pencil_common import (
 from bl_ui.space_toolsystem_common import (
     ToolActivePanelHelper,
 )
-from bl_ui.utils import (
-    View3DShadingLayout,
-    View3DShadingLightingLayout,
-    View3DShadingColorLayout,
-    View3DShadingOptionsLayout,
-    View3DShadingRenderPassLayout,
-)
 from bpy.app.translations import contexts as i18n_contexts
 
 
@@ -5471,59 +5464,263 @@ class VIEW3D_PT_object_type_visibility(Panel):
 class VIEW3D_PT_shading(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
-    bl_label = View3DShadingLayout.bl_label
+    bl_label = "Shading"
     bl_ui_units_x = 12
 
+    @classmethod
+    def get_shading(cls, context):
+        # Get settings from 3D viewport or OpenGL render engine
+        view = context.space_data
+        if view.type == 'VIEW_3D':
+            return view.shading
+        else:
+            return context.scene.display.shading
+
     def draw(self, _context):
-        View3DShadingLayout.draw(self.layout)
+        layout = self.layout
+        layout.label(text="Viewport Shading")
 
 
 class VIEW3D_PT_shading_lighting(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
-    bl_label = View3DShadingLightingLayout.bl_label
+    bl_label = "Lighting"
     bl_parent_id = 'VIEW3D_PT_shading'
 
     @classmethod
     def poll(cls, context):
-        shading = context.space_data.shading
-        return View3DShadingLightingLayout.poll(context, shading)
+        shading = VIEW3D_PT_shading.get_shading(context)
+        engine = context.scene.render.engine
+        return shading.type in {'SOLID', 'MATERIAL'} or engine == 'BLENDER_EEVEE' and shading.type == 'RENDERED'
 
     def draw(self, context):
-        shading = context.space_data.shading
-        View3DShadingLightingLayout.draw(context, shading, self.layout)
+        layout = self.layout
+        shading = VIEW3D_PT_shading.get_shading(context)
+
+        col = layout.column()
+        split = col.split(factor=0.9)
+
+        if shading.type == 'SOLID':
+            split.row().prop(shading, "light", expand=True)
+            col = split.column()
+
+            split = layout.split(factor=0.9)
+            col = split.column()
+            sub = col.row()
+
+            if shading.light == 'STUDIO':
+                prefs = context.preferences
+                system = prefs.system
+
+                if not system.use_studio_light_edit:
+                    sub.scale_y = 0.6  # smaller studiolight preview
+                    sub.template_icon_view(shading, "studio_light", scale_popup=3.0)
+                else:
+                    sub.prop(
+                        system,
+                        "use_studio_light_edit",
+                        text="Disable Studio Light Edit",
+                        icon='NONE',
+                        toggle=True,
+                    )
+
+                col = split.column()
+                col.operator("preferences.studiolight_show", emboss=False, text="", icon='PREFERENCES')
+
+                split = layout.split(factor=0.9)
+                col = split.column()
+
+                row = col.row()
+                row.prop(shading, "use_world_space_lighting", text="", icon='WORLD', toggle=True)
+                row = row.row()
+                row.active = shading.use_world_space_lighting
+                row.prop(shading, "studiolight_rotate_z", text="Rotation")
+                col = split.column()  # to align properly with above
+
+            elif shading.light == 'MATCAP':
+                sub.scale_y = 0.6  # smaller matcap preview
+                sub.template_icon_view(shading, "studio_light", scale_popup=3.0)
+
+                col = split.column()
+                col.operator("preferences.studiolight_show", emboss=False, text="", icon='PREFERENCES')
+                col.operator("view3d.toggle_matcap_flip", emboss=False, text="", icon='ARROW_LEFTRIGHT')
+
+        elif shading.type == 'MATERIAL':
+            col.prop(shading, "use_scene_lights")
+            col.prop(shading, "use_scene_world")
+            col = layout.column()
+            split = col.split(factor=0.9)
+
+            if not shading.use_scene_world:
+                col = split.column()
+                sub = col.row()
+                sub.scale_y = 0.6
+                sub.template_icon_view(shading, "studio_light", scale_popup=3)
+
+                col = split.column()
+                col.operator("preferences.studiolight_show", emboss=False, text="", icon='PREFERENCES')
+
+                split = layout.split(factor=0.9)
+                col = split.column()
+                col.prop(shading, "studiolight_rotate_z", text="Rotation")
+                col.prop(shading, "studiolight_intensity")
+                col.prop(shading, "studiolight_background_alpha")
+                col.prop(shading, "studiolight_background_blur")
+                col = split.column()  # to align properly with above
+
+        elif shading.type == 'RENDERED':
+            col.prop(shading, "use_scene_lights_render")
+            col.prop(shading, "use_scene_world_render")
+
+            if not shading.use_scene_world_render:
+                col = layout.column()
+                split = col.split(factor=0.9)
+
+                col = split.column()
+                sub = col.row()
+                sub.scale_y = 0.6
+                sub.template_icon_view(shading, "studio_light", scale_popup=3)
+
+                col = split.column()
+                col.operator("preferences.studiolight_show", emboss=False, text="", icon='PREFERENCES')
+
+                split = layout.split(factor=0.9)
+                col = split.column()
+                col.prop(shading, "studiolight_rotate_z", text="Rotation")
+                col.prop(shading, "studiolight_intensity")
+                col.prop(shading, "studiolight_background_alpha")
+                col.prop(shading, "studiolight_background_blur")
+                col = split.column()  # to align properly with above
 
 
 class VIEW3D_PT_shading_color(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
-    bl_label = View3DShadingColorLayout.bl_label
+    bl_label = "Color"
     bl_parent_id = 'VIEW3D_PT_shading'
 
     @classmethod
     def poll(cls, context):
-        shading = context.space_data.shading
-        return View3DShadingColorLayout.poll(context, shading)
+        shading = VIEW3D_PT_shading.get_shading(context)
+        return shading.type in {'WIREFRAME', 'SOLID'}
+
+    def _draw_color_type(self, context):
+        layout = self.layout
+        shading = VIEW3D_PT_shading.get_shading(context)
+
+        layout.grid_flow(columns=3, align=True).prop(shading, "color_type", expand=True)
+        if shading.color_type == 'SINGLE':
+            layout.row().prop(shading, "single_color", text="")
+
+    def _draw_background_color(self, context):
+        layout = self.layout
+        shading = VIEW3D_PT_shading.get_shading(context)
+
+        layout.row().label(text="Background")
+        layout.row().prop(shading, "background_type", expand=True)
+        if shading.background_type == 'VIEWPORT':
+            layout.row().prop(shading, "background_color", text="")
 
     def draw(self, context):
-        shading = context.space_data.shading
-        View3DShadingColorLayout.draw(context, shading, self.layout)
+        shading = VIEW3D_PT_shading.get_shading(context)
+        if shading.type == '

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list