diff --git a/src/ifcblenderexport/blenderbim/bim/__init__.py b/src/ifcblenderexport/blenderbim/bim/__init__.py index 653cd10110..6aa9c7f1b8 100644 --- a/src/ifcblenderexport/blenderbim/bim/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/__init__.py @@ -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, diff --git a/src/ifcblenderexport/blenderbim/bim/operator.py b/src/ifcblenderexport/blenderbim/bim/operator.py index 05b0e56cc3..d59c3f4217 100644 --- a/src/ifcblenderexport/blenderbim/bim/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/operator.py @@ -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" diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index 03d6f2850a..7763c7ba0d 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -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") diff --git a/src/ifcblenderexport/blenderbim/bim/ui.py b/src/ifcblenderexport/blenderbim/bim/ui.py index 3b3bbd7cfc..c2ed78824a 100644 --- a/src/ifcblenderexport/blenderbim/bim/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/ui.py @@ -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")