mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
remove unnecessary ifc operators
This commit is contained in:
@@ -32,43 +32,47 @@ from bonsai.bim.module.material.prop import purge as material_prop_purge
|
|||||||
from bonsai.bim.ifc import IfcStore
|
from bonsai.bim.ifc import IfcStore
|
||||||
|
|
||||||
|
|
||||||
class LoadMaterials(bpy.types.Operator, tool.Ifc.Operator):
|
class LoadMaterials(bpy.types.Operator):
|
||||||
bl_idname = "bim.load_materials"
|
bl_idname = "bim.load_materials"
|
||||||
bl_label = "Load Materials"
|
bl_label = "Load Materials"
|
||||||
bl_description = "Display list of named materials"
|
bl_description = "Display list of named materials"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
core.load_materials(tool.Material, context.scene.BIMMaterialProperties.material_type)
|
core.load_materials(tool.Material, context.scene.BIMMaterialProperties.material_type)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class DisableEditingMaterials(bpy.types.Operator, tool.Ifc.Operator):
|
class DisableEditingMaterials(bpy.types.Operator):
|
||||||
bl_idname = "bim.disable_editing_materials"
|
bl_idname = "bim.disable_editing_materials"
|
||||||
bl_label = "Disable Editing Materials"
|
bl_label = "Disable Editing Materials"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
core.disable_editing_materials(tool.Material)
|
core.disable_editing_materials(tool.Material)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class SelectByMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
class SelectByMaterial(bpy.types.Operator):
|
||||||
bl_idname = "bim.select_by_material"
|
bl_idname = "bim.select_by_material"
|
||||||
bl_label = "Select By Material"
|
bl_label = "Select By Material"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
material: bpy.props.IntProperty()
|
material: bpy.props.IntProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
core.select_by_material(tool.Material, tool.Spatial, material=tool.Ifc.get().by_id(self.material))
|
core.select_by_material(tool.Material, tool.Spatial, material=tool.Ifc.get().by_id(self.material))
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class EnableEditingMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
class EnableEditingMaterial(bpy.types.Operator):
|
||||||
bl_idname = "bim.enable_editing_material"
|
bl_idname = "bim.enable_editing_material"
|
||||||
bl_label = "Enable Editing Material"
|
bl_label = "Enable Editing Material"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
material: bpy.props.IntProperty()
|
material: bpy.props.IntProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
core.enable_editing_material(tool.Material, material=tool.Ifc.get().by_id(self.material))
|
core.enable_editing_material(tool.Material, material=tool.Ifc.get().by_id(self.material))
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class EditMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
class EditMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
@@ -81,14 +85,15 @@ class EditMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
core.edit_material(tool.Ifc, tool.Material, material=tool.Ifc.get().by_id(self.material))
|
core.edit_material(tool.Ifc, tool.Material, material=tool.Ifc.get().by_id(self.material))
|
||||||
|
|
||||||
|
|
||||||
class DisableEditingMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
class DisableEditingMaterial(bpy.types.Operator):
|
||||||
bl_idname = "bim.disable_editing_material"
|
bl_idname = "bim.disable_editing_material"
|
||||||
bl_label = "Disable Editing Material"
|
bl_label = "Disable Editing Material"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
material: bpy.props.IntProperty()
|
material: bpy.props.IntProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
core.disable_editing_material(tool.Material)
|
core.disable_editing_material(tool.Material)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class AssignParameterizedProfile(bpy.types.Operator, tool.Ifc.Operator):
|
class AssignParameterizedProfile(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
@@ -776,13 +781,13 @@ class ContractMaterialCategory(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class EnableEditingMaterialStyle(bpy.types.Operator, tool.Ifc.Operator):
|
class EnableEditingMaterialStyle(bpy.types.Operator):
|
||||||
bl_idname = "bim.enable_editing_material_style"
|
bl_idname = "bim.enable_editing_material_style"
|
||||||
bl_label = "Enable Editing Material Style"
|
bl_label = "Enable Editing Material Style"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
material: bpy.props.IntProperty()
|
material: bpy.props.IntProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
props = bpy.context.scene.BIMMaterialProperties
|
props = bpy.context.scene.BIMMaterialProperties
|
||||||
props.active_material_id = self.material
|
props.active_material_id = self.material
|
||||||
props.editing_material_type = "STYLE"
|
props.editing_material_type = "STYLE"
|
||||||
@@ -800,6 +805,7 @@ class EnableEditingMaterialStyle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
style = rep.Items[0].Styles[0]
|
style = rep.Items[0].Styles[0]
|
||||||
if style.Name: # props.styles only has named styles
|
if style.Name: # props.styles only has named styles
|
||||||
props.styles = str(rep.Items[0].Styles[0].id())
|
props.styles = str(rep.Items[0].Styles[0].id())
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class EditMaterialStyle(bpy.types.Operator, tool.Ifc.Operator):
|
class EditMaterialStyle(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
@@ -98,17 +98,18 @@ class RemoveProfileDef(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
props.active_profile_index = min(current_index, len(props.profiles) - 1)
|
props.active_profile_index = min(current_index, len(props.profiles) - 1)
|
||||||
|
|
||||||
|
|
||||||
class EnableEditingProfile(bpy.types.Operator, tool.Ifc.Operator):
|
class EnableEditingProfile(bpy.types.Operator):
|
||||||
bl_idname = "bim.enable_editing_profile"
|
bl_idname = "bim.enable_editing_profile"
|
||||||
bl_label = "Enable Editing Profile"
|
bl_label = "Enable Editing Profile"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
profile: bpy.props.IntProperty()
|
profile: bpy.props.IntProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
props = context.scene.BIMProfileProperties
|
props = context.scene.BIMProfileProperties
|
||||||
props.profile_attributes.clear()
|
props.profile_attributes.clear()
|
||||||
bonsai.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.profile), props.profile_attributes)
|
bonsai.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.profile), props.profile_attributes)
|
||||||
props.active_profile_id = self.profile
|
props.active_profile_id = self.profile
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class DisableEditingProfile(bpy.types.Operator):
|
class DisableEditingProfile(bpy.types.Operator):
|
||||||
@@ -176,12 +177,12 @@ class DuplicateProfileDef(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bpy.ops.bim.load_profiles()
|
bpy.ops.bim.load_profiles()
|
||||||
|
|
||||||
|
|
||||||
class EnableEditingArbitraryProfile(bpy.types.Operator, tool.Ifc.Operator):
|
class EnableEditingArbitraryProfile(bpy.types.Operator):
|
||||||
bl_idname = "bim.enable_editing_arbitrary_profile"
|
bl_idname = "bim.enable_editing_arbitrary_profile"
|
||||||
bl_label = "Enable Editing Arbitrary Profile"
|
bl_label = "Enable Editing Arbitrary Profile"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
props = context.scene.BIMProfileProperties
|
props = context.scene.BIMProfileProperties
|
||||||
active_profile = props.profiles[props.active_profile_index]
|
active_profile = props.profiles[props.active_profile_index]
|
||||||
profile_id = active_profile.ifc_definition_id
|
profile_id = active_profile.ifc_definition_id
|
||||||
@@ -194,6 +195,7 @@ class EnableEditingArbitraryProfile(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bpy.ops.object.mode_set(mode="EDIT")
|
bpy.ops.object.mode_set(mode="EDIT")
|
||||||
ProfileDecorator.install(context, exit_edit_mode_callback=lambda: disable_editing_arbitrary_profile(context))
|
ProfileDecorator.install(context, exit_edit_mode_callback=lambda: disable_editing_arbitrary_profile(context))
|
||||||
tool.Blender.set_viewport_tool("bim.cad_tool")
|
tool.Blender.set_viewport_tool("bim.cad_tool")
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
def disable_editing_arbitrary_profile(context):
|
def disable_editing_arbitrary_profile(context):
|
||||||
@@ -212,13 +214,14 @@ def disable_editing_arbitrary_profile(context):
|
|||||||
refresh()
|
refresh()
|
||||||
|
|
||||||
|
|
||||||
class DisableEditingArbitraryProfile(bpy.types.Operator, tool.Ifc.Operator):
|
class DisableEditingArbitraryProfile(bpy.types.Operator):
|
||||||
bl_idname = "bim.disable_editing_arbitrary_profile"
|
bl_idname = "bim.disable_editing_arbitrary_profile"
|
||||||
bl_label = "Disable Editing Arbitrary Profile"
|
bl_label = "Disable Editing Arbitrary Profile"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
return disable_editing_arbitrary_profile(context)
|
disable_editing_arbitrary_profile(context)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class EditArbitraryProfile(bpy.types.Operator, tool.Ifc.Operator):
|
class EditArbitraryProfile(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
@@ -356,14 +356,14 @@ class BrowseExternalStyle(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class ActivateExternalStyle(bpy.types.Operator, tool.Ifc.Operator):
|
class ActivateExternalStyle(bpy.types.Operator):
|
||||||
bl_idname = "bim.activate_external_style"
|
bl_idname = "bim.activate_external_style"
|
||||||
bl_label = "Activate External Style"
|
bl_label = "Activate External Style"
|
||||||
bl_options = {"REGISTER", "UNDO", "INTERNAL"}
|
bl_options = {"REGISTER", "UNDO", "INTERNAL"}
|
||||||
|
|
||||||
material_name: bpy.props.StringProperty(name="Material Name", default="")
|
material_name: bpy.props.StringProperty(name="Material Name", default="")
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
if not self.material_name:
|
if not self.material_name:
|
||||||
material = context.active_object.active_material
|
material = context.active_object.active_material
|
||||||
else:
|
else:
|
||||||
@@ -403,6 +403,7 @@ class ActivateExternalStyle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
if material.use_nodes:
|
if material.use_nodes:
|
||||||
tool.Blender.copy_node_graph(material, db["data_block"])
|
tool.Blender.copy_node_graph(material, db["data_block"])
|
||||||
bpy.data.materials.remove(db["data_block"])
|
bpy.data.materials.remove(db["data_block"])
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
def copy_material_attributes(self, source, target):
|
def copy_material_attributes(self, source, target):
|
||||||
ID_properties = bpy.types.ID.bl_rna.properties
|
ID_properties = bpy.types.ID.bl_rna.properties
|
||||||
@@ -444,34 +445,37 @@ class ActivateExternalStyle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
set_prop(prop_name)
|
set_prop(prop_name)
|
||||||
|
|
||||||
|
|
||||||
class DisableEditingStyles(bpy.types.Operator, tool.Ifc.Operator):
|
class DisableEditingStyles(bpy.types.Operator):
|
||||||
bl_idname = "bim.disable_editing_styles"
|
bl_idname = "bim.disable_editing_styles"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
bl_label = "Disable Editing Styles"
|
bl_label = "Disable Editing Styles"
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
core.disable_editing_styles(tool.Style)
|
core.disable_editing_styles(tool.Style)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class LoadStyles(bpy.types.Operator, tool.Ifc.Operator):
|
class LoadStyles(bpy.types.Operator):
|
||||||
bl_idname = "bim.load_styles"
|
bl_idname = "bim.load_styles"
|
||||||
bl_label = "Load Styles"
|
bl_label = "Load Styles"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
style_type: bpy.props.StringProperty()
|
style_type: bpy.props.StringProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
style_type = self.style_type if self.style_type else context.scene.BIMStylesProperties.style_type
|
style_type = self.style_type if self.style_type else context.scene.BIMStylesProperties.style_type
|
||||||
core.load_styles(tool.Style, style_type=style_type)
|
core.load_styles(tool.Style, style_type=style_type)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class SelectByStyle(bpy.types.Operator, tool.Ifc.Operator):
|
class SelectByStyle(bpy.types.Operator):
|
||||||
bl_idname = "bim.select_by_style"
|
bl_idname = "bim.select_by_style"
|
||||||
bl_label = "Select By Style"
|
bl_label = "Select By Style"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
style: bpy.props.IntProperty()
|
style: bpy.props.IntProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
core.select_by_style(tool.Style, tool.Spatial, style=tool.Ifc.get().by_id(self.style))
|
core.select_by_style(tool.Style, tool.Spatial, style=tool.Ifc.get().by_id(self.style))
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class ChooseTextureMapPath(bpy.types.Operator):
|
class ChooseTextureMapPath(bpy.types.Operator):
|
||||||
@@ -634,14 +638,14 @@ class AddPresentationStyle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
core.load_styles(tool.Style, style_type=props.style_type)
|
core.load_styles(tool.Style, style_type=props.style_type)
|
||||||
|
|
||||||
|
|
||||||
class EnableEditingSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
|
class EnableEditingSurfaceStyle(bpy.types.Operator):
|
||||||
bl_idname = "bim.enable_editing_surface_style"
|
bl_idname = "bim.enable_editing_surface_style"
|
||||||
bl_label = "Enable Editing Surface Style"
|
bl_label = "Enable Editing Surface Style"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
style: bpy.props.IntProperty(default=0)
|
style: bpy.props.IntProperty(default=0)
|
||||||
ifc_class: bpy.props.StringProperty(default="")
|
ifc_class: bpy.props.StringProperty(default="")
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
props = bpy.context.scene.BIMStylesProperties
|
props = bpy.context.scene.BIMStylesProperties
|
||||||
style = tool.Ifc.get().by_id(self.style)
|
style = tool.Ifc.get().by_id(self.style)
|
||||||
props.is_editing_style = self.style
|
props.is_editing_style = self.style
|
||||||
@@ -679,6 +683,7 @@ class EnableEditingSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
and active_style_type != "Shading"
|
and active_style_type != "Shading"
|
||||||
):
|
):
|
||||||
tool.Style.switch_shading(material, "Shading")
|
tool.Style.switch_shading(material, "Shading")
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
|
class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
@@ -515,12 +515,12 @@ class RenameType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
self.layout.prop(self, "name")
|
self.layout.prop(self, "name")
|
||||||
|
|
||||||
|
|
||||||
class AutoRenameOccurrences(bpy.types.Operator, tool.Ifc.Operator):
|
class AutoRenameOccurrences(bpy.types.Operator):
|
||||||
bl_idname = "bim.auto_rename_occurrences"
|
bl_idname = "bim.auto_rename_occurrences"
|
||||||
bl_label = "Auto Rename Occurrences"
|
bl_label = "Auto Rename Occurrences"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def execute(self, context):
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
element_type = tool.Ifc.get_entity(obj)
|
element_type = tool.Ifc.get_entity(obj)
|
||||||
if element_type and element_type.is_a("IfcTypeObject"):
|
if element_type and element_type.is_a("IfcTypeObject"):
|
||||||
@@ -529,6 +529,7 @@ class AutoRenameOccurrences(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
occurrence.Name = tool.Model.generate_occurrence_name(element_type, occurrence.is_a())
|
occurrence.Name = tool.Model.generate_occurrence_name(element_type, occurrence.is_a())
|
||||||
if obj:
|
if obj:
|
||||||
tool.Root.set_object_name(obj, occurrence)
|
tool.Root.set_object_name(obj, occurrence)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class DuplicateType(bpy.types.Operator, tool.Ifc.Operator):
|
class DuplicateType(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
Reference in New Issue
Block a user