Optimise operators when a drawing is active by not needlessly regenerating the cut after each operation.

This commit is contained in:
Dion Moult
2025-10-22 18:03:35 +11:00
parent f48b5b9d92
commit 381b0d379a
3 changed files with 9 additions and 6 deletions
-2
View File
@@ -222,8 +222,6 @@ def refresh_ui_data():
if isinstance(ifc_file := tool.Ifc.get(), ifcopenshell.sqlite):
ifc_file.clear_cache()
props = tool.Drawing.get_document_props()
props.should_draw_decorations = props.should_draw_decorations
if tool.Web.get_web_props().is_connected:
tool.Web.send_webui_data()
+5 -2
View File
@@ -239,12 +239,15 @@ class DecoratorData:
camera_rotation_checksum = None
@classmethod
def load(cls, handler):
cls.is_loaded = True
def clear_cache(cls):
cls.cut_cache = {}
cls.layerset_cache = {}
cls.fill_cache = {}
@classmethod
def load(cls, handler):
cls.is_loaded = True
text = {}
dimension = {}
fall = {}
@@ -1959,8 +1959,7 @@ class DecorationsHandler:
# NOTE: we USE POST_PIXEL here so that we can use both POLYLINE_UNIFORM_COLOR
# and drawing text in the same handler. BUT this means that we supply coordinates in WINSPACE
cls.installed = SpaceView3D.draw_handler_add(handler, (context,), "WINDOW", "POST_PIXEL")
if not DecoratorData.is_loaded:
DecoratorData.load(handler)
DecoratorData.clear_cache()
@classmethod
def uninstall(cls):
@@ -1987,5 +1986,8 @@ class DecorationsHandler:
if not DrawingsData.is_loaded:
DrawingsData.load()
if not DecoratorData.is_loaded:
DecoratorData.load(self)
for obj, decorator in DecoratorData.data["object_decorators"]:
decorator.decorate(context, obj)