mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
move all operators added to "add mesh" menu to common method in ui.py
This commit is contained in:
@@ -210,12 +210,7 @@ def register():
|
||||
bpy.types.Object.BIMDoorProperties = bpy.props.PointerProperty(type=prop.BIMDoorProperties)
|
||||
bpy.types.Object.BIMRailingProperties = bpy.props.PointerProperty(type=prop.BIMRailingProperties)
|
||||
bpy.types.Object.BIMRoofProperties = bpy.props.PointerProperty(type=prop.BIMRoofProperties)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(grid.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(stair.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(window.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(door.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(railing.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(roof.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.append(ui.add_mesh_object_menu)
|
||||
bpy.types.VIEW3D_MT_add.append(ui.add_menu)
|
||||
bpy.app.handlers.load_post.append(handler.load_post)
|
||||
wm = bpy.context.window_manager
|
||||
@@ -246,12 +241,7 @@ def unregister():
|
||||
del bpy.types.Object.BIMRailingProperties
|
||||
del bpy.types.Object.BIMRoofProperties
|
||||
bpy.app.handlers.load_post.remove(handler.load_post)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(grid.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(stair.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(window.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(door.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(railing.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(roof.add_object_button)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(ui.add_mesh_object_menu)
|
||||
bpy.types.VIEW3D_MT_add.remove(ui.add_menu)
|
||||
wm = bpy.context.window_manager
|
||||
kc = wm.keyconfigs.addon
|
||||
|
||||
@@ -647,7 +647,3 @@ class RemoveDoor(bpy.types.Operator, tool.Ifc.Operator):
|
||||
ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), pset=pset)
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def add_object_button(self, context):
|
||||
self.layout.operator(BIM_OT_add_door.bl_idname, icon="PLUGIN")
|
||||
|
||||
@@ -111,7 +111,3 @@ class BIM_OT_add_object(Operator, tool.Ifc.Operator):
|
||||
def _execute(self, context):
|
||||
add_object(self, context)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def add_object_button(self, context):
|
||||
self.layout.operator(BIM_OT_add_object.bl_idname, icon="PLUGIN")
|
||||
|
||||
@@ -537,7 +537,3 @@ class RemoveRailing(bpy.types.Operator, tool.Ifc.Operator):
|
||||
pset = tool.Pset.get_element_pset(element, "BBIM_Railing")
|
||||
ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), pset=pset)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def add_object_button(self, context):
|
||||
self.layout.operator(BIM_OT_add_railing.bl_idname, icon="PLUGIN")
|
||||
|
||||
@@ -803,7 +803,3 @@ class SetGableRoofEdgeAngle(bpy.types.Operator):
|
||||
|
||||
tool.Blender.apply_bmesh(me, bm)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def add_object_button(self, context):
|
||||
self.layout.operator(BIM_OT_add_roof.bl_idname, icon="PLUGIN")
|
||||
|
||||
@@ -340,8 +340,3 @@ class RemoveStair(bpy.types.Operator, tool.Ifc.Operator):
|
||||
ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), pset=pset)
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def add_object_button(self, context):
|
||||
self.layout.operator(BIM_OT_add_object.bl_idname, icon="PLUGIN")
|
||||
self.layout.operator(BIM_OT_add_clever_stair.bl_idname, icon="PLUGIN")
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import bpy
|
||||
import blenderbim.bim
|
||||
import blenderbim.tool as tool
|
||||
from bpy.types import Panel, Menu
|
||||
from blenderbim.bim.module.model.data import (
|
||||
@@ -652,3 +653,14 @@ class BIM_MT_model(Menu):
|
||||
|
||||
def add_menu(self, context):
|
||||
self.layout.menu("BIM_MT_model", icon="FILE_3D")
|
||||
|
||||
|
||||
def add_mesh_object_menu(self, context):
|
||||
self.layout.separator()
|
||||
self.layout.operator("mesh.add_grid", icon_value=blenderbim.bim.icons["IFC"].icon_id)
|
||||
self.layout.operator("mesh.add_stair", icon_value=blenderbim.bim.icons["IFC"].icon_id)
|
||||
self.layout.operator("mesh.add_clever_stair", icon_value=blenderbim.bim.icons["IFC"].icon_id)
|
||||
self.layout.operator("mesh.add_window", icon_value=blenderbim.bim.icons["IFC"].icon_id)
|
||||
self.layout.operator("mesh.add_door", icon_value=blenderbim.bim.icons["IFC"].icon_id)
|
||||
self.layout.operator("mesh.add_railing", icon_value=blenderbim.bim.icons["IFC"].icon_id)
|
||||
self.layout.operator("mesh.add_roof", icon_value=blenderbim.bim.icons["IFC"].icon_id)
|
||||
|
||||
@@ -593,7 +593,3 @@ class RemoveWindow(bpy.types.Operator, tool.Ifc.Operator):
|
||||
ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), pset=pset)
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def add_object_button(self, context):
|
||||
self.layout.operator(BIM_OT_add_window.bl_idname, icon="PLUGIN")
|
||||
|
||||
Reference in New Issue
Block a user