diff options
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/addon/engine.py | 4 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 43 | ||||
-rw-r--r-- | intern/cycles/blender/light.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/object.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/shader.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/sync.cpp | 14 |
6 files changed, 66 insertions, 3 deletions
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 48dd26cc622..b7713dc7110 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -228,6 +228,10 @@ def list_render_passes(scene, srl): else: yield (aov.name, "RGB", 'COLOR') + # Light groups. + for lightgroup in srl.lightgroups: + yield ("Combined_%s" % lightgroup.name, "RGB", 'COLOR') + def register_passes(engine, scene, view_layer): for name, channelids, channeltype in list_render_passes(scene, view_layer): diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index c86452e0a18..c97afa86fad 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -12,7 +12,7 @@ from bpy.types import Panel from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel from bl_ui.properties_render import draw_hair_settings -from bl_ui.properties_view_layer import ViewLayerCryptomattePanel, ViewLayerAOVPanel +from bl_ui.properties_view_layer import ViewLayerCryptomattePanel, ViewLayerAOVPanel, ViewLayerLightgroupsPanel class CyclesPresetPanel(PresetPanel, Panel): COMPAT_ENGINES = {'CYCLES'} @@ -883,6 +883,12 @@ class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, ViewLayerAOVPanel): bl_parent_id = "CYCLES_RENDER_PT_passes" +class CYCLES_RENDER_PT_passes_lightgroups(CyclesButtonsPanel, ViewLayerLightgroupsPanel): + bl_label = "Light Groups" + bl_context = "view_layer" + bl_parent_id = "CYCLES_RENDER_PT_passes" + + class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel): bl_label = "Post Processing" bl_options = {'DEFAULT_CLOSED'} @@ -1082,7 +1088,7 @@ class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel): return False ob = context.object - return ob and has_geometry_visibility(ob) and ob.type != 'LIGHT' + return ob and has_geometry_visibility(ob) def draw(self, context): pass @@ -1093,6 +1099,10 @@ class CYCLES_OBJECT_PT_shading_shadow_terminator(CyclesButtonsPanel, Panel): bl_parent_id = "CYCLES_OBJECT_PT_shading" bl_context = "object" + @classmethod + def poll(cls, context): + return context.object.type != 'LIGHT' + def draw(self, context): layout = self.layout layout.use_property_split = True @@ -1110,6 +1120,10 @@ class CYCLES_OBJECT_PT_shading_gi_approximation(CyclesButtonsPanel, Panel): bl_parent_id = "CYCLES_OBJECT_PT_shading" bl_context = "object" + @classmethod + def poll(cls, context): + return context.object.type != 'LIGHT' + def draw(self, context): layout = self.layout layout.use_property_split = True @@ -1132,7 +1146,7 @@ class CYCLES_OBJECT_PT_shading_caustics(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - return CyclesButtonsPanel.poll(context) and not use_metal(context) + return CyclesButtonsPanel.poll(context) and not use_metal(context) and context.object.type != 'LIGHT' def draw(self, context): layout = self.layout @@ -1147,6 +1161,23 @@ class CYCLES_OBJECT_PT_shading_caustics(CyclesButtonsPanel, Panel): col.prop(cob, "is_caustics_receiver") +class CYCLES_OBJECT_PT_lightgroup(CyclesButtonsPanel, Panel): + bl_label = "Light Group" + bl_parent_id = "CYCLES_OBJECT_PT_shading" + bl_context = "object" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + ob = context.object + + view_layer = context.view_layer + + col = layout.column(align=True) + col.prop_search(ob, "lightgroup", view_layer, "lightgroups", text="Light Group") + + class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel): bl_label = "Visibility" bl_context = "object" @@ -1399,10 +1430,14 @@ 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") + col = layout.column(align=True) + col.prop_search(world, "lightgroup", view_layer, "lightgroups", text="Light Group") + class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel): bl_label = "Volume" @@ -2209,6 +2244,7 @@ classes = ( CYCLES_RENDER_PT_passes_light, CYCLES_RENDER_PT_passes_crypto, CYCLES_RENDER_PT_passes_aov, + CYCLES_RENDER_PT_passes_lightgroups, CYCLES_RENDER_PT_filter, CYCLES_RENDER_PT_override, CYCLES_PT_post_processing, @@ -2220,6 +2256,7 @@ classes = ( CYCLES_OBJECT_PT_shading_shadow_terminator, CYCLES_OBJECT_PT_shading_gi_approximation, CYCLES_OBJECT_PT_shading_caustics, + CYCLES_OBJECT_PT_lightgroup, CYCLES_OBJECT_PT_visibility, CYCLES_OBJECT_PT_visibility_ray_visibility, CYCLES_OBJECT_PT_visibility_culling, diff --git a/intern/cycles/blender/light.cpp b/intern/cycles/blender/light.cpp index 04799443ceb..5359fa13505 100644 --- a/intern/cycles/blender/light.cpp +++ b/intern/cycles/blender/light.cpp @@ -143,6 +143,9 @@ void BlenderSync::sync_light(BL::Object &b_parent, light->set_use_scatter((visibility & PATH_RAY_VOLUME_SCATTER) != 0); light->set_is_shadow_catcher(b_ob_info.real_object.is_shadow_catcher()); + /* lightgroup */ + light->set_lightgroup(ustring(b_ob_info.real_object.lightgroup())); + /* tag */ light->tag_update(scene); } diff --git a/intern/cycles/blender/object.cpp b/intern/cycles/blender/object.cpp index 16a6b3454ed..d8f236e0641 100644 --- a/intern/cycles/blender/object.cpp +++ b/intern/cycles/blender/object.cpp @@ -343,6 +343,9 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph, object->set_random_id(hash_uint2(hash_string(object->name.c_str()), 0)); } + /* lightgroup */ + object->set_lightgroup(ustring(b_ob.lightgroup())); + object->tag_update(scene); } diff --git a/intern/cycles/blender/shader.cpp b/intern/cycles/blender/shader.cpp index 224cbea85f3..d3527567b96 100644 --- a/intern/cycles/blender/shader.cpp +++ b/intern/cycles/blender/shader.cpp @@ -1532,6 +1532,8 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, background->set_use_shader(view_layer.use_background_shader || viewport_parameters.use_custom_shader()); + background->set_lightgroup(ustring(b_world ? b_world.lightgroup() : "")); + background->tag_update(scene); } diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp index 8af2ee7a435..bd6bfafedeb 100644 --- a/intern/cycles/blender/sync.cpp +++ b/intern/cycles/blender/sync.cpp @@ -745,6 +745,20 @@ void BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_v } } + /* Light Group passes. */ + BL::ViewLayer::lightgroups_iterator b_lightgroup_iter; + for (b_view_layer.lightgroups.begin(b_lightgroup_iter); + b_lightgroup_iter != b_view_layer.lightgroups.end(); + ++b_lightgroup_iter) { + BL::Lightgroup b_lightgroup(*b_lightgroup_iter); + + string name = string_printf("Combined_%s", b_lightgroup.name().c_str()); + + b_engine.add_pass(name.c_str(), 3, "RGB", b_view_layer.name().c_str()); + Pass *pass = pass_add(scene, PASS_COMBINED, name.c_str(), PassMode::NOISY); + pass->set_lightgroup(ustring(b_lightgroup.name())); + } + scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold()); } |