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")