You can now view and edit the BCF project name

This commit is contained in:
Dion Moult
2020-12-13 16:35:51 +11:00
parent e39a997f5f
commit 9dcf44fbea
4 changed files with 22 additions and 7 deletions
@@ -25,8 +25,8 @@ if bpy is not None:
operator.UnassignClass,
operator.SelectClass,
operator.SelectType,
operator.LoadBcfProject,
operator.SaveBcfProject,
operator.GetBcfTopics,
operator.ViewBcfTopic,
operator.ActivateBcfViewpoint,
operator.OpenBcfFileReference,
@@ -507,15 +507,16 @@ class RejectElement(bpy.types.Operator):
return {"FINISHED"}
class GetBcfTopics(bpy.types.Operator):
bl_idname = "bim.get_bcf_topics"
bl_label = "Get BCF Topics"
class LoadBcfProject(bpy.types.Operator):
bl_idname = "bim.load_bcf_project"
bl_label = "Load BCF Project"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
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)
@@ -947,6 +947,11 @@ def refreshBcfTopic(self, context):
RefreshBcfTopic.refresh(context)
def setBcfProjectName(self, context):
import bcfplugin
bcfplugin.setProjectName(self.name)
class RefreshBcfTopic:
props: None
topic: None
@@ -1599,6 +1604,7 @@ class BIMProperties(PropertyGroup):
class BCFProperties(PropertyGroup):
name: StringProperty(default="", name="Project Name", update=setBcfProjectName)
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")
+11 -3
View File
@@ -1660,11 +1660,19 @@ class BIM_PT_bcf(Panel):
scene = context.scene
props = bpy.context.scene.BCFProperties
row = layout.row()
row.operator("bim.get_bcf_topics")
row = layout.row(align=True)
row.operator("bim.load_bcf_project")
if not props.topics:
return
row.operator("bim.save_bcf_project")
row = layout.row()
row.operator("bim.save_bcf_project")
row.prop(props, "name")
if not props.topics:
return
props = bpy.context.scene.BCFProperties
layout.template_list("BIM_UL_topics", "", props, "topics", props, "active_topic_index")