summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-20 21:15:14 +0200
committerGitHub <noreply@github.com>2022-07-20 21:15:14 +0200
commite1c50152a034e9a6605d113ff6956206caad3a26 (patch)
tree22f1a307a14443ce834393555d2b1d2174872f43 /editor
parent9a941ea35e5ba93e792b844d5616e2e602b69d3d (diff)
parentf3d43a384d2d162afe0cc2149fe61b5a12171a7f (diff)
Merge pull request #63232 from nathanfranke/simplify-editor-anchors
Simplify alignment preset, fixing icon for full rect
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/control_editor_plugin.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp
index 4d77f71be9..ec038174fc 100644
--- a/editor/plugins/control_editor_plugin.cpp
+++ b/editor/plugins/control_editor_plugin.cpp
@@ -173,7 +173,7 @@ void EditorPropertyAnchorsPreset::setup(const Vector<String> &p_options) {
Vector<String> split_after;
split_after.append("Custom");
- split_after.append("PresetWide");
+ split_after.append("PresetFullRect");
split_after.append("PresetBottomLeft");
split_after.append("PresetCenter");
@@ -181,24 +181,18 @@ void EditorPropertyAnchorsPreset::setup(const Vector<String> &p_options) {
Vector<String> text_split = p_options[i].split(":");
int64_t current_val = text_split[1].to_int();
- String humanized_name = text_split[0];
- if (humanized_name.begins_with("Preset")) {
- if (humanized_name == "PresetWide") {
- humanized_name = "Full Rect";
- } else {
- humanized_name = humanized_name.trim_prefix("Preset");
- humanized_name = humanized_name.capitalize();
- }
-
- String icon_name = text_split[0].trim_prefix("Preset");
- icon_name = "ControlAlign" + icon_name;
+ String option_name = text_split[0];
+ if (option_name.begins_with("Preset")) {
+ String preset_name = option_name.trim_prefix("Preset");
+ String humanized_name = preset_name.capitalize();
+ String icon_name = "ControlAlign" + preset_name;
options->add_icon_item(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(icon_name, "EditorIcons"), humanized_name);
} else {
- options->add_item(humanized_name);
+ options->add_item(option_name);
}
options->set_item_metadata(j, current_val);
- if (split_after.has(text_split[0])) {
+ if (split_after.has(option_name)) {
options->add_separator();
j++;
}