mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Support for setting the BCF author. You can also now edit basic BCF topic metadata.
This commit is contained in:
@@ -516,13 +516,14 @@ class LoadBcfProject(bpy.types.Operator):
|
||||
import bcfplugin
|
||||
|
||||
bcfplugin.openProject(self.filepath)
|
||||
bpy.context.scene.BCFProperties.name = bcfplugin.getProjectName()
|
||||
bcf.BcfStore.topics = bcfplugin.getTopics()
|
||||
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.BCFProperties.topics.add()
|
||||
new.name = topic[0]
|
||||
# Note: set this last, as we use it to check whether or not the project has been loaded
|
||||
bpy.context.scene.BCFProperties.name = bcfplugin.getProjectName()
|
||||
return {"FINISHED"}
|
||||
|
||||
def invoke(self, context, event):
|
||||
|
||||
@@ -910,8 +910,43 @@ class Constraint(PropertyGroup):
|
||||
user_defined_qualifier: StringProperty(name="Custom Qualifier")
|
||||
|
||||
|
||||
def updateBcfProjectName(self, context):
|
||||
import bcfplugin
|
||||
bcfplugin.setProjectName(self.name)
|
||||
|
||||
|
||||
def updateBcfTopicAttribute(context, name, value):
|
||||
import bcfplugin
|
||||
props = bpy.context.scene.BCFProperties
|
||||
topic = bcf.BcfStore.topics[props.active_topic_index][1]
|
||||
if getattr(topic, name) != value:
|
||||
setattr(topic, name, value)
|
||||
bcfplugin.modifyElement(topic, props.author)
|
||||
|
||||
|
||||
def updateBcfTopicName(self, context):
|
||||
if bpy.context.scene.BCFProperties.name:
|
||||
updateBcfTopicAttribute(context, "title", self.name)
|
||||
|
||||
|
||||
def updateBcfTopicType(self, context):
|
||||
updateBcfTopicAttribute(context, "type", self.topic_type)
|
||||
|
||||
|
||||
def updateBcfTopicStatus(self, context):
|
||||
updateBcfTopicAttribute(context, "status", self.topic_status)
|
||||
|
||||
|
||||
def updateBcfTopicPriority(self, context):
|
||||
updateBcfTopicAttribute(context, "priority", self.topic_priority)
|
||||
|
||||
|
||||
def updateBcfTopicStage(self, context):
|
||||
updateBcfTopicAttribute(context, "stage", self.topic_stage)
|
||||
|
||||
|
||||
class BcfTopic(PropertyGroup):
|
||||
name: StringProperty(name="Name")
|
||||
name: StringProperty(name="Name", update=updateBcfTopicName)
|
||||
|
||||
|
||||
class BcfTopicLabel(PropertyGroup):
|
||||
@@ -947,11 +982,6 @@ def refreshBcfTopic(self, context):
|
||||
RefreshBcfTopic.refresh(context)
|
||||
|
||||
|
||||
def setBcfProjectName(self, context):
|
||||
import bcfplugin
|
||||
bcfplugin.setProjectName(self.name)
|
||||
|
||||
|
||||
class RefreshBcfTopic:
|
||||
props: None
|
||||
topic: None
|
||||
@@ -1604,15 +1634,16 @@ class BIMProperties(PropertyGroup):
|
||||
|
||||
|
||||
class BCFProperties(PropertyGroup):
|
||||
name: StringProperty(default="", name="Project Name", update=setBcfProjectName)
|
||||
name: StringProperty(default="", name="Project Name", update=updateBcfProjectName)
|
||||
author: StringProperty(default="john@doe.com", name="Author Email")
|
||||
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_guid: StringProperty(default="", name="Topic GUID")
|
||||
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_type: StringProperty(default="", name="Topic Type", update=updateBcfTopicType)
|
||||
topic_status: StringProperty(default="", name="Topic Status", update=updateBcfTopicStatus)
|
||||
topic_priority: StringProperty(default="", name="Topic Priority", update=updateBcfTopicPriority)
|
||||
topic_stage: StringProperty(default="", name="Topic Stage", update=updateBcfTopicStage)
|
||||
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")
|
||||
|
||||
@@ -1671,6 +1671,9 @@ class BIM_PT_bcf(Panel):
|
||||
row = layout.row()
|
||||
row.prop(props, "name")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, "author")
|
||||
|
||||
if not props.topics:
|
||||
return
|
||||
|
||||
@@ -1684,26 +1687,21 @@ class BIM_PT_bcf(Panel):
|
||||
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")
|
||||
col = layout.column(align=True)
|
||||
col.prop(props, "topic_type", text="Type")
|
||||
col.prop(props, "topic_status", text="Status")
|
||||
col.prop(props, "topic_priority", text="Priority")
|
||||
col.prop(props, "topic_stage", text="Stage")
|
||||
col.prop(props, "topic_assigned_to", text="Assigned To")
|
||||
col.prop(props, "topic_due_date", text="Due Date")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.enabled = False
|
||||
col.prop(props, "topic_creation_date", text="Date")
|
||||
col.prop(props, "topic_creation_author", text="Author")
|
||||
col.prop(props, "topic_modified_date", text="Modified On")
|
||||
col.prop(props, "topic_modified_author", text="Modified By")
|
||||
|
||||
|
||||
layout.label(text="Header Files:")
|
||||
for index, f in enumerate(props.topic_files):
|
||||
|
||||
Reference in New Issue
Block a user