summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-13 15:24:46 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-13 15:24:46 +0200
commit58822717ff659ece3f290122354db20c103d2c59 (patch)
treeee65eca404650c9685aff880956fcc4408fdf47e
parent2ffb6096584fc8a91e7b00da98f18c78ad040505 (diff)
parentfd84f68217f1b47c303ab3d67c6a2db7c3e9898f (diff)
Merge pull request #67344 from KoBeWi/hollow_property
Add empty state to enum properties
-rw-r--r--editor/editor_properties.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 155802d16c..332e47dc52 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -760,8 +760,13 @@ void EditorPropertyEnum::_option_selected(int p_which) {
}
void EditorPropertyEnum::update_property() {
- int64_t which = get_edited_object()->get(get_edited_property());
+ Variant current = get_edited_object()->get(get_edited_property());
+ if (current.get_type() == Variant::NIL) {
+ options->select(-1);
+ return;
+ }
+ int64_t which = current;
for (int i = 0; i < options->get_item_count(); i++) {
if (which == (int64_t)options->get_item_metadata(i)) {
options->select(i);