Directly use pset doc functions instead of wrapped ones

This commit is contained in:
Gorgious
2022-10-31 17:30:18 +01:00
parent e8a73e008e
commit d05d430642
2 changed files with 6 additions and 23 deletions
@@ -24,7 +24,6 @@ from ifcopenshell.api.pset.data import Data
import blenderbim.tool as tool import blenderbim.tool as tool
from blenderbim.bim.module.pset.data import AddEditCustomPropertiesData from blenderbim.bim.module.pset.data import AddEditCustomPropertiesData
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.prop import get_property_set_description
from bpy.types import PropertyGroup from bpy.types import PropertyGroup
from bpy.props import ( from bpy.props import (
PointerProperty, PointerProperty,
@@ -50,7 +49,12 @@ def purge():
def blender_formatted_enum_from_psets(psets): def blender_formatted_enum_from_psets(psets):
return [(p.Name, p.Name, get_property_set_description(p.Name)) for p in psets] enum_items = []
version = tool.Ifc.get_schema()
for pset in psets:
doc = ifcopenshell.util.doc.get_property_set_doc(version, pset.Name) or {}
enum_items.append((pset.Name, pset.Name, doc.get("description", "")))
return enum_items
def get_pset_names(self, context): def get_pset_names(self, context):
-21
View File
@@ -141,27 +141,6 @@ def get_attribute_description(entity, attribute):
return doc return doc
def get_property_set_docs(pset):
schema = tool.Ifc.get_schema()
if schema is not None:
return get_property_set_doc(schema, pset)
def get_property_set_description(pset):
docs = get_property_set_docs(pset)
return docs.get("description", "") if docs is not None else ""
def get_property_set_properties(pset):
docs = get_property_set_docs(pset)
return docs.get("properties", {}) if docs is not None else {}
def get_property_set_doc_url(pset):
docs = get_property_set_docs(pset)
return docs.get("spec_url", "") if docs is not None else ""
def get_attribute_enum_values(prop, context): def get_attribute_enum_values(prop, context):
# Support weird buildingSMART dictionary mappings which behave like enums # Support weird buildingSMART dictionary mappings which behave like enums
items = [] items = []