mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
#5919 : Add an option to set the opacity of the rest of the model when modifying openings
Option is located in the preferences
This commit is contained in:
@@ -82,6 +82,7 @@ classes = (
|
||||
opening.AddPotentialOpening,
|
||||
opening.EditOpenings,
|
||||
opening.CloneOpening,
|
||||
opening.UpdateOpeningsFocus,
|
||||
opening.FlipFill,
|
||||
opening.HideBooleans,
|
||||
opening.HideAllOpenings,
|
||||
|
||||
@@ -845,6 +845,7 @@ class ShowOpenings(Operator, tool.Ifc.Operator):
|
||||
new.obj = opening
|
||||
opening.display_type = "WIRE"
|
||||
DecorationsHandler.install(bpy.context)
|
||||
bpy.ops.bim.update_openings_focus()
|
||||
return {"FINISHED"}
|
||||
|
||||
def update_with_aggregates(self, objs):
|
||||
@@ -856,6 +857,45 @@ class ShowOpenings(Operator, tool.Ifc.Operator):
|
||||
objs.append(aggregate_obj)
|
||||
|
||||
|
||||
class UpdateOpeningsFocus(Operator, tool.Ifc.Operator):
|
||||
bl_idname = "bim.update_openings_focus"
|
||||
bl_label = "Update Openings Focus"
|
||||
bl_description = "Show objects that are not part of the object or its openings as transparent"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def _execute(self, context):
|
||||
preferences = tool.Blender.get_addon_preferences()
|
||||
if preferences.opening_focus_opacity == 100:
|
||||
return {"FINISHED"}
|
||||
openings = set()
|
||||
building_objects = set()
|
||||
for opening in context.scene.BIMModelProperties.openings:
|
||||
if opening.obj:
|
||||
openings.add(opening.obj)
|
||||
opening_element = tool.Ifc.get_entity(opening.obj)
|
||||
if opening_element is None: # Most likely an opening created with bim.add_potential_opening
|
||||
continue
|
||||
building_element = opening_element.VoidsElements[0].RelatingBuildingElement
|
||||
building_objects.add(tool.Ifc.get_object(building_element))
|
||||
|
||||
for obj in context.scene.objects:
|
||||
obj.color = [
|
||||
obj.color[0],
|
||||
obj.color[1],
|
||||
obj.color[2],
|
||||
(
|
||||
1
|
||||
if not context.scene.BIMModelProperties.openings
|
||||
or not building_objects
|
||||
or obj in openings
|
||||
or obj in building_objects
|
||||
or obj in context.selected_objects
|
||||
else preferences.opening_focus_opacity / 100
|
||||
),
|
||||
]
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def hide_openings(context, objects):
|
||||
for opening_prop in context.scene.BIMModelProperties.openings:
|
||||
opening_obj = opening_prop.obj
|
||||
@@ -872,6 +912,7 @@ def hide_openings(context, objects):
|
||||
bpy.data.objects.remove(opening_obj)
|
||||
|
||||
tool.Model.clear_scene_openings()
|
||||
bpy.ops.bim.update_openings_focus()
|
||||
|
||||
|
||||
class HideAllOpenings(Operator, tool.Ifc.Operator):
|
||||
@@ -910,6 +951,7 @@ class EditOpenings(Operator, tool.Ifc.Operator):
|
||||
|
||||
tool.Model.clear_scene_openings()
|
||||
tool.Model.reload_body_representation(building_objs)
|
||||
bpy.ops.bim.update_openings_focus()
|
||||
return {"FINISHED"}
|
||||
|
||||
def get_buildings_and_openings(self, context, building_objs, opening_elements):
|
||||
|
||||
Reference in New Issue
Block a user