From 2a2918ddb7261b9c2e39a13ae4ae9e45a274ee61 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 31 Oct 2021 11:37:16 +0100 Subject: [PATCH] Now the render can be cancelled. --- game/addons/mat_maker_gd/nodes/mm_material.gd | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/game/addons/mat_maker_gd/nodes/mm_material.gd b/game/addons/mat_maker_gd/nodes/mm_material.gd index 76452581..ac79dea5 100644 --- a/game/addons/mat_maker_gd/nodes/mm_material.gd +++ b/game/addons/mat_maker_gd/nodes/mm_material.gd @@ -13,6 +13,7 @@ export(Array) var nodes : Array var initialized : bool = false var rendering : bool = false var queued_render : bool = false +var render_cancelled : bool = false func initialize(): if !initialized: @@ -78,7 +79,12 @@ func render_threaded() -> void: ThreadPool.add_job(j) func _thread_func() -> void: + if render_cancelled: + rendering = false + return + rendering = true + render_cancelled = false var did_render : bool = true @@ -89,6 +95,10 @@ func _thread_func() -> void: if n && n.render(self): did_render = true + if render_cancelled: + rendering = false + return + rendering = false if queued_render: