Mark unsafe enums #5673

This commit is contained in:
Andrej730
2024-11-01 13:41:57 +05:00
parent f3019e4d7a
commit 3debf62ca6
12 changed files with 24 additions and 0 deletions
+1
View File
@@ -184,6 +184,7 @@ class BcfTopic(PropertyGroup):
is_editable: BoolProperty(name="Edit Topic Attributes", default=False, update=updateBcfTopicIsEditable) is_editable: BoolProperty(name="Edit Topic Attributes", default=False, update=updateBcfTopicIsEditable)
# TODO: unsafe?
def get_related_topics(self: "BCFProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]: def get_related_topics(self: "BCFProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]:
props = self props = self
active_topic = props.active_topic active_topic = props.active_topic
@@ -45,19 +45,23 @@ def get_libraries(self, context):
return BrickschemaReferencesData.data["libraries"] return BrickschemaReferencesData.data["libraries"]
# TODO: unsafe?
def get_namespaces(self, context): def get_namespaces(self, context):
return [(uri, f"{alias}: {uri}", "") for alias, uri in BrickStore.namespaces] return [(uri, f"{alias}: {uri}", "") for alias, uri in BrickStore.namespaces]
# TODO: unsafe?
def get_brick_entity_classes(self, context): def get_brick_entity_classes(self, context):
entity = self.brick_entity_create_type entity = self.brick_entity_create_type
return [(uri, uri.split("#")[-1], "") for uri in BrickStore.entity_classes[entity]] return [(uri, uri.split("#")[-1], "") for uri in BrickStore.entity_classes[entity]]
# TODO: unsafe?
def get_brick_roots(self, context): def get_brick_roots(self, context):
return [(root, root, "") for root in BrickStore.root_classes] return [(root, root, "") for root in BrickStore.root_classes]
# TODO: unsafe?
def get_brick_relations(self, context): def get_brick_relations(self, context):
relations = [(uri, uri.split("#")[-1], "") for uri in BrickStore.relationships] relations = [(uri, uri.split("#")[-1], "") for uri in BrickStore.relationships]
for relation in BrickschemaData.data["active_relations"]: for relation in BrickschemaData.data["active_relations"]:
@@ -33,6 +33,7 @@ from bpy.props import (
) )
# TODO: unsafe?
def get_available_constraint_types(self, context): def get_available_constraint_types(self, context):
version = tool.Ifc.get_schema() version = tool.Ifc.get_schema()
return [(c, c, get_entity_doc(version, c).get("description", "")) for c in ["IfcObjective"]] return [(c, c, get_entity_doc(version, c).get("description", "")) for c in ["IfcObjective"]]
@@ -115,6 +115,7 @@ def get_schedule_predefined_types(self, context):
return CostSchedulesData.data["predefined_types"] return CostSchedulesData.data["predefined_types"]
# TODO: unsafe?
def get_currencies(self, context): def get_currencies(self, context):
return [ return [
("USD", "USD", "Dollar"), ("USD", "USD", "Dollar"),
+1
View File
@@ -22,6 +22,7 @@ from bonsai.bim.prop import StrProperty
class BIMCityJsonProperties(PropertyGroup): class BIMCityJsonProperties(PropertyGroup):
# TODO: unsafe?
def get_lods(self, context): def get_lods(self, context):
return [(item.name, "LOD" + item.name, "Level of Detail " + item.name) for item in self.lods] return [(item.name, "LOD" + item.name, "Level of Detail " + item.name) for item in self.lods]
@@ -270,6 +270,7 @@ class RadianceExporterProperties(PropertyGroup):
items=categories, name="Category", description="Material category", update=update_material_mapping items=categories, name="Category", description="Material category", update=update_material_mapping
) )
# TODO: unsafe?
def get_subcategories(self, context): def get_subcategories(self, context):
if self.category in spectraldb: if self.category in spectraldb:
return [(k, k, "") for k in spectraldb[self.category].keys()] return [(k, k, "") for k in spectraldb[self.category].keys()]
@@ -48,6 +48,7 @@ def purge():
parameterizedprofileclasses_enum = [] parameterizedprofileclasses_enum = []
# TODO: unsafe?
def get_profile_classes(self, context): def get_profile_classes(self, context):
global profileclasses_enum global profileclasses_enum
if len(profileclasses_enum) == 0 and IfcStore.get_schema(): if len(profileclasses_enum) == 0 and IfcStore.get_schema():
@@ -60,6 +61,7 @@ def get_profile_classes(self, context):
return profileclasses_enum return profileclasses_enum
# TODO: unsafe?
def get_parameterized_profile_classes(self, context): def get_parameterized_profile_classes(self, context):
global parameterizedprofileclasses_enum global parameterizedprofileclasses_enum
if len(parameterizedprofileclasses_enum) == 0 and IfcStore.get_schema(): if len(parameterizedprofileclasses_enum) == 0 and IfcStore.get_schema():
@@ -66,6 +66,7 @@ def update_actor_class(self, context):
ActorData.data["actors"] = ActorData.actors() ActorData.data["actors"] = ActorData.actors()
# TODO: unsafe?
def get_actor_class_enum(self, context): def get_actor_class_enum(self, context):
version = tool.Ifc.get_schema() version = tool.Ifc.get_schema()
return [ return [
@@ -74,6 +75,7 @@ def get_actor_class_enum(self, context):
] ]
# TODO: unsafe?
def get_actor_type_enum(self, context): def get_actor_type_enum(self, context):
version = tool.Ifc.get_schema() version = tool.Ifc.get_schema()
return [ return [
@@ -61,6 +61,7 @@ def blender_formatted_enum_from_psets(psets: list[ifcopenshell.entity_instance])
return enum_items return enum_items
# TODO: unsafe?
def get_pset_name(self, context): def get_pset_name(self, context):
pset_type = repr(self) pset_type = repr(self)
prop_type = pset_type.split(".")[-1] prop_type = pset_type.split(".")[-1]
@@ -190,6 +191,7 @@ def get_work_schedule_pset_names(self, context):
return psetnames[ifc_class] return psetnames[ifc_class]
# TODO: unsafe?
def get_qto_name(self, context): def get_qto_name(self, context):
pset_type = repr(self) pset_type = repr(self)
prop_type = pset_type.split(".")[-1] prop_type = pset_type.split(".")[-1]
@@ -211,12 +213,14 @@ def get_object_qto_name(self, context):
return ObjectPsetsData.data["qto_name"] return ObjectPsetsData.data["qto_name"]
# TODO: unsafe?
def get_template_type(self, context): def get_template_type(self, context):
version = tool.Ifc.get_schema() version = tool.Ifc.get_schema()
for t in ("IfcPropertySingleValue", "IfcPropertyEnumeratedValue"): for t in ("IfcPropertySingleValue", "IfcPropertyEnumeratedValue"):
yield (t, t, ifcopenshell.util.doc.get_entity_doc(version, t).get("description", "")) yield (t, t, ifcopenshell.util.doc.get_entity_doc(version, t).get("description", ""))
# TODO: unsafe?
def get_primary_measure_type(self, context): def get_primary_measure_type(self, context):
if not AddEditCustomPropertiesData.is_loaded: if not AddEditCustomPropertiesData.is_loaded:
AddEditCustomPropertiesData.load() AddEditCustomPropertiesData.load()
@@ -79,6 +79,7 @@ def get_property_template_type(self, context):
return PsetTemplatesData.data["property_template_type"] return PsetTemplatesData.data["property_template_type"]
# TODO: unsafe?
def get_template_type(self, context): def get_template_type(self, context):
return [ return [
( (
+3
View File
@@ -32,6 +32,7 @@ from bpy.props import (
) )
# TODO: unsafe?
def get_qto_rule(self, context): def get_qto_rule(self, context):
results = [] results = []
for rule_id, rule in ifc5d.qto.rules.items(): for rule_id, rule in ifc5d.qto.rules.items():
@@ -39,6 +40,7 @@ def get_qto_rule(self, context):
return results return results
# TODO: unsafe?
def get_calculator(self, context): def get_calculator(self, context):
results = [] results = []
for name, calculator in ifc5d.qto.calculators.items(): for name, calculator in ifc5d.qto.calculators.items():
@@ -46,6 +48,7 @@ def get_calculator(self, context):
return results return results
# TODO: unsafe?
def get_calculator_function(self, context): def get_calculator_function(self, context):
calculator = ifc5d.qto.calculators[self.calculator] calculator = ifc5d.qto.calculators[self.calculator]
results = [] results = []
@@ -82,10 +82,12 @@ def getTaskTimeColumns(self, context):
def getWorkSchedules(self, context): def getWorkSchedules(self, context):
# TODO: unsafe?
return [(str(k), v["Name"], "") for k, v in SequenceData.data["work_schedules"].items()] return [(str(k), v["Name"], "") for k, v in SequenceData.data["work_schedules"].items()]
def getWorkCalendars(self, context): def getWorkCalendars(self, context):
# TODO: unsafe?
return [(str(k), v["Name"], "") for k, v in SequenceData.data["work_calendars"].items()] return [(str(k), v["Name"], "") for k, v in SequenceData.data["work_calendars"].items()]
@@ -229,6 +231,7 @@ def updateTaskDuration(self, context):
tool.Sequence.refresh_task_resources() tool.Sequence.refresh_task_resources()
# TODO: unsafe?
def get_schedule_predefined_types(self, context): def get_schedule_predefined_types(self, context):
results = [] results = []
declaration = tool.Ifc().schema().declaration_by_name("IfcWorkSchedule") declaration = tool.Ifc().schema().declaration_by_name("IfcWorkSchedule")