updtaed preview refresh code to avoir queueing many refreshes when tweaking parameters

This commit is contained in:
RodZill4 2019-11-05 22:28:01 +01:00
parent df07cfab06
commit e341e25e7f
2 changed files with 19 additions and 3 deletions

View File

@ -289,7 +289,8 @@ func paste(pos = Vector2(0, 0)) -> void:
func send_changed_signal() -> void:
set_need_save(true)
timer.start(0.1)
timer.stop()
timer.start(0.2)
func do_send_changed_signal() -> void:
emit_signal("graph_changed")

View File

@ -6,6 +6,9 @@ var recent_files = []
var editor_interface = null
var current_tab = null
var updating : bool = false
var need_update : bool = false
onready var renderer = $Renderer
onready var projects = $VBoxContainer/HBoxContainer/ProjectsPane/Projects
onready var library = $VBoxContainer/HBoxContainer/VBoxContainer/Library
@ -405,8 +408,20 @@ func _on_PopupMenu_id_pressed(id) -> void:
# Preview
func update_preview() -> void:
update_preview_2d()
update_preview_3d()
var status
need_update = true
if updating:
return
updating = true
while need_update:
need_update = false
status = update_preview_2d()
while status is GDScriptFunctionState:
status = yield(status, "completed")
status = update_preview_3d()
while status is GDScriptFunctionState:
status = yield(status, "completed")
updating = false
func update_preview_2d(node = null) -> void:
var graph_edit : MMGraphEdit = get_current_graph_edit()