diff --git a/src/blenderbim/blenderbim/bim/module/pset_template/__init__.py b/src/blenderbim/blenderbim/bim/module/pset_template/__init__.py
index 1f822620da..3bc180c204 100644
--- a/src/blenderbim/blenderbim/bim/module/pset_template/__init__.py
+++ b/src/blenderbim/blenderbim/bim/module/pset_template/__init__.py
@@ -20,21 +20,20 @@ import bpy
from . import ui, prop, operator
classes = (
- operator.RefreshPsetTemplates,
- operator.AddPsetFile,
- operator.SavePsetTemplateFile,
- operator.AddPsetTemplate,
- operator.EditPsetTemplate,
- operator.RemovePsetTemplate,
- operator.AddPropTemplate,
- operator.EditPropTemplate,
- operator.RemovePropTemplate,
- operator.EnableEditingPsetTemplate,
- operator.DisableEditingPsetTemplate,
- operator.EnableEditingPropTemplate,
- operator.DeletePropEnum,
operator.AddPropEnum,
+ operator.AddPropTemplate,
+ operator.AddPsetFile,
+ operator.AddPsetTemplate,
+ operator.DeletePropEnum,
operator.DisableEditingPropTemplate,
+ operator.DisableEditingPsetTemplate,
+ operator.EditPropTemplate,
+ operator.EditPsetTemplate,
+ operator.EnableEditingPropTemplate,
+ operator.EnableEditingPsetTemplate,
+ operator.RemovePropTemplate,
+ operator.RemovePsetTemplate,
+ operator.SavePsetTemplateFile,
prop.PsetTemplate,
prop.EnumerationValues,
prop.PropTemplate,
diff --git a/src/blenderbim/blenderbim/bim/module/pset_template/data.py b/src/blenderbim/blenderbim/bim/module/pset_template/data.py
index 66d40530d0..70cdf93dee 100644
--- a/src/blenderbim/blenderbim/bim/module/pset_template/data.py
+++ b/src/blenderbim/blenderbim/bim/module/pset_template/data.py
@@ -16,8 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see .
+import os
import bpy
+import ifcopenshell
import blenderbim.tool as tool
+from blenderbim.bim.ifc import IfcStore
def refresh():
@@ -30,10 +33,51 @@ class PsetTemplatesData:
@classmethod
def load(cls):
- cls.data = {"primary_measure_type": cls.primary_measure_type()}
cls.is_loaded = True
+ cls.data["primary_measure_type"] = cls.primary_measure_type()
+ cls.data["pset_template_files"] = cls.pset_template_files()
+ cls.data["pset_templates"] = cls.pset_templates()
+ cls.data["pset_template"] = cls.pset_template()
+ cls.data["prop_templates"] = cls.prop_templates()
@classmethod
def primary_measure_type(cls):
schema = tool.Ifc.schema()
return [(t, t, "") for t in sorted([d.name() for d in schema.declarations() if hasattr(d, "declared_type")])]
+
+ @classmethod
+ def pset_template_files(cls):
+ files = os.listdir(os.path.join(bpy.context.scene.BIMProperties.data_dir, "pset"))
+ return [(f.replace(".ifc", ""), f.replace(".ifc", ""), "") for f in files]
+
+ @classmethod
+ def pset_templates(cls):
+ if not IfcStore.pset_template_file:
+ IfcStore.pset_template_path = os.path.join(
+ bpy.context.scene.BIMProperties.data_dir,
+ "pset",
+ bpy.context.scene.BIMPsetTemplateProperties.pset_template_files + ".ifc",
+ )
+ IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path)
+ return [(str(t.id()), t.Name, "") for t in IfcStore.pset_template_file.by_type("IfcPropertySetTemplate")]
+
+ @classmethod
+ def pset_template(cls):
+ props = bpy.context.scene.BIMPsetTemplateProperties
+ template_id = props.pset_templates
+ if not template_id:
+ return {}
+ info = IfcStore.pset_template_file.by_id(int(template_id)).get_info()
+ del info["id"]
+ del info["type"]
+ del info["OwnerHistory"]
+ del info["HasPropertyTemplates"]
+ return info
+
+ @classmethod
+ def prop_templates(cls):
+ props = bpy.context.scene.BIMPsetTemplateProperties
+ template_id = props.pset_templates
+ if not template_id:
+ return []
+ return [e.get_info() for e in IfcStore.pset_template_file.by_id(int(template_id)).HasPropertyTemplates or []]
diff --git a/src/blenderbim/blenderbim/bim/module/pset_template/operator.py b/src/blenderbim/blenderbim/bim/module/pset_template/operator.py
index c01aefe847..4c3b706933 100644
--- a/src/blenderbim/blenderbim/bim/module/pset_template/operator.py
+++ b/src/blenderbim/blenderbim/bim/module/pset_template/operator.py
@@ -22,24 +22,26 @@ import ifcopenshell
import ifcopenshell.api
import blenderbim.bim.schema
import blenderbim.bim.handler
-from blenderbim.bim.module.pset_template.prop import purge as purge_templates, updatePsetTemplates, getPsetTemplates
-from blenderbim.bim.module.pset.prop import purge as purge_psets
-from ifcopenshell.api.pset_template.data import Data
from blenderbim.bim.ifc import IfcStore
-# This is just a temporary operator until
-# @Moult performs some of his refactor-magic ;) - vulevukusej
-class RefreshPsetTemplates(bpy.types.Operator):
- bl_idname = "bim.refresh_psettemplates"
- bl_label = "Refresh the data for PsetTemplates"
- bl_options = {"REGISTER", "UNDO"}
-
+class Operator:
def execute(self, context):
- purge_templates()
- purge_psets()
+ IfcStore.begin_transaction(self)
+ IfcStore.pset_template_file.begin_transaction()
+ result = self._execute(context)
+ IfcStore.pset_template_file.end_transaction()
+ IfcStore.add_transaction_operation(self)
+ IfcStore.end_transaction(self)
+ blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
+ def rollback(self, data):
+ IfcStore.pset_template_file.undo()
+
+ def commit(self, data):
+ IfcStore.pset_template_file.redo()
+
class AddPsetFile(bpy.types.Operator):
bl_idname = "bim.add_pset_file"
@@ -76,52 +78,22 @@ class AddPsetFile(bpy.types.Operator):
return {"FINISHED"}
-class AddPsetTemplate(bpy.types.Operator):
+class AddPsetTemplate(bpy.types.Operator, Operator):
bl_idname = "bim.add_pset_template"
bl_label = "Add Pset Template"
bl_options = {"REGISTER", "UNDO"}
- def execute(self, context):
- IfcStore.begin_transaction(self)
- IfcStore.pset_template_file.begin_transaction()
- result = self._execute(context)
- IfcStore.pset_template_file.end_transaction()
- IfcStore.add_transaction_operation(self)
- IfcStore.end_transaction(self)
- return result
-
def _execute(self, context):
- ifcopenshell.api.run("pset_template.add_pset_template", IfcStore.pset_template_file)
- Data.load(IfcStore.pset_template_file)
- updatePsetTemplates(self, context)
- return {"FINISHED"}
-
- def rollback(self, data):
- IfcStore.pset_template_file.undo()
-
- def commit(self, data):
- IfcStore.pset_template_file.redo()
+ template = ifcopenshell.api.run("pset_template.add_pset_template", IfcStore.pset_template_file)
+ blenderbim.bim.handler.refresh_ui_data()
+ context.scene.BIMPsetTemplateProperties.pset_templates = str(template.id())
-class RemovePsetTemplate(bpy.types.Operator):
+class RemovePsetTemplate(bpy.types.Operator, Operator):
bl_idname = "bim.remove_pset_template"
bl_label = "Remove Pset Template"
bl_options = {"REGISTER", "UNDO"}
- @classmethod
- def poll(cls, context):
- props = context.scene.BIMPsetTemplateProperties
- return bool(getPsetTemplates(props, context))
-
- def execute(self, context):
- IfcStore.begin_transaction(self)
- IfcStore.pset_template_file.begin_transaction()
- result = self._execute(context)
- IfcStore.pset_template_file.end_transaction()
- IfcStore.add_transaction_operation(self)
- IfcStore.end_transaction(self)
- return result
-
def _execute(self, context):
props = context.scene.BIMPsetTemplateProperties
if props.active_pset_template_id == int(props.pset_templates):
@@ -131,15 +103,6 @@ class RemovePsetTemplate(bpy.types.Operator):
IfcStore.pset_template_file,
**{"pset_template": IfcStore.pset_template_file.by_id(int(props.pset_templates))}
)
- Data.load(IfcStore.pset_template_file)
- updatePsetTemplates(self, context)
- return {"FINISHED"}
-
- def rollback(self, data):
- IfcStore.pset_template_file.undo()
-
- def commit(self, data):
- IfcStore.pset_template_file.redo()
class EnableEditingPsetTemplate(bpy.types.Operator):
@@ -147,20 +110,15 @@ class EnableEditingPsetTemplate(bpy.types.Operator):
bl_label = "Enable Editing Pset Template"
bl_options = {"REGISTER", "UNDO"}
- @classmethod
- def poll(cls, context):
- props = context.scene.BIMPsetTemplateProperties
- return bool(getPsetTemplates(props, context))
-
def execute(self, context):
props = context.scene.BIMPsetTemplateProperties
props.active_pset_template_id = int(props.pset_templates)
- template = Data.pset_templates[props.active_pset_template_id]
- props.active_pset_template.global_id = template["GlobalId"]
- props.active_pset_template.name = template["Name"] or ""
- props.active_pset_template.description = template["Description"] or ""
- props.active_pset_template.template_type = template["TemplateType"]
- props.active_pset_template.applicable_entity = template["ApplicableEntity"] or ""
+ template = IfcStore.pset_template_file.by_id(props.active_pset_template_id)
+ props.active_pset_template.global_id = template.GlobalId
+ props.active_pset_template.name = template.Name or ""
+ props.active_pset_template.description = template.Description or ""
+ props.active_pset_template.template_type = template.TemplateType
+ props.active_pset_template.applicable_entity = template.ApplicableEntity or ""
return {"FINISHED"}
@@ -184,20 +142,19 @@ class EnableEditingPropTemplate(bpy.types.Operator):
def execute(self, context):
props = context.scene.BIMPsetTemplateProperties
props.active_prop_template_id = self.prop_template
- template = Data.prop_templates[props.active_prop_template_id]
- props.active_prop_template.name = template["Name"] or ""
- props.active_prop_template.description = template["Description"] or ""
- props.active_prop_template.primary_measure_type = template["PrimaryMeasureType"]
- props.active_prop_template.template_type = template["TemplateType"]
+ template = IfcStore.pset_template_file.by_id(props.active_prop_template_id)
+ props.active_prop_template.name = template.Name or ""
+ props.active_prop_template.description = template.Description or ""
+ props.active_prop_template.primary_measure_type = template.PrimaryMeasureType
+ props.active_prop_template.template_type = template.TemplateType
props.active_prop_template.enum_values.clear()
- if template["Enumerators"]:
+ if template.Enumerators:
props.active_prop_template.enum_values.clear()
data_type = props.active_prop_template.get_value_name()
- for e in template["Enumerators"].EnumerationValues:
+ for e in template.Enumerators.EnumerationValues:
new = props.active_prop_template.enum_values.add()
setattr(new, data_type, e.wrappedValue)
-
return {"FINISHED"}
@@ -236,20 +193,11 @@ class DisableEditingPropTemplate(bpy.types.Operator):
return {"FINISHED"}
-class EditPsetTemplate(bpy.types.Operator):
+class EditPsetTemplate(bpy.types.Operator, Operator):
bl_idname = "bim.edit_pset_template"
bl_label = "Edit Pset Template"
bl_options = {"REGISTER", "UNDO"}
- def execute(self, context):
- IfcStore.begin_transaction(self)
- IfcStore.pset_template_file.begin_transaction()
- result = self._execute(context)
- IfcStore.pset_template_file.end_transaction()
- IfcStore.add_transaction_operation(self)
- IfcStore.end_transaction(self)
- return result
-
def _execute(self, context):
props = context.scene.BIMPsetTemplateProperties
ifcopenshell.api.run(
@@ -265,16 +213,7 @@ class EditPsetTemplate(bpy.types.Operator):
},
}
)
- Data.load(IfcStore.pset_template_file)
- updatePsetTemplates(self, context)
bpy.ops.bim.disable_editing_pset_template()
- return {"FINISHED"}
-
- def rollback(self, data):
- IfcStore.pset_template_file.undo()
-
- def commit(self, data):
- IfcStore.pset_template_file.redo()
class SavePsetTemplateFile(bpy.types.Operator):
@@ -288,20 +227,11 @@ class SavePsetTemplateFile(bpy.types.Operator):
return {"FINISHED"}
-class AddPropTemplate(bpy.types.Operator):
+class AddPropTemplate(bpy.types.Operator, Operator):
bl_idname = "bim.add_prop_template"
bl_label = "Add Prop Template"
bl_options = {"REGISTER", "UNDO"}
- def execute(self, context):
- IfcStore.begin_transaction(self)
- IfcStore.pset_template_file.begin_transaction()
- result = self._execute(context)
- IfcStore.pset_template_file.end_transaction()
- IfcStore.add_transaction_operation(self)
- IfcStore.end_transaction(self)
- return result
-
def _execute(self, context):
props = context.scene.BIMPsetTemplateProperties
pset_template_id = props.active_pset_template_id or int(props.pset_templates)
@@ -310,31 +240,14 @@ class AddPropTemplate(bpy.types.Operator):
IfcStore.pset_template_file,
**{"pset_template": IfcStore.pset_template_file.by_id(pset_template_id)}
)
- Data.load(IfcStore.pset_template_file)
- return {"FINISHED"}
-
- def rollback(self, data):
- IfcStore.pset_template_file.undo()
-
- def commit(self, data):
- IfcStore.pset_template_file.redo()
-class RemovePropTemplate(bpy.types.Operator):
+class RemovePropTemplate(bpy.types.Operator, Operator):
bl_idname = "bim.remove_prop_template"
bl_label = "Remove Prop Template"
bl_options = {"REGISTER", "UNDO"}
prop_template: bpy.props.IntProperty()
- def execute(self, context):
- IfcStore.begin_transaction(self)
- IfcStore.pset_template_file.begin_transaction()
- result = self._execute(context)
- IfcStore.pset_template_file.end_transaction()
- IfcStore.add_transaction_operation(self)
- IfcStore.end_transaction(self)
- return result
-
def _execute(self, context):
props = context.scene.BIMPsetTemplateProperties
ifcopenshell.api.run(
@@ -342,30 +255,13 @@ class RemovePropTemplate(bpy.types.Operator):
IfcStore.pset_template_file,
**{"prop_template": IfcStore.pset_template_file.by_id(self.prop_template)}
)
- Data.load(IfcStore.pset_template_file)
- return {"FINISHED"}
-
- def rollback(self, data):
- IfcStore.pset_template_file.undo()
-
- def commit(self, data):
- IfcStore.pset_template_file.redo()
-class EditPropTemplate(bpy.types.Operator):
+class EditPropTemplate(bpy.types.Operator, Operator):
bl_idname = "bim.edit_prop_template"
bl_label = "Edit Prop Template"
bl_options = {"REGISTER", "UNDO"}
- def execute(self, context):
- IfcStore.begin_transaction(self)
- IfcStore.pset_template_file.begin_transaction()
- result = self._execute(context)
- IfcStore.pset_template_file.end_transaction()
- IfcStore.add_transaction_operation(self)
- IfcStore.end_transaction(self)
- return result
-
def _execute(self, context):
props = context.scene.BIMPsetTemplateProperties
if props.active_prop_template.template_type == "P_ENUMERATEDVALUE":
@@ -386,9 +282,7 @@ class EditPropTemplate(bpy.types.Operator):
},
}
)
- Data.load(IfcStore.pset_template_file)
bpy.ops.bim.disable_editing_prop_template()
- return {"FINISHED"}
# TODO -This will need to go into the
# api code at some point - vulevukusej
@@ -404,9 +298,3 @@ class EditPropTemplate(bpy.types.Operator):
),
)
return prop_enum
-
- def rollback(self, data):
- IfcStore.pset_template_file.undo()
-
- def commit(self, data):
- IfcStore.pset_template_file.redo()
diff --git a/src/blenderbim/blenderbim/bim/module/pset_template/prop.py b/src/blenderbim/blenderbim/bim/module/pset_template/prop.py
index 6642534e88..23fef7863c 100644
--- a/src/blenderbim/blenderbim/bim/module/pset_template/prop.py
+++ b/src/blenderbim/blenderbim/bim/module/pset_template/prop.py
@@ -1,5 +1,5 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
-# Copyright (C) 2020, 2021 Dion Moult
+# Copyright (C) 2020-2022 Dion Moult
#
# This file is part of BlenderBIM Add-on.
#
@@ -33,59 +33,30 @@ from bpy.props import (
FloatVectorProperty,
CollectionProperty,
)
-from ifcopenshell.api.pset_template.data import Data
-
-
-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(
- context.scene.BIMProperties.data_dir,
- "pset",
- context.scene.BIMPsetTemplateProperties.pset_template_files + ".ifc",
- )
- IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path)
- updatePsetTemplates(self, context)
+ IfcStore.pset_template_file = None
+ PsetTemplatesData.data["pset_template_files"] = PsetTemplatesData.pset_template_files()
+ PsetTemplatesData.data["pset_templates"] = PsetTemplatesData.pset_templates()
+ PsetTemplatesData.data["prop_templates"] = PsetTemplatesData.prop_templates()
def getPsetTemplateFiles(self, context):
- global psettemplatefiles_enum
- if len(psettemplatefiles_enum) < 1:
- files = os.listdir(os.path.join(context.scene.BIMProperties.data_dir, "pset"))
- psettemplatefiles_enum.extend([(f.replace(".ifc", ""), f.replace(".ifc", ""), "") for f in files])
- return psettemplatefiles_enum
+ if not PsetTemplatesData.is_loaded:
+ PsetTemplatesData.load()
+ return PsetTemplatesData.data["pset_template_files"]
def updatePsetTemplates(self, context):
- global psettemplates_enum
- psettemplates_enum.clear()
- getPsetTemplates(self, context)
+ PsetTemplatesData.data["pset_template"] = PsetTemplatesData.pset_template()
+ PsetTemplatesData.data["prop_templates"] = PsetTemplatesData.prop_templates()
def getPsetTemplates(self, context):
- global psettemplates_enum
- if len(psettemplates_enum) < 1:
- if not IfcStore.pset_template_file:
- IfcStore.pset_template_path = os.path.join(
- context.scene.BIMProperties.data_dir,
- "pset",
- context.scene.BIMPsetTemplateProperties.pset_template_files + ".ifc",
- )
- IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path)
- templates = IfcStore.pset_template_file.by_type("IfcPropertySetTemplate")
- psettemplates_enum.extend([(str(t.id()), t.Name, "") for t in templates])
- Data.load(IfcStore.pset_template_file)
- return psettemplates_enum
+ if not PsetTemplatesData.is_loaded:
+ PsetTemplatesData.load()
+ return PsetTemplatesData.data["pset_templates"]
def get_primary_measure_type(self, context):
@@ -182,7 +153,7 @@ class BIMPsetTemplateProperties(PropertyGroup):
pset_template_files: EnumProperty(
items=getPsetTemplateFiles, name="Pset Template Files", update=updatePsetTemplateFiles
)
- pset_templates: EnumProperty(items=getPsetTemplates, name="Pset Template Files")
+ pset_templates: EnumProperty(items=getPsetTemplates, name="Pset Template Files", update=updatePsetTemplates)
active_pset_template_id: IntProperty(name="Active Pset Template Id")
active_prop_template_id: IntProperty(name="Active Prop Template Id")
active_pset_template: PointerProperty(type=PsetTemplate)
diff --git a/src/blenderbim/blenderbim/bim/module/pset_template/ui.py b/src/blenderbim/blenderbim/bim/module/pset_template/ui.py
index b15ca05bd4..a5b984268b 100644
--- a/src/blenderbim/blenderbim/bim/module/pset_template/ui.py
+++ b/src/blenderbim/blenderbim/bim/module/pset_template/ui.py
@@ -20,10 +20,7 @@ import bpy
from bpy.types import Panel
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.helper import prop_with_search
-from blenderbim.bim.module.pset_template.prop import (
- getPsetTemplates,
-)
-from ifcopenshell.api.pset_template.data import Data
+from blenderbim.bim.module.pset_template.data import PsetTemplatesData
class BIM_PT_pset_template(Panel):
@@ -36,23 +33,24 @@ class BIM_PT_pset_template(Panel):
bl_parent_id = "BIM_PT_project_setup"
def draw(self, context):
- layout = self.layout
- props = context.scene.BIMPsetTemplateProperties
+ if not PsetTemplatesData.is_loaded:
+ PsetTemplatesData.load()
- row = layout.row(align=True)
- prop_with_search(row, props, "pset_template_files", text="")
+ self.props = context.scene.BIMPsetTemplateProperties
+
+ row = self.layout.row(align=True)
+ prop_with_search(row, self.props, "pset_template_files", text="")
row.operator("bim.save_pset_template_file", text="", icon="EXPORT")
row.operator("bim.add_pset_file", icon="ADD", text="")
- row.operator("bim.refresh_psettemplates", icon="FILE_REFRESH", text="")
- row = layout.row(align=True)
+ row = self.layout.row(align=True)
- if bool(getPsetTemplates(props, context)):
- prop_with_search(row, props, "pset_templates", text="", icon="COPY_ID")
+ if PsetTemplatesData.data["pset_templates"]:
+ prop_with_search(row, self.props, "pset_templates", text="", icon="COPY_ID")
else:
row.label(text="No Pset Templates", icon="COPY_ID")
- if props.active_pset_template_id:
+ if self.props.active_pset_template_id:
row.operator("bim.edit_pset_template", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_pset_template", text="", icon="CANCEL")
else:
@@ -60,49 +58,39 @@ class BIM_PT_pset_template(Panel):
row.operator("bim.enable_editing_pset_template", text="", icon="GREASEPENCIL")
row.operator("bim.remove_pset_template", text="", icon="X")
- if not Data.is_loaded and props.pset_template_files:
- Data.load(IfcStore.pset_template_file)
+ if PsetTemplatesData.data["pset_template"]:
+ self.draw_pset_template()
- if not Data.pset_templates:
- return
-
- if props.active_pset_template_id:
- pset_template = Data.pset_templates[int(props.active_pset_template_id)]
- row = layout.row()
- row.prop(props.active_pset_template, "name")
- row = layout.row()
- row.prop(props.active_pset_template, "description")
- prop_with_search(layout, props.active_pset_template, "template_type")
- row = layout.row()
- row.prop(props.active_pset_template, "applicable_entity")
+ def draw_pset_template(self):
+ if self.props.active_pset_template_id:
+ row = self.layout.row()
+ row.prop(self.props.active_pset_template, "name")
+ row = self.layout.row()
+ row.prop(self.props.active_pset_template, "description")
+ prop_with_search(self.layout, self.props.active_pset_template, "template_type")
+ row = self.layout.row()
+ row.prop(self.props.active_pset_template, "applicable_entity")
else:
- pset_template = Data.pset_templates[int(props.pset_templates)]
- for name, value in pset_template.items():
- if name == "id" or name == "type" or name == "HasPropertyTemplates":
- continue
- row = layout.row(align=True)
+ for name, value in PsetTemplatesData.data["pset_template"].items():
+ row = self.layout.row(align=True)
row.label(text=name)
row.label(text=str(value))
- row = layout.row(align=True)
+ row = self.layout.row(align=True)
row.label(text="Property Templates", icon="COPY_ID")
row.operator("bim.add_prop_template", icon="ADD", text="")
- row = layout.row()
- row.label(text="Name | Description | PrimaryMeasureType | TemplateType")
+ for prop_template in PsetTemplatesData.data["prop_templates"]:
+ row = self.layout.row(align=True)
- for prop_template_id in pset_template["HasPropertyTemplates"]:
- prop_template = Data.prop_templates[prop_template_id]
- row = layout.row(align=True)
+ if self.props.active_prop_template_id and self.props.active_prop_template_id == prop_template["id"]:
+ row.prop(self.props.active_prop_template, "name", text="")
+ row.prop(self.props.active_prop_template, "description", text="")
+ prop_with_search(row, self.props.active_prop_template, "primary_measure_type", text="")
+ row.prop(self.props.active_prop_template, "template_type", text="")
- if props.active_prop_template_id and props.active_prop_template_id == prop_template_id:
- row.prop(props.active_prop_template, "name", text="")
- row.prop(props.active_prop_template, "description", text="")
- prop_with_search(row, props.active_prop_template, "primary_measure_type", text="")
- row.prop(props.active_prop_template, "template_type", text="")
-
- if props.active_prop_template.template_type == "P_ENUMERATEDVALUE":
- row = layout.row(align=True)
+ if self.props.active_prop_template.template_type == "P_ENUMERATEDVALUE":
+ row = self.layout.row(align=True)
split = row.split(factor=0.2)
c = split.column()
c.label(
@@ -112,10 +100,10 @@ class BIM_PT_pset_template(Panel):
c = split.column()
box = c.box()
grid = box.column_flow(columns=4)
- value_name = props.active_prop_template.get_value_name()
+ value_name = self.props.active_prop_template.get_value_name()
r = grid.row()
r.operator("bim.add_prop_enum", text="Add Enum")
- for k, v in enumerate(props.active_prop_template.enum_values):
+ for k, v in enumerate(self.props.active_prop_template.enum_values):
r = grid.row(align=True)
r.prop(v, value_name, text="")
op = r.operator("bim.delete_prop_enum", icon="X", text="")
@@ -127,12 +115,12 @@ class BIM_PT_pset_template(Panel):
row.label(text=prop_template["PrimaryMeasureType"])
row.label(text=prop_template["TemplateType"])
- if props.active_prop_template_id and props.active_prop_template_id == prop_template_id:
+ if self.props.active_prop_template_id and self.props.active_prop_template_id == prop_template["id"]:
op = row.operator("bim.edit_prop_template", icon="CHECKMARK", text="")
row.operator("bim.disable_editing_prop_template", icon="CANCEL", text="")
- elif props.active_prop_template_id and props.active_prop_template_id != prop_template_id:
- row.operator("bim.remove_prop_template", icon="X", text="").prop_template = prop_template_id
+ elif self.props.active_prop_template_id and self.props.active_prop_template_id != prop_template["id"]:
+ row.operator("bim.remove_prop_template", icon="X", text="").prop_template = prop_template["id"]
else:
op = row.operator("bim.enable_editing_prop_template", icon="GREASEPENCIL", text="")
- op.prop_template = prop_template_id
- row.operator("bim.remove_prop_template", icon="X", text="").prop_template = prop_template_id
+ op.prop_template = prop_template["id"]
+ row.operator("bim.remove_prop_template", icon="X", text="").prop_template = prop_template["id"]
diff --git a/src/blenderbim/blenderbim/bim/ui.py b/src/blenderbim/blenderbim/bim/ui.py
index 2457cd99bf..d0dba39b09 100644
--- a/src/blenderbim/blenderbim/bim/ui.py
+++ b/src/blenderbim/blenderbim/bim/ui.py
@@ -150,6 +150,9 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
row = layout.row()
row.prop(self, "should_play_chaching_sound")
+ row = layout.row()
+ row.prop(context.scene.BIMProjectProperties, "should_disable_undo_on_save")
+
row = layout.row()
row.prop(context.scene.BIMModelProperties, "occurrence_name_style")
row = layout.row()