UI: improve light probe properties layout
authorWilliam Reynish <billrey@me.com>
Mon, 18 Feb 2019 03:10:07 +0000 (14:10 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 18 Feb 2019 03:12:22 +0000 (14:12 +1100)
Smaller adjustments to the Light Probe properties layout.

- Correctly use alignment for multi-property values.
- Correctly use sub-panels.
- Correctly use PROP_FACTOR for visibility_bleed_bias and
  visibility_blur.

release/scripts/startup/bl_ui/properties_data_lightprobe.py
source/blender/makesrna/intern/rna_lightprobe.c

index 527cdf3..0502ccd 100644 (file)
@@ -68,11 +68,10 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
             col.prop(probe, "falloff")
             col.prop(probe, "intensity")
 
-            col.separator()
-
-            col.prop(probe, "grid_resolution_x", text="Resolution X")
-            col.prop(probe, "grid_resolution_y", text="Y")
-            col.prop(probe, "grid_resolution_z", text="Z")
+            sub = col.column(align=True)
+            sub.prop(probe, "grid_resolution_x", text="Resolution X")
+            sub.prop(probe, "grid_resolution_y", text="Y")
+            sub.prop(probe, "grid_resolution_z", text="Z")
 
         elif probe.type == 'PLANAR':
             col = layout.column()
@@ -90,8 +89,7 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
             col.prop(probe, "falloff")
             col.prop(probe, "intensity")
 
-        col = layout.column()
-        sub = col.column()
+        sub = col.column(align=True)
         if probe.type != 'PLANAR':
             sub.prop(probe, "clip_start", text="Clipping Start")
         else:
@@ -100,15 +98,25 @@ class DATA_PT_lightprobe(DataButtonsPanel, Panel):
         if probe.type != 'PLANAR':
             sub.prop(probe, "clip_end", text="End")
 
+
+class DATA_PT_lightprobe_visibility(DataButtonsPanel, Panel):
+    bl_label = "Visibility"
+    bl_parent_id = "DATA_PT_lightprobe"
+    COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_RENDER'}
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        probe = context.lightprobe
+
+        col = layout.column()
+
         if probe.type == 'GRID':
-            col.separator()
-            col.label(text="Visibility")
             col.prop(probe, "visibility_buffer_bias", text="Bias")
             col.prop(probe, "visibility_bleed_bias", text="Bleed Bias")
             col.prop(probe, "visibility_blur", text="Blur")
 
-        col.separator()
-
         row = col.row(align=True)
         row.prop(probe, "visibility_collection")
         row.prop(probe, "invert_visibility_collection", text="", icon='ARROW_LEFTRIGHT')
@@ -176,6 +184,7 @@ class DATA_PT_lightprobe_display(DataButtonsPanel, Panel):
 classes = (
     DATA_PT_context_lightprobe,
     DATA_PT_lightprobe,
+    DATA_PT_lightprobe_visibility,
     DATA_PT_lightprobe_parallax,
     DATA_PT_lightprobe_display,
 )
index 1638501..427ce36 100644 (file)
@@ -171,14 +171,14 @@ static void rna_def_lightprobe(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Visibility Bias", "Bias for reducing self shadowing");
        RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
 
-       prop = RNA_def_property(srna, "visibility_bleed_bias", PROP_FLOAT, PROP_NONE);
+       prop = RNA_def_property(srna, "visibility_bleed_bias", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, NULL, "vis_bleedbias");
        RNA_def_property_float_default(prop, 0.0f);
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Visibility Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
        RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
 
-       prop = RNA_def_property(srna, "visibility_blur", PROP_FLOAT, PROP_NONE);
+       prop = RNA_def_property(srna, "visibility_blur", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, NULL, "vis_blur");
        RNA_def_property_float_default(prop, 0.2f);
        RNA_def_property_range(prop, 0.0f, 1.0f);