diff options
Diffstat (limited to 'editor/editor_plugin.cpp')
-rw-r--r-- | editor/editor_plugin.cpp | 96 |
1 files changed, 47 insertions, 49 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 4fdf669121..e11bc3c252 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -30,15 +30,20 @@ #include "editor_plugin.h" +#include "editor/debugger/editor_debugger_node.h" #include "editor/editor_command_palette.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" #include "editor/editor_resource_preview.h" #include "editor/editor_settings.h" +#include "editor/editor_translation_parser.h" #include "editor/editor_undo_redo_manager.h" #include "editor/export/editor_export.h" #include "editor/filesystem_dock.h" +#include "editor/import/editor_import_plugin.h" +#include "editor/import/resource_importer_scene.h" #include "editor/plugins/canvas_item_editor_plugin.h" +#include "editor/plugins/editor_debugger_plugin.h" #include "editor/plugins/node_3d_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/project_settings_editor.h" @@ -238,14 +243,18 @@ void EditorInterface::select_file(const String &p_file) { FileSystemDock::get_singleton()->select_file(p_file); } -String EditorInterface::get_selected_path() const { - return FileSystemDock::get_singleton()->get_selected_path(); +Vector<String> EditorInterface::get_selected_paths() const { + return FileSystemDock::get_singleton()->get_selected_paths(); } String EditorInterface::get_current_path() const { return FileSystemDock::get_singleton()->get_current_path(); } +String EditorInterface::get_current_directory() const { + return FileSystemDock::get_singleton()->get_current_directory(); +} + void EditorInterface::inspect_object(Object *p_obj, const String &p_for_property, bool p_inspector_only) { EditorNode::get_singleton()->push_item(p_obj, p_for_property, p_inspector_only); } @@ -289,6 +298,14 @@ bool EditorInterface::is_plugin_enabled(const String &p_plugin) const { return EditorNode::get_singleton()->is_addon_plugin_enabled(p_plugin); } +void EditorInterface::set_movie_maker_enabled(bool p_enabled) { + EditorNode::get_singleton()->set_movie_maker_enabled(p_enabled); +} + +bool EditorInterface::is_movie_maker_enabled() const { + return EditorNode::get_singleton()->is_movie_maker_enabled(); +} + EditorInspector *EditorInterface::get_inspector() const { return InspectorDock::get_inspector_singleton(); } @@ -355,8 +372,9 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("get_editor_main_screen"), &EditorInterface::get_editor_main_screen); ClassDB::bind_method(D_METHOD("make_mesh_previews", "meshes", "preview_size"), &EditorInterface::_make_mesh_previews); ClassDB::bind_method(D_METHOD("select_file", "file"), &EditorInterface::select_file); - ClassDB::bind_method(D_METHOD("get_selected_path"), &EditorInterface::get_selected_path); + ClassDB::bind_method(D_METHOD("get_selected_paths"), &EditorInterface::get_selected_paths); ClassDB::bind_method(D_METHOD("get_current_path"), &EditorInterface::get_current_path); + ClassDB::bind_method(D_METHOD("get_current_directory"), &EditorInterface::get_current_directory); ClassDB::bind_method(D_METHOD("get_file_system_dock"), &EditorInterface::get_file_system_dock); ClassDB::bind_method(D_METHOD("get_editor_paths"), &EditorInterface::get_editor_paths); ClassDB::bind_method(D_METHOD("get_command_palette"), &EditorInterface::get_command_palette); @@ -364,6 +382,9 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("set_plugin_enabled", "plugin", "enabled"), &EditorInterface::set_plugin_enabled); ClassDB::bind_method(D_METHOD("is_plugin_enabled", "plugin"), &EditorInterface::is_plugin_enabled); + ClassDB::bind_method(D_METHOD("set_movie_maker_enabled", "enabled"), &EditorInterface::set_movie_maker_enabled); + ClassDB::bind_method(D_METHOD("is_movie_maker_enabled"), &EditorInterface::is_movie_maker_enabled); + ClassDB::bind_method(D_METHOD("get_inspector"), &EditorInterface::get_inspector); ClassDB::bind_method(D_METHOD("save_scene"), &EditorInterface::save_scene); @@ -571,10 +592,8 @@ void EditorPlugin::notify_resource_saved(const Ref<Resource> &p_resource) { bool EditorPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) { bool success = false; - if (GDVIRTUAL_CALL(_forward_canvas_gui_input, p_event, success)) { - return success; - } - return false; + GDVIRTUAL_CALL(_forward_canvas_gui_input, p_event, success); + return success; } void EditorPlugin::forward_canvas_draw_over_viewport(Control *p_overlay) { @@ -606,12 +625,8 @@ int EditorPlugin::update_overlays() const { EditorPlugin::AfterGUIInput EditorPlugin::forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) { int success = EditorPlugin::AFTER_GUI_INPUT_PASS; - - if (GDVIRTUAL_CALL(_forward_3d_gui_input, p_camera, p_event, success)) { - return static_cast<EditorPlugin::AfterGUIInput>(success); - } - - return EditorPlugin::AFTER_GUI_INPUT_PASS; + GDVIRTUAL_CALL(_forward_3d_gui_input, p_camera, p_event, success); + return static_cast<EditorPlugin::AfterGUIInput>(success); } void EditorPlugin::forward_3d_draw_over_viewport(Control *p_overlay) { @@ -624,29 +639,20 @@ void EditorPlugin::forward_3d_force_draw_over_viewport(Control *p_overlay) { String EditorPlugin::get_name() const { String name; - if (GDVIRTUAL_CALL(_get_plugin_name, name)) { - return name; - } - - return String(); + GDVIRTUAL_CALL(_get_plugin_name, name); + return name; } const Ref<Texture2D> EditorPlugin::get_icon() const { Ref<Texture2D> icon; - if (GDVIRTUAL_CALL(_get_plugin_icon, icon)) { - return icon; - } - - return Ref<Texture2D>(); + GDVIRTUAL_CALL(_get_plugin_icon, icon); + return icon; } bool EditorPlugin::has_main_screen() const { - bool success; - if (GDVIRTUAL_CALL(_has_main_screen, success)) { - return success; - } - - return false; + bool success = false; + GDVIRTUAL_CALL(_has_main_screen, success); + return success; } void EditorPlugin::make_visible(bool p_visible) { @@ -663,20 +669,14 @@ void EditorPlugin::edit(Object *p_object) { bool EditorPlugin::handles(Object *p_object) const { bool success = false; - if (GDVIRTUAL_CALL(_handles, p_object, success)) { - return success; - } - - return false; + GDVIRTUAL_CALL(_handles, p_object, success); + return success; } Dictionary EditorPlugin::get_state() const { Dictionary state; - if (GDVIRTUAL_CALL(_get_state, state)) { - return state; - } - - return Dictionary(); + GDVIRTUAL_CALL(_get_state, state); + return state; } void EditorPlugin::set_state(const Dictionary &p_state) { @@ -822,11 +822,9 @@ void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) { } bool EditorPlugin::build() { - bool success; - if (GDVIRTUAL_CALL(_build, success)) { - return success; - } - return true; + bool success = true; + GDVIRTUAL_CALL(_build, success); + return success; } void EditorPlugin::queue_save_layout() { @@ -849,12 +847,12 @@ ScriptCreateDialog *EditorPlugin::get_script_create_dialog() { return SceneTreeDock::get_singleton()->get_script_create_dialog(); } -void EditorPlugin::add_debugger_plugin(const Ref<Script> &p_script) { - EditorDebuggerNode::get_singleton()->add_debugger_plugin(p_script); +void EditorPlugin::add_debugger_plugin(const Ref<EditorDebuggerPlugin> &p_plugin) { + EditorDebuggerNode::get_singleton()->add_debugger_plugin(p_plugin); } -void EditorPlugin::remove_debugger_plugin(const Ref<Script> &p_script) { - EditorDebuggerNode::get_singleton()->remove_debugger_plugin(p_script); +void EditorPlugin::remove_debugger_plugin(const Ref<EditorDebuggerPlugin> &p_plugin) { + EditorDebuggerNode::get_singleton()->remove_debugger_plugin(p_plugin); } void EditorPlugin::_editor_project_settings_changed() { @@ -979,7 +977,7 @@ void EditorPlugin::_bind_methods() { } Ref<EditorUndoRedoManager> EditorPlugin::get_undo_redo() { - return undo_redo; + return EditorNode::get_undo_redo(); } EditorPluginCreateFunc EditorPlugins::creation_funcs[MAX_CREATE_FUNCS]; |