Block the user from creating sub resources under a subcontract resource.

This commit is contained in:
Dion Moult
2021-08-24 14:42:50 +10:00
parent e9ad1019a4
commit 28864cefb1
@@ -1,4 +1,3 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
@@ -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", "")