1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Add get_edited_property_value() shorthand method

This commit is contained in:
kobewi
2023-05-26 09:13:24 +02:00
parent 2eec9a67d5
commit 010ce46ffa
8 changed files with 65 additions and 64 deletions

View File

@@ -250,7 +250,7 @@ void EditorPropertyArray::_object_id_selected(const StringName &p_property, Obje
}
void EditorPropertyArray::update_property() {
Variant array = get_edited_object()->get(get_edited_property());
Variant array = get_edited_property_value();
String array_type_name = Variant::get_type_name(array_type);
if (array_type == Variant::ARRAY && subtype != Variant::NIL) {
@@ -568,7 +568,7 @@ void EditorPropertyArray::_notification(int p_what) {
}
void EditorPropertyArray::_edit_pressed() {
Variant array = get_edited_object()->get(get_edited_property());
Variant array = get_edited_property_value();
if (!array.is_array() && edit->is_pressed()) {
initialize_array(array);
get_edited_object()->set(get_edited_property(), array);
@@ -808,7 +808,7 @@ void EditorPropertyDictionary::setup(PropertyHint p_hint) {
}
void EditorPropertyDictionary::update_property() {
Variant updated_val = get_edited_object()->get(get_edited_property());
Variant updated_val = get_edited_property_value();
if (updated_val.get_type() == Variant::NIL) {
edit->set_text(TTR("Dictionary (Nil)")); // This provides symmetry with the array property.
@@ -1217,7 +1217,7 @@ void EditorPropertyDictionary::_notification(int p_what) {
}
void EditorPropertyDictionary::_edit_pressed() {
Variant prop_val = get_edited_object()->get(get_edited_property());
Variant prop_val = get_edited_property_value();
if (prop_val.get_type() == Variant::NIL && edit->is_pressed()) {
VariantInternal::initialize(&prop_val, Variant::DICTIONARY);
get_edited_object()->set(get_edited_property(), prop_val);
@@ -1299,7 +1299,7 @@ void EditorPropertyLocalizableString::_remove_item(Object *p_button, int p_index
}
void EditorPropertyLocalizableString::update_property() {
Variant updated_val = get_edited_object()->get(get_edited_property());
Variant updated_val = get_edited_property_value();
if (updated_val.get_type() == Variant::NIL) {
edit->set_text(TTR("Localizable String (Nil)")); // This provides symmetry with the array property.
@@ -1431,7 +1431,7 @@ void EditorPropertyLocalizableString::_notification(int p_what) {
}
void EditorPropertyLocalizableString::_edit_pressed() {
Variant prop_val = get_edited_object()->get(get_edited_property());
Variant prop_val = get_edited_property_value();
if (prop_val.get_type() == Variant::NIL && edit->is_pressed()) {
VariantInternal::initialize(&prop_val, Variant::DICTIONARY);
get_edited_object()->set(get_edited_property(), prop_val);