From e88e2f5d9c7b68d6937627931e11c9ae2ba44e9b Mon Sep 17 00:00:00 2001 From: rileywong311 Date: Thu, 3 Aug 2023 15:05:41 -0700 Subject: [PATCH] Add brick create relation with split screen --- .../blenderbim/bim/module/brick/operator.py | 4 +- .../blenderbim/bim/module/brick/ui.py | 40 ++++++++++++++----- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/brick/operator.py b/src/blenderbim/blenderbim/bim/module/brick/operator.py index f95685e032..5ca949ffc4 100644 --- a/src/blenderbim/blenderbim/bim/module/brick/operator.py +++ b/src/blenderbim/blenderbim/bim/module/brick/operator.py @@ -149,7 +149,9 @@ class AddBrickRelation(bpy.types.Operator, Operator): brick = props.bricks[props.active_brick_index] if props.new_brick_relation_type == "http://www.w3.org/2000/01/rdf-schema#label": object = props.new_brick_relation_object - else: + elif props.split_screen_toggled: + object = props.split_screen_bricks[props.split_screen_active_brick_index].uri + else: object = props.new_brick_relation_namespace + props.new_brick_relation_object core.add_brick_relation( tool.Brick, diff --git a/src/blenderbim/blenderbim/bim/module/brick/ui.py b/src/blenderbim/blenderbim/bim/module/brick/ui.py index 445f87e076..b19e7152d8 100644 --- a/src/blenderbim/blenderbim/bim/module/brick/ui.py +++ b/src/blenderbim/blenderbim/bim/module/brick/ui.py @@ -104,7 +104,8 @@ class BIM_PT_brickschema(Panel): if self.props.set_list_root_toggled: row = grid1.row(align=True) - row.operator("bim.set_brick_list_root", text="Set View") + op = row.operator("bim.set_brick_list_root", text="Set View") + op.split_screen = False row.prop(data=self.props, property="brick_list_root", text="") row = grid1.row() @@ -137,22 +138,39 @@ class BIM_PT_brickschema(Panel): 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: - row = self.layout.row(align=True) - row.label(text="Create Relation:") - - if not self.props.new_brick_relation_type == "http://www.w3.org/2000/01/rdf-schema#label": - row = self.layout.row(align=True) - prop_with_search(row, self.props, "new_brick_relation_namespace", text="") + row = self.layout.row(align=True) + row.label(text="Create Relation:") + if self.props.brick_create_relations_toggled and self.props.new_brick_relation_type == "http://www.w3.org/2000/01/rdf-schema#label": row = self.layout.row(align=True) prop_with_search(row, self.props, "new_brick_relation_type", text="") row.prop(data=self.props, property="new_brick_relation_object", text="") row.operator("bim.add_brick_relation", text="", icon="ADD") - if self.props.add_relation_failed: - row = self.layout.row(align=True) - row.label(text="Failed to find this entity!", icon="ERROR") + elif self.props.brick_create_relations_toggled and self.props.split_screen_toggled: + row = self.layout.row(align=True) + split_screen_selection = self.props.split_screen_bricks[self.props.split_screen_active_brick_index] + if split_screen_selection.total_items: + row.label(text="No selection", icon="INFO") + else: + prop_with_search(row, self.props, "new_brick_relation_type", text="") + row.label(text=split_screen_selection.label if split_screen_selection.label else split_screen_selection.name) + row.operator("bim.add_brick_relation", text="", icon="ADD") + + elif self.props.brick_create_relations_toggled: + row = self.layout.row(align=True) + prop_with_search(row, self.props, "new_brick_relation_namespace", text="") + + row = self.layout.row(align=True) + prop_with_search(row, self.props, "new_brick_relation_type", text="") + row.prop(data=self.props, property="new_brick_relation_object", text="") + row.operator("bim.add_brick_relation", text="", icon="ADD") + + + if self.props.brick_create_relations_toggled and self.props.add_relation_failed: + row = self.layout.row(align=True) + row.label(text="Failed to find this entity!", icon="ERROR") + for relation in BrickschemaData.data["active_relations"]: row = self.layout.row(align=True)