mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 05:22:06 +00:00
Add experimental UI to manage geometric contexts
This commit is contained in:
@@ -706,3 +706,48 @@ class FetchObjectPassport(bpy.types.Operator):
|
||||
directory=os.path.join(uri, 'Mesh')
|
||||
)
|
||||
bpy.context.active_object.data = bpy.data.meshes[identification]
|
||||
|
||||
|
||||
class AddContext(bpy.types.Operator):
|
||||
bl_idname = 'bim.add_context'
|
||||
bl_label = 'Add Context'
|
||||
|
||||
def execute(self, context):
|
||||
context = bpy.context.scene.BIMProperties.contexts.add()
|
||||
context.name = bpy.context.scene.BIMProperties.available_contexts
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class RemoveContext(bpy.types.Operator):
|
||||
bl_idname = 'bim.remove_context'
|
||||
bl_label = 'Remove Context'
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
bpy.context.scene.BIMProperties.contexts.remove(self.index)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class AddSubcontext(bpy.types.Operator):
|
||||
bl_idname = 'bim.add_subcontext'
|
||||
bl_label = 'Add Subcontext'
|
||||
context_index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
subcontext = bpy.context.scene.BIMProperties.contexts[self.context_index].subcontexts.add()
|
||||
subcontext.name = bpy.context.scene.BIMProperties.available_subcontexts
|
||||
subcontext.target_view = bpy.context.scene.BIMProperties.available_target_views
|
||||
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_index, subcontext_index = self.indexes.split('-')
|
||||
context_index = int(context_index)
|
||||
subcontext_index = int(subcontext_index)
|
||||
bpy.context.scene.BIMProperties.contexts[context_index].subcontexts.remove(subcontext_index)
|
||||
return {'FINISHED'}
|
||||
|
||||
Reference in New Issue
Block a user