mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Selecting an ifc predefined type in addition to the ifc class in the object ifc class selector now correctly assigns it
This commit is contained in:
@@ -610,6 +610,9 @@ def update_enum_property_search_prop(self, context):
|
||||
for i, prop in enumerate(self.collection_names):
|
||||
if prop.name == self.dummy_name:
|
||||
setattr(context.data, self.prop_name, self.collection_identifiers[i].name)
|
||||
predefined_type = self.collection_predefined_types[i].name
|
||||
if predefined_type:
|
||||
setattr(context.data, "ifc_predefined_type", predefined_type)
|
||||
break
|
||||
|
||||
|
||||
@@ -620,6 +623,7 @@ class BIM_OT_enum_property_search(bpy.types.Operator):
|
||||
dummy_name: bpy.props.StringProperty(name="Property", update=update_enum_property_search_prop)
|
||||
collection_names: bpy.props.CollectionProperty(type=StrProperty)
|
||||
collection_identifiers: bpy.props.CollectionProperty(type=StrProperty)
|
||||
collection_predefined_types: bpy.props.CollectionProperty(type=StrProperty)
|
||||
prop_name: bpy.props.StringProperty()
|
||||
|
||||
def invoke(self, context, event):
|
||||
@@ -644,9 +648,10 @@ class BIM_OT_enum_property_search(bpy.types.Operator):
|
||||
self.collection_names.clear()
|
||||
self.collection_identifiers.clear()
|
||||
|
||||
def add_item(self, identifier: str, name: str):
|
||||
def add_item(self, identifier: str, name: str, predefined_type: str = ""):
|
||||
self.collection_identifiers.add().name = identifier
|
||||
self.collection_names.add().name = name
|
||||
self.collection_predefined_types.add().name = predefined_type
|
||||
|
||||
def add_items_regular(self, items):
|
||||
self.identifiers = []
|
||||
@@ -667,7 +672,7 @@ class BIM_OT_enum_property_search(bpy.types.Operator):
|
||||
if not isinstance(values, (tuple, list)):
|
||||
values = [values]
|
||||
for value in values:
|
||||
self.add_item(identifier=key, name=key + " (" + value + ")")
|
||||
self.add_item(identifier=key, name=key + " > " + value, predefined_type=value.upper())
|
||||
|
||||
|
||||
class EditBlenderCollection(bpy.types.Operator):
|
||||
|
||||
Reference in New Issue
Block a user