Implement ability to edit labels

This commit is contained in:
Dion Moult
2020-12-28 12:50:22 +11:00
parent 3deba2e71e
commit bca9c82c3d
3 changed files with 28 additions and 1 deletions
@@ -42,6 +42,7 @@ if bpy is not None:
operator.RemoveBcfComment,
operator.RemoveBcfReferenceLink,
operator.EditBcfReferenceLinks,
operator.EditBcfLabels,
operator.RemoveBcfLabel,
operator.EditBcfComment,
operator.AddBcfComment,
@@ -255,6 +256,7 @@ if bpy is not None:
operator.CopyGrid,
prop.StrProperty,
prop.BcfReferenceLink,
prop.BcfLabel,
prop.Attribute,
prop.MaterialLayer,
prop.MaterialConstituent,
@@ -896,6 +896,23 @@ class EditBcfReferenceLinks(bpy.types.Operator):
return {"FINISHED"}
class EditBcfLabels(bpy.types.Operator):
bl_idname = "bim.edit_bcf_labels"
bl_label = "Edit BCF Labels"
def execute(self, context):
bcfxml = bcfstore.BcfStore.get_bcfxml()
props = bpy.context.scene.BCFProperties
blender_topic = props.topics[props.active_topic_index]
topic = bcfxml.topics[blender_topic.name]
for index, label in enumerate(topic.labels):
if label == blender_topic.labels[index].name:
continue
topic.labels[index] = blender_topic.labels[index].name
bcfxml.edit_topic(topic)
return {"FINISHED"}
class RemoveBcfReferenceLink(bpy.types.Operator):
bl_idname = "bim.remove_bcf_reference_link"
bl_label = "Remove BCF Reference Link"
+9 -1
View File
@@ -171,6 +171,10 @@ def updateBcfReferenceLink(self, context):
bpy.ops.bim.edit_bcf_reference_links()
def updateBcfLabel(self, context):
bpy.ops.bim.edit_bcf_labels()
def getDiagramScales(self, context):
global diagram_scales_enum
if (
@@ -595,6 +599,10 @@ class BcfReferenceLink(PropertyGroup):
name: StringProperty(name="Name", update=updateBcfReferenceLink)
class BcfLabel(PropertyGroup):
name: StringProperty(name="Name", update=updateBcfLabel)
class StrProperty(PropertyGroup):
pass
@@ -1026,7 +1034,7 @@ class BcfTopic(PropertyGroup):
file_ifc_spatial_structure_element: StringProperty(default="", name="IFC Spatial Structure Element")
reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink)
reference_link: StringProperty(default="", name="Reference Link")
labels: CollectionProperty(name="Labels", type=StrProperty)
labels: CollectionProperty(name="Labels", type=BcfLabel)
label: StringProperty(default="", name="Label")
bim_snippet: PointerProperty(type=BcfBimSnippet)
document_references: CollectionProperty(name="Document References", type=BcfDocumentReference)