bbim, bcf - expose topic attributes to edit from bbim #3026

Previously they weren't editable if they were not defined in .bcf already, so previously it was kind of requiring them to be defined by some other software, not BBIM.

Also changed couple prop names to make them more clear to users.
This commit is contained in:
Andrej730
2024-08-12 15:59:27 +05:00
parent 7ecfe372ad
commit 74e8b80fb4
2 changed files with 8 additions and 16 deletions
@@ -138,7 +138,7 @@ class BcfTopic(PropertyGroup):
modified_author: StringProperty(default="", name="Modified By") modified_author: StringProperty(default="", name="Modified By")
assigned_to: StringProperty(default="", name="Assigned To") assigned_to: StringProperty(default="", name="Assigned To")
due_date: StringProperty(default="", name="Due Date") due_date: StringProperty(default="", name="Due Date")
description: StringProperty(default="", name="Description") description: StringProperty(default="", name="Topic Description")
viewpoints: EnumProperty(items=lambda _, context: getBcfViewpoints(_, context), name="BCF Viewpoints") viewpoints: EnumProperty(items=lambda _, context: getBcfViewpoints(_, context), name="BCF Viewpoints")
files: CollectionProperty(name="Files", type=StrProperty) files: CollectionProperty(name="Files", type=StrProperty)
reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink) reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink)
@@ -147,7 +147,7 @@ class BcfTopic(PropertyGroup):
document_references: CollectionProperty(name="Document References", type=BcfDocumentReference) document_references: CollectionProperty(name="Document References", type=BcfDocumentReference)
related_topics: CollectionProperty(name="Related Topics", type=StrProperty) related_topics: CollectionProperty(name="Related Topics", type=StrProperty)
comments: CollectionProperty(name="Comments", type=BcfComment) comments: CollectionProperty(name="Comments", type=BcfComment)
is_editable: BoolProperty(name="Is Editable", default=False, update=updateBcfTopicIsEditable) is_editable: BoolProperty(name="Edit Topic Attributes", default=False, update=updateBcfTopicIsEditable)
class BCFProperties(PropertyGroup): class BCFProperties(PropertyGroup):
+6 -14
View File
@@ -63,12 +63,12 @@ class BIM_PT_bcf(Panel):
col.operator("bim.remove_bcf_topic", icon="REMOVE", text="") col.operator("bim.remove_bcf_topic", icon="REMOVE", text="")
if props.active_topic_index < len(props.topics): if props.active_topic_index < len(props.topics):
topic = props.active_topic topic = props.active_topic
is_editable = topic.is_editable
col.prop(topic, "is_editable", icon="CHECKMARK" if topic.is_editable else "GREASEPENCIL", icon_only=True) col.prop(topic, "is_editable", icon="CHECKMARK" if topic.is_editable else "GREASEPENCIL", icon_only=True)
if props.active_topic_index < len(props.topics):
topic = props.active_topic topic = props.active_topic
row = layout.row() row = layout.row()
row.enabled = topic.is_editable row.enabled = is_editable
row.prop(topic, "description", text="") row.prop(topic, "description", text="")
row = layout.row() row = layout.row()
@@ -78,18 +78,10 @@ class BIM_PT_bcf(Panel):
row.operator("bim.remove_bcf_viewpoint", icon="X", text="") row.operator("bim.remove_bcf_viewpoint", icon="X", text="")
col = layout.column(align=True) col = layout.column(align=True)
if topic.type: props = ("type", "status", "priority", "stage", "assigned_to", "due_date")
col.prop(topic, "type", emboss=topic.is_editable) for prop in props:
if topic.status: if getattr(topic, prop) or is_editable:
col.prop(topic, "status", emboss=topic.is_editable) col.prop(topic, prop, emboss=is_editable)
if topic.priority:
col.prop(topic, "priority", emboss=topic.is_editable)
if topic.stage:
col.prop(topic, "stage", emboss=topic.is_editable)
if topic.assigned_to:
col.prop(topic, "assigned_to", emboss=topic.is_editable)
if topic.due_date:
col.prop(topic, "due_date", emboss=topic.is_editable)
col = layout.column(align=True) col = layout.column(align=True)
if topic.modified_date: if topic.modified_date: