From 52a367239cf17b19470e8243e67b076cbdbbce79 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 21 Jan 2022 19:01:50 +0100 Subject: [PATCH] Small improvements to MMMaterial. Also call the new threadpool method. --- game/addons/mat_maker_gd/nodes/mm_material.gd | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/game/addons/mat_maker_gd/nodes/mm_material.gd b/game/addons/mat_maker_gd/nodes/mm_material.gd index 71801428..dd6a5d49 100644 --- a/game/addons/mat_maker_gd/nodes/mm_material.gd +++ b/game/addons/mat_maker_gd/nodes/mm_material.gd @@ -52,6 +52,10 @@ func remove_node(node : MMNode) -> void: func render() -> void: initialize() + if rendering: + queued_render = true + return + if USE_THREADS: render_threaded() else: @@ -70,13 +74,6 @@ func render_non_threaded() -> void: func render_threaded() -> void: job.cancelled = false - if rendering: - queued_render = true - return - - if !initialized: - initialize() - if !ThreadPool.has_job(job): ThreadPool.add_job(job) @@ -109,11 +106,12 @@ func _thread_func() -> void: func cancel_render_and_wait() -> void: if rendering: - ThreadPool.cancel_task_wait(job) + ThreadPool.cancel_job_wait(job) job.cancelled = false pass func on_node_changed() -> void: + emit_changed() call_deferred("render")