2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* editor_plugin.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
2022-01-03 21:27:34 +01:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 02:10:30 +01: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. */
|
|
|
|
/*************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "editor_plugin.h"
|
2017-01-16 08:04:19 +01:00
|
|
|
|
2022-11-11 20:12:48 +01:00
|
|
|
#include "editor/debugger/editor_debugger_node.h"
|
2021-08-17 17:48:30 +02:00
|
|
|
#include "editor/editor_command_palette.h"
|
2017-03-05 14:21:25 +01:00
|
|
|
#include "editor/editor_node.h"
|
2021-05-25 02:25:11 +02:00
|
|
|
#include "editor/editor_paths.h"
|
2022-02-12 02:46:22 +01:00
|
|
|
#include "editor/editor_resource_preview.h"
|
2017-03-05 14:21:25 +01:00
|
|
|
#include "editor/editor_settings.h"
|
2022-11-11 20:12:48 +01:00
|
|
|
#include "editor/editor_translation_parser.h"
|
2022-03-25 18:06:46 +01:00
|
|
|
#include "editor/editor_undo_redo_manager.h"
|
2022-07-17 19:24:37 +02:00
|
|
|
#include "editor/export/editor_export.h"
|
2019-12-24 08:17:23 +01:00
|
|
|
#include "editor/filesystem_dock.h"
|
2022-11-11 20:12:48 +01:00
|
|
|
#include "editor/import/editor_import_plugin.h"
|
|
|
|
#include "editor/import/resource_importer_scene.h"
|
2022-02-14 14:00:03 +01:00
|
|
|
#include "editor/plugins/canvas_item_editor_plugin.h"
|
2022-10-03 15:21:25 +02:00
|
|
|
#include "editor/plugins/editor_debugger_plugin.h"
|
2022-02-14 14:00:03 +01:00
|
|
|
#include "editor/plugins/node_3d_editor_plugin.h"
|
|
|
|
#include "editor/plugins/script_editor_plugin.h"
|
2019-12-24 08:17:23 +01:00
|
|
|
#include "editor/project_settings_editor.h"
|
2022-02-12 02:46:22 +01:00
|
|
|
#include "editor/scene_tree_dock.h"
|
2017-08-28 05:03:34 +02:00
|
|
|
#include "main/main.h"
|
2020-03-26 22:49:16 +01:00
|
|
|
#include "scene/3d/camera_3d.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "scene/gui/popup_menu.h"
|
2020-03-27 19:21:27 +01:00
|
|
|
#include "servers/rendering_server.h"
|
2018-09-26 17:38:02 +02:00
|
|
|
|
2022-08-31 19:24:04 +02:00
|
|
|
TypedArray<Texture2D> EditorInterface::_make_mesh_previews(const TypedArray<Mesh> &p_meshes, int p_preview_size) {
|
2020-03-17 07:33:00 +01:00
|
|
|
Vector<Ref<Mesh>> meshes;
|
2017-08-28 05:03:34 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < p_meshes.size(); i++) {
|
|
|
|
meshes.push_back(p_meshes[i]);
|
|
|
|
}
|
|
|
|
|
2020-04-02 01:20:12 +02:00
|
|
|
Vector<Ref<Texture2D>> textures = make_mesh_previews(meshes, nullptr, p_preview_size);
|
2022-08-05 03:41:48 +02:00
|
|
|
TypedArray<Texture2D> ret;
|
2017-08-28 05:03:34 +02:00
|
|
|
for (int i = 0; i < textures.size(); i++) {
|
|
|
|
ret.push_back(textures[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-10-17 07:08:21 +02:00
|
|
|
Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>> &p_meshes, Vector<Transform3D> *p_transforms, int p_preview_size) {
|
2017-08-28 05:03:34 +02:00
|
|
|
int size = p_preview_size;
|
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RID scenario = RS::get_singleton()->scenario_create();
|
2017-08-28 05:03:34 +02:00
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RID viewport = RS::get_singleton()->viewport_create();
|
|
|
|
RS::get_singleton()->viewport_set_update_mode(viewport, RS::VIEWPORT_UPDATE_ALWAYS);
|
|
|
|
RS::get_singleton()->viewport_set_scenario(viewport, scenario);
|
|
|
|
RS::get_singleton()->viewport_set_size(viewport, size, size);
|
|
|
|
RS::get_singleton()->viewport_set_transparent_background(viewport, true);
|
|
|
|
RS::get_singleton()->viewport_set_active(viewport, true);
|
|
|
|
RID viewport_texture = RS::get_singleton()->viewport_get_texture(viewport);
|
2017-08-28 05:03:34 +02:00
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RID camera = RS::get_singleton()->camera_create();
|
|
|
|
RS::get_singleton()->viewport_attach_camera(viewport, camera);
|
2017-08-28 05:03:34 +02:00
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RID light = RS::get_singleton()->directional_light_create();
|
|
|
|
RID light_instance = RS::get_singleton()->instance_create2(light, scenario);
|
2017-08-28 05:03:34 +02:00
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RID light2 = RS::get_singleton()->directional_light_create();
|
|
|
|
RS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
|
|
|
RID light_instance2 = RS::get_singleton()->instance_create2(light2, scenario);
|
2017-08-28 05:03:34 +02:00
|
|
|
|
|
|
|
EditorProgress ep("mlib", TTR("Creating Mesh Previews"), p_meshes.size());
|
|
|
|
|
2020-03-17 07:33:00 +01:00
|
|
|
Vector<Ref<Texture2D>> textures;
|
2017-08-28 05:03:34 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < p_meshes.size(); i++) {
|
|
|
|
Ref<Mesh> mesh = p_meshes[i];
|
|
|
|
if (!mesh.is_valid()) {
|
2019-06-11 20:43:37 +02:00
|
|
|
textures.push_back(Ref<Texture2D>());
|
2017-08-28 05:03:34 +02:00
|
|
|
continue;
|
|
|
|
}
|
2019-01-31 18:04:36 +01:00
|
|
|
|
2020-10-17 07:08:21 +02:00
|
|
|
Transform3D mesh_xform;
|
2020-04-02 01:20:12 +02:00
|
|
|
if (p_transforms != nullptr) {
|
2019-01-31 18:04:36 +01:00
|
|
|
mesh_xform = (*p_transforms)[i];
|
|
|
|
}
|
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RID inst = RS::get_singleton()->instance_create2(mesh->get_rid(), scenario);
|
|
|
|
RS::get_singleton()->instance_set_transform(inst, mesh_xform);
|
2019-01-31 18:04:36 +01:00
|
|
|
|
2017-11-17 03:09:00 +01:00
|
|
|
AABB aabb = mesh->get_aabb();
|
2021-09-20 20:48:52 +02:00
|
|
|
Vector3 ofs = aabb.get_center();
|
2017-08-28 05:03:34 +02:00
|
|
|
aabb.position -= ofs;
|
2020-10-17 07:08:21 +02:00
|
|
|
Transform3D xform;
|
2019-01-31 18:04:36 +01:00
|
|
|
xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI / 6);
|
|
|
|
xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI / 6) * xform.basis;
|
2017-11-17 03:09:00 +01:00
|
|
|
AABB rot_aabb = xform.xform(aabb);
|
2017-08-28 05:03:34 +02:00
|
|
|
float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5;
|
2017-09-29 03:07:27 +02:00
|
|
|
if (m == 0) {
|
2019-06-11 20:43:37 +02:00
|
|
|
textures.push_back(Ref<Texture2D>());
|
2017-08-28 05:03:34 +02:00
|
|
|
continue;
|
2017-09-29 03:07:27 +02:00
|
|
|
}
|
2017-08-28 05:03:34 +02:00
|
|
|
xform.origin = -xform.basis.xform(ofs); //-ofs*m;
|
|
|
|
xform.origin.z -= rot_aabb.size.z * 2;
|
2019-01-31 18:04:36 +01:00
|
|
|
xform.invert();
|
|
|
|
xform = mesh_xform * xform;
|
|
|
|
|
2020-10-17 07:08:21 +02:00
|
|
|
RS::get_singleton()->camera_set_transform(camera, xform * Transform3D(Basis(), Vector3(0, 0, 3)));
|
2020-03-27 19:21:27 +01:00
|
|
|
RS::get_singleton()->camera_set_orthogonal(camera, m * 2, 0.01, 1000.0);
|
2019-01-31 18:04:36 +01:00
|
|
|
|
2020-10-17 07:08:21 +02:00
|
|
|
RS::get_singleton()->instance_set_transform(light_instance, xform * Transform3D().looking_at(Vector3(-2, -1, -1), Vector3(0, 1, 0)));
|
|
|
|
RS::get_singleton()->instance_set_transform(light_instance2, xform * Transform3D().looking_at(Vector3(+1, -1, -2), Vector3(0, 1, 0)));
|
2019-01-31 18:04:36 +01:00
|
|
|
|
2018-04-22 19:36:01 +02:00
|
|
|
ep.step(TTR("Thumbnail..."), i);
|
2017-08-28 05:03:34 +02:00
|
|
|
Main::iteration();
|
|
|
|
Main::iteration();
|
2020-03-27 19:21:27 +01:00
|
|
|
Ref<Image> img = RS::get_singleton()->texture_2d_get(viewport_texture);
|
2020-12-15 13:04:21 +01:00
|
|
|
ERR_CONTINUE(!img.is_valid() || img->is_empty());
|
2022-05-04 01:49:20 +02:00
|
|
|
Ref<ImageTexture> it = ImageTexture::create_from_image(img);
|
2017-08-28 05:03:34 +02:00
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RS::get_singleton()->free(inst);
|
2017-08-28 05:03:34 +02:00
|
|
|
|
|
|
|
textures.push_back(it);
|
|
|
|
}
|
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
RS::get_singleton()->free(viewport);
|
|
|
|
RS::get_singleton()->free(light);
|
|
|
|
RS::get_singleton()->free(light_instance);
|
|
|
|
RS::get_singleton()->free(light2);
|
|
|
|
RS::get_singleton()->free(light_instance2);
|
|
|
|
RS::get_singleton()->free(camera);
|
|
|
|
RS::get_singleton()->free(scenario);
|
2017-08-28 05:03:34 +02:00
|
|
|
|
|
|
|
return textures;
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2019-08-05 19:57:23 +02:00
|
|
|
void EditorInterface::set_main_screen_editor(const String &p_name) {
|
|
|
|
EditorNode::get_singleton()->select_editor_by_name(p_name);
|
|
|
|
}
|
|
|
|
|
2022-09-07 01:30:54 +02:00
|
|
|
VBoxContainer *EditorInterface::get_editor_main_screen() {
|
|
|
|
return EditorNode::get_singleton()->get_main_screen_control();
|
2017-08-26 15:32:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorInterface::edit_resource(const Ref<Resource> &p_resource) {
|
|
|
|
EditorNode::get_singleton()->edit_resource(p_resource);
|
|
|
|
}
|
|
|
|
|
2021-04-07 22:08:41 +02:00
|
|
|
void EditorInterface::edit_node(Node *p_node) {
|
|
|
|
EditorNode::get_singleton()->edit_node(p_node);
|
|
|
|
}
|
|
|
|
|
2021-12-07 21:00:26 +01:00
|
|
|
void EditorInterface::edit_script(const Ref<Script> &p_script, int p_line, int p_col, bool p_grab_focus) {
|
|
|
|
ScriptEditor::get_singleton()->edit(p_script, p_line, p_col, p_grab_focus);
|
|
|
|
}
|
|
|
|
|
2017-08-26 15:32:15 +02:00
|
|
|
void EditorInterface::open_scene_from_path(const String &scene_path) {
|
|
|
|
if (EditorNode::get_singleton()->is_changing_scene()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorNode::get_singleton()->open_request(scene_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorInterface::reload_scene_from_path(const String &scene_path) {
|
|
|
|
if (EditorNode::get_singleton()->is_changing_scene()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorNode::get_singleton()->reload_scene(scene_path);
|
|
|
|
}
|
|
|
|
|
2020-04-05 16:19:24 +02:00
|
|
|
void EditorInterface::play_main_scene() {
|
|
|
|
EditorNode::get_singleton()->run_play();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorInterface::play_current_scene() {
|
|
|
|
EditorNode::get_singleton()->run_play_current();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorInterface::play_custom_scene(const String &scene_path) {
|
|
|
|
EditorNode::get_singleton()->run_play_custom(scene_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorInterface::stop_playing_scene() {
|
|
|
|
EditorNode::get_singleton()->run_stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorInterface::is_playing_scene() const {
|
|
|
|
return EditorNode::get_singleton()->is_run_playing();
|
|
|
|
}
|
|
|
|
|
|
|
|
String EditorInterface::get_playing_scene() const {
|
|
|
|
return EditorNode::get_singleton()->get_run_playing_scene();
|
|
|
|
}
|
|
|
|
|
2017-08-26 15:32:15 +02:00
|
|
|
Node *EditorInterface::get_edited_scene_root() {
|
|
|
|
return EditorNode::get_singleton()->get_edited_scene();
|
|
|
|
}
|
|
|
|
|
2022-08-05 03:41:48 +02:00
|
|
|
PackedStringArray EditorInterface::get_open_scenes() const {
|
|
|
|
PackedStringArray ret;
|
2019-06-26 15:08:25 +02:00
|
|
|
Vector<EditorData::EditedScene> scenes = EditorNode::get_editor_data().get_edited_scenes();
|
2017-08-26 15:32:15 +02:00
|
|
|
|
|
|
|
int scns_amount = scenes.size();
|
|
|
|
for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) {
|
2020-05-14 16:41:43 +02:00
|
|
|
if (scenes[idx_scn].root == nullptr) {
|
2017-08-26 15:32:15 +02:00
|
|
|
continue;
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2021-09-30 16:30:55 +02:00
|
|
|
ret.push_back(scenes[idx_scn].root->get_scene_file_path());
|
2017-08-26 15:32:15 +02:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScriptEditor *EditorInterface::get_script_editor() {
|
|
|
|
return ScriptEditor::get_singleton();
|
|
|
|
}
|
|
|
|
|
2017-12-20 21:44:16 +01:00
|
|
|
void EditorInterface::select_file(const String &p_file) {
|
2021-11-17 21:08:55 +01:00
|
|
|
FileSystemDock::get_singleton()->select_file(p_file);
|
2017-12-20 21:44:16 +01:00
|
|
|
}
|
|
|
|
|
2022-05-10 22:25:36 +02:00
|
|
|
Vector<String> EditorInterface::get_selected_paths() const {
|
|
|
|
return FileSystemDock::get_singleton()->get_selected_paths();
|
2017-12-20 21:44:16 +01:00
|
|
|
}
|
|
|
|
|
2019-09-01 07:51:33 +02:00
|
|
|
String EditorInterface::get_current_path() const {
|
2021-11-17 21:08:55 +01:00
|
|
|
return FileSystemDock::get_singleton()->get_current_path();
|
2019-09-01 07:51:33 +02:00
|
|
|
}
|
|
|
|
|
2022-05-10 22:25:36 +02:00
|
|
|
String EditorInterface::get_current_directory() const {
|
|
|
|
return FileSystemDock::get_singleton()->get_current_directory();
|
|
|
|
}
|
|
|
|
|
2020-09-16 21:27:19 +02:00
|
|
|
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);
|
2017-08-26 15:32:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
EditorFileSystem *EditorInterface::get_resource_file_system() {
|
|
|
|
return EditorFileSystem::get_singleton();
|
|
|
|
}
|
|
|
|
|
2020-03-17 01:40:15 +01:00
|
|
|
FileSystemDock *EditorInterface::get_file_system_dock() {
|
2021-11-17 21:08:55 +01:00
|
|
|
return FileSystemDock::get_singleton();
|
2020-03-17 01:40:15 +01:00
|
|
|
}
|
|
|
|
|
2017-08-26 15:32:15 +02:00
|
|
|
EditorSelection *EditorInterface::get_selection() {
|
|
|
|
return EditorNode::get_singleton()->get_editor_selection();
|
|
|
|
}
|
|
|
|
|
2019-07-03 09:49:46 +02:00
|
|
|
Ref<EditorSettings> EditorInterface::get_editor_settings() {
|
2017-08-26 15:32:15 +02:00
|
|
|
return EditorSettings::get_singleton();
|
|
|
|
}
|
2021-05-25 02:25:11 +02:00
|
|
|
EditorPaths *EditorInterface::get_editor_paths() {
|
|
|
|
return EditorPaths::get_singleton();
|
|
|
|
}
|
2017-08-26 15:32:15 +02:00
|
|
|
|
|
|
|
EditorResourcePreview *EditorInterface::get_resource_previewer() {
|
|
|
|
return EditorResourcePreview::get_singleton();
|
|
|
|
}
|
|
|
|
|
|
|
|
Control *EditorInterface::get_base_control() {
|
|
|
|
return EditorNode::get_singleton()->get_gui_base();
|
|
|
|
}
|
|
|
|
|
2021-04-04 16:08:25 +02:00
|
|
|
float EditorInterface::get_editor_scale() const {
|
|
|
|
return EDSCALE;
|
|
|
|
}
|
|
|
|
|
2018-01-30 23:11:07 +01:00
|
|
|
void EditorInterface::set_plugin_enabled(const String &p_plugin, bool p_enabled) {
|
2019-09-01 09:03:47 +02:00
|
|
|
EditorNode::get_singleton()->set_addon_plugin_enabled(p_plugin, p_enabled, true);
|
2018-01-30 23:11:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorInterface::is_plugin_enabled(const String &p_plugin) const {
|
|
|
|
return EditorNode::get_singleton()->is_addon_plugin_enabled(p_plugin);
|
|
|
|
}
|
|
|
|
|
2022-06-26 02:23:59 +02:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2019-03-12 07:43:48 +01:00
|
|
|
EditorInspector *EditorInterface::get_inspector() const {
|
2021-11-17 21:08:55 +01:00
|
|
|
return InspectorDock::get_inspector_singleton();
|
2019-03-12 07:43:48 +01:00
|
|
|
}
|
|
|
|
|
2017-08-26 15:32:15 +02:00
|
|
|
Error EditorInterface::save_scene() {
|
2020-05-14 16:41:43 +02:00
|
|
|
if (!get_edited_scene_root()) {
|
2017-08-26 15:32:15 +02:00
|
|
|
return ERR_CANT_CREATE;
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2021-12-09 10:42:46 +01:00
|
|
|
if (get_edited_scene_root()->get_scene_file_path().is_empty()) {
|
2017-08-26 15:32:15 +02:00
|
|
|
return ERR_CANT_CREATE;
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2017-08-26 15:32:15 +02:00
|
|
|
|
2021-09-30 16:30:55 +02:00
|
|
|
save_scene_as(get_edited_scene_root()->get_scene_file_path());
|
2017-08-26 15:32:15 +02:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorInterface::save_scene_as(const String &p_scene, bool p_with_preview) {
|
|
|
|
EditorNode::get_singleton()->save_scene_to_path(p_scene, p_with_preview);
|
|
|
|
}
|
|
|
|
|
2019-08-05 19:57:23 +02:00
|
|
|
void EditorInterface::set_distraction_free_mode(bool p_enter) {
|
|
|
|
EditorNode::get_singleton()->set_distraction_free_mode(p_enter);
|
|
|
|
}
|
|
|
|
|
2022-08-19 01:46:31 +02:00
|
|
|
void EditorInterface::restart_editor(bool p_save) {
|
|
|
|
if (p_save) {
|
|
|
|
EditorNode::get_singleton()->save_all_scenes();
|
|
|
|
}
|
|
|
|
EditorNode::get_singleton()->restart_editor();
|
|
|
|
}
|
|
|
|
|
2020-05-31 19:58:15 +02:00
|
|
|
bool EditorInterface::is_distraction_free_mode_enabled() const {
|
|
|
|
return EditorNode::get_singleton()->is_distraction_free_mode_enabled();
|
|
|
|
}
|
|
|
|
|
2021-05-29 15:28:16 +02:00
|
|
|
EditorCommandPalette *EditorInterface::get_command_palette() const {
|
2021-08-11 12:21:31 +02:00
|
|
|
return EditorCommandPalette::get_singleton();
|
2021-05-29 15:28:16 +02:00
|
|
|
}
|
|
|
|
|
2020-04-02 01:20:12 +02:00
|
|
|
EditorInterface *EditorInterface::singleton = nullptr;
|
2017-08-26 15:32:15 +02:00
|
|
|
|
|
|
|
void EditorInterface::_bind_methods() {
|
2020-09-16 21:27:19 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("inspect_object", "object", "for_property", "inspector_only"), &EditorInterface::inspect_object, DEFVAL(String()), DEFVAL(false));
|
2017-08-26 15:32:15 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_selection"), &EditorInterface::get_selection);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_editor_settings"), &EditorInterface::get_editor_settings);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_script_editor"), &EditorInterface::get_script_editor);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_base_control"), &EditorInterface::get_base_control);
|
2021-04-04 16:08:25 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_editor_scale"), &EditorInterface::get_editor_scale);
|
2017-08-26 15:32:15 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("edit_resource", "resource"), &EditorInterface::edit_resource);
|
2021-04-07 22:08:41 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("edit_node", "node"), &EditorInterface::edit_node);
|
2021-12-07 21:00:26 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("edit_script", "script", "line", "column", "grab_focus"), &EditorInterface::edit_script, DEFVAL(-1), DEFVAL(0), DEFVAL(true));
|
2017-08-26 15:32:15 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorInterface::open_scene_from_path);
|
|
|
|
ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorInterface::reload_scene_from_path);
|
2020-04-05 16:19:24 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("play_main_scene"), &EditorInterface::play_main_scene);
|
|
|
|
ClassDB::bind_method(D_METHOD("play_current_scene"), &EditorInterface::play_current_scene);
|
|
|
|
ClassDB::bind_method(D_METHOD("play_custom_scene", "scene_filepath"), &EditorInterface::play_custom_scene);
|
|
|
|
ClassDB::bind_method(D_METHOD("stop_playing_scene"), &EditorInterface::stop_playing_scene);
|
|
|
|
ClassDB::bind_method(D_METHOD("is_playing_scene"), &EditorInterface::is_playing_scene);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_playing_scene"), &EditorInterface::get_playing_scene);
|
2017-08-26 15:32:15 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_open_scenes"), &EditorInterface::get_open_scenes);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &EditorInterface::get_edited_scene_root);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_resource_previewer"), &EditorInterface::get_resource_previewer);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_resource_filesystem"), &EditorInterface::get_resource_file_system);
|
2022-09-07 01:30:54 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_editor_main_screen"), &EditorInterface::get_editor_main_screen);
|
2017-10-11 20:00:01 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("make_mesh_previews", "meshes", "preview_size"), &EditorInterface::_make_mesh_previews);
|
2018-12-27 11:10:09 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("select_file", "file"), &EditorInterface::select_file);
|
2022-05-10 22:25:36 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_selected_paths"), &EditorInterface::get_selected_paths);
|
2019-09-01 07:51:33 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_current_path"), &EditorInterface::get_current_path);
|
2022-05-10 22:25:36 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_current_directory"), &EditorInterface::get_current_directory);
|
2020-03-17 01:40:15 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_file_system_dock"), &EditorInterface::get_file_system_dock);
|
2021-05-25 02:25:11 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_editor_paths"), &EditorInterface::get_editor_paths);
|
2021-05-29 15:28:16 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_command_palette"), &EditorInterface::get_command_palette);
|
2017-08-26 15:32:15 +02:00
|
|
|
|
2018-01-30 23:11:07 +01:00
|
|
|
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);
|
|
|
|
|
2022-06-26 02:23:59 +02:00
|
|
|
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);
|
|
|
|
|
2019-03-12 07:43:48 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_inspector"), &EditorInterface::get_inspector);
|
|
|
|
|
2017-08-26 15:32:15 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("save_scene"), &EditorInterface::save_scene);
|
|
|
|
ClassDB::bind_method(D_METHOD("save_scene_as", "path", "with_preview"), &EditorInterface::save_scene_as, DEFVAL(true));
|
2022-08-19 01:46:31 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("restart_editor", "save"), &EditorInterface::restart_editor, DEFVAL(true));
|
2019-08-05 19:57:23 +02:00
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("set_main_screen_editor", "name"), &EditorInterface::set_main_screen_editor);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_distraction_free_mode", "enter"), &EditorInterface::set_distraction_free_mode);
|
2020-05-31 19:58:15 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("is_distraction_free_mode_enabled"), &EditorInterface::is_distraction_free_mode_enabled);
|
|
|
|
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "distraction_free_mode"), "set_distraction_free_mode", "is_distraction_free_mode_enabled");
|
2017-08-26 15:32:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
EditorInterface::EditorInterface() {
|
|
|
|
singleton = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////
|
2019-06-11 20:43:37 +02:00
|
|
|
void EditorPlugin::add_custom_type(const String &p_type, const String &p_base, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon) {
|
2017-03-05 16:44:50 +01:00
|
|
|
EditorNode::get_editor_data().add_custom_type(p_type, p_base, p_script, p_icon);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorPlugin::remove_custom_type(const String &p_type) {
|
2014-02-10 02:10:30 +01:00
|
|
|
EditorNode::get_editor_data().remove_custom_type(p_type);
|
|
|
|
}
|
|
|
|
|
2018-02-14 05:31:38 +01:00
|
|
|
void EditorPlugin::add_autoload_singleton(const String &p_name, const String &p_path) {
|
|
|
|
EditorNode::get_singleton()->get_project_settings()->get_autoload_settings()->autoload_add(p_name, p_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::remove_autoload_singleton(const String &p_name) {
|
|
|
|
EditorNode::get_singleton()->get_project_settings()->get_autoload_settings()->autoload_remove(p_name);
|
|
|
|
}
|
|
|
|
|
2020-06-19 20:49:04 +02:00
|
|
|
Button *EditorPlugin::add_control_to_bottom_panel(Control *p_control, const String &p_title) {
|
2020-04-02 01:20:12 +02:00
|
|
|
ERR_FAIL_NULL_V(p_control, nullptr);
|
2017-03-05 16:44:50 +01:00
|
|
|
return EditorNode::get_singleton()->add_bottom_panel_item(p_title, p_control);
|
2016-02-27 04:32:00 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorPlugin::add_control_to_dock(DockSlot p_slot, Control *p_control) {
|
2016-02-28 03:10:44 +01:00
|
|
|
ERR_FAIL_NULL(p_control);
|
2017-03-05 16:44:50 +01:00
|
|
|
EditorNode::get_singleton()->add_control_to_dock(EditorNode::DockSlot(p_slot), p_control);
|
2016-02-28 03:10:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::remove_control_from_docks(Control *p_control) {
|
|
|
|
ERR_FAIL_NULL(p_control);
|
|
|
|
EditorNode::get_singleton()->remove_control_from_dock(p_control);
|
|
|
|
}
|
2016-02-27 04:32:00 +01:00
|
|
|
|
2016-02-28 20:58:17 +01:00
|
|
|
void EditorPlugin::remove_control_from_bottom_panel(Control *p_control) {
|
|
|
|
ERR_FAIL_NULL(p_control);
|
|
|
|
EditorNode::get_singleton()->remove_bottom_panel_item(p_control);
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorPlugin::add_control_to_container(CustomControlContainer p_location, Control *p_control) {
|
2018-06-28 01:06:39 +02:00
|
|
|
ERR_FAIL_NULL(p_control);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
switch (p_location) {
|
2014-02-10 02:10:30 +01:00
|
|
|
case CONTAINER_TOOLBAR: {
|
|
|
|
EditorNode::get_menu_hb()->add_child(p_control);
|
|
|
|
} break;
|
2016-02-27 04:32:00 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
case CONTAINER_SPATIAL_EDITOR_MENU: {
|
2020-03-26 22:49:16 +01:00
|
|
|
Node3DEditor::get_singleton()->add_control_to_menu_panel(p_control);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
} break;
|
2018-08-21 06:35:48 +02:00
|
|
|
case CONTAINER_SPATIAL_EDITOR_SIDE_LEFT: {
|
2022-01-08 13:31:22 +01:00
|
|
|
Node3DEditor::get_singleton()->add_control_to_left_panel(p_control);
|
2018-08-21 06:35:48 +02:00
|
|
|
} break;
|
|
|
|
case CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT: {
|
2022-01-08 13:31:22 +01:00
|
|
|
Node3DEditor::get_singleton()->add_control_to_right_panel(p_control);
|
2014-02-10 02:10:30 +01:00
|
|
|
} break;
|
|
|
|
case CONTAINER_SPATIAL_EDITOR_BOTTOM: {
|
2020-03-26 22:49:16 +01:00
|
|
|
Node3DEditor::get_singleton()->get_shader_split()->add_child(p_control);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
} break;
|
|
|
|
case CONTAINER_CANVAS_EDITOR_MENU: {
|
|
|
|
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(p_control);
|
|
|
|
|
|
|
|
} break;
|
2018-08-21 06:35:48 +02:00
|
|
|
case CONTAINER_CANVAS_EDITOR_SIDE_LEFT: {
|
2022-01-08 13:31:22 +01:00
|
|
|
CanvasItemEditor::get_singleton()->add_control_to_left_panel(p_control);
|
2018-08-21 06:35:48 +02:00
|
|
|
} break;
|
|
|
|
case CONTAINER_CANVAS_EDITOR_SIDE_RIGHT: {
|
2022-01-08 13:31:22 +01:00
|
|
|
CanvasItemEditor::get_singleton()->add_control_to_right_panel(p_control);
|
2015-01-12 00:52:42 +01:00
|
|
|
} break;
|
|
|
|
case CONTAINER_CANVAS_EDITOR_BOTTOM: {
|
|
|
|
CanvasItemEditor::get_singleton()->get_bottom_split()->add_child(p_control);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
} break;
|
2022-08-13 12:56:52 +02:00
|
|
|
case CONTAINER_INSPECTOR_BOTTOM: {
|
2021-11-17 21:08:55 +01:00
|
|
|
InspectorDock::get_singleton()->get_addon_area()->add_child(p_control);
|
2016-05-23 22:10:26 +02:00
|
|
|
|
|
|
|
} break;
|
2019-05-27 22:33:52 +02:00
|
|
|
case CONTAINER_PROJECT_SETTING_TAB_LEFT: {
|
|
|
|
ProjectSettingsEditor::get_singleton()->get_tabs()->add_child(p_control);
|
|
|
|
ProjectSettingsEditor::get_singleton()->get_tabs()->move_child(p_control, 0);
|
|
|
|
|
|
|
|
} break;
|
|
|
|
case CONTAINER_PROJECT_SETTING_TAB_RIGHT: {
|
|
|
|
ProjectSettingsEditor::get_singleton()->get_tabs()->add_child(p_control);
|
|
|
|
ProjectSettingsEditor::get_singleton()->get_tabs()->move_child(p_control, 1);
|
|
|
|
|
|
|
|
} break;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-13 22:21:19 +01:00
|
|
|
void EditorPlugin::remove_control_from_container(CustomControlContainer p_location, Control *p_control) {
|
2018-06-28 01:06:39 +02:00
|
|
|
ERR_FAIL_NULL(p_control);
|
2018-02-13 22:21:19 +01:00
|
|
|
|
|
|
|
switch (p_location) {
|
|
|
|
case CONTAINER_TOOLBAR: {
|
|
|
|
EditorNode::get_menu_hb()->remove_child(p_control);
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case CONTAINER_SPATIAL_EDITOR_MENU: {
|
2020-03-26 22:49:16 +01:00
|
|
|
Node3DEditor::get_singleton()->remove_control_from_menu_panel(p_control);
|
2018-02-13 22:21:19 +01:00
|
|
|
|
|
|
|
} break;
|
2022-01-08 13:31:22 +01:00
|
|
|
case CONTAINER_SPATIAL_EDITOR_SIDE_LEFT: {
|
|
|
|
Node3DEditor::get_singleton()->remove_control_from_left_panel(p_control);
|
|
|
|
} break;
|
2018-08-21 06:35:48 +02:00
|
|
|
case CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT: {
|
2022-01-08 13:31:22 +01:00
|
|
|
Node3DEditor::get_singleton()->remove_control_from_right_panel(p_control);
|
2018-02-13 22:21:19 +01:00
|
|
|
} break;
|
|
|
|
case CONTAINER_SPATIAL_EDITOR_BOTTOM: {
|
2020-03-26 22:49:16 +01:00
|
|
|
Node3DEditor::get_singleton()->get_shader_split()->remove_child(p_control);
|
2018-02-13 22:21:19 +01:00
|
|
|
|
|
|
|
} break;
|
|
|
|
case CONTAINER_CANVAS_EDITOR_MENU: {
|
|
|
|
CanvasItemEditor::get_singleton()->remove_control_from_menu_panel(p_control);
|
|
|
|
|
|
|
|
} break;
|
2022-01-08 13:31:22 +01:00
|
|
|
case CONTAINER_CANVAS_EDITOR_SIDE_LEFT: {
|
|
|
|
CanvasItemEditor::get_singleton()->remove_control_from_left_panel(p_control);
|
|
|
|
} break;
|
2018-08-21 06:35:48 +02:00
|
|
|
case CONTAINER_CANVAS_EDITOR_SIDE_RIGHT: {
|
2022-01-08 13:31:22 +01:00
|
|
|
CanvasItemEditor::get_singleton()->remove_control_from_right_panel(p_control);
|
2018-02-13 22:21:19 +01:00
|
|
|
} break;
|
|
|
|
case CONTAINER_CANVAS_EDITOR_BOTTOM: {
|
|
|
|
CanvasItemEditor::get_singleton()->get_bottom_split()->remove_child(p_control);
|
|
|
|
|
|
|
|
} break;
|
2022-08-13 12:56:52 +02:00
|
|
|
case CONTAINER_INSPECTOR_BOTTOM: {
|
2021-11-17 21:08:55 +01:00
|
|
|
InspectorDock::get_singleton()->get_addon_area()->remove_child(p_control);
|
2018-02-13 22:21:19 +01:00
|
|
|
|
|
|
|
} break;
|
2019-05-27 22:33:52 +02:00
|
|
|
case CONTAINER_PROJECT_SETTING_TAB_LEFT:
|
|
|
|
case CONTAINER_PROJECT_SETTING_TAB_RIGHT: {
|
|
|
|
ProjectSettingsEditor::get_singleton()->get_tabs()->remove_child(p_control);
|
|
|
|
|
|
|
|
} break;
|
2018-02-13 22:21:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-16 00:04:21 +01:00
|
|
|
void EditorPlugin::add_tool_menu_item(const String &p_name, const Callable &p_callable) {
|
|
|
|
EditorNode::get_singleton()->add_tool_menu_item(p_name, p_callable);
|
2016-08-07 16:01:22 +02:00
|
|
|
}
|
|
|
|
|
2022-01-28 15:06:54 +01:00
|
|
|
void EditorPlugin::add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu) {
|
2016-08-07 16:01:22 +02:00
|
|
|
ERR_FAIL_NULL(p_submenu);
|
2022-01-28 15:06:54 +01:00
|
|
|
EditorNode::get_singleton()->add_tool_submenu_item(p_name, p_submenu);
|
2016-08-07 16:01:22 +02:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorPlugin::remove_tool_menu_item(const String &p_name) {
|
2018-03-17 02:50:35 +01:00
|
|
|
EditorNode::get_singleton()->remove_tool_menu_item(p_name);
|
2016-08-07 16:01:22 +02:00
|
|
|
}
|
|
|
|
|
2022-04-06 14:41:04 +02:00
|
|
|
PopupMenu *EditorPlugin::get_export_as_menu() {
|
|
|
|
return EditorNode::get_singleton()->get_export_as_menu();
|
|
|
|
}
|
|
|
|
|
2017-06-08 19:57:35 +02:00
|
|
|
void EditorPlugin::set_input_event_forwarding_always_enabled() {
|
|
|
|
input_event_forwarding_always_enabled = true;
|
|
|
|
EditorPluginList *always_input_forwarding_list = EditorNode::get_singleton()->get_editor_plugins_force_input_forwarding();
|
|
|
|
always_input_forwarding_list->add_plugin(this);
|
|
|
|
}
|
|
|
|
|
2017-10-29 20:32:09 +01:00
|
|
|
void EditorPlugin::set_force_draw_over_forwarding_enabled() {
|
|
|
|
force_draw_over_forwarding_enabled = true;
|
|
|
|
EditorPluginList *always_draw_over_forwarding_list = EditorNode::get_singleton()->get_editor_plugins_force_over();
|
|
|
|
always_draw_over_forwarding_list->add_plugin(this);
|
|
|
|
}
|
|
|
|
|
2017-07-06 09:18:20 +02:00
|
|
|
void EditorPlugin::notify_scene_changed(const Node *scn_root) {
|
2021-07-17 23:22:52 +02:00
|
|
|
emit_signal(SNAME("scene_changed"), scn_root);
|
2017-07-06 09:18:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::notify_main_screen_changed(const String &screen_name) {
|
2020-05-14 16:41:43 +02:00
|
|
|
if (screen_name == last_main_screen_name) {
|
2017-07-06 09:18:20 +02:00
|
|
|
return;
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2017-07-06 09:18:20 +02:00
|
|
|
|
2021-07-17 23:22:52 +02:00
|
|
|
emit_signal(SNAME("main_screen_changed"), screen_name);
|
2017-07-06 09:18:20 +02:00
|
|
|
last_main_screen_name = screen_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::notify_scene_closed(const String &scene_filepath) {
|
2021-07-17 23:22:52 +02:00
|
|
|
emit_signal(SNAME("scene_closed"), scene_filepath);
|
2017-07-06 09:18:20 +02:00
|
|
|
}
|
|
|
|
|
2018-01-12 22:43:29 +01:00
|
|
|
void EditorPlugin::notify_resource_saved(const Ref<Resource> &p_resource) {
|
2021-07-17 23:22:52 +02:00
|
|
|
emit_signal(SNAME("resource_saved"), p_resource);
|
2018-01-12 22:43:29 +01:00
|
|
|
}
|
|
|
|
|
2017-10-15 22:33:25 +02:00
|
|
|
bool EditorPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) {
|
2022-09-29 11:53:28 +02:00
|
|
|
bool success = false;
|
2022-10-18 18:47:44 +02:00
|
|
|
GDVIRTUAL_CALL(_forward_canvas_gui_input, p_event, success);
|
|
|
|
return success;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2016-09-10 21:44:03 +02:00
|
|
|
|
2018-09-18 20:00:07 +02:00
|
|
|
void EditorPlugin::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_forward_canvas_draw_over_viewport, p_overlay);
|
2016-09-10 21:44:03 +02:00
|
|
|
}
|
|
|
|
|
2018-09-18 20:00:07 +02:00
|
|
|
void EditorPlugin::forward_canvas_force_draw_over_viewport(Control *p_overlay) {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_forward_canvas_force_draw_over_viewport, p_overlay);
|
2017-10-29 20:32:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the overlays of the 2D viewport or, if in 3D mode, of every 3D viewport.
|
|
|
|
int EditorPlugin::update_overlays() const {
|
2020-03-26 22:49:16 +01:00
|
|
|
if (Node3DEditor::get_singleton()->is_visible()) {
|
2017-10-29 20:32:09 +01:00
|
|
|
int count = 0;
|
2020-03-26 22:49:16 +01:00
|
|
|
for (uint32_t i = 0; i < Node3DEditor::VIEWPORTS_COUNT; i++) {
|
|
|
|
Node3DEditorViewport *vp = Node3DEditor::get_singleton()->get_editor_viewport(i);
|
2017-10-29 20:32:09 +01:00
|
|
|
if (vp->is_visible()) {
|
|
|
|
vp->update_surface();
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
} else {
|
|
|
|
// This will update the normal viewport itself as well
|
2022-08-13 23:21:24 +02:00
|
|
|
CanvasItemEditor::get_singleton()->get_viewport_control()->queue_redraw();
|
2017-10-29 20:32:09 +01:00
|
|
|
return 1;
|
|
|
|
}
|
2016-09-10 21:44:03 +02:00
|
|
|
}
|
|
|
|
|
2022-09-08 18:38:33 +02:00
|
|
|
EditorPlugin::AfterGUIInput EditorPlugin::forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event) {
|
2022-09-29 11:53:28 +02:00
|
|
|
int success = EditorPlugin::AFTER_GUI_INPUT_PASS;
|
2022-10-18 18:47:44 +02:00
|
|
|
GDVIRTUAL_CALL(_forward_3d_gui_input, p_camera, p_event, success);
|
|
|
|
return static_cast<EditorPlugin::AfterGUIInput>(success);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2018-09-18 20:00:07 +02:00
|
|
|
|
2022-09-08 18:38:33 +02:00
|
|
|
void EditorPlugin::forward_3d_draw_over_viewport(Control *p_overlay) {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_forward_3d_draw_over_viewport, p_overlay);
|
2018-09-18 20:00:07 +02:00
|
|
|
}
|
|
|
|
|
2022-09-08 18:38:33 +02:00
|
|
|
void EditorPlugin::forward_3d_force_draw_over_viewport(Control *p_overlay) {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_forward_3d_force_draw_over_viewport, p_overlay);
|
2018-09-18 20:00:07 +02:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
String EditorPlugin::get_name() const {
|
2021-08-22 03:52:44 +02:00
|
|
|
String name;
|
2022-10-18 18:47:44 +02:00
|
|
|
GDVIRTUAL_CALL(_get_plugin_name, name);
|
|
|
|
return name;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2019-06-11 20:43:37 +02:00
|
|
|
const Ref<Texture2D> EditorPlugin::get_icon() const {
|
2021-08-22 03:52:44 +02:00
|
|
|
Ref<Texture2D> icon;
|
2022-10-18 18:47:44 +02:00
|
|
|
GDVIRTUAL_CALL(_get_plugin_icon, icon);
|
|
|
|
return icon;
|
2017-12-06 23:27:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
bool EditorPlugin::has_main_screen() const {
|
2022-10-18 18:47:44 +02:00
|
|
|
bool success = false;
|
|
|
|
GDVIRTUAL_CALL(_has_main_screen, success);
|
|
|
|
return success;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void EditorPlugin::make_visible(bool p_visible) {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_make_visible, p_visible);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::edit(Object *p_object) {
|
2021-08-22 03:52:44 +02:00
|
|
|
if (p_object->is_class("Resource")) {
|
|
|
|
GDVIRTUAL_CALL(_edit, Ref<Resource>(Object::cast_to<Resource>(p_object)));
|
|
|
|
} else {
|
|
|
|
GDVIRTUAL_CALL(_edit, p_object);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorPlugin::handles(Object *p_object) const {
|
2022-09-29 11:53:28 +02:00
|
|
|
bool success = false;
|
2022-10-18 18:47:44 +02:00
|
|
|
GDVIRTUAL_CALL(_handles, p_object, success);
|
|
|
|
return success;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
Dictionary EditorPlugin::get_state() const {
|
2021-08-22 03:52:44 +02:00
|
|
|
Dictionary state;
|
2022-10-18 18:47:44 +02:00
|
|
|
GDVIRTUAL_CALL(_get_state, state);
|
|
|
|
return state;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorPlugin::set_state(const Dictionary &p_state) {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_set_state, p_state);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::clear() {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_clear);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2016-08-15 19:49:58 +02:00
|
|
|
// if editor references external resources/scenes, save them
|
|
|
|
void EditorPlugin::save_external_data() {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_save_external_data);
|
2016-08-15 19:49:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// if changes are pending in editor, apply them
|
2014-02-10 02:10:30 +01:00
|
|
|
void EditorPlugin::apply_changes() {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_apply_changes);
|
2016-08-15 19:49:58 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void EditorPlugin::get_breakpoints(List<String> *p_breakpoints) {
|
2021-08-22 03:52:44 +02:00
|
|
|
PackedStringArray arr;
|
|
|
|
if (GDVIRTUAL_CALL(_get_breakpoints, arr)) {
|
2020-05-14 16:41:43 +02:00
|
|
|
for (int i = 0; i < arr.size(); i++) {
|
2014-02-10 02:10:30 +01:00
|
|
|
p_breakpoints->push_back(arr[i]);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool EditorPlugin::get_remove_list(List<Node *> *p_list) {
|
2014-02-10 02:10:30 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::restore_global_state() {}
|
|
|
|
void EditorPlugin::save_global_state() {}
|
|
|
|
|
2021-04-28 17:39:57 +02:00
|
|
|
void EditorPlugin::add_undo_redo_inspector_hook_callback(Callable p_callable) {
|
|
|
|
EditorNode::get_singleton()->get_editor_data().add_undo_redo_inspector_hook_callback(p_callable);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::remove_undo_redo_inspector_hook_callback(Callable p_callable) {
|
|
|
|
EditorNode::get_singleton()->get_editor_data().remove_undo_redo_inspector_hook_callback(p_callable);
|
|
|
|
}
|
|
|
|
|
2020-06-23 13:48:59 +02:00
|
|
|
void EditorPlugin::add_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_parser.is_valid());
|
2020-06-23 13:48:59 +02:00
|
|
|
EditorTranslationParser::get_singleton()->add_parser(p_parser, EditorTranslationParser::CUSTOM);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::remove_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_parser.is_valid());
|
2020-06-23 13:48:59 +02:00
|
|
|
EditorTranslationParser::get_singleton()->remove_parser(p_parser, EditorTranslationParser::CUSTOM);
|
|
|
|
}
|
|
|
|
|
2022-02-07 09:38:42 +01:00
|
|
|
void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin> &p_importer, bool p_first_priority) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_importer.is_valid());
|
2022-02-07 09:38:42 +01:00
|
|
|
ResourceFormatImporter::get_singleton()->add_importer(p_importer, p_first_priority);
|
2021-07-17 23:22:52 +02:00
|
|
|
EditorFileSystem::get_singleton()->call_deferred(SNAME("scan"));
|
2017-04-09 00:37:31 +02:00
|
|
|
}
|
|
|
|
|
2017-06-11 11:18:22 +02:00
|
|
|
void EditorPlugin::remove_import_plugin(const Ref<EditorImportPlugin> &p_importer) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_importer.is_valid());
|
2017-06-11 11:18:22 +02:00
|
|
|
ResourceFormatImporter::get_singleton()->remove_importer(p_importer);
|
2021-07-17 23:22:52 +02:00
|
|
|
EditorFileSystem::get_singleton()->call_deferred(SNAME("scan"));
|
2017-06-11 11:18:22 +02:00
|
|
|
}
|
|
|
|
|
2017-09-15 00:38:38 +02:00
|
|
|
void EditorPlugin::add_export_plugin(const Ref<EditorExportPlugin> &p_exporter) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_exporter.is_valid());
|
2017-09-15 00:38:38 +02:00
|
|
|
EditorExport::get_singleton()->add_export_plugin(p_exporter);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin> &p_exporter) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_exporter.is_valid());
|
2017-09-15 00:38:38 +02:00
|
|
|
EditorExport::get_singleton()->remove_export_plugin(p_exporter);
|
|
|
|
}
|
|
|
|
|
2022-09-08 18:38:33 +02:00
|
|
|
void EditorPlugin::add_node_3d_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_gizmo_plugin.is_valid());
|
2020-03-26 22:49:16 +01:00
|
|
|
Node3DEditor::get_singleton()->add_gizmo_plugin(p_gizmo_plugin);
|
2018-10-29 11:30:28 +01:00
|
|
|
}
|
|
|
|
|
2022-09-08 18:38:33 +02:00
|
|
|
void EditorPlugin::remove_node_3d_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_gizmo_plugin.is_valid());
|
2020-03-26 22:49:16 +01:00
|
|
|
Node3DEditor::get_singleton()->remove_gizmo_plugin(p_gizmo_plugin);
|
2018-10-29 11:30:28 +01:00
|
|
|
}
|
|
|
|
|
2018-05-17 23:02:16 +02:00
|
|
|
void EditorPlugin::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_plugin.is_valid());
|
2018-05-17 23:02:16 +02:00
|
|
|
EditorInspector::add_inspector_plugin(p_plugin);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_plugin.is_valid());
|
2018-05-17 23:02:16 +02:00
|
|
|
EditorInspector::remove_inspector_plugin(p_plugin);
|
|
|
|
}
|
|
|
|
|
2022-02-07 09:38:42 +01:00
|
|
|
void EditorPlugin::add_scene_format_importer_plugin(const Ref<EditorSceneFormatImporter> &p_importer, bool p_first_priority) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_importer.is_valid());
|
2022-04-12 16:07:09 +02:00
|
|
|
ResourceImporterScene::add_importer(p_importer, p_first_priority);
|
2017-12-07 19:44:20 +01:00
|
|
|
}
|
|
|
|
|
2021-10-14 19:34:27 +02:00
|
|
|
void EditorPlugin::remove_scene_format_importer_plugin(const Ref<EditorSceneFormatImporter> &p_importer) {
|
2021-06-13 11:25:39 +02:00
|
|
|
ERR_FAIL_COND(!p_importer.is_valid());
|
2022-04-12 16:07:09 +02:00
|
|
|
ResourceImporterScene::remove_importer(p_importer);
|
2017-12-07 19:44:20 +01:00
|
|
|
}
|
|
|
|
|
2022-02-07 09:38:42 +01:00
|
|
|
void EditorPlugin::add_scene_post_import_plugin(const Ref<EditorScenePostImportPlugin> &p_plugin, bool p_first_priority) {
|
2022-04-12 16:07:09 +02:00
|
|
|
ResourceImporterScene::add_post_importer_plugin(p_plugin, p_first_priority);
|
2021-10-14 19:34:27 +02:00
|
|
|
}
|
2022-02-07 09:38:42 +01:00
|
|
|
|
2021-10-14 19:34:27 +02:00
|
|
|
void EditorPlugin::remove_scene_post_import_plugin(const Ref<EditorScenePostImportPlugin> &p_plugin) {
|
2022-04-12 16:07:09 +02:00
|
|
|
ResourceImporterScene::remove_post_importer_plugin(p_plugin);
|
2021-10-14 19:34:27 +02:00
|
|
|
}
|
|
|
|
|
2020-02-17 22:06:54 +01:00
|
|
|
int find(const PackedStringArray &a, const String &v) {
|
|
|
|
const String *r = a.ptr();
|
2018-06-11 02:59:53 +02:00
|
|
|
for (int j = 0; j < a.size(); ++j) {
|
|
|
|
if (r[j] == v) {
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::enable_plugin() {
|
|
|
|
// Called when the plugin gets enabled in project settings, after it's added to the tree.
|
|
|
|
// You can implement it to register autoloads.
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_enable_plugin);
|
2018-06-11 02:59:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::disable_plugin() {
|
|
|
|
// Last function called when the plugin gets disabled in project settings.
|
|
|
|
// Implement it to cleanup things from the project, such as unregister autoloads.
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_disable_plugin);
|
2018-06-11 02:59:53 +02:00
|
|
|
}
|
|
|
|
|
2015-06-22 05:03:19 +02:00
|
|
|
void EditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_set_window_layout, p_layout);
|
2015-06-22 05:03:19 +02:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_CALL(_get_window_layout, p_layout);
|
2016-08-15 19:49:58 +02:00
|
|
|
}
|
|
|
|
|
2018-01-08 16:55:22 +01:00
|
|
|
bool EditorPlugin::build() {
|
2022-10-18 18:47:44 +02:00
|
|
|
bool success = true;
|
|
|
|
GDVIRTUAL_CALL(_build, success);
|
|
|
|
return success;
|
2018-01-08 16:55:22 +01:00
|
|
|
}
|
|
|
|
|
2020-10-15 17:29:59 +02:00
|
|
|
void EditorPlugin::queue_save_layout() {
|
2016-08-15 19:49:58 +02:00
|
|
|
EditorNode::get_singleton()->save_layout();
|
2015-06-22 05:03:19 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorPlugin::make_bottom_panel_item_visible(Control *p_item) {
|
2016-09-17 16:59:12 +02:00
|
|
|
EditorNode::get_singleton()->make_bottom_panel_item_visible(p_item);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorPlugin::hide_bottom_panel() {
|
|
|
|
EditorNode::get_singleton()->hide_bottom_panel();
|
|
|
|
}
|
|
|
|
|
2017-08-26 15:32:15 +02:00
|
|
|
EditorInterface *EditorPlugin::get_editor_interface() {
|
|
|
|
return EditorInterface::get_singleton();
|
2016-09-10 22:34:27 +02:00
|
|
|
}
|
|
|
|
|
2018-06-30 05:08:28 +02:00
|
|
|
ScriptCreateDialog *EditorPlugin::get_script_create_dialog() {
|
2021-11-17 21:08:55 +01:00
|
|
|
return SceneTreeDock::get_singleton()->get_script_create_dialog();
|
2018-06-30 05:08:28 +02:00
|
|
|
}
|
|
|
|
|
2022-10-03 15:21:25 +02:00
|
|
|
void EditorPlugin::add_debugger_plugin(const Ref<EditorDebuggerPlugin> &p_plugin) {
|
|
|
|
EditorDebuggerNode::get_singleton()->add_debugger_plugin(p_plugin);
|
2020-05-18 16:55:49 +02:00
|
|
|
}
|
|
|
|
|
2022-10-03 15:21:25 +02:00
|
|
|
void EditorPlugin::remove_debugger_plugin(const Ref<EditorDebuggerPlugin> &p_plugin) {
|
|
|
|
EditorDebuggerNode::get_singleton()->remove_debugger_plugin(p_plugin);
|
2020-05-18 16:55:49 +02:00
|
|
|
}
|
|
|
|
|
2021-02-13 15:06:56 +01:00
|
|
|
void EditorPlugin::_editor_project_settings_changed() {
|
2021-07-17 23:22:52 +02:00
|
|
|
emit_signal(SNAME("project_settings_changed"));
|
2021-02-13 15:06:56 +01:00
|
|
|
}
|
|
|
|
void EditorPlugin::_notification(int p_what) {
|
2022-02-16 00:52:32 +01:00
|
|
|
switch (p_what) {
|
|
|
|
case NOTIFICATION_ENTER_TREE: {
|
|
|
|
EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case NOTIFICATION_EXIT_TREE: {
|
|
|
|
EditorNode::get_singleton()->disconnect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
|
|
|
|
} break;
|
2021-02-13 15:06:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void EditorPlugin::_bind_methods() {
|
2017-08-09 13:19:41 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_control_to_container", "container", "control"), &EditorPlugin::add_control_to_container);
|
|
|
|
ClassDB::bind_method(D_METHOD("add_control_to_bottom_panel", "control", "title"), &EditorPlugin::add_control_to_bottom_panel);
|
|
|
|
ClassDB::bind_method(D_METHOD("add_control_to_dock", "slot", "control"), &EditorPlugin::add_control_to_dock);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_control_from_docks", "control"), &EditorPlugin::remove_control_from_docks);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_control_from_bottom_panel", "control"), &EditorPlugin::remove_control_from_bottom_panel);
|
2018-02-13 22:21:19 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("remove_control_from_container", "container", "control"), &EditorPlugin::remove_control_from_container);
|
2020-12-16 00:04:21 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("add_tool_menu_item", "name", "callable"), &EditorPlugin::add_tool_menu_item);
|
2017-08-09 13:19:41 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_tool_submenu_item", "name", "submenu"), &EditorPlugin::add_tool_submenu_item);
|
2018-03-17 02:50:35 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("remove_tool_menu_item", "name"), &EditorPlugin::remove_tool_menu_item);
|
2022-04-06 14:41:04 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_export_as_menu"), &EditorPlugin::get_export_as_menu);
|
2017-08-09 13:19:41 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_custom_type", "type", "base", "script", "icon"), &EditorPlugin::add_custom_type);
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("remove_custom_type", "type"), &EditorPlugin::remove_custom_type);
|
2017-02-13 12:47:24 +01:00
|
|
|
|
2018-02-14 05:31:38 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("add_autoload_singleton", "name", "path"), &EditorPlugin::add_autoload_singleton);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_autoload_singleton", "name"), &EditorPlugin::remove_autoload_singleton);
|
|
|
|
|
2017-10-29 20:32:09 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("update_overlays"), &EditorPlugin::update_overlays);
|
2017-02-13 12:47:24 +01:00
|
|
|
|
2017-08-09 13:19:41 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("make_bottom_panel_item_visible", "item"), &EditorPlugin::make_bottom_panel_item_visible);
|
2017-02-13 12:47:24 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("hide_bottom_panel"), &EditorPlugin::hide_bottom_panel);
|
|
|
|
|
2022-03-25 18:06:46 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("get_undo_redo"), &EditorPlugin::get_undo_redo);
|
2021-04-28 17:39:57 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_undo_redo_inspector_hook_callback", "callable"), &EditorPlugin::add_undo_redo_inspector_hook_callback);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_undo_redo_inspector_hook_callback", "callable"), &EditorPlugin::remove_undo_redo_inspector_hook_callback);
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("queue_save_layout"), &EditorPlugin::queue_save_layout);
|
2020-06-23 13:48:59 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_translation_parser_plugin", "parser"), &EditorPlugin::add_translation_parser_plugin);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_translation_parser_plugin", "parser"), &EditorPlugin::remove_translation_parser_plugin);
|
2022-02-07 09:38:42 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("add_import_plugin", "importer", "first_priority"), &EditorPlugin::add_import_plugin, DEFVAL(false));
|
2017-08-09 13:19:41 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer"), &EditorPlugin::remove_import_plugin);
|
2022-02-07 09:38:42 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("add_scene_format_importer_plugin", "scene_format_importer", "first_priority"), &EditorPlugin::add_scene_format_importer_plugin, DEFVAL(false));
|
2021-10-14 19:34:27 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("remove_scene_format_importer_plugin", "scene_format_importer"), &EditorPlugin::remove_scene_format_importer_plugin);
|
2022-02-07 09:38:42 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("add_scene_post_import_plugin", "scene_import_plugin", "first_priority"), &EditorPlugin::add_scene_post_import_plugin, DEFVAL(false));
|
2021-10-14 19:34:27 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("remove_scene_post_import_plugin", "scene_import_plugin"), &EditorPlugin::remove_scene_post_import_plugin);
|
2018-05-17 23:02:16 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_export_plugin", "plugin"), &EditorPlugin::add_export_plugin);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_export_plugin", "plugin"), &EditorPlugin::remove_export_plugin);
|
2022-09-08 18:38:33 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_node_3d_gizmo_plugin", "plugin"), &EditorPlugin::add_node_3d_gizmo_plugin);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_node_3d_gizmo_plugin", "plugin"), &EditorPlugin::remove_node_3d_gizmo_plugin);
|
2018-05-17 23:02:16 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_inspector_plugin", "plugin"), &EditorPlugin::add_inspector_plugin);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_inspector_plugin", "plugin"), &EditorPlugin::remove_inspector_plugin);
|
2017-06-08 19:57:35 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled);
|
2017-10-29 20:32:09 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_force_draw_over_forwarding_enabled"), &EditorPlugin::set_force_draw_over_forwarding_enabled);
|
2017-08-26 15:32:15 +02:00
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_editor_interface"), &EditorPlugin::get_editor_interface);
|
2018-06-30 05:08:28 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("get_script_create_dialog"), &EditorPlugin::get_script_create_dialog);
|
2020-05-18 16:55:49 +02:00
|
|
|
ClassDB::bind_method(D_METHOD("add_debugger_plugin", "script"), &EditorPlugin::add_debugger_plugin);
|
|
|
|
ClassDB::bind_method(D_METHOD("remove_debugger_plugin", "script"), &EditorPlugin::remove_debugger_plugin);
|
2017-07-06 09:18:20 +02:00
|
|
|
|
2021-08-22 03:52:44 +02:00
|
|
|
GDVIRTUAL_BIND(_forward_canvas_gui_input, "event");
|
|
|
|
GDVIRTUAL_BIND(_forward_canvas_draw_over_viewport, "viewport_control");
|
|
|
|
GDVIRTUAL_BIND(_forward_canvas_force_draw_over_viewport, "viewport_control");
|
|
|
|
GDVIRTUAL_BIND(_forward_3d_gui_input, "viewport_camera", "event");
|
|
|
|
GDVIRTUAL_BIND(_forward_3d_draw_over_viewport, "viewport_control");
|
|
|
|
GDVIRTUAL_BIND(_forward_3d_force_draw_over_viewport, "viewport_control");
|
|
|
|
GDVIRTUAL_BIND(_get_plugin_name);
|
|
|
|
GDVIRTUAL_BIND(_get_plugin_icon);
|
|
|
|
GDVIRTUAL_BIND(_has_main_screen);
|
|
|
|
GDVIRTUAL_BIND(_make_visible, "visible");
|
|
|
|
GDVIRTUAL_BIND(_edit, "object");
|
|
|
|
GDVIRTUAL_BIND(_handles, "object");
|
|
|
|
GDVIRTUAL_BIND(_get_state);
|
|
|
|
GDVIRTUAL_BIND(_set_state, "state");
|
|
|
|
GDVIRTUAL_BIND(_clear);
|
|
|
|
GDVIRTUAL_BIND(_save_external_data);
|
|
|
|
GDVIRTUAL_BIND(_apply_changes);
|
|
|
|
GDVIRTUAL_BIND(_get_breakpoints);
|
|
|
|
GDVIRTUAL_BIND(_set_window_layout, "configuration");
|
|
|
|
GDVIRTUAL_BIND(_get_window_layout, "configuration");
|
|
|
|
GDVIRTUAL_BIND(_build);
|
|
|
|
GDVIRTUAL_BIND(_enable_plugin);
|
|
|
|
GDVIRTUAL_BIND(_disable_plugin);
|
2017-03-05 16:44:50 +01:00
|
|
|
|
2017-08-29 07:15:46 +02:00
|
|
|
ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
|
|
|
|
ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath")));
|
|
|
|
ADD_SIGNAL(MethodInfo("main_screen_changed", PropertyInfo(Variant::STRING, "screen_name")));
|
2018-01-12 22:43:29 +01:00
|
|
|
ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
|
2021-02-13 15:06:56 +01:00
|
|
|
ADD_SIGNAL(MethodInfo("project_settings_changed"));
|
2017-07-06 09:18:20 +02:00
|
|
|
|
2017-08-20 17:45:01 +02:00
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_TOOLBAR);
|
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU);
|
2018-08-21 06:35:48 +02:00
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_SIDE_LEFT);
|
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT);
|
2017-08-20 17:45:01 +02:00
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_SPATIAL_EDITOR_BOTTOM);
|
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_CANVAS_EDITOR_MENU);
|
2018-08-21 06:35:48 +02:00
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_CANVAS_EDITOR_SIDE_LEFT);
|
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_CANVAS_EDITOR_SIDE_RIGHT);
|
2017-10-21 20:58:02 +02:00
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_CANVAS_EDITOR_BOTTOM);
|
2022-08-13 12:56:52 +02:00
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_INSPECTOR_BOTTOM);
|
2019-05-27 22:33:52 +02:00
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_PROJECT_SETTING_TAB_LEFT);
|
|
|
|
BIND_ENUM_CONSTANT(CONTAINER_PROJECT_SETTING_TAB_RIGHT);
|
2017-08-20 17:45:01 +02:00
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_LEFT_UL);
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_LEFT_BL);
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_LEFT_UR);
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_LEFT_BR);
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_RIGHT_UL);
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_RIGHT_BL);
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_RIGHT_UR);
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_RIGHT_BR);
|
|
|
|
BIND_ENUM_CONSTANT(DOCK_SLOT_MAX);
|
2022-08-15 20:04:17 +02:00
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(AFTER_GUI_INPUT_PASS);
|
|
|
|
BIND_ENUM_CONSTANT(AFTER_GUI_INPUT_STOP);
|
|
|
|
BIND_ENUM_CONSTANT(AFTER_GUI_INPUT_CUSTOM);
|
2017-03-05 16:44:50 +01:00
|
|
|
}
|
|
|
|
|
2022-03-25 18:06:46 +01:00
|
|
|
Ref<EditorUndoRedoManager> EditorPlugin::get_undo_redo() {
|
2022-08-29 12:10:32 +02:00
|
|
|
return EditorNode::get_undo_redo();
|
2022-03-25 18:06:46 +01:00
|
|
|
}
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
EditorPluginCreateFunc EditorPlugins::creation_funcs[MAX_CREATE_FUNCS];
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
int EditorPlugins::creation_func_count = 0;
|