Bump to latest bcfplugin, new operator to save BCF projects

This commit is contained in:
Dion Moult
2020-12-13 13:44:50 +11:00
parent f3269b732f
commit e39a997f5f
4 changed files with 27 additions and 23 deletions
@@ -25,7 +25,7 @@ if bpy is not None:
operator.UnassignClass,
operator.SelectClass,
operator.SelectType,
operator.SelectBcfFile,
operator.SaveBcfProject,
operator.GetBcfTopics,
operator.ViewBcfTopic,
operator.ActivateBcfViewpoint,
+21 -15
View File
@@ -510,11 +510,12 @@ class RejectElement(bpy.types.Operator):
class GetBcfTopics(bpy.types.Operator):
bl_idname = "bim.get_bcf_topics"
bl_label = "Get BCF Topics"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
import bcfplugin
bcfplugin.openProject(bpy.context.scene.BCFProperties.bcf_file)
bcfplugin.openProject(self.filepath)
bcf.BcfStore.topics = bcfplugin.getTopics()
while len(bpy.context.scene.BCFProperties.topics) > 0:
bpy.context.scene.BCFProperties.topics.remove(0)
@@ -523,6 +524,25 @@ class GetBcfTopics(bpy.types.Operator):
new.name = topic[0]
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
class SaveBcfProject(bpy.types.Operator):
bl_idname = "bim.save_bcf_project"
bl_label = "Save BCF Project"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
import bcfplugin
bcfplugin.saveProject(self.filepath)
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
class ViewBcfTopic(bpy.types.Operator):
bl_idname = "bim.view_bcf_topic"
@@ -2030,20 +2050,6 @@ class SelectSmartGroup(bpy.types.Operator):
return {"FINISHED"}
class SelectBcfFile(bpy.types.Operator):
bl_idname = "bim.select_bcf_file"
bl_label = "Select BCF File"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
bpy.context.scene.BCFProperties.bcf_file = self.filepath
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
class SelectFeaturesDir(bpy.types.Operator):
bl_idname = "bim.select_features_dir"
bl_label = "Select Features Directory"
+2 -3
View File
@@ -1057,8 +1057,8 @@ class RefreshBcfTopic:
cls.props.topic_related_topics.remove(0)
for t in cls.topic.relatedTopics:
new = cls.props.topic_related_topics.add()
new.name = bcfplugin.getTopicFromUUID(t.value).title
new.guid = str(t.value)
new.name = bcfplugin.getTopicFromUUID(t.guid).title
new.guid = str(t.guid)
@classmethod
def load_viewpoints(cls):
@@ -1599,7 +1599,6 @@ class BIMProperties(PropertyGroup):
class BCFProperties(PropertyGroup):
bcf_file: StringProperty(default="", name="BCF File")
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")
+3 -4
View File
@@ -1660,13 +1660,12 @@ class BIM_PT_bcf(Panel):
scene = context.scene
props = bpy.context.scene.BCFProperties
row = layout.row(align=True)
row.prop(props, "bcf_file")
row.operator("bim.select_bcf_file", icon="FILE_FOLDER", text="")
row = layout.row()
row.operator("bim.get_bcf_topics")
row = layout.row()
row.operator("bim.save_bcf_project")
props = bpy.context.scene.BCFProperties
layout.template_list("BIM_UL_topics", "", props, "topics", props, "active_topic_index")