mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Fix bim.activate_model hiding all elements #6893
It was an overlook with using by accident bim.disable_status_filters instead of bim.enable_status_filters in bim.activate_status_filters, but it was also kind of unexpectedly introduced in 7858cb1.
But thinking about it, bim.activate_model shouldn't activate Statuses UI either way, since it might bring their filters they had before but explicitly disabled.
This commit is contained in:
@@ -2139,7 +2139,10 @@ class ActivateModel(bpy.types.Operator):
|
|||||||
bl_idname = "bim.activate_model"
|
bl_idname = "bim.activate_model"
|
||||||
bl_label = "Activate Model"
|
bl_label = "Activate Model"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_description = "Activate the model view, hide all annotations"
|
bl_description = (
|
||||||
|
"Activate the model view.\n\n"
|
||||||
|
"Show all objects (and apply status filters if they were enabled before) and hide all annotations."
|
||||||
|
)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
dprops = tool.Drawing.get_document_props()
|
dprops = tool.Drawing.get_document_props()
|
||||||
@@ -2169,7 +2172,7 @@ class ActivateModel(bpy.types.Operator):
|
|||||||
if not bpy.app.background:
|
if not bpy.app.background:
|
||||||
with context.temp_override(**tool.Blender.get_viewport_context()):
|
with context.temp_override(**tool.Blender.get_viewport_context()):
|
||||||
bpy.ops.object.hide_view_clear()
|
bpy.ops.object.hide_view_clear()
|
||||||
bpy.ops.bim.activate_status_filters()
|
bpy.ops.bim.activate_status_filters(only_if_enabled=True)
|
||||||
|
|
||||||
for obj in context.visible_objects:
|
for obj in context.visible_objects:
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
|
|||||||
@@ -94,12 +94,24 @@ class ActivateStatusFilters(bpy.types.Operator):
|
|||||||
bl_description = "Filter and display objects based on currently selected IFC statuses"
|
bl_description = "Filter and display objects based on currently selected IFC statuses"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
only_if_enabled: bpy.props.BoolProperty( # pyright: ignore[reportRedeclaration]
|
||||||
|
name="Only If Filters are Enabled",
|
||||||
|
description="Activate status filters only in case if they were enabled from the UI before.",
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
only_if_enabled: bool
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
props = tool.Sequence.get_status_props()
|
props = tool.Sequence.get_status_props()
|
||||||
|
|
||||||
if not props.is_enabled:
|
if not props.is_enabled:
|
||||||
# In case if operator was added to Quick Favorites.
|
if not self.only_if_enabled:
|
||||||
bpy.ops.bim.disable_status_filters()
|
# Allow users to use the same operator to refresh filters,
|
||||||
|
# even if they were not enabled before.
|
||||||
|
# Typically would occur when operator is added to Quick Favorites.
|
||||||
|
bpy.ops.bim.enable_status_filters()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
visible_statuses = {s.name for s in props.statuses if s.is_visible}
|
visible_statuses = {s.name for s in props.statuses if s.is_visible}
|
||||||
|
|||||||
Reference in New Issue
Block a user