diff options
author | reduz <reduzio@gmail.com> | 2022-06-19 00:42:02 +0200 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2022-06-25 15:50:15 +0200 |
commit | b7c41f9ba1afe892af465b56cd942b83e1a19b13 (patch) | |
tree | 4704fff413b5593bed54ccc483088e7cb7a357a0 /doc | |
parent | c32285733d4f235249c1031ee64d19b751e4d7df (diff) |
Add ability to export Node pointers as NodePaths
This PR implements:
* A new hint: PROPERTY_HINT_NODE_TYPE for variant type OBJECT, which can take specific node types as hint string.
* The editor will show it as a node path, but will set it as a pointer to a node from the current scene if you select a path.
* When scene is saved, the node path is saved, then restored as a pointer.
NOTE: This is a proof of concept and this approach will most likely not work. The reason if that, if the node referenced is deleted, then when trying to edit this the node will become invalid.
Potential workarounds: Since this uses the Variant API, it should obtain the pointer from the Variant object ID. Yet, this would either only really work in GDScript or it would need to be implemented with workarounds in every language.
Alternative ways to make this work: Nodes could export an additional property with a node path (like for which_node, it could be which_node_path).
Another alternative: Path editing could happen as a hidden metadata (ignoring the pointer).
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/@GlobalScope.xml | 4 | ||||
-rw-r--r-- | doc/classes/EditorProperty.xml | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 4048b483e8..14483abbcb 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2583,7 +2583,9 @@ <constant name="PROPERTY_HINT_LOCALIZABLE_STRING" value="44" enum="PropertyHint"> Hints that a dictionary property is string translation map. Dictionary keys are locale codes and, values are translated strings. </constant> - <constant name="PROPERTY_HINT_MAX" value="45" enum="PropertyHint"> + <constant name="PROPERTY_HINT_NODE_TYPE" value="45" enum="PropertyHint"> + </constant> + <constant name="PROPERTY_HINT_MAX" value="46" enum="PropertyHint"> </constant> <constant name="PROPERTY_USAGE_NONE" value="0" enum="PropertyUsageFlags"> </constant> diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml index c428233372..84f8523da3 100644 --- a/doc/classes/EditorProperty.xml +++ b/doc/classes/EditorProperty.xml @@ -38,7 +38,7 @@ Gets the edited object. </description> </method> - <method name="get_edited_property"> + <method name="get_edited_property" qualifiers="const"> <return type="StringName" /> <description> Gets the edited property. If your editor is for a single property (added via [method EditorInspectorPlugin._parse_property]), then this will return the property. |