mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Implement ability to edit labels
This commit is contained in:
@@ -42,6 +42,7 @@ if bpy is not None:
|
|||||||
operator.RemoveBcfComment,
|
operator.RemoveBcfComment,
|
||||||
operator.RemoveBcfReferenceLink,
|
operator.RemoveBcfReferenceLink,
|
||||||
operator.EditBcfReferenceLinks,
|
operator.EditBcfReferenceLinks,
|
||||||
|
operator.EditBcfLabels,
|
||||||
operator.RemoveBcfLabel,
|
operator.RemoveBcfLabel,
|
||||||
operator.EditBcfComment,
|
operator.EditBcfComment,
|
||||||
operator.AddBcfComment,
|
operator.AddBcfComment,
|
||||||
@@ -255,6 +256,7 @@ if bpy is not None:
|
|||||||
operator.CopyGrid,
|
operator.CopyGrid,
|
||||||
prop.StrProperty,
|
prop.StrProperty,
|
||||||
prop.BcfReferenceLink,
|
prop.BcfReferenceLink,
|
||||||
|
prop.BcfLabel,
|
||||||
prop.Attribute,
|
prop.Attribute,
|
||||||
prop.MaterialLayer,
|
prop.MaterialLayer,
|
||||||
prop.MaterialConstituent,
|
prop.MaterialConstituent,
|
||||||
|
|||||||
@@ -896,6 +896,23 @@ class EditBcfReferenceLinks(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
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):
|
class RemoveBcfReferenceLink(bpy.types.Operator):
|
||||||
bl_idname = "bim.remove_bcf_reference_link"
|
bl_idname = "bim.remove_bcf_reference_link"
|
||||||
bl_label = "Remove BCF Reference Link"
|
bl_label = "Remove BCF Reference Link"
|
||||||
|
|||||||
@@ -171,6 +171,10 @@ def updateBcfReferenceLink(self, context):
|
|||||||
bpy.ops.bim.edit_bcf_reference_links()
|
bpy.ops.bim.edit_bcf_reference_links()
|
||||||
|
|
||||||
|
|
||||||
|
def updateBcfLabel(self, context):
|
||||||
|
bpy.ops.bim.edit_bcf_labels()
|
||||||
|
|
||||||
|
|
||||||
def getDiagramScales(self, context):
|
def getDiagramScales(self, context):
|
||||||
global diagram_scales_enum
|
global diagram_scales_enum
|
||||||
if (
|
if (
|
||||||
@@ -595,6 +599,10 @@ class BcfReferenceLink(PropertyGroup):
|
|||||||
name: StringProperty(name="Name", update=updateBcfReferenceLink)
|
name: StringProperty(name="Name", update=updateBcfReferenceLink)
|
||||||
|
|
||||||
|
|
||||||
|
class BcfLabel(PropertyGroup):
|
||||||
|
name: StringProperty(name="Name", update=updateBcfLabel)
|
||||||
|
|
||||||
|
|
||||||
class StrProperty(PropertyGroup):
|
class StrProperty(PropertyGroup):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -1026,7 +1034,7 @@ class BcfTopic(PropertyGroup):
|
|||||||
file_ifc_spatial_structure_element: StringProperty(default="", name="IFC Spatial Structure Element")
|
file_ifc_spatial_structure_element: StringProperty(default="", name="IFC Spatial Structure Element")
|
||||||
reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink)
|
reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink)
|
||||||
reference_link: StringProperty(default="", name="Reference Link")
|
reference_link: StringProperty(default="", name="Reference Link")
|
||||||
labels: CollectionProperty(name="Labels", type=StrProperty)
|
labels: CollectionProperty(name="Labels", type=BcfLabel)
|
||||||
label: StringProperty(default="", name="Label")
|
label: StringProperty(default="", name="Label")
|
||||||
bim_snippet: PointerProperty(type=BcfBimSnippet)
|
bim_snippet: PointerProperty(type=BcfBimSnippet)
|
||||||
document_references: CollectionProperty(name="Document References", type=BcfDocumentReference)
|
document_references: CollectionProperty(name="Document References", type=BcfDocumentReference)
|
||||||
|
|||||||
Reference in New Issue
Block a user