mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
Implement Brick split screen
This commit is contained in:
@@ -57,9 +57,10 @@ class ViewBrickClass(bpy.types.Operator, Operator):
|
|||||||
bl_label = "View Brick Class"
|
bl_label = "View Brick Class"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
brick_class: bpy.props.StringProperty(name="Brick Class")
|
brick_class: bpy.props.StringProperty(name="Brick Class")
|
||||||
|
split_screen: bpy.props.BoolProperty(name="Split Screen", default=False, options={"HIDDEN"})
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.view_brick_class(tool.Brick, brick_class=self.brick_class)
|
core.view_brick_class(tool.Brick, brick_class=self.brick_class, split_screen=self.split_screen)
|
||||||
|
|
||||||
|
|
||||||
class ViewBrickItem(bpy.types.Operator, Operator):
|
class ViewBrickItem(bpy.types.Operator, Operator):
|
||||||
@@ -67,18 +68,20 @@ class ViewBrickItem(bpy.types.Operator, Operator):
|
|||||||
bl_label = "View Brick Item"
|
bl_label = "View Brick Item"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
item: bpy.props.StringProperty(name="Brick Item")
|
item: bpy.props.StringProperty(name="Brick Item")
|
||||||
|
split_screen: bpy.props.BoolProperty(name="Split Screen", default=False, options={"HIDDEN"})
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.view_brick_item(tool.Brick, item=self.item)
|
core.view_brick_item(tool.Brick, item=self.item, split_screen=self.split_screen)
|
||||||
|
|
||||||
|
|
||||||
class RewindBrickClass(bpy.types.Operator, Operator):
|
class RewindBrickClass(bpy.types.Operator, Operator):
|
||||||
bl_idname = "bim.rewind_brick_class"
|
bl_idname = "bim.rewind_brick_class"
|
||||||
bl_label = "Rewind Brick Class"
|
bl_label = "Rewind Brick Class"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
split_screen: bpy.props.BoolProperty(name="Split Screen", default=False, options={"HIDDEN"})
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.rewind_brick_class(tool.Brick)
|
core.rewind_brick_class(tool.Brick, split_screen=self.split_screen)
|
||||||
|
|
||||||
|
|
||||||
class CloseBrickProject(bpy.types.Operator, Operator):
|
class CloseBrickProject(bpy.types.Operator, Operator):
|
||||||
@@ -205,9 +208,10 @@ class RefreshBrickViewer(bpy.types.Operator, Operator):
|
|||||||
bl_idname = "bim.refresh_brick_viewer"
|
bl_idname = "bim.refresh_brick_viewer"
|
||||||
bl_label = "Refresh Brick Viewer"
|
bl_label = "Refresh Brick Viewer"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
split_screen: bpy.props.BoolProperty(name="Split Screen", default=False, options={"HIDDEN"})
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.refresh_brick_viewer(tool.Brick)
|
core.refresh_brick_viewer(tool.Brick, split_screen=self.split_screen)
|
||||||
|
|
||||||
|
|
||||||
class RemoveBrick(bpy.types.Operator, Operator):
|
class RemoveBrick(bpy.types.Operator, Operator):
|
||||||
@@ -268,10 +272,14 @@ class SetBrickListRoot(bpy.types.Operator, Operator):
|
|||||||
bl_idname = "bim.set_brick_list_root"
|
bl_idname = "bim.set_brick_list_root"
|
||||||
bl_label = "Set Brick View Type"
|
bl_label = "Set Brick View Type"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
split_screen: bpy.props.BoolProperty(name="Split Screen", default=False, options={"HIDDEN"})
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
root = context.scene.BIMBrickProperties.brick_list_root
|
if self.split_screen:
|
||||||
core.set_brick_list_root(tool.Brick, brick_root=root)
|
root = context.scene.BIMBrickProperties.split_screen_brick_list_root
|
||||||
|
else:
|
||||||
|
root = context.scene.BIMBrickProperties.brick_list_root
|
||||||
|
core.set_brick_list_root(tool.Brick, brick_root=root, split_screen=self.split_screen)
|
||||||
|
|
||||||
|
|
||||||
class RemoveBrickRelation(bpy.types.Operator, Operator):
|
class RemoveBrickRelation(bpy.types.Operator, Operator):
|
||||||
|
|||||||
@@ -97,4 +97,9 @@ class BIMBrickProperties(PropertyGroup):
|
|||||||
new_brick_relation_object: StringProperty(name="New Brick Relation Object")
|
new_brick_relation_object: StringProperty(name="New Brick Relation Object")
|
||||||
add_relation_failed: BoolProperty(name="Add Relation Failed", default=False)
|
add_relation_failed: BoolProperty(name="Add Relation Failed", default=False)
|
||||||
# create relations split screen
|
# create relations split screen
|
||||||
split_screen_toggled: BoolProperty(name="Split Screen Toggled", default=False)
|
split_screen_toggled: BoolProperty(name="Split Screen Toggled", default=False)
|
||||||
|
split_screen_bricks: CollectionProperty(name="Split Screen Bricks", type=Brick)
|
||||||
|
split_screen_active_brick_index: IntProperty(name="Split Screen Active Brick Index", update=update_active_brick_index)
|
||||||
|
split_screen_active_brick_class: StringProperty(name="Split Screen Active Brick Class")
|
||||||
|
split_screen_brick_breadcrumbs: CollectionProperty(name="Split Screen Brick Breadcrumbs", type=StrProperty)
|
||||||
|
split_screen_brick_list_root: EnumProperty(name="Split Screen Brick List Root", items=get_brick_roots)
|
||||||
@@ -86,27 +86,48 @@ class BIM_PT_brickschema(Panel):
|
|||||||
row.prop(data=self.props, property="new_brick_label", text="")
|
row.prop(data=self.props, property="new_brick_label", text="")
|
||||||
prop_with_search(row, self.props, "brick_entity_class", text="")
|
prop_with_search(row, self.props, "brick_entity_class", text="")
|
||||||
row.operator("bim.add_brick", text="", icon="ADD")
|
row.operator("bim.add_brick", text="", icon="ADD")
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
|
||||||
col = row.column()
|
|
||||||
col.alignment = "LEFT"
|
|
||||||
if len(self.props.brick_breadcrumbs):
|
|
||||||
row.operator("bim.rewind_brick_class", text="", icon="FRAME_PREV")
|
|
||||||
col = row.column()
|
|
||||||
col.alignment = "RIGHT"
|
|
||||||
row.operator("bim.remove_brick", text="", icon="X")
|
|
||||||
# row.operator("bim.refresh_brick_viewer", text="", icon="FILE_REFRESH")
|
# row.operator("bim.refresh_brick_viewer", text="", icon="FILE_REFRESH")
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text=self.props.active_brick_class)
|
col = row.column()
|
||||||
|
col.alignment = "RIGHT"
|
||||||
|
row.prop(data=self.props, property="split_screen_toggled", text="", icon="WINDOW")
|
||||||
|
|
||||||
|
grid = self.layout.grid_flow(even_columns=True)
|
||||||
|
grid1 = grid.column(align=True)
|
||||||
|
row = grid1.row(align=True)
|
||||||
|
if len(self.props.brick_breadcrumbs):
|
||||||
|
op = row.operator("bim.rewind_brick_class", text="", icon="FRAME_PREV")
|
||||||
|
op.split_screen = False
|
||||||
row.prop(data=self.props, property="set_list_root_toggled", text="", icon="OUTLINER")
|
row.prop(data=self.props, property="set_list_root_toggled", text="", icon="OUTLINER")
|
||||||
|
row.label(text=self.props.active_brick_class)
|
||||||
|
|
||||||
if self.props.set_list_root_toggled:
|
if self.props.set_list_root_toggled:
|
||||||
row = self.layout.row(align=True)
|
row = grid1.row(align=True)
|
||||||
row.operator("bim.set_brick_list_root", text="Set View")
|
row.operator("bim.set_brick_list_root", text="Set View")
|
||||||
row.prop(data=self.props, property="brick_list_root", text="")
|
row.prop(data=self.props, property="brick_list_root", text="")
|
||||||
|
|
||||||
self.layout.template_list("BIM_UL_bricks", "", self.props, "bricks", self.props, "active_brick_index")
|
row = grid1.row()
|
||||||
|
BIM_UL_bricks.split_screen = False
|
||||||
|
row.template_list("BIM_UL_bricks", "", self.props, "bricks", self.props, "active_brick_index")
|
||||||
|
|
||||||
|
if self.props.split_screen_toggled:
|
||||||
|
grid2 = grid.column(align=True)
|
||||||
|
row = grid2.row(align=True)
|
||||||
|
if len(self.props.split_screen_brick_breadcrumbs):
|
||||||
|
op = row.operator("bim.rewind_brick_class", text="", icon="FRAME_PREV")
|
||||||
|
op.split_screen = True
|
||||||
|
row.label(text=self.props.split_screen_active_brick_class)
|
||||||
|
|
||||||
|
if self.props.set_list_root_toggled:
|
||||||
|
row = grid2.row(align=True)
|
||||||
|
op = row.operator("bim.set_brick_list_root", text="Set View")
|
||||||
|
op.split_screen = True
|
||||||
|
row.prop(data=self.props, property="split_screen_brick_list_root", text="")
|
||||||
|
|
||||||
|
row = grid2.row()
|
||||||
|
BIM_UL_bricks.split_screen = True
|
||||||
|
row.template_list("BIM_UL_bricks", "", self.props, "split_screen_bricks", self.props, "split_screen_active_brick_index")
|
||||||
|
|
||||||
if BrickschemaData.data["active_relations"]:
|
if BrickschemaData.data["active_relations"]:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
@@ -114,15 +135,11 @@ class BIM_PT_brickschema(Panel):
|
|||||||
col.alignment = "RIGHT"
|
col.alignment = "RIGHT"
|
||||||
row.prop(data=self.props, property="brick_create_relations_toggled", text="", icon="PLUGIN")
|
row.prop(data=self.props, property="brick_create_relations_toggled", text="", icon="PLUGIN")
|
||||||
row.prop(data=self.props, property="brick_edit_relations_toggled", text="", icon="TOOL_SETTINGS")
|
row.prop(data=self.props, property="brick_edit_relations_toggled", text="", icon="TOOL_SETTINGS")
|
||||||
|
row.operator("bim.remove_brick", text="", icon="X")
|
||||||
|
|
||||||
if self.props.brick_create_relations_toggled:
|
if self.props.brick_create_relations_toggled:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
col = row.column()
|
|
||||||
col.alignment = "LEFT"
|
|
||||||
row.label(text="Create Relation:")
|
row.label(text="Create Relation:")
|
||||||
col = row.column()
|
|
||||||
col.alignment = "RIGHT"
|
|
||||||
row.prop(data=self.props, property="split_screen_toggled", text="", icon="WINDOW")
|
|
||||||
|
|
||||||
if not self.props.new_brick_relation_type == "http://www.w3.org/2000/01/rdf-schema#label":
|
if not self.props.new_brick_relation_type == "http://www.w3.org/2000/01/rdf-schema#label":
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
@@ -203,12 +220,15 @@ class BIM_PT_ifc_brickschema_references(Panel):
|
|||||||
|
|
||||||
|
|
||||||
class BIM_UL_bricks(UIList):
|
class BIM_UL_bricks(UIList):
|
||||||
|
split_screen = False
|
||||||
|
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||||
if item:
|
if item:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
|
label = item.label if item.label else item.name
|
||||||
if item.total_items:
|
if item.total_items:
|
||||||
op = row.operator("bim.view_brick_class", text="", icon="DISCLOSURE_TRI_RIGHT", emboss=False)
|
op = row.operator("bim.view_brick_class", text="", icon="DISCLOSURE_TRI_RIGHT", emboss=False)
|
||||||
op.brick_class = item.name
|
op.brick_class = item.name
|
||||||
row.label(text=item.label if item.label else item.name)
|
op.split_screen = self.split_screen
|
||||||
if item.total_items:
|
label = label + " (" + str(item.total_items) + ")"
|
||||||
row.label(text=str(item.total_items))
|
row.label(text=label)
|
||||||
|
|||||||
@@ -20,34 +20,37 @@
|
|||||||
def load_brick_project(brick, filepath=None, brick_root=None):
|
def load_brick_project(brick, filepath=None, brick_root=None):
|
||||||
brick.load_brick_file(filepath)
|
brick.load_brick_file(filepath)
|
||||||
brick.import_brick_classes(brick_root)
|
brick.import_brick_classes(brick_root)
|
||||||
|
brick.import_brick_classes(brick_root, split_screen=True)
|
||||||
brick.set_active_brick_class(brick_root)
|
brick.set_active_brick_class(brick_root)
|
||||||
|
brick.set_active_brick_class(brick_root, split_screen=True)
|
||||||
|
|
||||||
|
|
||||||
def view_brick_class(brick, brick_class=None):
|
def view_brick_class(brick, brick_class=None, split_screen=False):
|
||||||
brick.add_brick_breadcrumb()
|
brick.add_brick_breadcrumb(split_screen=split_screen)
|
||||||
brick.clear_brick_browser()
|
brick.clear_brick_browser(split_screen=split_screen)
|
||||||
brick.import_brick_classes(brick_class)
|
brick.import_brick_classes(brick_class, split_screen=split_screen)
|
||||||
brick.import_brick_items(brick_class)
|
brick.import_brick_items(brick_class, split_screen=split_screen)
|
||||||
brick.set_active_brick_class(brick_class)
|
brick.set_active_brick_class(brick_class, split_screen=split_screen)
|
||||||
|
|
||||||
|
|
||||||
def view_brick_item(brick, item=None):
|
def view_brick_item(brick, item=None, split_screen=False):
|
||||||
brick_class = brick.get_item_class(item)
|
brick_class = brick.get_item_class(item)
|
||||||
view_brick_class(brick, brick_class=brick_class)
|
view_brick_class(brick, brick_class=brick_class, split_screen=split_screen)
|
||||||
brick.select_browser_item(item)
|
brick.select_browser_item(item, split_screen=split_screen)
|
||||||
|
|
||||||
|
|
||||||
def rewind_brick_class(brick):
|
def rewind_brick_class(brick, split_screen=False):
|
||||||
previous_class = brick.pop_brick_breadcrumb()
|
previous_class = brick.pop_brick_breadcrumb(split_screen=split_screen)
|
||||||
brick.clear_brick_browser()
|
brick.clear_brick_browser(split_screen=split_screen)
|
||||||
brick.import_brick_classes(previous_class)
|
brick.import_brick_classes(previous_class, split_screen=split_screen)
|
||||||
brick.import_brick_items(previous_class)
|
brick.import_brick_items(previous_class, split_screen=split_screen)
|
||||||
brick.set_active_brick_class(previous_class)
|
brick.set_active_brick_class(previous_class, split_screen=split_screen)
|
||||||
|
|
||||||
|
|
||||||
def close_brick_project(brick):
|
def close_brick_project(brick):
|
||||||
brick.clear_project()
|
brick.clear_project()
|
||||||
brick.clear_brick_browser()
|
brick.clear_brick_browser()
|
||||||
|
brick.clear_brick_browser(split_screen=True)
|
||||||
|
|
||||||
|
|
||||||
def convert_brick_project(ifc, brick):
|
def convert_brick_project(ifc, brick):
|
||||||
@@ -76,11 +79,13 @@ def add_brick(ifc, brick, element=None, namespace=None, brick_class=None, librar
|
|||||||
else:
|
else:
|
||||||
brick_uri = brick.add_brick(namespace, brick_class, label)
|
brick_uri = brick.add_brick(namespace, brick_class, label)
|
||||||
brick.run_refresh_brick_viewer()
|
brick.run_refresh_brick_viewer()
|
||||||
|
brick.run_refresh_brick_viewer(split_screen=True)
|
||||||
|
|
||||||
|
|
||||||
def add_brick_relation(brick, brick_uri=None, predicate=None, object=None):
|
def add_brick_relation(brick, brick_uri=None, predicate=None, object=None):
|
||||||
brick.add_relation(brick_uri, predicate, object)
|
brick.add_relation(brick_uri, predicate, object)
|
||||||
brick.run_refresh_brick_viewer()
|
brick.run_refresh_brick_viewer()
|
||||||
|
brick.run_refresh_brick_viewer(split_screen=True)
|
||||||
|
|
||||||
|
|
||||||
def convert_ifc_to_brick(brick, namespace=None, library=None):
|
def convert_ifc_to_brick(brick, namespace=None, library=None):
|
||||||
@@ -95,12 +100,17 @@ def convert_ifc_to_brick(brick, namespace=None, library=None):
|
|||||||
def new_brick_file(brick, brick_root=None):
|
def new_brick_file(brick, brick_root=None):
|
||||||
brick.new_brick_file()
|
brick.new_brick_file()
|
||||||
brick.import_brick_classes(brick_root)
|
brick.import_brick_classes(brick_root)
|
||||||
|
brick.import_brick_classes(brick_root, split_screen=True)
|
||||||
brick.set_active_brick_class(brick_root)
|
brick.set_active_brick_class(brick_root)
|
||||||
|
brick.set_active_brick_class(brick_root, split_screen=True)
|
||||||
|
|
||||||
|
|
||||||
def refresh_brick_viewer(brick):
|
def refresh_brick_viewer(brick, split_screen=False):
|
||||||
brick.run_view_brick_class(brick_class=brick.get_active_brick_class())
|
if split_screen:
|
||||||
brick.pop_brick_breadcrumb()
|
brick.run_view_brick_class(brick_class=brick.get_active_brick_class(split_screen=split_screen), split_screen=split_screen)
|
||||||
|
else:
|
||||||
|
brick.run_view_brick_class(brick_class=brick.get_active_brick_class(), split_screen=split_screen)
|
||||||
|
brick.pop_brick_breadcrumb(split_screen=split_screen)
|
||||||
|
|
||||||
|
|
||||||
def remove_brick(ifc, brick, library=None, brick_uri=None):
|
def remove_brick(ifc, brick, library=None, brick_uri=None):
|
||||||
@@ -110,6 +120,7 @@ def remove_brick(ifc, brick, library=None, brick_uri=None):
|
|||||||
ifc.run("library.remove_reference", reference=reference)
|
ifc.run("library.remove_reference", reference=reference)
|
||||||
brick.remove_brick(brick_uri)
|
brick.remove_brick(brick_uri)
|
||||||
brick.run_refresh_brick_viewer()
|
brick.run_refresh_brick_viewer()
|
||||||
|
brick.run_refresh_brick_viewer(split_screen=True)
|
||||||
|
|
||||||
|
|
||||||
def serialize_brick(brick):
|
def serialize_brick(brick):
|
||||||
@@ -120,11 +131,11 @@ def add_namespace(brick, alias=None, uri=None):
|
|||||||
brick.add_namespace(alias, uri)
|
brick.add_namespace(alias, uri)
|
||||||
|
|
||||||
|
|
||||||
def set_brick_list_root(brick, brick_root=None):
|
def set_brick_list_root(brick, brick_root=None, split_screen=False):
|
||||||
brick.clear_brick_browser()
|
brick.clear_brick_browser(split_screen=split_screen)
|
||||||
brick.import_brick_classes(brick_root)
|
brick.import_brick_classes(brick_root, split_screen=split_screen)
|
||||||
brick.set_active_brick_class(brick_root)
|
brick.set_active_brick_class(brick_root, split_screen=split_screen)
|
||||||
brick.clear_breadcrumbs()
|
brick.clear_breadcrumbs(split_screen=split_screen)
|
||||||
|
|
||||||
|
|
||||||
def remove_brick_relation(brick, brick_uri=None, predicate=None, object=None):
|
def remove_brick_relation(brick, brick_uri=None, predicate=None, object=None):
|
||||||
|
|||||||
@@ -53,9 +53,14 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
return str(brick)
|
return str(brick)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_brick_breadcrumb(cls):
|
def add_brick_breadcrumb(cls, split_screen=False):
|
||||||
new = bpy.context.scene.BIMBrickProperties.brick_breadcrumbs.add()
|
props = bpy.context.scene.BIMBrickProperties
|
||||||
new.name = bpy.context.scene.BIMBrickProperties.active_brick_class
|
if split_screen:
|
||||||
|
new = props.split_screen_brick_breadcrumbs.add()
|
||||||
|
new.name = props.split_screen_active_brick_class
|
||||||
|
else:
|
||||||
|
new = props.brick_breadcrumbs.add()
|
||||||
|
new.name = props.active_brick_class
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_brick_from_element(cls, element, namespace, brick_class):
|
def add_brick_from_element(cls, element, namespace, brick_class):
|
||||||
@@ -126,14 +131,18 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
cs.remove(triple)
|
cs.remove(triple)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clear_brick_browser(cls):
|
def clear_brick_browser(cls, split_screen=False):
|
||||||
bpy.context.scene.BIMBrickProperties.bricks.clear()
|
props = bpy.context.scene.BIMBrickProperties
|
||||||
|
if split_screen:
|
||||||
|
props.split_screen_bricks.clear()
|
||||||
|
else:
|
||||||
|
props.bricks.clear()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clear_project(cls):
|
def clear_project(cls):
|
||||||
BrickStore.purge()
|
BrickStore.purge()
|
||||||
bpy.context.scene.BIMBrickProperties.active_brick_class == ""
|
bpy.context.scene.BIMBrickProperties.active_brick_class == ""
|
||||||
bpy.context.scene.BIMBrickProperties.brick_breadcrumbs.clear()
|
bpy.context.scene.BIMBrickProperties.split_screen_active_brick_class == ""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def export_brick_attributes(cls, brick_uri):
|
def export_brick_attributes(cls, brick_uri):
|
||||||
@@ -143,7 +152,9 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
return {"Identification": brick_uri, "Name": brick_uri.split("#")[-1]}
|
return {"Identification": brick_uri, "Name": brick_uri.split("#")[-1]}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_active_brick_class(cls):
|
def get_active_brick_class(cls, split_screen=False):
|
||||||
|
if split_screen:
|
||||||
|
return bpy.context.scene.BIMBrickProperties.split_screen_active_brick_class
|
||||||
return bpy.context.scene.BIMBrickProperties.active_brick_class
|
return bpy.context.scene.BIMBrickProperties.active_brick_class
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -224,7 +235,7 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
return uri.split("#")[0] + "#"
|
return uri.split("#")[0] + "#"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_brick_classes(cls, brick_class):
|
def import_brick_classes(cls, brick_class, split_screen=False):
|
||||||
query = BrickStore.graph.query(
|
query = BrickStore.graph.query(
|
||||||
"""
|
"""
|
||||||
PREFIX brick: <https://brickschema.org/schema/Brick#>
|
PREFIX brick: <https://brickschema.org/schema/Brick#>
|
||||||
@@ -243,8 +254,12 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
"{brick_class}", brick_class
|
"{brick_class}", brick_class
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if split_screen:
|
||||||
|
bricks = bpy.context.scene.BIMBrickProperties.split_screen_bricks
|
||||||
|
else:
|
||||||
|
bricks = bpy.context.scene.BIMBrickProperties.bricks
|
||||||
for row in query:
|
for row in query:
|
||||||
new = bpy.context.scene.BIMBrickProperties.bricks.add()
|
new = bricks.add()
|
||||||
label = row.get("label")
|
label = row.get("label")
|
||||||
if label:
|
if label:
|
||||||
new.label = label.toPython()
|
new.label = label.toPython()
|
||||||
@@ -253,7 +268,7 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
new.total_items = row.get("total_items").toPython()
|
new.total_items = row.get("total_items").toPython()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_brick_items(cls, brick_class):
|
def import_brick_items(cls, brick_class, split_screen=False):
|
||||||
query = BrickStore.graph.query(
|
query = BrickStore.graph.query(
|
||||||
"""
|
"""
|
||||||
PREFIX brick: <https://brickschema.org/schema/Brick#>
|
PREFIX brick: <https://brickschema.org/schema/Brick#>
|
||||||
@@ -270,8 +285,12 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
"{brick_class}", brick_class
|
"{brick_class}", brick_class
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if split_screen:
|
||||||
|
bricks = bpy.context.scene.BIMBrickProperties.split_screen_bricks
|
||||||
|
else:
|
||||||
|
bricks = bpy.context.scene.BIMBrickProperties.bricks
|
||||||
for row in query:
|
for row in query:
|
||||||
new = bpy.context.scene.BIMBrickProperties.bricks.add()
|
new = bricks.add()
|
||||||
label = row.get("label")
|
label = row.get("label")
|
||||||
if label:
|
if label:
|
||||||
new.label = label.toPython()
|
new.label = label.toPython()
|
||||||
@@ -307,11 +326,16 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
BrickStore.load_relationships()
|
BrickStore.load_relationships()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def pop_brick_breadcrumb(cls):
|
def pop_brick_breadcrumb(cls, split_screen=False):
|
||||||
crumb = bpy.context.scene.BIMBrickProperties.brick_breadcrumbs[-1]
|
props = bpy.context.scene.BIMBrickProperties
|
||||||
|
if split_screen:
|
||||||
|
breadcrumbs = props.split_screen_brick_breadcrumbs
|
||||||
|
else:
|
||||||
|
breadcrumbs = props.brick_breadcrumbs
|
||||||
|
crumb = breadcrumbs[-1]
|
||||||
name = crumb.name
|
name = crumb.name
|
||||||
last_index = len(bpy.context.scene.BIMBrickProperties.brick_breadcrumbs) - 1
|
last_index = len(breadcrumbs) - 1
|
||||||
bpy.context.scene.BIMBrickProperties.brick_breadcrumbs.remove(last_index)
|
breadcrumbs.remove(last_index)
|
||||||
return name
|
return name
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -328,22 +352,29 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run_refresh_brick_viewer(cls):
|
def run_refresh_brick_viewer(cls, split_screen=False):
|
||||||
return blenderbim.core.brick.refresh_brick_viewer(tool.Brick)
|
return blenderbim.core.brick.refresh_brick_viewer(tool.Brick, split_screen)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run_view_brick_class(cls, brick_class=None):
|
def run_view_brick_class(cls, brick_class=None, split_screen=False):
|
||||||
return blenderbim.core.brick.view_brick_class(tool.Brick, brick_class=brick_class)
|
return blenderbim.core.brick.view_brick_class(tool.Brick, brick_class=brick_class, split_screen=split_screen)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def select_browser_item(cls, item):
|
def select_browser_item(cls, item, split_screen=False):
|
||||||
name = item.split("#")[-1]
|
name = item.split("#")[-1]
|
||||||
props = bpy.context.scene.BIMBrickProperties
|
props = bpy.context.scene.BIMBrickProperties
|
||||||
props.active_brick_index = props.bricks.find(name)
|
if split_screen:
|
||||||
|
props.split_screen_active_brick_index = props.split_screen_bricks.find(name)
|
||||||
|
else:
|
||||||
|
props.active_brick_index = props.bricks.find(name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_active_brick_class(cls, brick_class):
|
def set_active_brick_class(cls, brick_class, split_screen=False):
|
||||||
bpy.context.scene.BIMBrickProperties.active_brick_class = brick_class
|
props = bpy.context.scene.BIMBrickProperties
|
||||||
|
if split_screen:
|
||||||
|
props.split_screen_active_brick_class = brick_class
|
||||||
|
else:
|
||||||
|
props.active_brick_class = brick_class
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def serialize_brick(cls):
|
def serialize_brick(cls):
|
||||||
@@ -355,8 +386,11 @@ class Brick(blenderbim.core.tool.Brick):
|
|||||||
BrickStore.load_namespaces()
|
BrickStore.load_namespaces()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clear_breadcrumbs(cls):
|
def clear_breadcrumbs(cls, split_screen=False):
|
||||||
bpy.context.scene.BIMBrickProperties.brick_breadcrumbs.clear()
|
if split_screen:
|
||||||
|
bpy.context.scene.BIMBrickProperties.split_screen_brick_breadcrumbs.clear()
|
||||||
|
else:
|
||||||
|
bpy.context.scene.BIMBrickProperties.brick_breadcrumbs.clear()
|
||||||
|
|
||||||
class BrickStore:
|
class BrickStore:
|
||||||
schema = None # this is now a os path
|
schema = None # this is now a os path
|
||||||
|
|||||||
Reference in New Issue
Block a user