2018-07-19 23:34:22 +08:00
|
|
|
/*************************************************************************/
|
|
|
|
/* plugin_config_dialog.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2021-01-02 03:13:46 +08:00
|
|
|
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
2018-07-19 23:34:22 +08:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
#include "plugin_config_dialog.h"
|
2021-07-15 06:46:35 +08:00
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
#include "core/io/config_file.h"
|
2021-06-11 20:51:48 +08:00
|
|
|
#include "core/io/dir_access.h"
|
2018-07-19 23:34:22 +08:00
|
|
|
#include "editor/editor_node.h"
|
|
|
|
#include "editor/editor_plugin.h"
|
2019-12-24 15:17:23 +08:00
|
|
|
#include "editor/editor_scale.h"
|
|
|
|
#include "editor/project_settings_editor.h"
|
2018-07-19 23:34:22 +08:00
|
|
|
#include "scene/gui/grid_container.h"
|
|
|
|
|
2020-02-07 04:51:36 +08:00
|
|
|
#include "modules/modules_enabled.gen.h"
|
|
|
|
#ifdef MODULE_GDSCRIPT_ENABLED
|
|
|
|
#include "modules/gdscript/gdscript.h"
|
|
|
|
#endif
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
void PluginConfigDialog::_clear_fields() {
|
|
|
|
name_edit->set_text("");
|
|
|
|
subfolder_edit->set_text("");
|
|
|
|
desc_edit->set_text("");
|
|
|
|
author_edit->set_text("");
|
|
|
|
version_edit->set_text("");
|
|
|
|
script_edit->set_text("");
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginConfigDialog::_on_confirmed() {
|
|
|
|
String path = "res://addons/" + subfolder_edit->get_text();
|
|
|
|
|
|
|
|
if (!_edit_mode) {
|
|
|
|
DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
2020-05-14 22:41:43 +08:00
|
|
|
if (!d || d->make_dir_recursive(path) != OK) {
|
2018-07-19 23:34:22 +08:00
|
|
|
return;
|
2020-05-14 22:41:43 +08:00
|
|
|
}
|
2018-07-19 23:34:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile);
|
|
|
|
cf->set_value("plugin", "name", name_edit->get_text());
|
|
|
|
cf->set_value("plugin", "description", desc_edit->get_text());
|
|
|
|
cf->set_value("plugin", "author", author_edit->get_text());
|
|
|
|
cf->set_value("plugin", "version", version_edit->get_text());
|
|
|
|
cf->set_value("plugin", "script", script_edit->get_text());
|
|
|
|
|
|
|
|
cf->save(path.plus_file("plugin.cfg"));
|
|
|
|
|
|
|
|
if (!_edit_mode) {
|
2019-01-23 21:54:33 +08:00
|
|
|
int lang_idx = script_option_edit->get_selected();
|
|
|
|
String lang_name = ScriptServer::get_language(lang_idx)->get_name();
|
2018-07-19 23:34:22 +08:00
|
|
|
|
|
|
|
Ref<Script> script;
|
|
|
|
|
2019-01-23 21:54:33 +08:00
|
|
|
// TODO Use script templates. Right now, this code won't add the 'tool' annotation to other languages.
|
|
|
|
// TODO Better support script languages with named classes (has_named_classes).
|
|
|
|
|
2020-02-07 04:51:36 +08:00
|
|
|
// FIXME: It's hacky to have hardcoded access to the GDScript module here.
|
|
|
|
// The editor code should not have to know what languages are enabled.
|
|
|
|
#ifdef MODULE_GDSCRIPT_ENABLED
|
2019-01-23 21:54:33 +08:00
|
|
|
if (lang_name == GDScriptLanguage::get_singleton()->get_name()) {
|
|
|
|
// Hard-coded GDScript template to keep usability until we use script templates.
|
2020-01-21 13:05:56 +08:00
|
|
|
Ref<Script> gdscript = memnew(GDScript);
|
2018-07-19 23:34:22 +08:00
|
|
|
gdscript->set_source_code(
|
2021-03-13 09:50:55 +08:00
|
|
|
"@tool\n"
|
2018-07-19 23:34:22 +08:00
|
|
|
"extends EditorPlugin\n"
|
|
|
|
"\n"
|
2018-10-03 04:15:13 +08:00
|
|
|
"\n"
|
2020-01-21 13:05:56 +08:00
|
|
|
"func _enter_tree()%VOID_RETURN%:\n"
|
|
|
|
"%TS%pass\n"
|
|
|
|
"\n"
|
|
|
|
"\n"
|
|
|
|
"func _exit_tree()%VOID_RETURN%:\n"
|
|
|
|
"%TS%pass\n");
|
|
|
|
GDScriptLanguage::get_singleton()->make_template("", "", gdscript);
|
2018-07-19 23:34:22 +08:00
|
|
|
String script_path = path.plus_file(script_edit->get_text());
|
|
|
|
gdscript->set_path(script_path);
|
|
|
|
ResourceSaver::save(script_path, gdscript);
|
|
|
|
script = gdscript;
|
2019-01-23 21:54:33 +08:00
|
|
|
} else {
|
2020-02-07 04:51:36 +08:00
|
|
|
#endif
|
2019-01-23 21:54:33 +08:00
|
|
|
String script_path = path.plus_file(script_edit->get_text());
|
|
|
|
String class_name = script_path.get_file().get_basename();
|
|
|
|
script = ScriptServer::get_language(lang_idx)->get_template(class_name, "EditorPlugin");
|
|
|
|
script->set_path(script_path);
|
|
|
|
ResourceSaver::save(script_path, script);
|
2020-02-07 04:51:36 +08:00
|
|
|
#ifdef MODULE_GDSCRIPT_ENABLED
|
2018-07-19 23:34:22 +08:00
|
|
|
}
|
2020-02-07 04:51:36 +08:00
|
|
|
#endif
|
2018-07-19 23:34:22 +08:00
|
|
|
|
2021-03-05 02:22:47 +08:00
|
|
|
emit_signal("plugin_ready", script.operator->(), active_edit->is_pressed() ? _to_absolute_plugin_path(subfolder_edit->get_text()) : "");
|
2018-07-19 23:34:22 +08:00
|
|
|
} else {
|
|
|
|
EditorNode::get_singleton()->get_project_settings()->update_plugins();
|
|
|
|
}
|
|
|
|
_clear_fields();
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginConfigDialog::_on_cancelled() {
|
|
|
|
_clear_fields();
|
|
|
|
}
|
|
|
|
|
2019-01-23 21:54:33 +08:00
|
|
|
void PluginConfigDialog::_on_required_text_changed(const String &) {
|
|
|
|
int lang_idx = script_option_edit->get_selected();
|
|
|
|
String ext = ScriptServer::get_language(lang_idx)->get_extension();
|
2021-07-11 22:14:27 +08:00
|
|
|
|
|
|
|
Ref<Texture2D> valid_icon = get_theme_icon("StatusSuccess", "EditorIcons");
|
|
|
|
Ref<Texture2D> invalid_icon = get_theme_icon("StatusWarning", "EditorIcons");
|
|
|
|
|
|
|
|
// Set variables to assume all is valid
|
|
|
|
bool is_valid = true;
|
|
|
|
name_validation->set_texture(valid_icon);
|
|
|
|
subfolder_validation->set_texture(valid_icon);
|
|
|
|
script_validation->set_texture(valid_icon);
|
|
|
|
name_validation->set_tooltip("");
|
|
|
|
subfolder_validation->set_tooltip("");
|
|
|
|
script_validation->set_tooltip("");
|
|
|
|
|
|
|
|
// Change valid status to invalid depending on conditions.
|
|
|
|
Vector<String> errors;
|
|
|
|
if (name_edit->get_text().is_empty()) {
|
|
|
|
is_valid = false;
|
|
|
|
name_validation->set_texture(invalid_icon);
|
|
|
|
name_validation->set_tooltip(TTR("Plugin name cannot not be blank."));
|
|
|
|
}
|
|
|
|
if (script_edit->get_text().get_extension() != ext) {
|
|
|
|
is_valid = false;
|
|
|
|
script_validation->set_texture(invalid_icon);
|
|
|
|
script_validation->set_tooltip(vformat(TTR("Script extension must match chosen langauge extension (.%s)."), ext));
|
|
|
|
}
|
|
|
|
if (script_edit->get_text().get_basename().is_empty()) {
|
|
|
|
is_valid = false;
|
|
|
|
script_validation->set_texture(invalid_icon);
|
|
|
|
script_validation->set_tooltip(TTR("Script name cannot not be blank."));
|
|
|
|
}
|
|
|
|
if (subfolder_edit->get_text().is_empty()) {
|
|
|
|
is_valid = false;
|
|
|
|
subfolder_validation->set_texture(invalid_icon);
|
|
|
|
subfolder_validation->set_tooltip(TTR("Subfolder cannot be blank."));
|
|
|
|
} else {
|
|
|
|
DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
|
|
|
String path = "res://addons/" + subfolder_edit->get_text();
|
|
|
|
if (dir->dir_exists(path) && !_edit_mode) { // Only show this error if in "create" mode.
|
|
|
|
is_valid = false;
|
|
|
|
subfolder_validation->set_texture(invalid_icon);
|
|
|
|
subfolder_validation->set_tooltip(TTR("Subfolder cannot be one which already exists."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
get_ok_button()->set_disabled(!is_valid);
|
2018-07-19 23:34:22 +08:00
|
|
|
}
|
|
|
|
|
2021-03-05 02:22:47 +08:00
|
|
|
String PluginConfigDialog::_to_absolute_plugin_path(const String &p_plugin_name) {
|
|
|
|
return "res://addons/" + p_plugin_name + "/plugin.cfg";
|
|
|
|
}
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
void PluginConfigDialog::_notification(int p_what) {
|
|
|
|
switch (p_what) {
|
2020-03-07 01:00:16 +08:00
|
|
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
|
|
|
if (is_visible()) {
|
|
|
|
name_edit->grab_focus();
|
|
|
|
}
|
|
|
|
} break;
|
2018-07-19 23:34:22 +08:00
|
|
|
case NOTIFICATION_READY: {
|
2020-02-22 01:28:45 +08:00
|
|
|
connect("confirmed", callable_mp(this, &PluginConfigDialog::_on_confirmed));
|
2020-12-15 02:37:30 +08:00
|
|
|
get_cancel_button()->connect("pressed", callable_mp(this, &PluginConfigDialog::_on_cancelled));
|
2018-07-19 23:34:22 +08:00
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginConfigDialog::config(const String &p_config_path) {
|
|
|
|
if (p_config_path.length()) {
|
|
|
|
Ref<ConfigFile> cf = memnew(ConfigFile);
|
2019-08-07 18:54:30 +08:00
|
|
|
Error err = cf->load(p_config_path);
|
2019-09-25 16:28:50 +08:00
|
|
|
ERR_FAIL_COND_MSG(err != OK, "Cannot load config file from path '" + p_config_path + "'.");
|
2018-07-19 23:34:22 +08:00
|
|
|
|
|
|
|
name_edit->set_text(cf->get_value("plugin", "name", ""));
|
|
|
|
subfolder_edit->set_text(p_config_path.get_base_dir().get_basename().get_file());
|
|
|
|
desc_edit->set_text(cf->get_value("plugin", "description", ""));
|
|
|
|
author_edit->set_text(cf->get_value("plugin", "author", ""));
|
|
|
|
version_edit->set_text(cf->get_value("plugin", "version", ""));
|
|
|
|
script_edit->set_text(cf->get_value("plugin", "script", ""));
|
|
|
|
|
|
|
|
_edit_mode = true;
|
|
|
|
active_edit->hide();
|
2021-07-11 22:14:27 +08:00
|
|
|
Object::cast_to<Label>(active_edit->get_parent()->get_child(active_edit->get_index() - 2))->hide();
|
2018-07-19 23:34:22 +08:00
|
|
|
subfolder_edit->hide();
|
2021-07-11 22:14:27 +08:00
|
|
|
Object::cast_to<Label>(subfolder_edit->get_parent()->get_child(subfolder_edit->get_index() - 2))->hide();
|
2018-07-19 23:34:22 +08:00
|
|
|
set_title(TTR("Edit a Plugin"));
|
|
|
|
} else {
|
|
|
|
_clear_fields();
|
|
|
|
_edit_mode = false;
|
|
|
|
active_edit->show();
|
2021-07-11 22:14:27 +08:00
|
|
|
Object::cast_to<Label>(active_edit->get_parent()->get_child(active_edit->get_index() - 2))->show();
|
2018-07-19 23:34:22 +08:00
|
|
|
subfolder_edit->show();
|
2021-07-11 22:14:27 +08:00
|
|
|
Object::cast_to<Label>(subfolder_edit->get_parent()->get_child(subfolder_edit->get_index() - 2))->show();
|
2018-07-19 23:34:22 +08:00
|
|
|
set_title(TTR("Create a Plugin"));
|
|
|
|
}
|
2021-07-11 22:14:27 +08:00
|
|
|
// Simulate text changing so the errors populate.
|
|
|
|
_on_required_text_changed("");
|
|
|
|
|
2020-12-15 02:37:30 +08:00
|
|
|
get_ok_button()->set_disabled(!_edit_mode);
|
|
|
|
get_ok_button()->set_text(_edit_mode ? TTR("Update") : TTR("Create"));
|
2018-07-19 23:34:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void PluginConfigDialog::_bind_methods() {
|
|
|
|
ADD_SIGNAL(MethodInfo("plugin_ready", PropertyInfo(Variant::STRING, "script_path", PROPERTY_HINT_NONE, ""), PropertyInfo(Variant::STRING, "activate_name")));
|
|
|
|
}
|
|
|
|
|
|
|
|
PluginConfigDialog::PluginConfigDialog() {
|
2020-12-15 02:37:30 +08:00
|
|
|
get_ok_button()->set_disabled(true);
|
2018-07-19 23:34:22 +08:00
|
|
|
set_hide_on_ok(true);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
VBoxContainer *vbox = memnew(VBoxContainer);
|
|
|
|
vbox->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
|
vbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
|
add_child(vbox);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
GridContainer *grid = memnew(GridContainer);
|
2021-07-11 22:14:27 +08:00
|
|
|
grid->set_columns(3);
|
|
|
|
vbox->add_child(grid);
|
2018-07-19 23:34:22 +08:00
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
// Plugin Name
|
2018-07-19 23:34:22 +08:00
|
|
|
Label *name_lb = memnew(Label);
|
|
|
|
name_lb->set_text(TTR("Plugin Name:"));
|
|
|
|
grid->add_child(name_lb);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
name_validation = memnew(TextureRect);
|
|
|
|
name_validation->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
|
|
|
grid->add_child(name_validation);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
name_edit = memnew(LineEdit);
|
2020-02-22 01:28:45 +08:00
|
|
|
name_edit->connect("text_changed", callable_mp(this, &PluginConfigDialog::_on_required_text_changed));
|
2018-07-19 23:34:22 +08:00
|
|
|
name_edit->set_placeholder("MyPlugin");
|
|
|
|
grid->add_child(name_edit);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
// Subfolder
|
2018-07-19 23:34:22 +08:00
|
|
|
Label *subfolder_lb = memnew(Label);
|
|
|
|
subfolder_lb->set_text(TTR("Subfolder:"));
|
|
|
|
grid->add_child(subfolder_lb);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
subfolder_validation = memnew(TextureRect);
|
|
|
|
subfolder_validation->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
|
|
|
grid->add_child(subfolder_validation);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
subfolder_edit = memnew(LineEdit);
|
|
|
|
subfolder_edit->set_placeholder("\"my_plugin\" -> res://addons/my_plugin");
|
2021-07-11 22:14:27 +08:00
|
|
|
subfolder_edit->connect("text_changed", callable_mp(this, &PluginConfigDialog::_on_required_text_changed));
|
2018-07-19 23:34:22 +08:00
|
|
|
grid->add_child(subfolder_edit);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
// Description
|
2018-07-19 23:34:22 +08:00
|
|
|
Label *desc_lb = memnew(Label);
|
|
|
|
desc_lb->set_text(TTR("Description:"));
|
|
|
|
grid->add_child(desc_lb);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
Control *desc_spacer = memnew(Control);
|
|
|
|
grid->add_child(desc_spacer);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
desc_edit = memnew(TextEdit);
|
2018-10-21 04:05:11 +08:00
|
|
|
desc_edit->set_custom_minimum_size(Size2(400, 80) * EDSCALE);
|
2021-05-31 19:02:35 +08:00
|
|
|
desc_edit->set_wrap_enabled(true);
|
2018-07-19 23:34:22 +08:00
|
|
|
grid->add_child(desc_edit);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
// Author
|
2018-07-19 23:34:22 +08:00
|
|
|
Label *author_lb = memnew(Label);
|
|
|
|
author_lb->set_text(TTR("Author:"));
|
|
|
|
grid->add_child(author_lb);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
Control *author_spacer = memnew(Control);
|
|
|
|
grid->add_child(author_spacer);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
author_edit = memnew(LineEdit);
|
|
|
|
author_edit->set_placeholder("Godette");
|
|
|
|
grid->add_child(author_edit);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
// Version
|
2018-07-19 23:34:22 +08:00
|
|
|
Label *version_lb = memnew(Label);
|
|
|
|
version_lb->set_text(TTR("Version:"));
|
|
|
|
grid->add_child(version_lb);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
Control *version_spacer = memnew(Control);
|
|
|
|
grid->add_child(version_spacer);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
version_edit = memnew(LineEdit);
|
|
|
|
version_edit->set_placeholder("1.0");
|
|
|
|
grid->add_child(version_edit);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
// Language dropdown
|
2018-07-19 23:34:22 +08:00
|
|
|
Label *script_option_lb = memnew(Label);
|
|
|
|
script_option_lb->set_text(TTR("Language:"));
|
|
|
|
grid->add_child(script_option_lb);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
Control *script_opt_spacer = memnew(Control);
|
|
|
|
grid->add_child(script_opt_spacer);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
script_option_edit = memnew(OptionButton);
|
2019-02-12 22:41:00 +08:00
|
|
|
int default_lang = 0;
|
2019-01-23 21:54:33 +08:00
|
|
|
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
|
|
|
ScriptLanguage *lang = ScriptServer::get_language(i);
|
|
|
|
script_option_edit->add_item(lang->get_name());
|
2020-02-07 04:51:36 +08:00
|
|
|
#ifdef MODULE_GDSCRIPT_ENABLED
|
2019-02-12 22:41:00 +08:00
|
|
|
if (lang == GDScriptLanguage::get_singleton()) {
|
|
|
|
default_lang = i;
|
|
|
|
}
|
2020-02-07 04:51:36 +08:00
|
|
|
#endif
|
2019-01-23 21:54:33 +08:00
|
|
|
}
|
2019-02-12 22:41:00 +08:00
|
|
|
script_option_edit->select(default_lang);
|
2018-07-19 23:34:22 +08:00
|
|
|
grid->add_child(script_option_edit);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
// Plugin Script Name
|
2018-07-19 23:34:22 +08:00
|
|
|
Label *script_lb = memnew(Label);
|
|
|
|
script_lb->set_text(TTR("Script Name:"));
|
|
|
|
grid->add_child(script_lb);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
script_validation = memnew(TextureRect);
|
|
|
|
script_validation->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
|
|
|
|
grid->add_child(script_validation);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
script_edit = memnew(LineEdit);
|
2020-02-22 01:28:45 +08:00
|
|
|
script_edit->connect("text_changed", callable_mp(this, &PluginConfigDialog::_on_required_text_changed));
|
2018-07-19 23:34:22 +08:00
|
|
|
script_edit->set_placeholder("\"plugin.gd\" -> res://addons/my_plugin/plugin.gd");
|
|
|
|
grid->add_child(script_edit);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
// Activate now checkbox
|
2019-01-23 21:54:33 +08:00
|
|
|
// TODO Make this option work better with languages like C#. Right now, it does not work because the C# project must be compiled first.
|
2018-07-19 23:34:22 +08:00
|
|
|
Label *active_lb = memnew(Label);
|
|
|
|
active_lb->set_text(TTR("Activate now?"));
|
|
|
|
grid->add_child(active_lb);
|
|
|
|
|
2021-07-11 22:14:27 +08:00
|
|
|
Control *active_spacer = memnew(Control);
|
|
|
|
grid->add_child(active_spacer);
|
|
|
|
|
2018-07-19 23:34:22 +08:00
|
|
|
active_edit = memnew(CheckBox);
|
|
|
|
active_edit->set_pressed(true);
|
|
|
|
grid->add_child(active_edit);
|
|
|
|
}
|
|
|
|
|
|
|
|
PluginConfigDialog::~PluginConfigDialog() {
|
|
|
|
}
|