1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-26 15:46:23 +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

@@ -164,7 +164,7 @@ void EditorPropertyAnchorsPreset::_option_selected(int p_which) {
}
void EditorPropertyAnchorsPreset::update_property() {
int64_t which = get_edited_object()->get(get_edited_property());
int64_t which = get_edited_property_value();
for (int i = 0; i < options->get_item_count(); i++) {
Variant val = options->get_item_metadata(i);
@@ -255,7 +255,7 @@ void EditorPropertySizeFlags::_preset_selected(int p_which) {
}
void EditorPropertySizeFlags::_expand_toggled() {
uint32_t value = get_edited_object()->get(get_edited_property());
uint32_t value = get_edited_property_value();
if (flag_expand->is_visible() && flag_expand->is_pressed()) {
value |= Control::SIZE_EXPAND;
@@ -288,7 +288,7 @@ void EditorPropertySizeFlags::_flag_toggled() {
}
void EditorPropertySizeFlags::update_property() {
uint32_t value = get_edited_object()->get(get_edited_property());
uint32_t value = get_edited_property_value();
for (int i = 0; i < flag_checks.size(); i++) {
int flag_value = flag_checks[i]->get_meta("_value");

View File

@@ -227,7 +227,7 @@ void EditorPropertyFontMetaOverride::_object_id_selected(const StringName &p_pro
}
void EditorPropertyFontMetaOverride::update_property() {
Variant updated_val = get_edited_object()->get(get_edited_property());
Variant updated_val = get_edited_property_value();
Dictionary dict = updated_val;
@@ -330,7 +330,7 @@ void EditorPropertyFontMetaOverride::update_property() {
}
void EditorPropertyFontMetaOverride::_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) {
Callable::CallError ce;
Variant::construct(Variant::DICTIONARY, prop_val, nullptr, 0, ce);
@@ -415,7 +415,7 @@ void EditorPropertyOTVariation::_object_id_selected(const StringName &p_property
}
void EditorPropertyOTVariation::update_property() {
Variant updated_val = get_edited_object()->get(get_edited_property());
Variant updated_val = get_edited_property_value();
Dictionary dict = updated_val;
@@ -511,7 +511,7 @@ void EditorPropertyOTVariation::update_property() {
}
void EditorPropertyOTVariation::_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) {
Callable::CallError ce;
Variant::construct(Variant::DICTIONARY, prop_val, nullptr, 0, ce);
@@ -607,7 +607,7 @@ void EditorPropertyOTFeatures::_object_id_selected(const StringName &p_property,
}
void EditorPropertyOTFeatures::update_property() {
Variant updated_val = get_edited_object()->get(get_edited_property());
Variant updated_val = get_edited_property_value();
Dictionary dict = updated_val;
@@ -814,7 +814,7 @@ void EditorPropertyOTFeatures::update_property() {
}
void EditorPropertyOTFeatures::_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) {
Callable::CallError ce;
Variant::construct(Variant::DICTIONARY, prop_val, nullptr, 0, ce);

View File

@@ -169,7 +169,7 @@ void EditorPropertyRootMotion::_node_clear() {
}
void EditorPropertyRootMotion::update_property() {
NodePath p = get_edited_object()->get(get_edited_property());
NodePath p = get_edited_property_value();
assign->set_tooltip_text(p);
if (p == NodePath()) {
assign->set_icon(Ref<Texture2D>());

View File

@@ -2719,14 +2719,14 @@ void EditorPropertyTilePolygon::update_property() {
if (String(count_property).is_empty()) {
if (base_type == "OccluderPolygon2D") {
// Single OccluderPolygon2D.
Ref<OccluderPolygon2D> occluder = get_edited_object()->get(get_edited_property());
Ref<OccluderPolygon2D> occluder = get_edited_property_value();
generic_tile_polygon_editor->clear_polygons();
if (occluder.is_valid()) {
generic_tile_polygon_editor->add_polygon(occluder->get_polygon());
}
} else if (base_type == "NavigationPolygon") {
// Single OccluderPolygon2D.
Ref<NavigationPolygon> navigation_polygon = get_edited_object()->get(get_edited_property());
Ref<NavigationPolygon> navigation_polygon = get_edited_property_value();
generic_tile_polygon_editor->clear_polygons();
if (navigation_polygon.is_valid()) {
for (int i = 0; i < navigation_polygon->get_outline_count(); i++) {

View File

@@ -6620,7 +6620,7 @@ void EditorPropertyVisualShaderMode::_option_selected(int p_which) {
}
void EditorPropertyVisualShaderMode::update_property() {
int which = get_edited_object()->get(get_edited_property());
int which = get_edited_property_value();
options->select(which);
}