Construction Type Browser, polishing of 2nd iteration (#2336)

* Polish a bit the type browser UI

* Remove SELECT from type browser

* model and geometry module tests fixed

* Polishing of type authoring layout redesign

* Further polishing of type authoring layout
This commit is contained in:
Carlos Villagrasa
2022-08-10 13:23:13 +02:00
committed by GitHub
parent fa8fc161da
commit 4e5503002a
5 changed files with 16 additions and 29 deletions
@@ -55,7 +55,7 @@ class AuthoringData:
@classmethod
def load_relating_types_browser(cls):
cls.data["relating_types_browser_ids"] = cls.relating_types_browser()
cls.data["relating_types_ids_browser"] = cls.relating_types_browser()
@classmethod
def load_preview_constr_types(cls):
@@ -105,8 +105,10 @@ class AuthoringData:
@classmethod
def assetize_constr_class(cls, ifc_class=None):
selected_ifc_class = cls.props.ifc_class
selected_relating_type_id = cls.props.relating_type_id
if ifc_class is None:
ifc_class = cls.props.ifc_class
ifc_class = cls.props.ifc_class_browser
relating_type_info = cls.relating_type_info(ifc_class)
_ = cls.new_relating_type_info(ifc_class) if relating_type_info is None else relating_type_info
constr_class_occurrences = cls.constr_class_entities(ifc_class)
@@ -122,6 +124,10 @@ class AuthoringData:
cls.assetize_object(obj, ifc_class, constr_class_entity)
relating_type_info = cls.relating_type_info(ifc_class)
relating_type_info.fully_loaded = True
cls.props.updating = True
cls.props.ifc_class = selected_ifc_class
cls.props.relating_type_id = selected_relating_type_id
cls.props.updating = False
@classmethod
def assetize_object(cls, obj, ifc_class, ifc_class_entity, from_selection=False):
@@ -36,7 +36,7 @@ def get_relating_type(self, context):
def get_relating_type_browser(self, context):
if not AuthoringData.is_loaded:
AuthoringData.load()
return AuthoringData.data["relating_types_browser_ids"]
return AuthoringData.data["relating_types_ids_browser"]
def update_icon_id(self, context, browser=False):
@@ -49,16 +49,14 @@ def update_icon_id(self, context, browser=False):
) and relating_type is not None:
if not AuthoringData.assetize_relating_type_from_selection(browser=browser):
return
if ifc_class not in AuthoringData.data["preview_constr_types"]:
pass
self.icon_id = AuthoringData.data["preview_constr_types"][ifc_class][relating_type_id]["icon_id"]
def update_ifc_class(self, context):
AuthoringData.load_ifc_classes()
AuthoringData.load_relating_types()
if self.updating:
return
if not self.updating:
update_icon_id(self, context)
def update_ifc_class_browser(self, context):
@@ -73,6 +73,7 @@ class BimTool(WorkSpaceTool):
if ifc_classes and relating_types_ids and not props.icon_id:
# hack Dion won't like to show a preview also on the first time the sidebar is shown
bpy.app.timers.register(lambda: prop.update_ifc_class_browser(props, context))
bpy.app.timers.register(lambda: prop.update_relating_type(props, context))
ifc_class = props.ifc_class
+4 -10
View File
@@ -51,9 +51,7 @@ Scenario: Add type instance - add a mesh where existing instances have changed c
Scenario: Preview one type on the Construction Type Browser
Given an empty IFC project
And I load the demo construction library
When I display the construction type browser
And I preview only one asset on the construction type browser
And I set "scene.BIMModelProperties.ifc_class" to "IfcColumnType"
When I set "scene.BIMModelProperties.ifc_class" to "IfcColumnType"
And I set "scene.BIMModelProperties.relating_type" to "DEMO2"
Then construction type is DEMO2
And objects starting with "IfcColumn/" do not exist
@@ -63,18 +61,14 @@ Scenario: Preview one class on the construction type browser
Given an empty IFC project
And I load the demo construction library
When I display the construction type browser
And I preview all available assets on the construction type browser
And I set "scene.BIMModelProperties.ifc_class" to "IfcWallType"
Then "scene.BIMModelProperties.ifc_class" is "IfcWallType"
And objects starting with "IfcWall/" do not exist
And I set "scene.BIMModelProperties.ifc_class_browser" to "IfcWallType"
Then objects starting with "IfcWall/" do not exist
And all construction types for "IfcWallType" have a preview
Scenario: Add one type from the Construction Type Browser
Given an empty IFC project
And I load the demo construction library
When I display the construction type browser
And I preview only one asset on the construction type browser
And I set "scene.BIMModelProperties.ifc_class" to "IfcColumnType"
When I set "scene.BIMModelProperties.ifc_class" to "IfcColumnType"
And I set "scene.BIMModelProperties.relating_type" to "DEMO2"
And I add the construction type
Then the object "IfcColumn/Column" exists
-12
View File
@@ -629,18 +629,6 @@ def i_display_the_construction_type_browser():
bpy.ops.bim.display_constr_types("INVOKE_DEFAULT")
@given("I preview only one asset on the construction type browser")
@when("I preview only one asset on the construction type browser")
def i_preview_one_construction_type():
bpy.context.scene.BIMModelProperties.unfold_relating_types = False
@given("I preview all available assets on the construction type browser")
@when("I preview all available assets on the construction type browser")
def i_preview_all_construction_types():
bpy.context.scene.BIMModelProperties.unfold_relating_types = True
@given("I add the construction type")
@when("I add the construction type")
def i_add_the_active_construction_type():