summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-05-03 21:19:15 +0200
committerGitHub <noreply@github.com>2018-05-03 21:19:15 +0200
commit460e551ddf38626d3db01dd6bac3caa5b328cf9f (patch)
tree353251cd996b618db2e3b0cadb79dab2217e610b /editor
parent8be015c9e34d138ae22394f36971456f34090448 (diff)
parentd855fdb45130a5029c07131c42e42cfe6c9fdf6e (diff)
Merge pull request #16418 from bojidar-bg/15961-gdscript-array-export
Allow exporting arrays of resources in GDScript
Diffstat (limited to 'editor')
-rw-r--r--editor/property_editor.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index ac478c11e3..e0063925b1 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -3273,22 +3273,34 @@ void PropertyEditor::update_tree() {
while (hint.begins_with(itos(Variant::ARRAY) + ":")) {
type_name += "<Array";
type_name_suffix += ">";
- hint = hint.substr(2, hint.size() - 2);
+ hint = hint.right(2);
}
if (hint.find(":") >= 0) {
- hint = hint.substr(0, hint.find(":"));
+ int colon_pos = hint.find(":");
+ String hint_string = hint.right(colon_pos + 1);
+ hint = hint.left(colon_pos);
+
+ PropertyHint property_hint = PROPERTY_HINT_NONE;
+
if (hint.find("/") >= 0) {
- hint = hint.substr(0, hint.find("/"));
+ int slash_pos = hint.find("/");
+ property_hint = PropertyHint(hint.right(slash_pos + 1).to_int());
+ hint = hint.left(slash_pos);
+ }
+
+ if (property_hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ type_name += "<" + hint_string;
+ } else {
+ type_name += "<" + Variant::get_type_name(Variant::Type(hint.to_int()));
}
- type_name += "<" + Variant::get_type_name(Variant::Type(hint.to_int()));
type_name_suffix += ">";
}
type_name += type_name_suffix;
if (v.is_array())
- item->set_text(1, type_name + "[" + itos(v.call("size")) + "]");
+ item->set_text(1, type_name + "(" + itos(v.call("size")) + ")");
else
- item->set_text(1, type_name + "[]");
+ item->set_text(1, type_name + "()");
if (show_type_icons)
item->set_icon(0, get_icon("PoolByteArray", "EditorIcons"));