Option not to draw specific linked files #6947

Example - https://postimg.cc/7GTkhGPb
This commit is contained in:
Andrej730
2025-08-14 19:53:56 +05:00
parent 40a895b5ad
commit 6bc318b15c
3 changed files with 28 additions and 2 deletions
@@ -413,6 +413,7 @@ class DocProperties(PropertyGroup):
name="Draw Linked Projects",
description=("Whether to draw all currently loaded linked projects.\n\nGlobal option for all drawings."),
default=True,
options=set(),
)
is_editing_drawings: BoolProperty(name="Is Editing Drawings", default=False)
is_editing_schedules: BoolProperty(name="Is Editing Schedules", default=False)
@@ -70,8 +70,25 @@ class BIM_PT_camera(Panel):
row = col.row(align=True)
row.prop(props, "has_annotation", icon="MOD_EDGESPLIT")
row.prop(dprops, "should_use_annotation_cache", text="", icon="FILE_REFRESH")
# Drawing linked projects.
row = col.row(align=True)
row.prop(dprops, "should_draw_linked_projects")
if dprops.should_draw_linked_projects:
header, panel = self.layout.panel("links_to_draw")
header.label(text="Linked Projects to Draw", icon="OUTPUT")
pprops = tool.Project.get_project_props()
links = list(pprops.get_loaded_links())
if panel:
if links:
for link in links:
row = panel.row(align=True)
split = row.split(factor=0.9)
split.label(text=link.name, icon="FILE")
split.prop(link, "include_in_drawings", text="")
else:
panel.label(text="No IFC projects linked and loaded.")
row = self.layout.row(align=True)
row.prop(props, "target_view")
+10 -2
View File
@@ -225,6 +225,7 @@ class Link(PropertyGroup):
is_selectable: BoolProperty(name="Is Selectable", default=True)
is_wireframe: BoolProperty(name="Is Wireframe", default=False)
is_hidden: BoolProperty(name="Is Hidden", default=False)
include_in_drawings: BoolProperty(name="Include in Drawings", default=True, options=set())
empty_handle: PointerProperty(
name="Empty Object Handle",
description="We use empty object handle to allow simple manipulations with a linked model (moving, scaling, rotating)",
@@ -237,6 +238,7 @@ class Link(PropertyGroup):
is_selectable: bool
is_wireframe: bool
is_hidden: bool
include_in_drawings: bool
empty_handle: Union[bpy.types.Object, None]
@@ -505,12 +507,18 @@ class BIMProjectProperties(PropertyGroup):
return self.library_breadcrumb[-1]
return None
def get_loaded_links(self) -> Generator[Link]:
for link in self.links:
if not link.is_loaded:
continue
yield link
def get_loaded_links_for_drawings(self) -> Generator[Link]:
props = tool.Drawing.get_document_props()
if not props.should_draw_linked_projects:
return
for link in self.links:
if not link.is_loaded:
for link in self.get_loaded_links():
if not link.include_in_drawings:
continue
yield link