mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
* first attempt * adopted new solution for umlauts in enums * fix typo
This commit is contained in:
@@ -24,6 +24,7 @@ import ifcopenshell
|
|||||||
import ifcopenshell.util.pset
|
import ifcopenshell.util.pset
|
||||||
import blenderbim.bim.handler
|
import blenderbim.bim.handler
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
|
from collections import defaultdict
|
||||||
from bpy.types import PropertyGroup
|
from bpy.types import PropertyGroup
|
||||||
from bpy.props import (
|
from bpy.props import (
|
||||||
PointerProperty,
|
PointerProperty,
|
||||||
@@ -191,12 +192,36 @@ def update_is_visible(self, context):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def getAttributeEnumValues(self, context):
|
def InternStr(s):
|
||||||
|
if not hasattr(InternStr, "StringCache"): # Another way to define a function attribute
|
||||||
|
InternStr.StringCache = defaultdict(str)
|
||||||
|
InternStr.StringCache[s] = s
|
||||||
|
return InternStr.StringCache[s]
|
||||||
|
|
||||||
|
InternStr.StringCache = {}
|
||||||
|
|
||||||
|
|
||||||
|
def getAttributeEnumValues(prop, context):
|
||||||
# Support weird buildingSMART dictionary mappings which behave like enums
|
# Support weird buildingSMART dictionary mappings which behave like enums
|
||||||
data = json.loads(self.enum_items)
|
items = []
|
||||||
|
data = json.loads(prop.enum_items)
|
||||||
|
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
return [(str(k), v, "") for k, v in data.items()]
|
for k, v in data.items():
|
||||||
return [(e, e, "") for e in data]
|
items.append((
|
||||||
|
InternStr(k),
|
||||||
|
InternStr(v),
|
||||||
|
"",
|
||||||
|
))
|
||||||
|
else:
|
||||||
|
for e in data:
|
||||||
|
items.append((
|
||||||
|
InternStr(e),
|
||||||
|
InternStr(e),
|
||||||
|
"",
|
||||||
|
))
|
||||||
|
|
||||||
|
return items
|
||||||
|
|
||||||
|
|
||||||
def update_schema_dir(self, context):
|
def update_schema_dir(self, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user