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:
Andrej730
2025-07-11 12:57:50 +05:00
parent 19be8107b3
commit 4a11a117ad
2 changed files with 19 additions and 4 deletions
@@ -2139,7 +2139,10 @@ class ActivateModel(bpy.types.Operator):
bl_idname = "bim.activate_model"
bl_label = "Activate Model"
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):
dprops = tool.Drawing.get_document_props()
@@ -2169,7 +2172,7 @@ class ActivateModel(bpy.types.Operator):
if not bpy.app.background:
with context.temp_override(**tool.Blender.get_viewport_context()):
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:
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_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):
props = tool.Sequence.get_status_props()
if not props.is_enabled:
# In case if operator was added to Quick Favorites.
bpy.ops.bim.disable_status_filters()
if not self.only_if_enabled:
# 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"}
visible_statuses = {s.name for s in props.statuses if s.is_visible}