Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit a62a32d

Browse files
committed
Support for setting the BCF author. You can also now edit basic BCF topic metadata.
1 parent 6a06c29 commit a62a32d

3 files changed

Lines changed: 62 additions & 32 deletions

File tree

src/ifcblenderexport/blenderbim/bim/operator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,13 +516,14 @@ def execute(self, context):
516516
import bcfplugin
517517

518518
bcfplugin.openProject(self.filepath)
519-
bpy.context.scene.BCFProperties.name = bcfplugin.getProjectName()
520519
bcf.BcfStore.topics = bcfplugin.getTopics()
521520
while len(bpy.context.scene.BCFProperties.topics) > 0:
522521
bpy.context.scene.BCFProperties.topics.remove(0)
523522
for topic in bcf.BcfStore.topics:
524523
new = bpy.context.scene.BCFProperties.topics.add()
525524
new.name = topic[0]
525+
# Note: set this last, as we use it to check whether or not the project has been loaded
526+
bpy.context.scene.BCFProperties.name = bcfplugin.getProjectName()
526527
return {"FINISHED"}
527528

528529
def invoke(self, context, event):

src/ifcblenderexport/blenderbim/bim/prop.py

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -910,8 +910,43 @@ class Constraint(PropertyGroup):
910910
user_defined_qualifier: StringProperty(name="Custom Qualifier")
911911

912912

913+
def updateBcfProjectName(self, context):
914+
import bcfplugin
915+
bcfplugin.setProjectName(self.name)
916+
917+
918+
def updateBcfTopicAttribute(context, name, value):
919+
import bcfplugin
920+
props = bpy.context.scene.BCFProperties
921+
topic = bcf.BcfStore.topics[props.active_topic_index][1]
922+
if getattr(topic, name) != value:
923+
setattr(topic, name, value)
924+
bcfplugin.modifyElement(topic, props.author)
925+
926+
927+
def updateBcfTopicName(self, context):
928+
if bpy.context.scene.BCFProperties.name:
929+
updateBcfTopicAttribute(context, "title", self.name)
930+
931+
932+
def updateBcfTopicType(self, context):
933+
updateBcfTopicAttribute(context, "type", self.topic_type)
934+
935+
936+
def updateBcfTopicStatus(self, context):
937+
updateBcfTopicAttribute(context, "status", self.topic_status)
938+
939+
940+
def updateBcfTopicPriority(self, context):
941+
updateBcfTopicAttribute(context, "priority", self.topic_priority)
942+
943+
944+
def updateBcfTopicStage(self, context):
945+
updateBcfTopicAttribute(context, "stage", self.topic_stage)
946+
947+
913948
class BcfTopic(PropertyGroup):
914-
name: StringProperty(name="Name")
949+
name: StringProperty(name="Name", update=updateBcfTopicName)
915950

916951

917952
class BcfTopicLabel(PropertyGroup):
@@ -947,11 +982,6 @@ def refreshBcfTopic(self, context):
947982
RefreshBcfTopic.refresh(context)
948983

949984

950-
def setBcfProjectName(self, context):
951-
import bcfplugin
952-
bcfplugin.setProjectName(self.name)
953-
954-
955985
class RefreshBcfTopic:
956986
props: None
957987
topic: None
@@ -1604,15 +1634,16 @@ class BIMProperties(PropertyGroup):
16041634

16051635

16061636
class BCFProperties(PropertyGroup):
1607-
name: StringProperty(default="", name="Project Name", update=setBcfProjectName)
1637+
name: StringProperty(default="", name="Project Name", update=updateBcfProjectName)
1638+
author: StringProperty(default="john@doe.com", name="Author Email")
16081639
topics: CollectionProperty(name="BCF Topics", type=BcfTopic)
16091640
active_topic_index: IntProperty(name="Active BCF Topic Index", update=refreshBcfTopic)
16101641
viewpoints: EnumProperty(items=getBcfViewpoints, name="BCF Viewpoints")
16111642
topic_guid: StringProperty(default="", name="Topic GUID")
1612-
topic_type: StringProperty(default="", name="Topic Type")
1613-
topic_status: StringProperty(default="", name="Topic Status")
1614-
topic_priority: StringProperty(default="", name="Topic Priority")
1615-
topic_stage: StringProperty(default="", name="Topic Stage")
1643+
topic_type: StringProperty(default="", name="Topic Type", update=updateBcfTopicType)
1644+
topic_status: StringProperty(default="", name="Topic Status", update=updateBcfTopicStatus)
1645+
topic_priority: StringProperty(default="", name="Topic Priority", update=updateBcfTopicPriority)
1646+
topic_stage: StringProperty(default="", name="Topic Stage", update=updateBcfTopicStage)
16161647
topic_creation_date: StringProperty(default="", name="Topic Date")
16171648
topic_creation_author: StringProperty(default="", name="Topic Author")
16181649
topic_modified_date: StringProperty(default="", name="Topic Modified Date")

src/ifcblenderexport/blenderbim/bim/ui.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,9 @@ def draw(self, context):
16711671
row = layout.row()
16721672
row.prop(props, "name")
16731673

1674+
row = layout.row()
1675+
row.prop(props, "author")
1676+
16741677
if not props.topics:
16751678
return
16761679

@@ -1684,26 +1687,21 @@ def draw(self, context):
16841687
row.prop(props, "viewpoints")
16851688
row.operator("bim.activate_bcf_viewpoint", icon="SCENE", text="")
16861689

1687-
row = layout.row()
1688-
row.prop(props, "topic_type", text="Type")
1689-
row = layout.row()
1690-
row.prop(props, "topic_status", text="Status")
1691-
row = layout.row()
1692-
row.prop(props, "topic_priority", text="Priority")
1693-
row = layout.row()
1694-
row.prop(props, "topic_stage", text="Stage")
1695-
row = layout.row()
1696-
row.prop(props, "topic_creation_date", text="Date")
1697-
row = layout.row()
1698-
row.prop(props, "topic_creation_author", text="Author")
1699-
row = layout.row()
1700-
row.prop(props, "topic_modified_date", text="Modified On")
1701-
row = layout.row()
1702-
row.prop(props, "topic_modified_author", text="Modified By")
1703-
row = layout.row()
1704-
row.prop(props, "topic_assigned_to", text="Assigned To")
1705-
row = layout.row()
1706-
row.prop(props, "topic_due_date", text="Due Date")
1690+
col = layout.column(align=True)
1691+
col.prop(props, "topic_type", text="Type")
1692+
col.prop(props, "topic_status", text="Status")
1693+
col.prop(props, "topic_priority", text="Priority")
1694+
col.prop(props, "topic_stage", text="Stage")
1695+
col.prop(props, "topic_assigned_to", text="Assigned To")
1696+
col.prop(props, "topic_due_date", text="Due Date")
1697+
1698+
col = layout.column(align=True)
1699+
col.enabled = False
1700+
col.prop(props, "topic_creation_date", text="Date")
1701+
col.prop(props, "topic_creation_author", text="Author")
1702+
col.prop(props, "topic_modified_date", text="Modified On")
1703+
col.prop(props, "topic_modified_author", text="Modified By")
1704+
17071705

17081706
layout.label(text="Header Files:")
17091707
for index, f in enumerate(props.topic_files):

0 commit comments

Comments
 (0)