summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-03-16 10:47:32 +0100
committerGitHub <noreply@github.com>2020-03-16 10:47:32 +0100
commit47eb28a919ee2ba88f0bd904b25e8b73459693a8 (patch)
tree704083bc05ad274c84c663d74f2f2717915c1d1d /editor
parent2a49798c7b92b332c2198f52b9c5ae10bd944bd0 (diff)
parent09b055bd3484f89289e93671388bfbf4a2484cb3 (diff)
Merge pull request #36184 from volzhs/plugins-checkbox
Use checkbox for plugin status instead of option list
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_plugin_settings.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index 76dbadf67e..33877f86c2 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -137,19 +137,12 @@ void EditorPluginSettings::update_plugins() {
item->set_metadata(1, script);
item->set_text(2, author);
item->set_metadata(2, description);
- item->set_cell_mode(3, TreeItem::CELL_MODE_RANGE);
- item->set_range_config(3, 0, 1, 1);
- item->set_text(3, "Inactive,Active");
+ item->set_cell_mode(3, TreeItem::CELL_MODE_CHECK);
+ item->set_text(3, TTR("Enable"));
+ bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(d2);
+ item->set_checked(3, is_active);
item->set_editable(3, true);
item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin"));
-
- if (EditorNode::get_singleton()->is_addon_plugin_enabled(d2)) {
- item->set_custom_color(3, get_color("success_color", "Editor"));
- item->set_range(3, 1);
- } else {
- item->set_custom_color(3, get_color("disabled_font_color", "Editor"));
- item->set_range(3, 0);
- }
}
}
}
@@ -164,7 +157,7 @@ void EditorPluginSettings::_plugin_activity_changed() {
TreeItem *ti = plugin_list->get_edited();
ERR_FAIL_COND(!ti);
- bool active = ti->get_range(3);
+ bool active = ti->is_checked(3);
String name = ti->get_metadata(0);
EditorNode::get_singleton()->set_addon_plugin_enabled(name, active, true);
@@ -173,14 +166,9 @@ void EditorPluginSettings::_plugin_activity_changed() {
if (is_active != active) {
updating = true;
- ti->set_range(3, is_active ? 1 : 0);
+ ti->set_checked(3, is_active);
updating = false;
}
-
- if (is_active)
- ti->set_custom_color(3, get_color("success_color", "Editor"));
- else
- ti->set_custom_color(3, get_color("disabled_font_color", "Editor"));
}
void EditorPluginSettings::_create_clicked() {