mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
Optimise operators when a drawing is active by not needlessly regenerating the cut after each operation.
This commit is contained in:
@@ -222,8 +222,6 @@ def refresh_ui_data():
|
|||||||
if isinstance(ifc_file := tool.Ifc.get(), ifcopenshell.sqlite):
|
if isinstance(ifc_file := tool.Ifc.get(), ifcopenshell.sqlite):
|
||||||
ifc_file.clear_cache()
|
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:
|
if tool.Web.get_web_props().is_connected:
|
||||||
tool.Web.send_webui_data()
|
tool.Web.send_webui_data()
|
||||||
|
|
||||||
|
|||||||
@@ -239,12 +239,15 @@ class DecoratorData:
|
|||||||
camera_rotation_checksum = None
|
camera_rotation_checksum = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, handler):
|
def clear_cache(cls):
|
||||||
cls.is_loaded = True
|
|
||||||
cls.cut_cache = {}
|
cls.cut_cache = {}
|
||||||
cls.layerset_cache = {}
|
cls.layerset_cache = {}
|
||||||
cls.fill_cache = {}
|
cls.fill_cache = {}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def load(cls, handler):
|
||||||
|
cls.is_loaded = True
|
||||||
|
|
||||||
text = {}
|
text = {}
|
||||||
dimension = {}
|
dimension = {}
|
||||||
fall = {}
|
fall = {}
|
||||||
|
|||||||
@@ -1959,8 +1959,7 @@ class DecorationsHandler:
|
|||||||
# NOTE: we USE POST_PIXEL here so that we can use both POLYLINE_UNIFORM_COLOR
|
# 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
|
# 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")
|
cls.installed = SpaceView3D.draw_handler_add(handler, (context,), "WINDOW", "POST_PIXEL")
|
||||||
if not DecoratorData.is_loaded:
|
DecoratorData.clear_cache()
|
||||||
DecoratorData.load(handler)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def uninstall(cls):
|
def uninstall(cls):
|
||||||
@@ -1987,5 +1986,8 @@ class DecorationsHandler:
|
|||||||
if not DrawingsData.is_loaded:
|
if not DrawingsData.is_loaded:
|
||||||
DrawingsData.load()
|
DrawingsData.load()
|
||||||
|
|
||||||
|
if not DecoratorData.is_loaded:
|
||||||
|
DecoratorData.load(self)
|
||||||
|
|
||||||
for obj, decorator in DecoratorData.data["object_decorators"]:
|
for obj, decorator in DecoratorData.data["object_decorators"]:
|
||||||
decorator.decorate(context, obj)
|
decorator.decorate(context, obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user