From 0b47d08ef665898c84ca30a1ba2ecc0076a757d1 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 20 May 2019 13:42:16 +0200 Subject: UI: integrate Cycles ray visibility and culling in new Visibility panel --- intern/cycles/blender/addon/ui.py | 68 ++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 22 deletions(-) (limited to 'intern') diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 5a7c798f7e3..a49efb3567f 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1172,27 +1172,53 @@ class CYCLES_OBJECT_PT_motion_blur(CyclesButtonsPanel, Panel): row.prop(cob, "motion_steps", text="Steps") -class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel): - bl_label = "Cycles Settings" +def has_geometry_visibility(ob): + return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or + (ob.instance_type == 'COLLECTION' and ob.instance_collection)) + + +class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel): + bl_label = "Visibility" bl_context = "object" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): - ob = context.object - return (CyclesButtonsPanel.poll(context) and - ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or - (ob.instance_type == 'COLLECTION' and ob.instance_collection))) + return CyclesButtonsPanel.poll(context) and (context.object) def draw(self, context): - pass + layout = self.layout + layout.use_property_split = True + + flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) + layout = self.layout + ob = context.object + + col = flow.column() + col.prop(ob, "hide_viewport", text="Show in Viewports", invert_checkbox=True) + col = flow.column() + col.prop(ob, "hide_render", text="Show in Renders", invert_checkbox=True) + col = flow.column() + col.prop(ob, "hide_select", text="Selectable", invert_checkbox=True) + + if has_geometry_visibility(ob): + cob = ob.cycles + col = flow.column() + col.prop(cob, "is_shadow_catcher") + col = flow.column() + col.prop(cob, "is_holdout") -class CYCLES_OBJECT_PT_cycles_settings_ray_visibility(CyclesButtonsPanel, Panel): +class CYCLES_OBJECT_PT_visibility_ray_visibility(CyclesButtonsPanel, Panel): bl_label = "Ray Visibility" - bl_parent_id = "CYCLES_OBJECT_PT_cycles_settings" + bl_parent_id = "CYCLES_OBJECT_PT_visibility" bl_context = "object" + @classmethod + def poll(cls, context): + ob = context.object + return CyclesButtonsPanel.poll(context) and has_geometry_visibility(ob) + def draw(self, context): layout = self.layout layout.use_property_split = True @@ -1222,19 +1248,16 @@ class CYCLES_OBJECT_PT_cycles_settings_ray_visibility(CyclesButtonsPanel, Panel) layout.separator() - flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) - col = flow.column() - col.prop(cob, "is_shadow_catcher") - col = flow.column() - col.prop(cob, "is_holdout") - - -class CYCLES_OBJECT_PT_cycles_settings_performance(CyclesButtonsPanel, Panel): - bl_label = "Performance" - bl_parent_id = "CYCLES_OBJECT_PT_cycles_settings" +class CYCLES_OBJECT_PT_visibility_culling(CyclesButtonsPanel, Panel): + bl_label = "Culling" + bl_parent_id = "CYCLES_OBJECT_PT_visibility" bl_context = "object" + @classmethod + def poll(cls, context): + ob = context.object + return CyclesButtonsPanel.poll(context) and has_geometry_visibility(ob) def draw(self, context): layout = self.layout @@ -2073,6 +2096,7 @@ def get_panels(): 'MATERIAL_PT_preview', 'NODE_DATA_PT_light', 'NODE_DATA_PT_spot', + 'OBJECT_PT_visibility', 'VIEWLAYER_PT_filter', 'VIEWLAYER_PT_layer_passes', 'RENDER_PT_post_processing', @@ -2129,9 +2153,9 @@ classes = ( CYCLES_CAMERA_PT_dof_aperture, CYCLES_PT_context_material, CYCLES_OBJECT_PT_motion_blur, - CYCLES_OBJECT_PT_cycles_settings, - CYCLES_OBJECT_PT_cycles_settings_ray_visibility, - CYCLES_OBJECT_PT_cycles_settings_performance, + CYCLES_OBJECT_PT_visibility, + CYCLES_OBJECT_PT_visibility_ray_visibility, + CYCLES_OBJECT_PT_visibility_culling, CYCLES_LIGHT_PT_preview, CYCLES_LIGHT_PT_light, CYCLES_LIGHT_PT_nodes, -- cgit v1.2.3