In Godot, how can I listen for changes in the properties of nodes within the editor? Additionally, how can this be used in a plugin?

Godot Version

4.1

Question

for example, when moving or manipulating nodes, there are output messages indicating property operations. I want to listen to such changes for editing games.

First, you need to create a plugin. Then you need to write @tool above your script that controls your node.Then you can override the setter like this:

@tool
extends BaseClass

@export var my_var: Type:
    set(value):
        my_var = value
        print(value)
1 Like

You can listen to the property_changed signal from a @tool script and do as you please with the info it provides.
link: EditorProperty — Godot Engine (latest) documentation in English

Thank you for your response. However, EditorProperty seems to be a signal for custom controls. How can I get the signal for property changes on default controls?

It is the same (base) class the actual editor uses. You can see this by checking the signals of the object in the panel like so:

@tool
extends Node

func _notification(what):
	if what == NOTIFICATION_APPLICATION_FOCUS_IN:
		for c in EditorInterface.get_inspector().get_child(0).get_children():
			if c is Container:
				for c2 in c.get_children():
					if c2 is Container:
						for c3 in c2.get_children():
							for s in c3.get_signal_list():
								print(s.name)

property_changed will be there a few times

I’m sorry, I still can’t find a suitable solution. Could you demonstrate with code how to listen for changes in the position of an image node in the Godot editor within a plugin? Thank you very much.

Oh, for that just use the property_list_changed on the Object.
You can get what is selected from EditorInterface.get_selection().
I just assumed you were already doing this, sorry.