summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-07-19 18:18:20 +0200
committerGitHub <noreply@github.com>2018-07-19 18:18:20 +0200
commit76bfe14e00ee5c8b65275d8b8e0c4cdc25b4b899 (patch)
tree980c196a53a7d1583993ff40679b57d405f143cb
parentaea6f4853e63d74a38456bd3c7f6bc31ce4351e6 (diff)
parentafb4dfab22ffd1b87faa9dd596efa832f2475abb (diff)
Merge pull request #20117 from ordigdug/inspector-fix-inconsistencies-with-exported-enums
Fix -new inspector- Inconsistencies with exported enums - Fixes remai…
-rw-r--r--editor/editor_properties.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index f6d67e1b44..0b49b5a801 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -392,13 +392,37 @@ EditorPropertyCheck::EditorPropertyCheck() {
void EditorPropertyEnum::_option_selected(int p_which) {
- emit_signal("property_changed", get_edited_property(), p_which);
+ String text = options->get_item_text(p_which);
+ Vector<String> text_split = text.split(":");
+ if (text_split.size() == 1) {
+ emit_signal("property_changed", get_edited_property(), p_which);
+ return;
+ }
+ String name = text_split[1];
+ emit_signal("property_changed", get_edited_property(), name.to_int());
}
void EditorPropertyEnum::update_property() {
int which = get_edited_object()->get(get_edited_property());
- options->select(which);
+ if (which == 0) {
+ options->select(which);
+ return;
+ }
+
+ for (int i = 0; i < options->get_item_count(); i++) {
+ String text = options->get_item_text(i);
+ Vector<String> text_split = text.split(":");
+ if (text_split.size() == 1) {
+ options->select(which);
+ return;
+ }
+ String name = text_split[1];
+ if (itos(which) == name) {
+ options->select(i);
+ return;
+ }
+ }
}
void EditorPropertyEnum::setup(const Vector<String> &p_options) {