Small improvements to MMMaterial. Also call the new threadpool method.

This commit is contained in:
Relintai 2022-01-21 19:01:50 +01:00
parent 2ada5fa3b1
commit 52a367239c

View File

@ -52,6 +52,10 @@ func remove_node(node : MMNode) -> void:
func render() -> void: func render() -> void:
initialize() initialize()
if rendering:
queued_render = true
return
if USE_THREADS: if USE_THREADS:
render_threaded() render_threaded()
else: else:
@ -70,13 +74,6 @@ func render_non_threaded() -> void:
func render_threaded() -> void: func render_threaded() -> void:
job.cancelled = false job.cancelled = false
if rendering:
queued_render = true
return
if !initialized:
initialize()
if !ThreadPool.has_job(job): if !ThreadPool.has_job(job):
ThreadPool.add_job(job) ThreadPool.add_job(job)
@ -109,11 +106,12 @@ func _thread_func() -> void:
func cancel_render_and_wait() -> void: func cancel_render_and_wait() -> void:
if rendering: if rendering:
ThreadPool.cancel_task_wait(job) ThreadPool.cancel_job_wait(job)
job.cancelled = false job.cancelled = false
pass pass
func on_node_changed() -> void: func on_node_changed() -> void:
emit_changed()
call_deferred("render") call_deferred("render")