The reimport is successful but I’m getting these errors when I run it. Any ideas on how I can prevent them?
ERROR: editor/gui/progress_dialog.cpp:191 - Do not use progress dialog (task) while flushing the message queue or using call_deferred()!
ERROR: editor/gui/progress_dialog.cpp:225 - Condition "!tasks.has(p_task)" is true. Returning: canceled
ERROR: editor/gui/progress_dialog.cpp:225 - Condition "!tasks.has(p_task)" is true. Returning: canceled
ERROR: editor/gui/progress_dialog.cpp:191 - Do not use progress dialog (task) while flushing the message queue or using call_deferred()!
I can’t use call_deferred on the EditorScript because it never executes.
If you use the editor tree then I can’t access my function:
func _run():
var tree = Engine.get_main_loop() as SceneTree
tree.call_deferred("reimport")
func reimport():
print("reimport")
var file_system = EditorInterface.get_resource_filesystem()
file_system.reimport_files(["res://mimic_ldtk/mimic.ldtk"])
Oh i didn’t realize you can use call_deferred that way! Thanks
Still throws the error tho
func _run():
var file_system = EditorInterface.get_resource_filesystem()
file_system.reimport_files.call_deferred(["res://mimic_ldtk/mimic.ldtk"])
ERROR: editor/gui/progress_dialog.cpp:191 - Do not use progress dialog (task) while flushing the message queue or using call_deferred()!
ERROR: editor/gui/progress_dialog.cpp:225 - Condition "!tasks.has(p_task)" is true. Returning: canceled
ERROR: editor/gui/progress_dialog.cpp:225 - Condition "!tasks.has(p_task)" is true. Returning: canceled
I’m trying to speed up my workflow by using a command palette to import on demand. It’s annoying to always have to select the asset, go to the import tab and click “reimport”:
Isn’t the Resource re-importing after tabbing back to Godot? I tried using that plugin and its example ldtk file and the Resource is being re-imported every time I go back to Godot.
Either way, this should stop those errors:
func _run() -> void:
var root = EditorInterface.get_base_control()
root.get_tree().process_frame.connect(func():
var file_system = EditorInterface.get_resource_filesystem()
file_system.reimport_files(["res://mimic_ldtk/mimic.ldtk"])
, CONNECT_ONE_SHOT)