[Bf-blender-cvs] [0b47d08ef66] master: UI: integrate Cycles ray visibility and culling in new Visibility panel

Brecht Van Lommel noreply at git.blender.org
Mon May 20 13:48:45 CEST 2019


Commit: 0b47d08ef665898c84ca30a1ba2ecc0076a757d1
Author: Brecht Van Lommel
Date:   Mon May 20 13:42:16 2019 +0200
Branches: master
https://developer.blender.org/rB0b47d08ef665898c84ca30a1ba2ecc0076a757d1

UI: integrate Cycles ray visibility and culling in new Visibility panel

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

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

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

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,



More information about the Bf-blender-cvs mailing list