From 28864cefb11bbbfa13237105c46266b11fc922d0 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 24 Aug 2021 14:42:50 +1000 Subject: [PATCH] Block the user from creating sub resources under a subcontract resource. --- src/blenderbim/blenderbim/bim/module/resource/ui.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/resource/ui.py b/src/blenderbim/blenderbim/bim/module/resource/ui.py index c00d61bedf..060688aa7e 100644 --- a/src/blenderbim/blenderbim/bim/module/resource/ui.py +++ b/src/blenderbim/blenderbim/bim/module/resource/ui.py @@ -1,4 +1,3 @@ - # BlenderBIM Add-on - OpenBIM Blender Add-on # Copyright (C) 2020, 2021 Dion Moult # @@ -22,6 +21,7 @@ from blenderbim.bim.ifc import IfcStore from ifcopenshell.api.resource.data import Data import blenderbim.bim.helper + class BIM_PT_resources(Panel): bl_label = "IFC Resources" bl_idname = "BIM_PT_resources" @@ -68,7 +68,12 @@ class BIM_PT_resources(Panel): } total_resources = len(self.tprops.resources) - if total_resources and self.props.active_resource_index < total_resources: + if ( + total_resources + and self.props.active_resource_index < total_resources + and Data.resources[self.tprops.resources[self.props.active_resource_index].ifc_definition_id]["type"] + != "IfcSubContractResource" + ): row = self.layout.row(align=True) for ifc_class, icon in icon_map.items(): label = ifc_class.replace("Ifc", "").replace("Construction", "").replace("Resource", "")