summaryrefslogtreecommitdiff
path: root/core/object
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-06-19 00:42:02 +0200
committerreduz <reduzio@gmail.com>2022-06-25 15:50:15 +0200
commitb7c41f9ba1afe892af465b56cd942b83e1a19b13 (patch)
tree4704fff413b5593bed54ccc483088e7cb7a357a0 /core/object
parentc32285733d4f235249c1031ee64d19b751e4d7df (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 'core/object')
-rw-r--r--core/object/object.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/object/object.h b/core/object/object.h
index 02dd875acf..7631cc6c4c 100644
--- a/core/object/object.h
+++ b/core/object/object.h
@@ -91,6 +91,7 @@ enum PropertyHint {
PROPERTY_HINT_INT_IS_POINTER,
PROPERTY_HINT_LOCALE_ID,
PROPERTY_HINT_LOCALIZABLE_STRING,
+ PROPERTY_HINT_NODE_TYPE, ///< a node object type
PROPERTY_HINT_MAX,
// When updating PropertyHint, also sync the hardcoded list in VisualScriptEditorVariableEdit
};