mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Option not to draw specific linked files #6947
Example - https://postimg.cc/7GTkhGPb
This commit is contained in:
@@ -413,6 +413,7 @@ class DocProperties(PropertyGroup):
|
|||||||
name="Draw Linked Projects",
|
name="Draw Linked Projects",
|
||||||
description=("Whether to draw all currently loaded linked projects.\n\nGlobal option for all drawings."),
|
description=("Whether to draw all currently loaded linked projects.\n\nGlobal option for all drawings."),
|
||||||
default=True,
|
default=True,
|
||||||
|
options=set(),
|
||||||
)
|
)
|
||||||
is_editing_drawings: BoolProperty(name="Is Editing Drawings", default=False)
|
is_editing_drawings: BoolProperty(name="Is Editing Drawings", default=False)
|
||||||
is_editing_schedules: BoolProperty(name="Is Editing Schedules", 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 = col.row(align=True)
|
||||||
row.prop(props, "has_annotation", icon="MOD_EDGESPLIT")
|
row.prop(props, "has_annotation", icon="MOD_EDGESPLIT")
|
||||||
row.prop(dprops, "should_use_annotation_cache", text="", icon="FILE_REFRESH")
|
row.prop(dprops, "should_use_annotation_cache", text="", icon="FILE_REFRESH")
|
||||||
|
|
||||||
|
# Drawing linked projects.
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
row.prop(dprops, "should_draw_linked_projects")
|
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 = self.layout.row(align=True)
|
||||||
row.prop(props, "target_view")
|
row.prop(props, "target_view")
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ class Link(PropertyGroup):
|
|||||||
is_selectable: BoolProperty(name="Is Selectable", default=True)
|
is_selectable: BoolProperty(name="Is Selectable", default=True)
|
||||||
is_wireframe: BoolProperty(name="Is Wireframe", default=False)
|
is_wireframe: BoolProperty(name="Is Wireframe", default=False)
|
||||||
is_hidden: BoolProperty(name="Is Hidden", 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(
|
empty_handle: PointerProperty(
|
||||||
name="Empty Object Handle",
|
name="Empty Object Handle",
|
||||||
description="We use empty object handle to allow simple manipulations with a linked model (moving, scaling, rotating)",
|
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_selectable: bool
|
||||||
is_wireframe: bool
|
is_wireframe: bool
|
||||||
is_hidden: bool
|
is_hidden: bool
|
||||||
|
include_in_drawings: bool
|
||||||
empty_handle: Union[bpy.types.Object, None]
|
empty_handle: Union[bpy.types.Object, None]
|
||||||
|
|
||||||
|
|
||||||
@@ -505,12 +507,18 @@ class BIMProjectProperties(PropertyGroup):
|
|||||||
return self.library_breadcrumb[-1]
|
return self.library_breadcrumb[-1]
|
||||||
return None
|
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]:
|
def get_loaded_links_for_drawings(self) -> Generator[Link]:
|
||||||
props = tool.Drawing.get_document_props()
|
props = tool.Drawing.get_document_props()
|
||||||
if not props.should_draw_linked_projects:
|
if not props.should_draw_linked_projects:
|
||||||
return
|
return
|
||||||
for link in self.links:
|
for link in self.get_loaded_links():
|
||||||
if not link.is_loaded:
|
if not link.include_in_drawings:
|
||||||
continue
|
continue
|
||||||
yield link
|
yield link
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user