Show topic reference links and allow browsing of links

This commit is contained in:
Dion Moult
2020-03-25 15:03:06 +11:00
parent 52ff61a91c
commit f2e203d699
4 changed files with 32 additions and 1 deletions
@@ -36,6 +36,7 @@ if bpy is not None:
operator.SelectBcfFile,
operator.GetBcfTopics,
operator.ActivateBcfViewpoint,
operator.OpenBcfReferenceLink,
operator.SelectFeaturesDir,
operator.SelectDiffJsonFile,
operator.SelectDiffNewFile,
@@ -106,6 +107,7 @@ if bpy is not None:
operator.Uninstall,
prop.BcfTopic,
prop.BcfTopicLabel,
prop.BcfTopicLink,
prop.Subcontext,
prop.BIMProperties,
prop.BCFProperties,
@@ -3,6 +3,7 @@ import bpy
import time
import json
import logging
import webbrowser
import ifcopenshell
from . import export_ifc
from . import import_ifc
@@ -446,6 +447,16 @@ class ActivateBcfViewpoint(bpy.types.Operator):
return {'FINISHED'}
class OpenBcfReferenceLink(bpy.types.Operator):
bl_idname = 'bim.open_bcf_reference_link'
bl_label = 'Open BCF Reference Link'
index: bpy.props.IntProperty()
def execute(self, context):
webbrowser.open(bpy.context.scene.BCFProperties.topic_links[self.index].name)
return {'FINISHED'}
class SelectAudited(bpy.types.Operator):
bl_idname = 'bim.select_audited'
bl_label = 'Select Audited'
+12
View File
@@ -368,6 +368,10 @@ class BcfTopicLabel(PropertyGroup):
name: StringProperty(name='Name')
class BcfTopicLink(PropertyGroup):
name: StringProperty(name='Name')
def refreshBcfTopic(self, context):
global bcfviewpoints_enum
import bcfplugin
@@ -396,12 +400,19 @@ def refreshBcfTopic(self, context):
else:
props.topic_due_date = ''
props.topic_description = topic.description
while len(props.topic_labels) > 0:
props.topic_labels.remove(0)
for label in topic.labels:
new = props.topic_labels.add()
new.name = label.value
while len(props.topic_links) > 0:
props.topic_links.remove(0)
for link in topic.referenceLinks:
new = props.topic_links.add()
new.name = link.value
# Load viewpoints
bcfviewpoints_enum.clear()
viewpoints = bcfplugin.getViewpoints(topic)
@@ -508,6 +519,7 @@ class BCFProperties(PropertyGroup):
topic_due_date: StringProperty(default='', name='Topic Due Date')
topic_description: StringProperty(default='', name='Topic Description')
topic_labels: CollectionProperty(name='BCF Topic Labels', type=BcfTopicLabel)
topic_links: CollectionProperty(name='BCF Topic Links', type=BcfTopicLink)
class MapConversion(PropertyGroup):
+7 -1
View File
@@ -575,8 +575,14 @@ class BIM_PT_bcf(Panel):
row = layout.row()
row.prop(props, 'topic_due_date', text='Due Date')
layout.label(text="Reference Links:")
for index, label in enumerate(props.topic_links):
row = layout.row(align=True)
row.prop(label, 'name', text='')
row.operator('bim.open_bcf_reference_link', icon='URL', text='').index = index
layout.label(text="Labels:")
for i, label in enumerate(props.topic_labels):
for index, label in enumerate(props.topic_labels):
row = layout.row(align=True)
row.prop(label, 'name', text='')