mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 20:12:31 +00:00
Fix #5204. Bug where you could attempt to add IFC objects in edit mode which isn't allowed.
This commit is contained in:
@@ -494,6 +494,10 @@ class BIM_OT_add_door(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Door"
|
bl_label = "Door"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return tool.Ifc.get() and context.mode == "OBJECT"
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
if not ifc_file:
|
if not ifc_file:
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class BIM_OT_add_object(Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return tool.Ifc.get()
|
return tool.Ifc.get() and context.mode == "OBJECT"
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
add_object(self, context)
|
add_object(self, context)
|
||||||
|
|||||||
@@ -283,6 +283,10 @@ class BIM_OT_add_railing(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Railing"
|
bl_label = "Railing"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return tool.Ifc.get() and context.mode == "OBJECT"
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
if not ifc_file:
|
if not ifc_file:
|
||||||
|
|||||||
@@ -499,6 +499,10 @@ class BIM_OT_add_roof(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Roof"
|
bl_label = "Roof"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return tool.Ifc.get() and context.mode == "OBJECT"
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
if not ifc_file:
|
if not ifc_file:
|
||||||
|
|||||||
@@ -155,6 +155,10 @@ class BIM_OT_add_stair(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Stair"
|
bl_label = "Stair"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return tool.Ifc.get() and context.mode == "OBJECT"
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
if not ifc_file:
|
if not ifc_file:
|
||||||
|
|||||||
@@ -663,10 +663,11 @@ def add_menu(self, context):
|
|||||||
|
|
||||||
|
|
||||||
def add_mesh_object_menu(self, context):
|
def add_mesh_object_menu(self, context):
|
||||||
self.layout.separator()
|
if context.mode == "OBJECT":
|
||||||
self.layout.operator("mesh.add_grid", icon_value=bonsai.bim.icons["IFC"].icon_id)
|
self.layout.separator()
|
||||||
self.layout.operator("mesh.add_stair", icon_value=bonsai.bim.icons["IFC"].icon_id)
|
self.layout.operator("mesh.add_grid", icon_value=bonsai.bim.icons["IFC"].icon_id)
|
||||||
self.layout.operator("mesh.add_window", icon_value=bonsai.bim.icons["IFC"].icon_id)
|
self.layout.operator("mesh.add_stair", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Stair (Untyped)")
|
||||||
self.layout.operator("mesh.add_door", icon_value=bonsai.bim.icons["IFC"].icon_id)
|
self.layout.operator("mesh.add_window", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Window (Untyped)")
|
||||||
self.layout.operator("mesh.add_railing", icon_value=bonsai.bim.icons["IFC"].icon_id)
|
self.layout.operator("mesh.add_door", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Door (Untyped)")
|
||||||
self.layout.operator("mesh.add_roof", icon_value=bonsai.bim.icons["IFC"].icon_id)
|
self.layout.operator("mesh.add_railing", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Railing (Untyped)")
|
||||||
|
self.layout.operator("mesh.add_roof", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Roof (Untyped)")
|
||||||
|
|||||||
@@ -387,6 +387,10 @@ class BIM_OT_add_window(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_label = "Window"
|
bl_label = "Window"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return tool.Ifc.get() and context.mode == "OBJECT"
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
if not ifc_file:
|
if not ifc_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user