You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-27 15:57:02 +00:00
Add empty state to enum properties
This commit is contained in:
@@ -760,8 +760,13 @@ void EditorPropertyEnum::_option_selected(int p_which) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyEnum::update_property() {
|
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++) {
|
for (int i = 0; i < options->get_item_count(); i++) {
|
||||||
if (which == (int64_t)options->get_item_metadata(i)) {
|
if (which == (int64_t)options->get_item_metadata(i)) {
|
||||||
options->select(i);
|
options->select(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user