/**************************************************************************/ /* editor_interface.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* 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. */ /**************************************************************************/ #ifndef EDITOR_INTERFACE_H #define EDITOR_INTERFACE_H #include "core/io/resource.h" #include "core/object/class_db.h" #include "core/object/object.h" #include "core/object/script_language.h" class Control; class CreateDialog; class EditorCommandPalette; class EditorFileSystem; class EditorInspector; class EditorPaths; class EditorPlugin; class EditorResourcePreview; class EditorSelection; class EditorSettings; class EditorToaster; class EditorUndoRedoManager; class FileSystemDock; class Mesh; class Node; class PropertySelector; class SceneTreeDialog; class ScriptEditor; class SubViewport; class Texture2D; class Theme; class VBoxContainer; class Window; class EditorInterface : public Object { GDCLASS(EditorInterface, Object); static EditorInterface *singleton; // Editor dialogs. PropertySelector *property_selector = nullptr; PropertySelector *method_selector = nullptr; SceneTreeDialog *node_selector = nullptr; CreateDialog *create_dialog = nullptr; void _node_selected(const NodePath &p_node_paths, const Callable &p_callback); void _property_selected(const String &p_property_name, const Callable &p_callback); void _method_selected(const String &p_property_name, const Callable &p_callback); void _quick_open(const String &p_file_path, const Callable &p_callback); void _create_dialog_item_selected(bool p_is_canceled, const Callable &p_callback); void _call_dialog_callback(const Callable &p_callback, const Variant &p_selected, const String &p_context); // Editor tools. TypedArray _make_mesh_previews(const TypedArray &p_meshes, int p_preview_size); AABB _calculate_aabb_for_scene(Node *p_node, AABB &p_scene_aabb); protected: static void _bind_methods(); #ifndef DISABLE_DEPRECATED void _popup_node_selector_bind_compat_94323(const Callable &p_callback, const TypedArray &p_valid_types = TypedArray()); void _popup_property_selector_bind_compat_94323(Object *p_object, const Callable &p_callback, const PackedInt32Array &p_type_filter = PackedInt32Array()); static void _bind_compatibility_methods(); #endif public: static EditorInterface *get_singleton() { return singleton; } void restart_editor(bool p_save = true); // Editor tools. EditorCommandPalette *get_command_palette() const; EditorFileSystem *get_resource_file_system() const; EditorPaths *get_editor_paths() const; EditorResourcePreview *get_resource_previewer() const; EditorSelection *get_selection() const; Ref get_editor_settings() const; EditorToaster *get_editor_toaster() const; EditorUndoRedoManager *get_editor_undo_redo() const; Vector> make_mesh_previews(const Vector> &p_meshes, Vector *p_transforms, int p_preview_size); void make_scene_preview(const String &p_path, Node *p_scene, int p_preview_size); void set_plugin_enabled(const String &p_plugin, bool p_enabled); bool is_plugin_enabled(const String &p_plugin) const; // Editor GUI. Ref get_editor_theme() const; Control *get_base_control() const; VBoxContainer *get_editor_main_screen() const; ScriptEditor *get_script_editor() const; SubViewport *get_editor_viewport_2d() const; SubViewport *get_editor_viewport_3d(int p_idx = 0) const; void set_main_screen_editor(const String &p_name); void set_distraction_free_mode(bool p_enter); bool is_distraction_free_mode_enabled() const; bool is_multi_window_enabled() const; float get_editor_scale() const; void popup_dialog(Window *p_dialog, const Rect2i &p_screen_rect = Rect2i()); void popup_dialog_centered(Window *p_dialog, const Size2i &p_minsize = Size2i()); void popup_dialog_centered_ratio(Window *p_dialog, float p_ratio = 0.8); void popup_dialog_centered_clamped(Window *p_dialog, const Size2i &p_size = Size2i(), float p_fallback_ratio = 0.75); String get_current_feature_profile() const; void set_current_feature_profile(const String &p_profile_name); // Editor dialogs. void popup_node_selector(const Callable &p_callback, const TypedArray &p_valid_types = TypedArray(), Node *p_current_value = nullptr); // Must use Vector because exposing Vector is not supported. void popup_property_selector(Object *p_object, const Callable &p_callback, const PackedInt32Array &p_type_filter = PackedInt32Array(), const String &p_current_value = String()); void popup_method_selector(Object *p_object, const Callable &p_callback, const String &p_current_value = String()); void popup_quick_open(const Callable &p_callback, const TypedArray &p_base_types = TypedArray()); void popup_create_dialog(const Callable &p_callback, const StringName &p_base_type = "", const String &p_current_type = "", const String &p_dialog_title = "", const TypedArray &p_custom_type_blocklist = TypedArray(), const Dictionary &p_custom_suffix = Dictionary()); // Editor docks. FileSystemDock *get_file_system_dock() const; void select_file(const String &p_file); Vector get_selected_paths() const; String get_current_path() const; String get_current_directory() const; EditorInspector *get_inspector() const; // Object/Resource/Node editing. void inspect_object(Object *p_obj, const String &p_for_property = String(), bool p_inspector_only = false); void edit_resource(const Ref &p_resource); void edit_node(Node *p_node); void edit_script(const Ref