diff --git a/src/blenderbim/blenderbim/bim/module/brick/__init__.py b/src/blenderbim/blenderbim/bim/module/brick/__init__.py index ca3e084128..ac53d3eb41 100644 --- a/src/blenderbim/blenderbim/bim/module/brick/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/brick/__init__.py @@ -35,7 +35,6 @@ classes = ( operator.ViewBrickItem, operator.SerializeBrick, operator.AddBrickNamespace, - operator.SetBrickListRoot, operator.RemoveBrickRelation, prop.Brick, prop.BIMBrickProperties, diff --git a/src/blenderbim/blenderbim/bim/module/brick/operator.py b/src/blenderbim/blenderbim/bim/module/brick/operator.py index 5ca949ffc4..7778fd6eef 100644 --- a/src/blenderbim/blenderbim/bim/module/brick/operator.py +++ b/src/blenderbim/blenderbim/bim/module/brick/operator.py @@ -270,20 +270,6 @@ class AddBrickNamespace(bpy.types.Operator, Operator): core.add_namespace(tool.Brick, alias=alias, uri=uri) -class SetBrickListRoot(bpy.types.Operator, Operator): - bl_idname = "bim.set_brick_list_root" - bl_label = "Set Brick View Type" - bl_options = {"REGISTER", "UNDO"} - split_screen: bpy.props.BoolProperty(name="Split Screen", default=False, options={"HIDDEN"}) - - def _execute(self, context): - if self.split_screen: - 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): bl_idname = "bim.remove_brick_relation" bl_label = "Remove Relation" diff --git a/src/blenderbim/blenderbim/bim/module/brick/prop.py b/src/blenderbim/blenderbim/bim/module/brick/prop.py index 2396b65a59..fed515b044 100644 --- a/src/blenderbim/blenderbim/bim/module/brick/prop.py +++ b/src/blenderbim/blenderbim/bim/module/brick/prop.py @@ -30,6 +30,8 @@ from bpy.props import ( FloatVectorProperty, CollectionProperty, ) +import blenderbim.core.brick as core +import blenderbim.tool.brick as tool from blenderbim.tool.brick import BrickStore def update_active_brick_index(self, context): @@ -65,6 +67,15 @@ def get_brick_relations(self, context): return BrickStore.relationships +def update_view(self, context): + root = context.scene.BIMBrickProperties.brick_list_root + core.set_brick_list_root(tool.Brick, brick_root=root, split_screen=False) + +def split_screen_update_view(self, context): + root = context.scene.BIMBrickProperties.split_screen_brick_list_root + core.set_brick_list_root(tool.Brick, brick_root=root, split_screen=True) + + class Brick(PropertyGroup): name: StringProperty(name="Name") label: StringProperty(name="Label") @@ -79,7 +90,7 @@ class BIMBrickProperties(PropertyGroup): active_brick_index: IntProperty(name="Active Brick Index", update=update_active_brick_index) libraries: EnumProperty(name="Libraries", items=get_libraries) set_list_root_toggled: BoolProperty(name="Set List Root Toggled", default=False) - brick_list_root: EnumProperty(name="Brick List Root", items=get_brick_roots) + brick_list_root: EnumProperty(name="Brick List Root", items=get_brick_roots, update=update_view) # namespace manager namespace: EnumProperty(name="Namespace", items=get_namespaces) brick_settings_toggled: BoolProperty(name="Brick Settings Toggled", default=False) @@ -102,4 +113,4 @@ class BIMBrickProperties(PropertyGroup): 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) \ No newline at end of file + split_screen_brick_list_root: EnumProperty(name="Split Screen Brick List Root", items=get_brick_roots, update=split_screen_update_view) \ No newline at end of file diff --git a/src/blenderbim/blenderbim/bim/module/brick/ui.py b/src/blenderbim/blenderbim/bim/module/brick/ui.py index b19e7152d8..20a46e8d45 100644 --- a/src/blenderbim/blenderbim/bim/module/brick/ui.py +++ b/src/blenderbim/blenderbim/bim/module/brick/ui.py @@ -91,6 +91,7 @@ class BIM_PT_brickschema(Panel): row = self.layout.row(align=True) col = row.column() col.alignment = "RIGHT" + row.prop(data=self.props, property="set_list_root_toggled", text="", icon="OUTLINER") row.prop(data=self.props, property="split_screen_toggled", text="", icon="WINDOW") grid = self.layout.grid_flow(even_columns=True) @@ -99,13 +100,10 @@ class BIM_PT_brickschema(Panel): 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.label(text=self.props.active_brick_class) if self.props.set_list_root_toggled: row = grid1.row(align=True) - 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() @@ -122,8 +120,6 @@ class BIM_PT_brickschema(Panel): 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() diff --git a/src/blenderbim/blenderbim/core/brick.py b/src/blenderbim/blenderbim/core/brick.py index dace67569d..5fea5abe1a 100644 --- a/src/blenderbim/blenderbim/core/brick.py +++ b/src/blenderbim/blenderbim/core/brick.py @@ -132,9 +132,7 @@ def add_namespace(brick, alias=None, uri=None): def set_brick_list_root(brick, brick_root=None, split_screen=False): - brick.clear_brick_browser(split_screen=split_screen) - brick.import_brick_classes(brick_root, split_screen=split_screen) - brick.set_active_brick_class(brick_root, split_screen=split_screen) + brick.run_view_brick_class(brick_class=brick_root, split_screen=split_screen) brick.clear_breadcrumbs(split_screen=split_screen)