clean: push timer

feat: purge stagging on pre--redo/undo
This commit is contained in:
Swann 2021-01-12 11:33:48 +01:00
parent e3bd7ea445
commit abd846fc8d
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
4 changed files with 19 additions and 8 deletions

View File

@ -54,7 +54,7 @@ from .timers import registry
background_execution_queue = Queue()
stagging = list()
locking = False
deleyables = []
stop_modal_executor = False
@ -269,7 +269,10 @@ class SessionStartOperator(bpy.types.Operator):
# Background client updates service
deleyables.append(timers.ClientUpdate())
deleyables.append(timers.DynamicRightSelectTimer())
deleyables.append(timers.PushTimer(queue=stagging))
deleyables.append(timers.PushTimer(
queue=stagging,
timeout=settings.depsgraph_update_rate
))
session_update = timers.SessionStatusUpdate()
session_user_sync = timers.SessionUserSync()
session_background_executor = timers.MainThreadExecutor(
@ -982,6 +985,8 @@ def depsgraph_evaluation(scene):
# # New items !
# logger.error("UPDATE: ADD")
def clear_staging(dummy):
stagging.clear()
def register():
from bpy.utils import register_class
@ -989,6 +994,9 @@ def register():
for cls in classes:
register_class(cls)
bpy.app.handlers.undo_pre.append(clear_staging)
bpy.app.handlers.redo_pre.append(clear_staging)
bpy.app.handlers.undo_post.append(sanitize_deps_graph)
bpy.app.handlers.redo_post.append(sanitize_deps_graph)
@ -1004,6 +1012,9 @@ def unregister():
for cls in reversed(classes):
unregister_class(cls)
bpy.app.handlers.undo_pre.remove(clear_staging)
bpy.app.handlers.redo_pre.remove(clear_staging)
bpy.app.handlers.undo_post.remove(sanitize_deps_graph)
bpy.app.handlers.redo_post.remove(sanitize_deps_graph)

View File

@ -200,10 +200,10 @@ class SessionPrefs(bpy.types.AddonPreferences):
default=1000
)
# Replication update settings
depsgraph_update_rate: bpy.props.IntProperty(
name='depsgraph update rate',
description='Dependency graph uppdate rate (milliseconds)',
default=1000
depsgraph_update_rate: bpy.props.FloatProperty(
name='depsgraph update rate (s)',
description='Dependency graph uppdate rate (s)',
default=1
)
clear_memory_filecache: bpy.props.BoolProperty(
name="Clear memory filecache",

View File

@ -139,7 +139,6 @@ class PushTimer(Timer):
def execute(self):
while self.q_push:
node = session.get(uuid= self.q_push.pop())
start = utils.current_milli_time()
if node.has_changed():
try:
@ -154,7 +153,7 @@ class PushTimer(Timer):
except Exception as e:
logging.error(e)
else:
logging.info("Skipping updatem no changes")
logging.debug("Skipping update no changes")
class DynamicRightSelectTimer(Timer):
def __init__(self, timeout=.1):

View File

@ -281,6 +281,7 @@ class SESSION_PT_advanced_settings(bpy.types.Panel):
warning = replication_section_row.box()
warning.label(text="Don't use this with heavy meshes !", icon='ERROR')
replication_section_row = replication_section.row()
replication_section_row.prop(settings, "depsgraph_update_rate")
cache_section = layout.row().box()