mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Linked Models - option to isolate selected object
Quick demo - https://files.catbox.moe/6chdx7.mp4
This commit is contained in:
@@ -2373,19 +2373,23 @@ class HideQueriedLinkedElement(bpy.types.Operator):
|
||||
bl_label = "Hide Queried Linked Element"
|
||||
bl_description = (
|
||||
"Hide geometry for currently queried linked element.\n\n"
|
||||
"ALT+Click (or ALT+H in Explore Tool) to unhide all geometry for currently selected linked model.\n"
|
||||
"(Not Yet Implemented) SHIFT+Click to hide everything but currently queried element.\n\n"
|
||||
"Know limitation: doesn't work with UNDO."
|
||||
"SHIFT+Click (or SHIFT+H in Explore Tool) to hide everything "
|
||||
"in the currently selected model, but the queried element.\n"
|
||||
"ALT+Click (or ALT+H in Explore Tool) to unhide all geometry for currently selected linked model.\n\n"
|
||||
"Known limitation: doesn't work with UNDO."
|
||||
)
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
unhide_all: bpy.props.BoolProperty(options={"SKIP_SAVE"}) # pyright: ignore[reportRedeclaration]
|
||||
hide_all_except: bpy.props.BoolProperty(options={"SKIP_SAVE"}) # pyright: ignore[reportRedeclaration]
|
||||
|
||||
if TYPE_CHECKING:
|
||||
unhide_all: bool
|
||||
hide_all_except: bool
|
||||
|
||||
def invoke(self, context, event):
|
||||
self.unhide_all = event.alt
|
||||
self.hide_all_except = event.shift
|
||||
return self.execute(context)
|
||||
|
||||
def execute(self, context) -> set["rna_enums.OperatorReturnItems"]:
|
||||
@@ -2394,6 +2398,9 @@ class HideQueriedLinkedElement(bpy.types.Operator):
|
||||
if self.unhide_all:
|
||||
return self.run_unhide_all()
|
||||
|
||||
if self.hide_all_except:
|
||||
return self.run_hide_all_except()
|
||||
|
||||
obj = props.queried_obj
|
||||
if not obj:
|
||||
self.report({"INFO"}, "No object is queried to hide.")
|
||||
@@ -2415,6 +2422,21 @@ class HideQueriedLinkedElement(bpy.types.Operator):
|
||||
self.report({"INFO"}, "All linked model geometry is unhidden.")
|
||||
return {"FINISHED"}
|
||||
|
||||
def run_hide_all_except(self) -> set["rna_enums.OperatorReturnItems"]:
|
||||
props = tool.Project.get_project_props()
|
||||
obj = props.queried_obj
|
||||
if not obj:
|
||||
self.report({"INFO"}, "No object is queried.")
|
||||
return {"FINISHED"}
|
||||
link = props.active_link
|
||||
if not link:
|
||||
self.report({"INFO"}, "No linked model is currently selected.")
|
||||
return {"FINISHED"}
|
||||
guid = props.queried_guid
|
||||
tool.Project.Link.hide_all_elements_except(link, obj, guid)
|
||||
self.report({"INFO"}, "All other linked model geometry is now hidden.")
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class AppendInspectedLinkedElement(AppendLibraryElement):
|
||||
bl_idname = "bim.append_inspected_linked_element"
|
||||
|
||||
Reference in New Issue
Block a user