How to show real progress in editor

Godot Version



Hi, I’m working on an editor plugin.
my problem is I have a few processes in my plugin that take some time and I want to show progress, the problem is the editor freezes and then the process is done, so how to show progress exactly?

In the loop (that is so busy) try using a custom signal, like:

feedback.emit("Busy %s" % percentage)

Then have your plugin connect to ‘feedback’ and display a text box or something.

I’m using static func so is not possible

I changed my functions but the editor still just freezes

I am also making an Editor Plugin and face this issue. The code I have (and was helped with too) is partially:

# Thanks to
# Honestly, this func bends my brain! Thanks Exoticorn.
func feedback(msg:StringName, style=&"NORMAL"):
	var msg_speed := 1
	var _time
	if _messages.size() == 1:
		while not _messages.is_empty():
			var num:=_messages.size()
			_time = msg_speed/num
			var _tup = _messages[0]
			var _msg = _tup[0]
			%feedback/msg.text = _msg
			var styl = _tup[1]
			if styl == &"WARNING":
				%feedback/icon.texture = get_theme_icon(
					&"StatusWarning", &"EditorIcons")
			elif styl == &"ERROR":
				%feedback/icon.texture = get_theme_icon(
					&"StatusError", &"EditorIcons")
				%feedback/icon.texture = get_theme_icon(
					&"NodeInfo", &"EditorIcons")
				print("Feedback: ", _msg)
			await get_tree().create_timer(_time).timeout

This is in a script that is on a UI node (for my plugin). %feedback is a MarginContainer, iirc.

It is called either directly:"Possible infinite loop in Array.", &"WARNING")
or by a signal:
feedback.emit("%s is not supported." % working_resource, &"NORMAL")
(Where feedback is defined as a signal and is connected to the feedback func)

It’s a bit of a mess, but HTH.

The code is online at: Donn Ingle —Dbat / Godot Resource Wrangler · GitLab