Implement BCF delete label

This commit is contained in:
Dion Moult
2020-12-28 11:40:40 +11:00
parent 6cfa9f6e9b
commit d5566785be
3 changed files with 22 additions and 5 deletions
@@ -41,6 +41,7 @@ if bpy is not None:
operator.RemoveBcfComment,
operator.RemoveBcfReferenceLink,
operator.EditBcfReferenceLinks,
operator.RemoveBcfLabel,
operator.EditBcfComment,
operator.AddBcfComment,
operator.ActivateBcfViewpoint,
@@ -893,6 +893,22 @@ class RemoveBcfReferenceLink(bpy.types.Operator):
return {"FINISHED"}
class RemoveBcfLabel(bpy.types.Operator):
bl_idname = "bim.remove_bcf_label"
bl_label = "Remove BCF Label"
index: bpy.props.IntProperty()
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]
del topic.labels[self.index]
bcfxml.edit_topic(topic)
blender_topic.labels.remove(self.index)
return {"FINISHED"}
class RemoveBcfComment(bpy.types.Operator):
bl_idname = "bim.remove_bcf_comment"
bl_label = "Remove BCF Comment"
+5 -5
View File
@@ -1795,11 +1795,11 @@ class BIM_PT_bcf_metadata(Panel):
row = layout.row()
row.operator("bim.add_bcf_reference_link")
if topic.labels:
layout.label(text="Labels:")
for index, label in enumerate(topic.labels):
row = layout.row(align=True)
row.prop(label, "name", text="")
layout.label(text="Labels:")
for index, label in enumerate(topic.labels):
row = layout.row(align=True)
row.prop(label, "name", text="")
row.operator("bim.remove_bcf_label", icon="X", text="").index = index
if topic.bim_snippet.schema:
layout.label(text="BIM Snippet:")