mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 13:04:49 +00:00
WIP refactor context UI into its own module. Remove dependency to Blender properties. See #1222.
This commit is contained in:
@@ -2096,50 +2096,6 @@ class FetchObjectPassport(bpy.types.Operator):
|
||||
bpy.context.active_object.data = bpy.data.meshes[reference.name]
|
||||
|
||||
|
||||
class AddSubcontext(bpy.types.Operator):
|
||||
bl_idname = "bim.add_subcontext"
|
||||
bl_label = "Add Subcontext"
|
||||
context: bpy.props.StringProperty()
|
||||
|
||||
def execute(self, context):
|
||||
self.file = ifc.IfcStore.get_file()
|
||||
import blenderbim.bim.module.context.add_context as add_context
|
||||
usecase = add_context.Usecase(self.file, {
|
||||
"context": self.context.capitalize(),
|
||||
"subcontext": bpy.context.scene.BIMProperties.available_subcontexts,
|
||||
"target_view": bpy.context.scene.BIMProperties.available_target_views,
|
||||
})
|
||||
result = usecase.execute()
|
||||
|
||||
props = bpy.context.scene.BIMProperties
|
||||
subcontext = getattr(bpy.context.scene.BIMProperties, "{}_subcontexts".format(self.context)).add()
|
||||
subcontext.name = bpy.context.scene.BIMProperties.available_subcontexts
|
||||
subcontext.target_view = bpy.context.scene.BIMProperties.available_target_views
|
||||
subcontext.ifc_definition_id = int(result)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class RemoveSubcontext(bpy.types.Operator):
|
||||
bl_idname = "bim.remove_subcontext"
|
||||
bl_label = "Remove Context"
|
||||
indexes: bpy.props.StringProperty()
|
||||
|
||||
def execute(self, context):
|
||||
context, subcontext_index = self.indexes.split("-")
|
||||
subcontext_index = int(subcontext_index)
|
||||
subcontexts = getattr(bpy.context.scene.BIMProperties, "{}_subcontexts".format(context))
|
||||
|
||||
self.file = ifc.IfcStore.get_file()
|
||||
import blenderbim.bim.module.context.remove_context as remove_context
|
||||
usecase = remove_context.Usecase(self.file, {
|
||||
"context": self.file.by_id(subcontexts[subcontext_index].ifc_definition_id)
|
||||
})
|
||||
usecase.execute()
|
||||
|
||||
subcontexts.remove(subcontext_index)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class OpenView(bpy.types.Operator):
|
||||
bl_idname = "bim.open_view"
|
||||
bl_label = "Open View"
|
||||
|
||||
Reference in New Issue
Block a user