mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 10:51:13 +00:00
Bump to latest bcfplugin, new operator to save BCF projects
This commit is contained in:
@@ -25,7 +25,7 @@ if bpy is not None:
|
|||||||
operator.UnassignClass,
|
operator.UnassignClass,
|
||||||
operator.SelectClass,
|
operator.SelectClass,
|
||||||
operator.SelectType,
|
operator.SelectType,
|
||||||
operator.SelectBcfFile,
|
operator.SaveBcfProject,
|
||||||
operator.GetBcfTopics,
|
operator.GetBcfTopics,
|
||||||
operator.ViewBcfTopic,
|
operator.ViewBcfTopic,
|
||||||
operator.ActivateBcfViewpoint,
|
operator.ActivateBcfViewpoint,
|
||||||
|
|||||||
@@ -510,11 +510,12 @@ class RejectElement(bpy.types.Operator):
|
|||||||
class GetBcfTopics(bpy.types.Operator):
|
class GetBcfTopics(bpy.types.Operator):
|
||||||
bl_idname = "bim.get_bcf_topics"
|
bl_idname = "bim.get_bcf_topics"
|
||||||
bl_label = "Get BCF Topics"
|
bl_label = "Get BCF Topics"
|
||||||
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
import bcfplugin
|
import bcfplugin
|
||||||
|
|
||||||
bcfplugin.openProject(bpy.context.scene.BCFProperties.bcf_file)
|
bcfplugin.openProject(self.filepath)
|
||||||
bcf.BcfStore.topics = bcfplugin.getTopics()
|
bcf.BcfStore.topics = bcfplugin.getTopics()
|
||||||
while len(bpy.context.scene.BCFProperties.topics) > 0:
|
while len(bpy.context.scene.BCFProperties.topics) > 0:
|
||||||
bpy.context.scene.BCFProperties.topics.remove(0)
|
bpy.context.scene.BCFProperties.topics.remove(0)
|
||||||
@@ -523,6 +524,25 @@ class GetBcfTopics(bpy.types.Operator):
|
|||||||
new.name = topic[0]
|
new.name = topic[0]
|
||||||
return {"FINISHED"}
|
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):
|
class ViewBcfTopic(bpy.types.Operator):
|
||||||
bl_idname = "bim.view_bcf_topic"
|
bl_idname = "bim.view_bcf_topic"
|
||||||
@@ -2030,20 +2050,6 @@ class SelectSmartGroup(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
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):
|
class SelectFeaturesDir(bpy.types.Operator):
|
||||||
bl_idname = "bim.select_features_dir"
|
bl_idname = "bim.select_features_dir"
|
||||||
bl_label = "Select Features Directory"
|
bl_label = "Select Features Directory"
|
||||||
|
|||||||
@@ -1057,8 +1057,8 @@ class RefreshBcfTopic:
|
|||||||
cls.props.topic_related_topics.remove(0)
|
cls.props.topic_related_topics.remove(0)
|
||||||
for t in cls.topic.relatedTopics:
|
for t in cls.topic.relatedTopics:
|
||||||
new = cls.props.topic_related_topics.add()
|
new = cls.props.topic_related_topics.add()
|
||||||
new.name = bcfplugin.getTopicFromUUID(t.value).title
|
new.name = bcfplugin.getTopicFromUUID(t.guid).title
|
||||||
new.guid = str(t.value)
|
new.guid = str(t.guid)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load_viewpoints(cls):
|
def load_viewpoints(cls):
|
||||||
@@ -1599,7 +1599,6 @@ class BIMProperties(PropertyGroup):
|
|||||||
|
|
||||||
|
|
||||||
class BCFProperties(PropertyGroup):
|
class BCFProperties(PropertyGroup):
|
||||||
bcf_file: StringProperty(default="", name="BCF File")
|
|
||||||
topics: CollectionProperty(name="BCF Topics", type=BcfTopic)
|
topics: CollectionProperty(name="BCF Topics", type=BcfTopic)
|
||||||
active_topic_index: IntProperty(name="Active BCF Topic Index", update=refreshBcfTopic)
|
active_topic_index: IntProperty(name="Active BCF Topic Index", update=refreshBcfTopic)
|
||||||
viewpoints: EnumProperty(items=getBcfViewpoints, name="BCF Viewpoints")
|
viewpoints: EnumProperty(items=getBcfViewpoints, name="BCF Viewpoints")
|
||||||
|
|||||||
@@ -1660,13 +1660,12 @@ class BIM_PT_bcf(Panel):
|
|||||||
scene = context.scene
|
scene = context.scene
|
||||||
props = bpy.context.scene.BCFProperties
|
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 = layout.row()
|
||||||
row.operator("bim.get_bcf_topics")
|
row.operator("bim.get_bcf_topics")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.operator("bim.save_bcf_project")
|
||||||
|
|
||||||
props = bpy.context.scene.BCFProperties
|
props = bpy.context.scene.BCFProperties
|
||||||
layout.template_list("BIM_UL_topics", "", props, "topics", props, "active_topic_index")
|
layout.template_list("BIM_UL_topics", "", props, "topics", props, "active_topic_index")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user