mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix bug where Blender prop enums persisted when starting new files
This commit is contained in:
@@ -52,12 +52,17 @@ def subscribe_to(object, data_path, callback):
|
||||
def purge_module_data():
|
||||
from blenderbim.bim import modules
|
||||
|
||||
for name in modules.keys():
|
||||
for name, value in modules.items():
|
||||
try:
|
||||
getattr(getattr(getattr(ifcopenshell.api, name), "data"), "Data").purge()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
getattr(value, "prop").purge()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
@persistent
|
||||
def loadIfcStore(scene):
|
||||
|
||||
@@ -17,6 +17,11 @@ from bpy.props import (
|
||||
bcfviewpoints_enum = None
|
||||
|
||||
|
||||
def purge():
|
||||
global bcfviewpoints_enum
|
||||
bcfviewpoints_enum = None
|
||||
|
||||
|
||||
def updateBcfReferenceLink(self, context):
|
||||
if bpy.context.scene.BCFProperties.is_loaded:
|
||||
bpy.ops.bim.edit_bcf_reference_links()
|
||||
|
||||
@@ -18,6 +18,13 @@ scenarios_enum = []
|
||||
classes_enum = []
|
||||
|
||||
|
||||
def purge():
|
||||
global scenarios_enum
|
||||
global classes_enum
|
||||
scenarios_enum = []
|
||||
classes_enum = []
|
||||
|
||||
|
||||
def getScenarios(self, context):
|
||||
global scenarios_enum
|
||||
if len(scenarios_enum) < 1:
|
||||
|
||||
@@ -16,6 +16,11 @@ from bpy.props import (
|
||||
classification_enum = []
|
||||
|
||||
|
||||
def purge():
|
||||
global classification_enum
|
||||
classification_enum = []
|
||||
|
||||
|
||||
def getClassifications(self, context):
|
||||
global classification_enum
|
||||
if len(classification_enum) < 1:
|
||||
|
||||
@@ -21,6 +21,17 @@ profileclasses_enum = []
|
||||
parameterizedprofileclasses_enum = []
|
||||
|
||||
|
||||
def purge():
|
||||
global materials_enum
|
||||
global materialtypes_enum
|
||||
global profileclasses_enum
|
||||
global parameterizedprofileclasses_enum
|
||||
materials_enum = []
|
||||
materialtypes_enum = []
|
||||
profileclasses_enum = []
|
||||
parameterizedprofileclasses_enum = []
|
||||
|
||||
|
||||
def getProfileClasses(self, context):
|
||||
global profileclasses_enum
|
||||
if len(profileclasses_enum) == 0 and IfcStore.get_schema():
|
||||
|
||||
@@ -18,6 +18,11 @@ from bpy.props import (
|
||||
ifcpatchrecipes_enum = []
|
||||
|
||||
|
||||
def purge():
|
||||
global ifcpatchrecipes_enum
|
||||
ifcpatchrecipes_enum = []
|
||||
|
||||
|
||||
def getIfcPatchRecipes(self, context):
|
||||
global ifcpatchrecipes_enum
|
||||
if len(ifcpatchrecipes_enum) < 1:
|
||||
|
||||
@@ -19,6 +19,13 @@ psetnames = {}
|
||||
qtonames = {}
|
||||
|
||||
|
||||
def purge():
|
||||
global psetnames
|
||||
global qtonames
|
||||
psetnames = {}
|
||||
qtonames = {}
|
||||
|
||||
|
||||
def getPsetNames(self, context):
|
||||
global psetnames
|
||||
obj = context.active_object
|
||||
|
||||
@@ -21,6 +21,13 @@ psettemplatefiles_enum = []
|
||||
psettemplates_enum = []
|
||||
|
||||
|
||||
def purge():
|
||||
global psettemplatefiles_enum
|
||||
global psettemplates_enum
|
||||
psettemplatefiles_enum = []
|
||||
psettemplates_enum = []
|
||||
|
||||
|
||||
def updatePsetTemplateFiles(self, context):
|
||||
global psettemplates_enum
|
||||
IfcStore.pset_template_path = os.path.join(
|
||||
|
||||
@@ -17,6 +17,15 @@ classes_enum = []
|
||||
types_enum = []
|
||||
|
||||
|
||||
def purge():
|
||||
global products_enum
|
||||
global classes_enum
|
||||
global types_enum
|
||||
products_enum = []
|
||||
classes_enum = []
|
||||
types_enum = []
|
||||
|
||||
|
||||
def getIfcPredefinedTypes(self, context):
|
||||
global types_enum
|
||||
file = IfcStore.get_file()
|
||||
|
||||
@@ -20,6 +20,17 @@ type_classes_enum = []
|
||||
available_types_enum = []
|
||||
|
||||
|
||||
def purge():
|
||||
global applicable_types_enum
|
||||
global relating_types_enum
|
||||
global type_classes_enum
|
||||
global available_types_enum
|
||||
applicable_types_enum = []
|
||||
relating_types_enum = []
|
||||
type_classes_enum = []
|
||||
available_types_enum = []
|
||||
|
||||
|
||||
def getIfcTypes(self, context):
|
||||
global type_classes_enum
|
||||
file = IfcStore.get_file()
|
||||
|
||||
Reference in New Issue
Block a user