diff --git a/core/handlers.py b/core/handlers.py index c27460232a3dab2182b096bfc6210435342e1ff7..6deff67cc88bb276c85f7a60057993aaec4c1fb1 100644 --- a/core/handlers.py +++ b/core/handlers.py @@ -6,7 +6,8 @@ from bpy.app.handlers import persistent from sverchok import old_nodes from sverchok import data_structure from sverchok.core import upgrade_nodes, undo_handler_node_count -from sverchok.core.update_system import set_first_run, clear_system_cache +from sverchok.core.update_system import ( + set_first_run, clear_system_cache, reset_timing_graphs) from sverchok.ui import color_def, bgl_callback_nodeview, bgl_callback_3dview from sverchok.utils import app_handler_ops from sverchok.utils.logging import debug @@ -95,6 +96,7 @@ def sv_handler_undo_post(scene): gh.ContextTrees.reset_data() + @persistent def sv_update_handler(scene): """ @@ -103,6 +105,8 @@ def sv_update_handler(scene): if not has_frame_changed(scene): return + reset_timing_graphs() + for ng in sverchok_trees(): try: # print('sv_update_handler') diff --git a/core/update_system.py b/core/update_system.py index 7cdd9ede69cff562f5c1c9f95c8ae0986d1eb31e..16e9bde9944eba053d49d8ec8f311385336c36e5 100644 --- a/core/update_system.py +++ b/core/update_system.py @@ -63,6 +63,10 @@ def update_error_colors(self, context): no_data_color = self.no_data_color[:] exception_color = self.exception_color[:] +def reset_timing_graphs(): + global graphs + graphs = [] + # cache node group update trees update_cache = {} # cache for partial update lists diff --git a/utils/modules/shader_utils.py b/utils/modules/shader_utils.py index ea45a91bd6c9f974fa968f34f8739f369c81fdf0..d26e5832dc9b3c297bb055b59bb8dd80d487b518 100644 --- a/utils/modules/shader_utils.py +++ b/utils/modules/shader_utils.py @@ -10,6 +10,7 @@ class ShaderLib2D(): """ docstring ? """ + self.can_use_cache = False self.vectors = [] self.vertex_colors = [] self.indices = [] @@ -17,6 +18,10 @@ class ShaderLib2D(): self.addc = self.vertex_colors.extend self.addi = self.indices.extend + def use_cached_canvas(self, geom): + self.add_data(geom.vectors, geom.vertex_colors, geom.indices) + self.can_use_cache = True + def add_data(self, new_vectors=None, new_colors=None, new_indices=None): """ input @@ -39,6 +44,8 @@ class ShaderLib2D(): | / | a - d """ + if self.can_use_cache: return + a = (x, y) b = (x, y - h) c = (x + w, y - h)