diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2022-04-08 03:19:55 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2022-04-10 19:45:16 +0300 |
commit | 2e77a8f9748fdf6311b6956d299e76cf05e6823d (patch) | |
tree | 963033628e315577f5b7dfab2de8a22493c9ba8c /release | |
parent | 0b05e0b97e4b556ce87dd659a3786be53f89e4e5 (diff) |
Render: Add operators to add all used or remove all unused lightgroups
These operators build a list of all lightgroups that are used by the view layer's
scene and either add all used lightgroups that are not part of the view layer yet
or remove all lightgroups in the view layer that are not being used.
Differential Revision: https://developer.blender.org/D14596
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_view_layer.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py index 83e797583ad..44d764f1a2d 100644 --- a/release/scripts/startup/bl_ui/properties_view_layer.py +++ b/release/scripts/startup/bl_ui/properties_view_layer.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # <pep8 compliant> -from bpy.types import Panel, UIList +from bpy.types import Menu, Panel, UIList class VIEWLAYER_UL_aov(UIList): @@ -138,7 +138,7 @@ class ViewLayerAOVPanel(ViewLayerButtonsPanel, Panel): row = layout.row() col = row.column() col.template_list("VIEWLAYER_UL_aov", "aovs", view_layer, - "aovs", view_layer, "active_aov_index", rows=2) + "aovs", view_layer, "active_aov_index", rows=3) col = row.column() sub = col.column(align=True) @@ -187,6 +187,16 @@ class VIEWLAYER_PT_layer_passes_cryptomatte(ViewLayerCryptomattePanel, Panel): COMPAT_ENGINES = {'BLENDER_EEVEE'} +class VIEWLAYER_MT_lightgroup_sync(Menu): + bl_label = "Lightgroup Sync" + + def draw(self, _context): + layout = self.layout + + layout.operator("scene.view_layer_add_used_lightgroups", icon='ADD') + layout.operator("scene.view_layer_remove_unused_lightgroups", icon='REMOVE') + + class ViewLayerLightgroupsPanel(ViewLayerButtonsPanel, Panel): bl_label = "Light Groups" @@ -201,12 +211,14 @@ class ViewLayerLightgroupsPanel(ViewLayerButtonsPanel, Panel): row = layout.row() col = row.column() col.template_list("UI_UL_list", "lightgroups", view_layer, - "lightgroups", view_layer, "active_lightgroup_index", rows=2) + "lightgroups", view_layer, "active_lightgroup_index", rows=3) col = row.column() sub = col.column(align=True) sub.operator("scene.view_layer_add_lightgroup", icon='ADD', text="") sub.operator("scene.view_layer_remove_lightgroup", icon='REMOVE', text="") + sub.separator() + sub.menu("VIEWLAYER_MT_lightgroup_sync", icon='DOWNARROW_HLT', text="") class VIEWLAYER_PT_layer_passes_lightgroups(ViewLayerLightgroupsPanel): @@ -215,6 +227,7 @@ class VIEWLAYER_PT_layer_passes_lightgroups(ViewLayerLightgroupsPanel): classes = ( + VIEWLAYER_MT_lightgroup_sync, VIEWLAYER_PT_layer, VIEWLAYER_PT_layer_passes, VIEWLAYER_PT_eevee_layer_passes_data, |