mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Allow disabling undo on save
The transaction system does not scale on large scale or complex remove_deep deletions. So if you want to delete a mesh with many thousands of vertices, it becomes very, very slow. Unfortunately we cannot also clear Blender's undo history, so this advanced feature should be used carefully. Tested: - deleting 250 average objects: 264s before, 246s after (6.8% faster) - deleting 1 object with 6,000 vertices: 5 minutes and counting (basically impractical) before, 11s after
This commit is contained in:
@@ -828,7 +828,16 @@ class ExportIFC(bpy.types.Operator):
|
|||||||
return {"RUNNING_MODAL"}
|
return {"RUNNING_MODAL"}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
return IfcStore.execute_ifc_operator(self, context)
|
if context.scene.BIMProjectProperties.should_disable_undo_on_save:
|
||||||
|
old_history_size = tool.Ifc.get().history_size
|
||||||
|
old_undo_steps = context.preferences.edit.undo_steps
|
||||||
|
tool.Ifc.get().history_size = 0
|
||||||
|
context.preferences.edit.undo_steps = 0
|
||||||
|
IfcStore.execute_ifc_operator(self, context)
|
||||||
|
if context.scene.BIMProjectProperties.should_disable_undo_on_save:
|
||||||
|
tool.Ifc.get().history_size = old_history_size
|
||||||
|
context.preferences.edit.undo_steps = old_undo_steps
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ class BIMProjectProperties(PropertyGroup):
|
|||||||
false_origin: StringProperty(name="False Origin", default="0,0,0")
|
false_origin: StringProperty(name="False Origin", default="0,0,0")
|
||||||
element_offset: IntProperty(name="Element Offset", default=0)
|
element_offset: IntProperty(name="Element Offset", default=0)
|
||||||
element_limit: IntProperty(name="Element Offset", default=30000)
|
element_limit: IntProperty(name="Element Offset", default=30000)
|
||||||
|
should_disable_undo_on_save: BoolProperty(name="Disable Undo When Saving (Faster saves, no undo for you!)", default=False)
|
||||||
links: CollectionProperty(name="Links", type=Link)
|
links: CollectionProperty(name="Links", type=Link)
|
||||||
active_link_index: IntProperty(name="Active Link Index")
|
active_link_index: IntProperty(name="Active Link Index")
|
||||||
export_schema: EnumProperty(items=get_export_schema, name="IFC Schema")
|
export_schema: EnumProperty(items=get_export_schema, name="IFC Schema")
|
||||||
|
|||||||
@@ -203,7 +203,8 @@ class file(object):
|
|||||||
self.history.pop(0)
|
self.history.pop(0)
|
||||||
|
|
||||||
def begin_transaction(self):
|
def begin_transaction(self):
|
||||||
self.transaction = Transaction(self)
|
if self.history_size:
|
||||||
|
self.transaction = Transaction(self)
|
||||||
|
|
||||||
def end_transaction(self):
|
def end_transaction(self):
|
||||||
if self.transaction:
|
if self.transaction:
|
||||||
|
|||||||
Reference in New Issue
Block a user