[Bf-blender-cvs] [f11dba88923] blender-v3.2-release: Fix Cycles world light group confusing UI

Brecht Van Lommel noreply at git.blender.org
Wed May 4 21:24:09 CEST 2022


Commit: f11dba88923f1710ef35eef61ea297800f718ce9
Author: Brecht Van Lommel
Date:   Wed May 4 21:20:17 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBf11dba88923f1710ef35eef61ea297800f718ce9

Fix Cycles world light group confusing UI

Move to a subpanel of the Settings panel. Otherwise it seems like it's a
setting of one of the shader nodes.

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

M	intern/cycles/blender/addon/ui.py

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

diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 131b849a094..886f5345020 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1446,28 +1446,10 @@ class CYCLES_WORLD_PT_surface(CyclesButtonsPanel, Panel):
         layout.use_property_split = True
 
         world = context.world
-        view_layer = context.view_layer
 
         if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
             layout.prop(world, "color")
 
-        row = layout.row(align=True)
-        row.use_property_decorate = False
-
-        sub = row.column(align=True)
-        sub.prop_search(
-            world,
-            "lightgroup",
-            view_layer,
-            "lightgroups",
-            text="Light Group",
-            results_are_suggestions=True,
-        )
-
-        sub = row.column(align=True)
-        sub.active = bool(world.lightgroup) and not any(lg.name == world.lightgroup for lg in view_layer.lightgroups)
-        sub.operator("scene.view_layer_add_lightgroup", icon='ADD', text="").name = world.lightgroup
-
 
 class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel):
     bl_label = "Volume"
@@ -1616,6 +1598,40 @@ class CYCLES_WORLD_PT_settings_volume(CyclesButtonsPanel, Panel):
         sub.prop(cworld, "volume_step_size")
 
 
+class CYCLES_WORLD_PT_settings_light_group(CyclesButtonsPanel, Panel):
+    bl_label = "Light Group"
+    bl_parent_id = "CYCLES_WORLD_PT_settings"
+    bl_context = "world"
+
+    @classmethod
+    def poll(cls, context):
+        return context.world and CyclesButtonsPanel.poll(context)
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+        layout.use_property_decorate = False
+
+        world = context.world
+        view_layer = context.view_layer
+
+        row = layout.row(align=True)
+
+        sub = row.column(align=True)
+        sub.prop_search(
+            world,
+            "lightgroup",
+            view_layer,
+            "lightgroups",
+            text="Light Group",
+            results_are_suggestions=True,
+        )
+
+        sub = row.column(align=True)
+        sub.active = bool(world.lightgroup) and not any(lg.name == world.lightgroup for lg in view_layer.lightgroups)
+        sub.operator("scene.view_layer_add_lightgroup", icon='ADD', text="").name = world.lightgroup
+
+
 class CYCLES_MATERIAL_PT_preview(CyclesButtonsPanel, Panel):
     bl_label = "Preview"
     bl_context = "material"
@@ -2308,6 +2324,7 @@ classes = (
     CYCLES_WORLD_PT_settings,
     CYCLES_WORLD_PT_settings_surface,
     CYCLES_WORLD_PT_settings_volume,
+    CYCLES_WORLD_PT_settings_light_group,
     CYCLES_MATERIAL_PT_preview,
     CYCLES_MATERIAL_PT_surface,
     CYCLES_MATERIAL_PT_volume,



More information about the Bf-blender-cvs mailing list