WIP refactor context UI into its own module. Remove dependency to Blender properties. See #1222.

This commit is contained in:
Dion Moult
2021-01-03 12:08:00 +11:00
parent b91dfb401d
commit c5ec54ca7f
7 changed files with 123 additions and 84 deletions
@@ -0,0 +1,30 @@
import blenderbim.bim.ifc
is_loaded = False
class Data:
is_loaded = False
contexts = {}
@classmethod
def load(cls):
file = blenderbim.bim.ifc.IfcStore.get_file()
if not file:
return
cls.contexts = {}
for context in file.by_type("IfcGeometricRepresentationContext", include_subtypes=False):
subcontexts = {}
# See bug #1224 for why we don't use HasSubContexts
for subcontext in file.by_type("IfcGeometricRepresentationSubContext"):
if subcontext.ParentContext != context:
continue
subcontexts[int(subcontext.id())] = {
"ContextType": subcontext.ContextType,
"ContextIdentifier": subcontext.ContextIdentifier,
"TargetView": subcontext.TargetView,
}
cls.contexts[int(context.id())] = {
"ContextType": context.ContextType,
"HasSubContexts": subcontexts
}
cls.is_loaded = True