Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Rachinskiy <mikhail.rachinskiy@gmail.com>2019-07-22 21:03:24 +0300
committerMikhail Rachinskiy <mikhail.rachinskiy@gmail.com>2019-07-22 21:03:24 +0300
commite27ec695f107371ee811f8d9488ebaf7672fb9be (patch)
tree37b8053c3f6f2a5c03bbcb685135cfc65def48fd /object_boolean_tools.py
parent05dc8caa35da9914a0c0da61bb0dd49aa292e9ce (diff)
Bool Tool: Fix T66514 slice tool support for local view
Diffstat (limited to 'object_boolean_tools.py')
-rw-r--r--object_boolean_tools.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/object_boolean_tools.py b/object_boolean_tools.py
index 56c11aec..b14263e2 100644
--- a/object_boolean_tools.py
+++ b/object_boolean_tools.py
@@ -116,10 +116,10 @@ def ConvertToMesh(obj):
# Do the Union, Difference and Intersection Operations with a Brush
def Operation(context, _operation):
- prefs = bpy.context.preferences.addons[__name__].preferences
+ prefs = context.preferences.addons[__name__].preferences
useWire = prefs.use_wire
- for selObj in bpy.context.selected_objects:
+ for selObj in context.selected_objects:
if (
selObj != context.active_object and
(selObj.type == "MESH" or selObj.type == "CURVE")
@@ -140,17 +140,26 @@ def Operation(context, _operation):
cyclesVis.glossy = False
cyclesVis.shadow = False
cyclesVis.transmission = False
+
if _operation == "SLICE":
# copies instance_collection property(empty), but group property is empty (users_group = None)
- clone = context.active_object.copy()
- # clone.select_set(state=True)
+ clone = actObj.copy()
context.collection.objects.link(clone)
+
+ space_data = context.space_data
+ is_local_view = bool(space_data.local_view)
+
+ if is_local_view:
+ clone.local_view_set(space_data, True)
+
sliceMod = clone.modifiers.new("BTool_" + selObj.name, "BOOLEAN") # add mod to clone obj
sliceMod.object = selObj
sliceMod.operation = "DIFFERENCE"
clone["BoolToolRoot"] = True
+
newMod = actObj.modifiers.new("BTool_" + selObj.name, "BOOLEAN")
newMod.object = selObj
+
if _operation == "SLICE":
newMod.operation = "INTERSECT"
else:
@@ -645,8 +654,14 @@ class OBJECT_OT_BoolTool_Auto_Slice(Operator, Auto_Boolean):
obj_copy.data = obj.data.copy()
context.collection.objects.link(obj_copy)
+ space_data = context.space_data
+ is_local_view = bool(space_data.local_view)
+
+ if is_local_view:
+ obj_copy.local_view_set(space_data, True)
+
self.boolean_mod(obj, ob, "DIFFERENCE", ob_delete=False)
- bpy.context.view_layer.objects.active = obj_copy
+ context.view_layer.objects.active = obj_copy
self.boolean_mod(obj_copy, ob, "INTERSECT")
obj_copy.select_set(state=True)