diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-07-02 00:17:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-02 00:17:21 +0200 |
commit | a2459c7d35eeaeea8b1d4fa9ce6c9cbe74f11643 (patch) | |
tree | c52f05eddaf57d2b54e4df061ecf354a8b3ea133 /core | |
parent | d67691fbd6c1335caf523a2601450733bb4f101f (diff) | |
parent | dc43cfc830e7e602ad5aa1f59ceaa82e344dd378 (diff) |
Merge pull request #61610 from TokageItLab/importer-retarget-registered-gdhumanoid
Diffstat (limited to 'core')
-rw-r--r-- | core/string/node_path.cpp | 15 | ||||
-rw-r--r-- | core/string/node_path.h | 2 | ||||
-rw-r--r-- | core/variant/variant_call.cpp | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/core/string/node_path.cpp b/core/string/node_path.cpp index 238897c2b1..30fa434fad 100644 --- a/core/string/node_path.cpp +++ b/core/string/node_path.cpp @@ -199,6 +199,21 @@ Vector<StringName> NodePath::get_subnames() const { return Vector<StringName>(); } +StringName NodePath::get_concatenated_names() const { + ERR_FAIL_COND_V(!data, StringName()); + + if (!data->concatenated_path) { + int pc = data->path.size(); + String concatenated; + const StringName *sn = data->path.ptr(); + for (int i = 0; i < pc; i++) { + concatenated += i == 0 ? sn[i].operator String() : "/" + sn[i]; + } + data->concatenated_path = concatenated; + } + return data->concatenated_path; +} + StringName NodePath::get_concatenated_subnames() const { ERR_FAIL_COND_V(!data, StringName()); diff --git a/core/string/node_path.h b/core/string/node_path.h index 53976bd524..2bce33e21e 100644 --- a/core/string/node_path.h +++ b/core/string/node_path.h @@ -39,6 +39,7 @@ class NodePath { SafeRefCount refcount; Vector<StringName> path; Vector<StringName> subpath; + StringName concatenated_path; StringName concatenated_subpath; bool absolute; bool has_slashes; @@ -59,6 +60,7 @@ public: StringName get_subname(int p_idx) const; Vector<StringName> get_names() const; Vector<StringName> get_subnames() const; + StringName get_concatenated_names() const; StringName get_concatenated_subnames() const; NodePath rel_path_to(const NodePath &p_np) const; diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index c14de74af7..8e16a767cf 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -1806,6 +1806,7 @@ static void _register_variant_builtin_methods() { bind_method(NodePath, get_subname_count, sarray(), varray()); bind_method(NodePath, hash, sarray(), varray()); bind_method(NodePath, get_subname, sarray("idx"), varray()); + bind_method(NodePath, get_concatenated_names, sarray(), varray()); bind_method(NodePath, get_concatenated_subnames, sarray(), varray()); bind_method(NodePath, get_as_property_path, sarray(), varray()); bind_method(NodePath, is_empty, sarray(), varray()); |