1
0
mirror of https://github.com/godotengine/godot synced 2024-07-03 08:00:09 +00:00

Organize existing code for editor plugins

This commit is contained in:
Aaron Franke 2024-04-21 01:11:35 -07:00
parent 6118592c6d
commit 1bcbbe96c4
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
96 changed files with 137 additions and 132 deletions

View File

@ -32,7 +32,7 @@
#define DEBUG_ADAPTER_SERVER_H
#include "debug_adapter_protocol.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class DebugAdapterServer : public EditorPlugin {
GDCLASS(DebugAdapterServer, EditorPlugin);

View File

@ -31,7 +31,7 @@
#ifndef EDITOR_AUDIO_BUSES_H
#define EDITOR_AUDIO_BUSES_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"

View File

@ -36,9 +36,9 @@
#include "core/io/image_loader.h"
#include "core/io/resource_loader.h"
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/multi_node_edit.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/themes/editor_scale.h"
#include "scene/resources/packed_scene.h"

View File

@ -34,7 +34,7 @@
#include "core/os/thread.h"
#include "editor/code_editor.h"
#include "editor/doc_tools.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/popup.h"

View File

@ -34,7 +34,7 @@
#include "core/templates/rb_map.h"
#include "editor/code_editor.h"
#include "editor/editor_help.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/option_button.h"
#include "scene/gui/tree.h"

View File

@ -90,7 +90,6 @@
#include "editor/editor_log.h"
#include "editor/editor_native_shader_source_visualizer.h"
#include "editor/editor_paths.h"
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
#include "editor/editor_property_name_processor.h"
#include "editor/editor_quick_open.h"
@ -134,12 +133,12 @@
#include "editor/inspector_dock.h"
#include "editor/multi_node_edit.h"
#include "editor/node_dock.h"
#include "editor/plugin_config_dialog.h"
#include "editor/plugins/animation_player_editor_plugin.h"
#include "editor/plugins/asset_library_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "editor/plugins/debugger_editor_plugin.h"
#include "editor/plugins/dedicated_server_export_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/editor_preview_plugins.h"
#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "editor/plugins/gdextension_export_plugin.h"
@ -148,6 +147,7 @@
#include "editor/plugins/node_3d_editor_plugin.h"
#include "editor/plugins/packed_scene_translation_parser_plugin.h"
#include "editor/plugins/particle_process_material_editor_plugin.h"
#include "editor/plugins/plugin_config_dialog.h"
#include "editor/plugins/root_motion_editor_plugin.h"
#include "editor/plugins/script_text_editor.h"
#include "editor/plugins/text_editor.h"

View File

@ -35,7 +35,7 @@
#include "core/templates/safe_refcount.h"
#include "editor/editor_data.h"
#include "editor/editor_folding.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
typedef void (*EditorNodeInitCallback)();
typedef void (*EditorPluginInitializeCallback)();

View File

@ -31,7 +31,7 @@
#ifndef AUDIO_STREAM_IMPORT_SETTINGS_H
#define AUDIO_STREAM_IMPORT_SETTINGS_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/audio/audio_stream_player.h"
#include "scene/gui/color_rect.h"
#include "scene/gui/dialogs.h"

View File

@ -34,9 +34,9 @@
#include "core/io/resource_importer.h"
#include "editor/action_map_editor.h"
#include "editor/editor_autoload_settings.h"
#include "editor/editor_plugin_settings.h"
#include "editor/editor_sectioned_inspector.h"
#include "editor/localization_editor.h"
#include "editor/plugins/editor_plugin_settings.h"
#include "editor/shader_globals_editor.h"
#include "scene/gui/center_container.h"

View File

@ -31,7 +31,7 @@
#ifndef ABSTRACT_POLYGON_2D_EDITOR_H
#define ABSTRACT_POLYGON_2D_EDITOR_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/polygon_2d.h"
#include "scene/gui/box_container.h"

View File

@ -31,8 +31,8 @@
#ifndef ANIMATION_BLEND_SPACE_1D_EDITOR_H
#define ANIMATION_BLEND_SPACE_1D_EDITOR_H
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/animation/animation_blend_space_1d.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"

View File

@ -31,8 +31,8 @@
#ifndef ANIMATION_BLEND_SPACE_2D_EDITOR_H
#define ANIMATION_BLEND_SPACE_2D_EDITOR_H
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/animation/animation_blend_space_2d.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"

View File

@ -32,7 +32,7 @@
#define ANIMATION_LIBRARY_EDITOR_H
#include "editor/animation_track_editor.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/animation/animation_mixer.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"

View File

@ -32,8 +32,8 @@
#define ANIMATION_PLAYER_EDITOR_PLUGIN_H
#include "editor/animation_track_editor.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_library_editor.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/animation/animation_player.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/slider.h"

View File

@ -31,7 +31,7 @@
#ifndef ANIMATION_TREE_EDITOR_PLUGIN_H
#define ANIMATION_TREE_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/animation/animation_tree.h"
#include "scene/gui/graph_edit.h"

View File

@ -32,8 +32,8 @@
#define ASSET_LIBRARY_EDITOR_PLUGIN_H
#include "editor/editor_asset_installer.h"
#include "editor/editor_plugin.h"
#include "editor/editor_plugin_settings.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/editor_plugin_settings.h"
#include "scene/gui/box_container.h"
#include "scene/gui/check_box.h"
#include "scene/gui/grid_container.h"

View File

@ -32,7 +32,7 @@
#define AUDIO_STREAM_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/audio/audio_stream_player.h"
#include "scene/gui/button.h"
#include "scene/gui/color_rect.h"

View File

@ -31,7 +31,7 @@
#ifndef AUDIO_STREAM_RANDOMIZER_EDITOR_PLUGIN_H
#define AUDIO_STREAM_RANDOMIZER_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "servers/audio/audio_stream.h"
class AudioStreamRandomizerEditorPlugin : public EditorPlugin {

View File

@ -32,7 +32,7 @@
#define BIT_MAP_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/resources/bit_map.h"
class TextureRect;

View File

@ -32,8 +32,8 @@
#define BONE_MAP_EDITOR_PLUGIN_H
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
#include "editor/plugins/editor_plugin.h"
#include "modules/modules_enabled.gen.h" // For regex.
#ifdef MODULE_REGEX_ENABLED

View File

@ -31,7 +31,7 @@
#ifndef CAMERA_3D_EDITOR_PLUGIN_H
#define CAMERA_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/camera_3d.h"
class Camera3DEditor : public Control {

View File

@ -31,7 +31,7 @@
#ifndef CANVAS_ITEM_EDITOR_PLUGIN_H
#define CANVAS_ITEM_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/base_button.h"
#include "scene/gui/box_container.h"

View File

@ -31,7 +31,7 @@
#ifndef CAST_2D_EDITOR_PLUGIN_H
#define CAST_2D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/node_2d.h"
class CanvasItemEditor;

View File

@ -31,7 +31,7 @@
#ifndef COLLISION_SHAPE_2D_EDITOR_PLUGIN_H
#define COLLISION_SHAPE_2D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/physics/collision_shape_2d.h"
class CanvasItemEditor;

View File

@ -32,7 +32,7 @@
#define CONTROL_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/check_box.h"

View File

@ -31,7 +31,7 @@
#ifndef CPU_PARTICLES_2D_EDITOR_PLUGIN_H
#define CPU_PARTICLES_2D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/cpu_particles_2d.h"
#include "scene/2d/physics/collision_polygon_2d.h"
#include "scene/gui/box_container.h"

View File

@ -32,8 +32,8 @@
#define CURVE_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/editor_resource_preview.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/resources/curve.h"
class EditorSpinSlider;

View File

@ -31,7 +31,7 @@
#ifndef DEBUGGER_EDITOR_PLUGIN_H
#define DEBUGGER_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class EditorFileServer;
class MenuButton;

View File

@ -32,7 +32,7 @@
#define EDITOR_PLUGIN_SETTINGS_H
#include "editor/editor_data.h"
#include "editor/plugin_config_dialog.h"
#include "editor/plugins/plugin_config_dialog.h"
class Tree;

View File

@ -32,9 +32,9 @@
#define FONT_CONFIG_PLUGIN_H
#include "core/io/marshalls.h"
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
#include "editor/editor_properties_array_dict.h"
#include "editor/plugins/editor_plugin.h"
/*************************************************************************/

View File

@ -31,7 +31,7 @@
#ifndef GPU_PARTICLES_2D_EDITOR_PLUGIN_H
#define GPU_PARTICLES_2D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/gpu_particles_2d.h"
#include "scene/2d/physics/collision_polygon_2d.h"
#include "scene/gui/box_container.h"

View File

@ -31,7 +31,7 @@
#ifndef GPU_PARTICLES_3D_EDITOR_PLUGIN_H
#define GPU_PARTICLES_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/gpu_particles_3d.h"
#include "scene/gui/spin_box.h"

View File

@ -31,7 +31,7 @@
#ifndef GPU_PARTICLES_COLLISION_SDF_EDITOR_PLUGIN_H
#define GPU_PARTICLES_COLLISION_SDF_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/gpu_particles_collision_3d.h"
#include "scene/resources/material.h"

View File

@ -32,7 +32,7 @@
#define GRADIENT_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class EditorSpinSlider;
class ColorPicker;

View File

@ -32,7 +32,7 @@
#define GRADIENT_TEXTURE_2D_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class Button;
class EditorSpinSlider;

View File

@ -33,7 +33,7 @@
#include "editor/action_map_editor.h"
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class InputEventConfigContainer : public VBoxContainer {
GDCLASS(InputEventConfigContainer, VBoxContainer);

View File

@ -31,7 +31,7 @@
#ifndef LIGHTMAP_GI_EDITOR_PLUGIN_H
#define LIGHTMAP_GI_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/lightmap_gi.h"
#include "scene/resources/material.h"

View File

@ -32,7 +32,7 @@
#define MATERIAL_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "scene/resources/3d/primitive_meshes.h"
#include "scene/resources/material.h"

View File

@ -32,7 +32,7 @@
#define MESH_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/light_3d.h"
#include "scene/3d/mesh_instance_3d.h"

View File

@ -31,7 +31,7 @@
#ifndef MESH_INSTANCE_3D_EDITOR_PLUGIN_H
#define MESH_INSTANCE_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/gui/option_button.h"

View File

@ -31,7 +31,7 @@
#ifndef MESH_LIBRARY_EDITOR_PLUGIN_H
#define MESH_LIBRARY_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/resources/3d/mesh_library.h"
class EditorFileDialog;

View File

@ -31,7 +31,7 @@
#ifndef MULTIMESH_EDITOR_PLUGIN_H
#define MULTIMESH_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/multimesh_instance_3d.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"

View File

@ -31,7 +31,7 @@
#ifndef NAVIGATION_LINK_2D_EDITOR_PLUGIN_H
#define NAVIGATION_LINK_2D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/navigation_link_2d.h"
class CanvasItemEditor;

View File

@ -31,7 +31,7 @@
#ifndef NAVIGATION_OBSTACLE_3D_EDITOR_PLUGIN_H
#define NAVIGATION_OBSTACLE_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/physics/collision_polygon_3d.h"
#include "scene/gui/box_container.h"

View File

@ -33,7 +33,7 @@
#include "editor/plugins/abstract_polygon_2d_editor.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class AcceptDialog;
class HBoxContainer;

View File

@ -31,7 +31,7 @@
#ifndef NODE_3D_EDITOR_PLUGIN_H
#define NODE_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/node_3d_editor_gizmos.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/box_container.h"

View File

@ -31,7 +31,7 @@
#ifndef OCCLUDER_INSTANCE_3D_EDITOR_PLUGIN_H
#define OCCLUDER_INSTANCE_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/occluder_instance_3d.h"
#include "scene/resources/material.h"

View File

@ -32,7 +32,7 @@
#define PACKED_SCENE_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
class PackedSceneEditor : public VBoxContainer {

View File

@ -31,7 +31,7 @@
#ifndef PARALLAX_BACKGROUND_EDITOR_PLUGIN_H
#define PARALLAX_BACKGROUND_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class HBoxContainer;
class MenuButton;

View File

@ -31,8 +31,8 @@
#ifndef PARTICLE_PROCESS_MATERIAL_EDITOR_PLUGIN_H
#define PARTICLE_PROCESS_MATERIAL_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
#include "editor/plugins/editor_plugin.h"
class Button;
class EditorSpinSlider;

View File

@ -31,7 +31,7 @@
#ifndef PATH_2D_EDITOR_PLUGIN_H
#define PATH_2D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/path_2d.h"
#include "scene/gui/box_container.h"

View File

@ -31,7 +31,7 @@
#ifndef PATH_3D_EDITOR_PLUGIN_H
#define PATH_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/node_3d_editor_gizmos.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/path_3d.h"

View File

@ -31,7 +31,7 @@
#ifndef PHYSICAL_BONE_3D_EDITOR_PLUGIN_H
#define PHYSICAL_BONE_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"

View File

@ -33,9 +33,10 @@
#include "core/io/config_file.h"
#include "core/io/dir_access.h"
#include "core/object/script_language.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/gui/editor_validation_panel.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/project_settings_editor.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/grid_container.h"
@ -58,30 +59,35 @@ void PluginConfigDialog::_on_confirmed() {
return;
}
}
int lang_idx = script_option_edit->get_selected();
ScriptLanguage *language = ScriptServer::get_language(lang_idx);
if (language == nullptr) {
return;
}
String ext = language->get_extension();
String script_name = script_edit->get_text().is_empty() ? _get_subfolder() : script_edit->get_text();
if (script_name.get_extension() != ext) {
script_name += "." + ext;
}
String script_path = path.path_join(script_name);
// Create the plugin.cfg file.
Ref<ConfigFile> cf = memnew(ConfigFile);
cf->load(path.path_join("plugin.cfg"));
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_name);
// Language-specific settings.
int lang_index = script_option_edit->get_selected();
_create_script_for_plugin(path, cf, lang_index);
// Save and inform the editor.
cf->save(path.path_join("plugin.cfg"));
EditorNode::get_singleton()->get_project_settings()->update_plugins();
EditorFileSystem::get_singleton()->scan();
_clear_fields();
}
if (!_edit_mode) {
void PluginConfigDialog::_create_script_for_plugin(const String &p_plugin_path, Ref<ConfigFile> p_config_file, int p_script_lang_index) {
ScriptLanguage *language = ScriptServer::get_language(p_script_lang_index);
ERR_FAIL_COND(language == nullptr);
String ext = language->get_extension();
String script_name = script_edit->get_text().is_empty() ? _get_subfolder() : script_edit->get_text();
if (script_name.get_extension() != ext) {
script_name += "." + ext;
}
String script_path = p_plugin_path.path_join(script_name);
p_config_file->set_value("plugin", "script", script_name);
// If the requested script does not exist, create it.
if (!_edit_mode && !FileAccess::exists(script_path)) {
String class_name = script_name.get_basename();
String template_content = "";
Vector<ScriptLanguage::ScriptTemplate> templates = language->get_built_in_templates("EditorPlugin");
@ -91,12 +97,9 @@ void PluginConfigDialog::_on_confirmed() {
Ref<Script> scr = language->make_template(template_content, class_name, "EditorPlugin");
scr->set_path(script_path, true);
ResourceSaver::save(scr);
p_config_file->save(p_plugin_path.path_join("plugin.cfg"));
emit_signal(SNAME("plugin_ready"), scr.ptr(), active_edit->is_pressed() ? _to_absolute_plugin_path(_get_subfolder()) : "");
} else {
EditorNode::get_singleton()->get_project_settings()->update_plugins();
}
_clear_fields();
}
void PluginConfigDialog::_on_canceled() {
@ -104,19 +107,9 @@ void PluginConfigDialog::_on_canceled() {
}
void PluginConfigDialog::_on_required_text_changed() {
int lang_idx = script_option_edit->get_selected();
ScriptLanguage *language = ScriptServer::get_language(lang_idx);
if (language == nullptr) {
return;
}
String ext = language->get_extension();
if (name_edit->get_text().is_empty()) {
validation_panel->set_message(MSG_ID_PLUGIN, TTR("Plugin name cannot be blank."), EditorValidationPanel::MSG_ERROR);
}
if ((!script_edit->get_text().get_extension().is_empty() && script_edit->get_text().get_extension() != ext) || script_edit->get_text().ends_with(".")) {
validation_panel->set_message(MSG_ID_SCRIPT, vformat(TTR("Script extension must match chosen language extension (.%s)."), ext), EditorValidationPanel::MSG_ERROR);
}
if (subfolder_edit->is_visible()) {
if (!subfolder_edit->get_text().is_empty() && !subfolder_edit->get_text().is_valid_filename()) {
validation_panel->set_message(MSG_ID_SUBFOLDER, TTR("Subfolder name is not a valid folder name."), EditorValidationPanel::MSG_ERROR);
@ -129,6 +122,16 @@ void PluginConfigDialog::_on_required_text_changed() {
} else {
validation_panel->set_message(MSG_ID_SUBFOLDER, "", EditorValidationPanel::MSG_OK);
}
// Language and script validation.
int lang_idx = script_option_edit->get_selected();
ScriptLanguage *language = ScriptServer::get_language(lang_idx);
if (language == nullptr) {
return;
}
String ext = language->get_extension();
if ((!script_edit->get_text().get_extension().is_empty() && script_edit->get_text().get_extension() != ext) || script_edit->get_text().ends_with(".")) {
validation_panel->set_message(MSG_ID_SCRIPT, vformat(TTR("Script extension must match chosen language extension (.%s)."), ext), EditorValidationPanel::MSG_ERROR);
}
if (active_edit->is_visible()) {
if (language->get_name() == "C#") {
active_edit->set_pressed(false);
@ -296,10 +299,10 @@ PluginConfigDialog::PluginConfigDialog() {
grid->add_child(script_option_edit);
// Plugin Script Name
Label *script_lb = memnew(Label);
script_lb->set_text(TTR("Script Name:"));
script_lb->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
grid->add_child(script_lb);
Label *script_name_label = memnew(Label);
script_name_label->set_text(TTR("Script Name:"));
script_name_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
grid->add_child(script_name_label);
script_edit = memnew(LineEdit);
script_edit->set_tooltip_text(TTR("Optional. The path to the script (relative to the add-on folder). If left empty, will default to \"plugin.gd\"."));
@ -308,11 +311,11 @@ PluginConfigDialog::PluginConfigDialog() {
grid->add_child(script_edit);
// Activate now checkbox
Label *active_lb = memnew(Label);
active_lb->set_text(TTR("Activate now?"));
active_lb->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
grid->add_child(active_lb);
plugin_edit_hidden_controls.push_back(active_lb);
Label *active_label = memnew(Label);
active_label->set_text(TTR("Activate now?"));
active_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
grid->add_child(active_label);
plugin_edit_hidden_controls.push_back(active_label);
active_edit = memnew(CheckBox);
active_edit->set_pressed(true);

View File

@ -39,6 +39,7 @@
#include "scene/gui/text_edit.h"
#include "scene/gui/texture_rect.h"
class ConfigFile;
class EditorValidationPanel;
class PluginConfigDialog : public ConfirmationDialog {
@ -70,6 +71,7 @@ class PluginConfigDialog : public ConfirmationDialog {
void _on_confirmed();
void _on_canceled();
void _on_required_text_changed();
void _create_script_for_plugin(const String &p_plugin_path, Ref<ConfigFile> p_config_file, int p_script_lang_index);
String _get_subfolder();
static String _to_absolute_plugin_path(const String &p_plugin_name);

View File

@ -31,7 +31,7 @@
#ifndef POLYGON_3D_EDITOR_PLUGIN_H
#define POLYGON_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/physics/collision_polygon_3d.h"
#include "scene/gui/box_container.h"

View File

@ -31,7 +31,7 @@
#ifndef RESOURCE_PRELOADER_EDITOR_PLUGIN_H
#define RESOURCE_PRELOADER_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/tree.h"

View File

@ -32,7 +32,7 @@
#define SCRIPT_EDITOR_PLUGIN_H
#include "core/object/script_language.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/panel_container.h"
#include "scene/resources/syntax_highlighter.h"

View File

@ -31,7 +31,7 @@
#ifndef SHADER_EDITOR_PLUGIN_H
#define SHADER_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class HSplitContainer;
class ItemList;

View File

@ -32,7 +32,7 @@
#define SHADER_FILE_EDITOR_PLUGIN_H
#include "editor/code_editor.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/rich_text_label.h"

View File

@ -31,7 +31,7 @@
#ifndef SKELETON_2D_EDITOR_PLUGIN_H
#define SKELETON_2D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/skeleton_2d.h"
class AcceptDialog;

View File

@ -31,9 +31,9 @@
#ifndef SKELETON_3D_EDITOR_PLUGIN_H
#define SKELETON_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/node_3d_editor_plugin.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/mesh_instance_3d.h"

View File

@ -31,7 +31,7 @@
#ifndef SKELETON_IK_3D_EDITOR_PLUGIN_H
#define SKELETON_IK_3D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class Button;
class SkeletonIK3D;

View File

@ -31,7 +31,7 @@
#ifndef SPRITE_2D_EDITOR_PLUGIN_H
#define SPRITE_2D_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/sprite_2d.h"
#include "scene/gui/spin_box.h"

View File

@ -31,7 +31,7 @@
#ifndef SPRITE_FRAMES_EDITOR_PLUGIN_H
#define SPRITE_FRAMES_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/2d/animated_sprite_2d.h"
#include "scene/3d/sprite_3d.h"
#include "scene/gui/button.h"

View File

@ -32,7 +32,7 @@
#define STYLE_BOX_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/texture_rect.h"
class Button;

View File

@ -31,7 +31,7 @@
#ifndef SUB_VIEWPORT_PREVIEW_EDITOR_PLUGIN_H
#define SUB_VIEWPORT_PREVIEW_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/texture_editor_plugin.h"
#include "scene/main/viewport.h"

View File

@ -32,7 +32,7 @@
#define TEXTURE_3D_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/spin_box.h"
#include "scene/resources/shader.h"
#include "scene/resources/texture.h"

View File

@ -32,7 +32,7 @@
#define TEXTURE_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/margin_container.h"
#include "scene/resources/texture.h"

View File

@ -32,7 +32,7 @@
#define TEXTURE_LAYERED_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/spin_box.h"
#include "scene/resources/shader.h"
#include "scene/resources/texture.h"

View File

@ -32,7 +32,7 @@
#define TEXTURE_REGION_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/dialogs.h"
class AtlasTexture;

View File

@ -31,7 +31,7 @@
#ifndef THEME_EDITOR_PLUGIN_H
#define THEME_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/theme_editor_preview.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/margin_container.h"

View File

@ -31,7 +31,7 @@
#ifndef TILES_EDITOR_PLUGIN_H
#define TILES_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "tile_atlas_view.h"

View File

@ -31,8 +31,8 @@
#ifndef VERSION_CONTROL_EDITOR_PLUGIN_H
#define VERSION_CONTROL_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/editor_vcs_interface.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/check_button.h"
#include "scene/gui/container.h"
#include "scene/gui/file_dialog.h"

View File

@ -31,8 +31,8 @@
#ifndef VISUAL_SHADER_EDITOR_PLUGIN_H
#define VISUAL_SHADER_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/editor_properties.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/editor_resource_conversion_plugin.h"
#include "scene/gui/graph_edit.h"
#include "scene/resources/syntax_highlighter.h"

View File

@ -31,7 +31,7 @@
#ifndef VOXEL_GI_EDITOR_PLUGIN_H
#define VOXEL_GI_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/3d/voxel_gi.h"
#include "scene/resources/material.h"

View File

@ -35,11 +35,11 @@
#include "editor/action_map_editor.h"
#include "editor/editor_autoload_settings.h"
#include "editor/editor_data.h"
#include "editor/editor_plugin_settings.h"
#include "editor/editor_sectioned_inspector.h"
#include "editor/group_settings_editor.h"
#include "editor/import_defaults_editor.h"
#include "editor/localization_editor.h"
#include "editor/plugins/editor_plugin_settings.h"
#include "editor/shader_globals_editor.h"
#include "scene/gui/tab_container.h"

View File

@ -33,8 +33,8 @@
#include "editor/editor_autoload_settings.h"
#include "editor/editor_data.h"
#include "editor/editor_plugin_settings.h"
#include "editor/editor_sectioned_inspector.h"
#include "editor/plugins/editor_plugin_settings.h"
#include "scene/gui/tab_container.h"
class ShaderGlobalsEditorInterface;

View File

@ -35,7 +35,7 @@
#include "../csg_shape.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "editor/plugins/node_3d_editor_gizmos.h"
class Gizmo3DHelper;

View File

@ -34,7 +34,7 @@
#include "../gdscript_parser.h"
#include "gdscript_language_protocol.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class GDScriptLanguageServer : public EditorPlugin {
GDCLASS(GDScriptLanguageServer, EditorPlugin);

View File

@ -36,7 +36,7 @@
#include "../gltf_document.h"
#include "editor_scene_exporter_gltf_settings.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class EditorFileDialog;
class EditorInspector;

View File

@ -35,7 +35,7 @@
#include "../grid_map.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/gui/item_list.h"
#include "scene/gui/slider.h"

View File

@ -32,7 +32,7 @@
#define AUDIO_STREAM_INTERACTIVE_EDITOR_PLUGIN_H
#include "editor/editor_inspector.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/dialogs.h"
class CheckBox;

View File

@ -41,7 +41,7 @@
#include "core/templates/self_list.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#endif
class CSharpScript;

View File

@ -31,8 +31,8 @@
#ifndef MULTIPLAYER_EDITOR_PLUGIN_H
#define MULTIPLAYER_EDITOR_PLUGIN_H
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_debugger_plugin.h"
#include "editor/plugins/editor_plugin.h"
class EditorNetworkProfiler;
class MultiplayerEditorDebugger : public EditorDebuggerPlugin {

View File

@ -33,7 +33,7 @@
#include "../scene_replication_config.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
class ConfirmationDialog;

View File

@ -33,7 +33,7 @@
#ifdef TOOLS_ENABLED
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class AcceptDialog;
class Button;

View File

@ -33,7 +33,7 @@
#ifdef TOOLS_ENABLED
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class NoiseEditorPlugin : public EditorPlugin {
GDCLASS(NoiseEditorPlugin, EditorPlugin)

View File

@ -40,7 +40,7 @@
#endif
#ifdef TOOLS_ENABLED
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
#endif
void initialize_noise_module(ModuleInitializationLevel p_level) {

View File

@ -36,8 +36,8 @@
#include "openxr_interaction_profile_editor.h"
#include "openxr_select_interaction_profile_dialog.h"
#include "editor/editor_plugin.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
#include "scene/gui/label.h"

View File

@ -34,7 +34,7 @@
#include "openxr_action_map_editor.h"
#include "openxr_select_runtime.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class OpenXREditorPlugin : public EditorPlugin {
GDCLASS(OpenXREditorPlugin, EditorPlugin);

View File

@ -34,7 +34,7 @@
#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED)
#include "core/io/zip_io.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/editor_plugin.h"
class WebToolsEditorPlugin : public EditorPlugin {
GDCLASS(WebToolsEditorPlugin, EditorPlugin);