mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Show BCF topic metadata in UI
This commit is contained in:
@@ -105,8 +105,10 @@ if bpy is not None:
|
||||
operator.SetViewPreset1,
|
||||
operator.Uninstall,
|
||||
prop.BcfTopic,
|
||||
prop.BcfTopicLabel,
|
||||
prop.Subcontext,
|
||||
prop.BIMProperties,
|
||||
prop.BCFProperties,
|
||||
prop.DocProperties,
|
||||
prop.BIMLibrary,
|
||||
prop.MapConversion,
|
||||
@@ -161,6 +163,7 @@ if bpy is not None:
|
||||
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
|
||||
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
|
||||
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties)
|
||||
bpy.types.Scene.BCFProperties = bpy.props.PointerProperty(type=prop.BCFProperties)
|
||||
bpy.types.Scene.DocProperties = bpy.props.PointerProperty(type=prop.DocProperties)
|
||||
bpy.types.Scene.BIMLibrary = bpy.props.PointerProperty(type=prop.BIMLibrary)
|
||||
bpy.types.Scene.MapConversion = bpy.props.PointerProperty(type=prop.MapConversion)
|
||||
@@ -178,6 +181,7 @@ if bpy is not None:
|
||||
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
|
||||
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
|
||||
del(bpy.types.Scene.BIMProperties)
|
||||
del(bpy.types.Scene.BCFProperties)
|
||||
del(bpy.types.Scene.DocProperties)
|
||||
del(bpy.types.Scene.MapConversion)
|
||||
del(bpy.types.Scene.TargetCRS)
|
||||
|
||||
@@ -393,12 +393,12 @@ class GetBcfTopics(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
import bcfplugin
|
||||
bcfplugin.openProject(bpy.context.scene.BIMProperties.bcf_file)
|
||||
bcfplugin.openProject(bpy.context.scene.BCFProperties.bcf_file)
|
||||
bcf.BcfStore.topics = bcfplugin.getTopics()
|
||||
while len(bpy.context.scene.BIMProperties.bcf_topics) > 0:
|
||||
bpy.context.scene.BIMProperties.bcf_topics.remove(0)
|
||||
while len(bpy.context.scene.BCFProperties.topics) > 0:
|
||||
bpy.context.scene.BCFProperties.topics.remove(0)
|
||||
for topic in bcf.BcfStore.topics:
|
||||
new = bpy.context.scene.BIMProperties.bcf_topics.add()
|
||||
new = bpy.context.scene.BCFProperties.topics.add()
|
||||
new.name = topic[0]
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -413,11 +413,11 @@ class ActivateBcfViewpoint(bpy.types.Operator):
|
||||
topics = bcfplugin.getTopics()
|
||||
if not topics:
|
||||
return {'FINISHED'}
|
||||
topic = topics[bpy.context.scene.BIMProperties.active_bcf_topic_index][1]
|
||||
topic = topics[bpy.context.scene.BCFProperties.active_topic_index][1]
|
||||
viewpoints = bcfplugin.getViewpoints(topic)
|
||||
if not viewpoints:
|
||||
return {'FINISHED'}
|
||||
viewpoint = viewpoints[int(bpy.context.scene.BIMProperties.bcf_viewpoints)][1]
|
||||
viewpoint = viewpoints[int(bpy.context.scene.BCFProperties.viewpoints)][1]
|
||||
|
||||
obj = bpy.data.objects.get('Viewpoint')
|
||||
if not obj:
|
||||
@@ -888,7 +888,7 @@ class SelectBcfFile(bpy.types.Operator):
|
||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||
|
||||
def execute(self, context):
|
||||
bpy.context.scene.BIMProperties.bcf_file = self.filepath
|
||||
bpy.context.scene.BCFProperties.bcf_file = self.filepath
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
|
||||
@@ -364,16 +364,51 @@ class BcfTopic(PropertyGroup):
|
||||
name: StringProperty(name='Name')
|
||||
|
||||
|
||||
class BcfTopicLabel(PropertyGroup):
|
||||
name: StringProperty(name='Name')
|
||||
|
||||
|
||||
def refreshBcfTopic(self, context):
|
||||
global bcfviewpoints_enum
|
||||
import bcfplugin
|
||||
|
||||
props = bpy.context.scene.BCFProperties
|
||||
topic = bcf.BcfStore.topics[props.active_topic_index][1]
|
||||
|
||||
# Load metadata
|
||||
props.topic_type = topic.type
|
||||
props.topic_status = topic.status
|
||||
props.topic_priority = topic.priority
|
||||
props.topic_stage = topic.stage
|
||||
if topic.date:
|
||||
props.topic_creation_date = topic.date.strftime('%a %Y-%m-%d %H:%S')
|
||||
else:
|
||||
props.topic_creation_date = ''
|
||||
props.topic_creation_author = topic.author
|
||||
if topic.modDate:
|
||||
props.topic_modified_date = topic.modDate.strftime('%a %Y-%m-%d %H:%S')
|
||||
else:
|
||||
props.topic_modified_date = ''
|
||||
props.topic_modified_author = topic.modAuthor
|
||||
props.topic_assigned_to = topic.assignee
|
||||
if topic.dueDate:
|
||||
props.topic_due_date = topic.dueDate.strftime('%a %Y-%m-%d %H:%S')
|
||||
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
|
||||
|
||||
# Load viewpoints
|
||||
bcfviewpoints_enum.clear()
|
||||
topic = bcf.BcfStore.topics[bpy.context.scene.BIMProperties.active_bcf_topic_index][1]
|
||||
viewpoints = bcfplugin.getViewpoints(topic)
|
||||
for i, viewpoint in enumerate(viewpoints):
|
||||
bcfviewpoints_enum.append((str(i), 'View {}'.format(i+1), ''))
|
||||
|
||||
# Load comments
|
||||
bcf.BcfStore.comments = bcfplugin.getComments(topic)
|
||||
comments = bpy.data.texts.get('BCF Comments')
|
||||
if comments:
|
||||
@@ -454,10 +489,25 @@ class BIMProperties(PropertyGroup):
|
||||
available_contexts: EnumProperty(items=[('Model', 'Model', ''), ('Plan', 'Plan', '')], name="Available Contexts")
|
||||
available_subcontexts: EnumProperty(items=getSubcontexts, name="Available Subcontexts")
|
||||
available_target_views: EnumProperty(items=getTargetViews, name="Available Target Views")
|
||||
|
||||
|
||||
class BCFProperties(PropertyGroup):
|
||||
bcf_file: StringProperty(default='', name='BCF File')
|
||||
bcf_topics: CollectionProperty(name='BCF Topics', type=BcfTopic)
|
||||
active_bcf_topic_index: IntProperty(name='Active BCF Topic Index', update=refreshBcfTopic)
|
||||
bcf_viewpoints: EnumProperty(items=getBcfViewpoints, name='BCF Viewpoints')
|
||||
topics: CollectionProperty(name='BCF Topics', type=BcfTopic)
|
||||
active_topic_index: IntProperty(name='Active BCF Topic Index', update=refreshBcfTopic)
|
||||
viewpoints: EnumProperty(items=getBcfViewpoints, name='BCF Viewpoints')
|
||||
topic_type: StringProperty(default='', name='Topic Type')
|
||||
topic_status: StringProperty(default='', name='Topic Status')
|
||||
topic_priority: StringProperty(default='', name='Topic Priority')
|
||||
topic_stage: StringProperty(default='', name='Topic Stage')
|
||||
topic_creation_date: StringProperty(default='', name='Topic Date')
|
||||
topic_creation_author: StringProperty(default='', name='Topic Author')
|
||||
topic_modified_date: StringProperty(default='', name='Topic Modified Date')
|
||||
topic_modified_author: StringProperty(default='', name='Topic Modified By')
|
||||
topic_assigned_to: StringProperty(default='', name='Topic Assigned To')
|
||||
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)
|
||||
|
||||
|
||||
class MapConversion(PropertyGroup):
|
||||
|
||||
@@ -535,7 +535,7 @@ class BIM_PT_bcf(Panel):
|
||||
layout.use_property_split = True
|
||||
|
||||
scene = context.scene
|
||||
props = bpy.context.scene.BIMProperties
|
||||
props = bpy.context.scene.BCFProperties
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(props, "bcf_file")
|
||||
@@ -544,13 +544,42 @@ class BIM_PT_bcf(Panel):
|
||||
row = layout.row()
|
||||
row.operator("bim.get_bcf_topics")
|
||||
|
||||
props = bpy.context.scene.BIMProperties
|
||||
layout.template_list('BIM_UL_topics', '', props, 'bcf_topics', props, 'active_bcf_topic_index')
|
||||
props = bpy.context.scene.BCFProperties
|
||||
layout.template_list('BIM_UL_topics', '', props, 'topics', props, 'active_topic_index')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'bcf_viewpoints')
|
||||
row.prop(props, 'topic_description', text='')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'viewpoints')
|
||||
row.operator('bim.activate_bcf_viewpoint', icon='SCENE', text='')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_type', text='Type')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_status', text='Status')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_priority', text='Priority')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_stage', text='Stage')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_creation_date', text='Date')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_creation_author', text='Author')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_modified_date', text='Modified On')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_modified_author', text='Modified By')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_assigned_to', text='Assigned To')
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_due_date', text='Due Date')
|
||||
|
||||
layout.label(text="Labels:")
|
||||
for i, label in enumerate(props.topic_labels):
|
||||
row = layout.row(align=True)
|
||||
row.prop(label, 'name', text='')
|
||||
|
||||
|
||||
class BIM_PT_qa(Panel):
|
||||
bl_label = "BIMTester Quality Auditing"
|
||||
|
||||
Reference in New Issue
Block a user