From f8a51ea60a533bd8158d93bd0ef394a61fc96a85 Mon Sep 17 00:00:00 2001
From: Jesse Yurkovich <jesse.y@gmail.com>
Date: Mon, 29 Nov 2021 12:04:22 -0800
Subject: [PATCH] Fix T93391: Update BoolTool addon for visibility breaking
 change

The visibility settings were moved from Object.cycles_visibility.setting
to Object.setting in August. However, some addons like bool tool were
not updated to account for this.

Differential Revision: https://developer.blender.org/D13375
---
 object_boolean_tools.py | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/object_boolean_tools.py b/object_boolean_tools.py
index 3000f5885..05a9cf23d 100644
--- a/object_boolean_tools.py
+++ b/object_boolean_tools.py
@@ -80,18 +80,13 @@ def isBrush(_obj):
 #         return False
 
 
-def cycles_visibility_set(ob, value=False):
-    if not hasattr(ob, "cycles_visibility"):
-        return
-
-    vis = ob.cycles_visibility
-
-    vis.camera = value
-    vis.diffuse = value
-    vis.glossy = value
-    vis.shadow = value
-    vis.transmission = value
-    vis.scatter = value
+def object_visibility_set(ob, value=False):
+    ob.visible_camera = value
+    ob.visible_diffuse = value
+    ob.visible_glossy = value
+    ob.visible_shadow = value
+    ob.visible_transmission = value
+    ob.visible_volume_scatter = value
 
 
 def BT_ObjectByName(obj):
@@ -147,7 +142,7 @@ def Operation(context, _operation):
             else:
                 selObj.display_type = "BOUNDS"
 
-            cycles_visibility_set(selObj, value=False)
+            object_visibility_set(selObj, value=False)
 
             if _operation == "SLICE":
                 # copies instance_collection property(empty), but group property is empty (users_group = None)
@@ -191,7 +186,7 @@ def Remove(context, thisObj_name, Prop):
                 obj.display_type = "TEXTURED"
                 del obj["BoolToolBrush"]
                 del obj["BoolTool_FTransform"]
-                cycles_visibility_set(obj, value=True)
+                object_visibility_set(obj, value=True)
 
                 # Remove it from the Canvas
                 for mod in actObj.modifiers:
@@ -216,7 +211,7 @@ def Remove(context, thisObj_name, Prop):
             actObj.display_type = "TEXTURED"
             del actObj["BoolToolBrush"]
             del actObj["BoolTool_FTransform"]
-            cycles_visibility_set(actObj, value=True)
+            object_visibility_set(actObj, value=True)
 
         if Prop == "CANVAS":
             for mod in actObj.modifiers:
-- 
GitLab