/*************************************************************************/ /* plugin_config_dialog.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* 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" #include "core/io/config_file.h" #include "core/io/dir_access.h" #include "editor/editor_node.h" #include "editor/editor_plugin.h" #include "editor/editor_scale.h" #include "editor/project_settings_editor.h" 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) { DirAccessRef d = DirAccess::create(DirAccess::ACCESS_RESOURCES); if (!d || d->make_dir_recursive(path) != OK) { return; } } Ref 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) { int lang_idx = script_option_edit->get_selected(); String lang_name = ScriptServer::get_language(lang_idx)->get_name(); Ref