Allow for getting/setting indexed properties of objects using get/set_indexed

Performance is around the same as using pure set() through GDScript.
This commit is contained in:
Bojidar Marinov
2017-05-30 23:20:15 +03:00
parent 7bbde636e8
commit 0cf9597758
23 changed files with 416 additions and 246 deletions

View File

@ -41,10 +41,11 @@ class NodePath {
struct Data {
SafeRefCount refcount;
StringName property;
Vector<StringName> path;
Vector<StringName> subpath;
StringName concatenated_subpath;
bool absolute;
bool has_slashes;
};
Data *data;
@ -53,7 +54,7 @@ class NodePath {
public:
_FORCE_INLINE_ StringName get_sname() const {
if (data && data->path.size() == 1 && data->subpath.empty() && !data->property) {
if (data && data->path.size() == 1 && data->subpath.empty()) {
return data->path[0];
} else {
return operator String();
@ -67,13 +68,13 @@ public:
StringName get_subname(int p_idx) const;
Vector<StringName> get_names() const;
Vector<StringName> get_subnames() const;
StringName get_concatenated_subnames() const;
NodePath rel_path_to(const NodePath &p_np) const;
NodePath get_as_property_path() const;
void prepend_period();
StringName get_property() const;
NodePath get_parent() const;
uint32_t hash() const;
@ -88,8 +89,8 @@ public:
void simplify();
NodePath simplified() const;
NodePath(const Vector<StringName> &p_path, bool p_absolute, const String &p_property = "");
NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute, const String &p_property = "");
NodePath(const Vector<StringName> &p_path, bool p_absolute);
NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute);
NodePath(const NodePath &p_path);
NodePath(const String &p_path);
NodePath();