From f6bbcaba6deb720522c685f8fdb895866e5c5e76 Mon Sep 17 00:00:00 2001 From: Jonas Holzman Date: Mon, 30 Dec 2024 00:40:07 +0100 Subject: [PATCH] UI: Improve Studio Lights Editor layout Improve the Studio Lights Editor Preferences panel by replacing the current column layout (which looks very horizontally compressed using the default Preferences window size) by a grid flow layout with boxes. Pull Request: https://projects.blender.org/blender/blender/pulls/132425 --- scripts/startup/bl_ui/space_userpref.py | 37 +++++++++---------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index 84a50003773..f8451af4ce0 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -2733,15 +2733,17 @@ class USERPREF_PT_studiolight_light_editor(StudioLightPanel, Panel): @staticmethod def opengl_light_buttons(layout, light): - col = layout.column() - col.active = light.use + box = col.box() + box.active = light.use - col.prop(light, "use", text="Use Light") - col.prop(light, "diffuse_color", text="Diffuse") - col.prop(light, "specular_color", text="Specular") - col.prop(light, "smooth") - col.prop(light, "direction") + box.prop(light, "use", text="Use Light") + box.prop(light, "diffuse_color", text="Diffuse") + box.prop(light, "specular_color", text="Specular") + box.prop(light, "smooth") + box.prop(light, "direction") + + col.separator() def draw(self, context): layout = self.layout @@ -2756,25 +2758,12 @@ class USERPREF_PT_studiolight_light_editor(StudioLightPanel, Panel): layout.separator() layout.use_property_split = True - column = layout.split() - column.active = system.use_studio_light_edit - light = system.solid_lights[0] - colsplit = column.split(factor=0.85) - self.opengl_light_buttons(colsplit, light) + flow = layout.grid_flow(row_major=True, columns=2, even_rows=True, even_columns=True) + flow.active = system.use_studio_light_edit - light = system.solid_lights[1] - colsplit = column.split(factor=0.85) - self.opengl_light_buttons(colsplit, light) - - light = system.solid_lights[2] - colsplit = column.split(factor=0.85) - self.opengl_light_buttons(colsplit, light) - - light = system.solid_lights[3] - self.opengl_light_buttons(column, light) - - layout.separator() + for i, light in enumerate(system.solid_lights): + self.opengl_light_buttons(flow, light) layout.prop(system, "light_ambient")