Editor tell other nodes what data is going to be passed throug some structs
that are
are converted to dictionaries.
These structs usually have this format:
{type, value, origin}
For now, I have identified 4 types:
{
"type": "files",
"files": ["res://path/to/your/resource.tres"],
"from": @@6431:<Tree#559234967434>
}
type
is "files"
.
String hint can be used as reference to know that user is dragging files related to any resource and is dragging them from EditorFileSystem
tree (which reference is passed in from
).
The file path is absolute to project folder res://
, and all files are passed to "files"
array.
Note: Some plugins in the future may add extra "virtual" directories like user://
, but at the version of writing this guide (Godot 4) this is not common.
{
"type": "nodes",
"nodes": [^"/root/@@very/@@long/@@editor/@@node/@@paths/YourNode"]
}
type
is "nodes"
.
String hint can be used as reference to know that user is dragging one (or many) Node
from SceneTree
.
Each node path is passed in "nodes"
array. Objects are not passed on this struct, but since these are supposed to be always a full path, using get_node()
should not raise any error.
Never free these nodes. Other objects may rely on these references and can lead memory leaks and the whole editor crash.
{
"type": "obj_property",
"object": <ObjectClassName#ObjectID>,
"property": &"property_name",
"value": <Variant>
}
type
is `"obj_property".
String hint can be used as reference to know that user is dragging an Object property from EditorInspector
.
Object reference is passed in "object"
key. It's current value (at the moment of drag) and the dragged property are passed in value
and property
respectively.
{
"type": "resource",
"resource": <ResourceClassName#ObjectID>,
"from": @@---:<Node#ObjectID>
}