Implement ability to edit individual BCF reference links

This commit is contained in:
Dion Moult
2020-12-28 11:20:44 +11:00
parent 6a00f2f0d2
commit 6cfa9f6e9b
3 changed files with 28 additions and 1 deletions
@@ -40,6 +40,7 @@ if bpy is not None:
operator.ViewBcfTopic,
operator.RemoveBcfComment,
operator.RemoveBcfReferenceLink,
operator.EditBcfReferenceLinks,
operator.EditBcfComment,
operator.AddBcfComment,
operator.ActivateBcfViewpoint,
@@ -251,6 +252,7 @@ if bpy is not None:
operator.SnapSpacesTogether,
operator.CopyGrid,
prop.StrProperty,
prop.BcfReferenceLink,
prop.Attribute,
prop.MaterialLayer,
prop.MaterialConstituent,
@@ -860,6 +860,23 @@ class AddBcfReferenceLink(bpy.types.Operator):
return {"FINISHED"}
class EditBcfReferenceLinks(bpy.types.Operator):
bl_idname = "bim.edit_bcf_reference_links"
bl_label = "Edit BCF Reference Link"
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, reference_link in enumerate(topic.reference_links):
if reference_link == blender_topic.reference_links[index].name:
continue
topic.reference_links[index] = blender_topic.reference_links[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
@@ -167,6 +167,10 @@ def refreshPredefinedTypes(self, context):
context.scene.BIMProperties.ifc_predefined_type = enum[0][0]
def updateBcfReferenceLink(self, context):
bpy.ops.bim.edit_bcf_reference_links()
def getDiagramScales(self, context):
global diagram_scales_enum
if (
@@ -587,6 +591,10 @@ def refreshBcfTopic(self, context):
getBcfViewpoints(self, context)
class BcfReferenceLink(PropertyGroup):
name: StringProperty(name="Name", update=updateBcfReferenceLink)
class StrProperty(PropertyGroup):
pass
@@ -1016,7 +1024,7 @@ class BcfTopic(PropertyGroup):
file_reference: StringProperty(default="", name="Reference")
file_ifc_project: StringProperty(default="", name="IFC Project")
file_ifc_spatial_structure_element: StringProperty(default="", name="IFC Spatial Structure Element")
reference_links: CollectionProperty(name="Reference Links", type=StrProperty)
reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink)
reference_link: StringProperty(default="", name="Reference Link")
labels: CollectionProperty(name="Labels", type=StrProperty)
bim_snippet: PointerProperty(type=BcfBimSnippet)