summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp125
1 files changed, 81 insertions, 44 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 72a7ce3534..f099f29204 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -66,7 +66,11 @@
#include "editor/import/resource_importer_scene.h"
#include "editor/import/resource_importer_texture.h"
#include "editor/import/resource_importer_wav.h"
+#include "editor/plugins/animation_blend_space_1d_editor.h"
+#include "editor/plugins/animation_blend_space_2d_editor.h"
+#include "editor/plugins/animation_blend_tree_editor_plugin.h"
#include "editor/plugins/animation_player_editor_plugin.h"
+#include "editor/plugins/animation_state_machine_editor.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/plugins/asset_library_editor_plugin.h"
#include "editor/plugins/baked_lightmap_editor_plugin.h"
@@ -95,6 +99,7 @@
#include "editor/plugins/physical_bone_plugin.h"
#include "editor/plugins/polygon_2d_editor_plugin.h"
#include "editor/plugins/resource_preloader_editor_plugin.h"
+#include "editor/plugins/root_motion_editor_plugin.h"
#include "editor/plugins/script_editor_plugin.h"
#include "editor/plugins/script_text_editor.h"
#include "editor/plugins/shader_editor_plugin.h"
@@ -582,7 +587,6 @@ void EditorNode::edit_node(Node *p_node) {
void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const String &p_path) {
editor_data.apply_changes_in_editors();
-
int flg = 0;
if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources"))
flg |= ResourceSaver::FLAG_COMPRESS;
@@ -1069,8 +1073,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
void EditorNode::_save_all_scenes() {
- int i = _next_unsaved_scene(true, 0);
- while (i != -1) {
+ for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
Node *scene = editor_data.get_edited_scene_root(i);
if (scene && scene->get_filename() != "") {
if (i != editor_data.get_edited_scene())
@@ -1078,7 +1081,6 @@ void EditorNode::_save_all_scenes() {
else
_save_scene_with_preview(scene->get_filename());
} // else: ignore new scenes
- i = _next_unsaved_scene(true, ++i);
}
_save_default_environment();
@@ -1300,7 +1302,31 @@ void EditorNode::_dialog_action(String p_file) {
}
}
-void EditorNode::push_item(Object *p_object, const String &p_property) {
+bool EditorNode::item_has_editor(Object *p_object) {
+
+ return editor_data.get_subeditors(p_object).size() > 0;
+}
+
+void EditorNode::edit_item(Object *p_object) {
+
+ Vector<EditorPlugin *> sub_plugins;
+
+ if (p_object) {
+ sub_plugins = editor_data.get_subeditors(p_object);
+ }
+
+ if (!sub_plugins.empty()) {
+ _display_top_editors(false);
+
+ _set_top_editors(sub_plugins);
+ _set_editing_top_editors(p_object);
+ _display_top_editors(true);
+ } else {
+ _hide_top_editors();
+ }
+}
+
+void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) {
if (!p_object) {
get_inspector()->edit(NULL);
@@ -1312,7 +1338,9 @@ void EditorNode::push_item(Object *p_object, const String &p_property) {
uint32_t id = p_object->get_instance_id();
if (id != editor_history.get_current()) {
- if (p_property == "")
+ if (p_inspector_only) {
+ editor_history.add_object_inspector_only(id);
+ } else if (p_property == "")
editor_history.add_object(id);
else
editor_history.add_object(id, p_property);
@@ -1328,8 +1356,7 @@ void EditorNode::_save_default_environment() {
if (fallback.is_valid() && fallback->get_path().is_resource_file()) {
Map<RES, bool> processed;
_find_and_save_edited_subresources(fallback.ptr(), processed, 0);
- if (fallback->get_last_modified_time() != fallback->get_import_last_modified_time())
- save_resource_in_path(fallback, fallback->get_path());
+ save_resource_in_path(fallback, fallback->get_path());
}
}
@@ -1366,6 +1393,7 @@ void EditorNode::_edit_current() {
uint32_t current = editor_history.get_current();
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
+ bool inspector_only = editor_history.is_current_inspector_only();
this->current = current_obj;
@@ -1457,57 +1485,60 @@ void EditorNode::_edit_current() {
/* Take care of PLUGIN EDITOR */
- EditorPlugin *main_plugin = editor_data.get_editor(current_obj);
+ if (!inspector_only) {
- if (main_plugin) {
+ EditorPlugin *main_plugin = editor_data.get_editor(current_obj);
- // special case if use of external editor is true
- if (main_plugin->get_name() == "Script" && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
- if (!changing_scene)
- main_plugin->edit(current_obj);
- }
+ if (main_plugin) {
- else if (main_plugin != editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) {
- // update screen main_plugin
+ // special case if use of external editor is true
+ if (main_plugin->get_name() == "Script" && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
+ if (!changing_scene)
+ main_plugin->edit(current_obj);
+ }
- if (!changing_scene) {
+ else if (main_plugin != editor_plugin_screen && (!ScriptEditor::get_singleton() || !ScriptEditor::get_singleton()->is_visible_in_tree() || ScriptEditor::get_singleton()->can_take_away_focus())) {
+ // update screen main_plugin
- if (editor_plugin_screen)
- editor_plugin_screen->make_visible(false);
- editor_plugin_screen = main_plugin;
- editor_plugin_screen->edit(current_obj);
+ if (!changing_scene) {
- editor_plugin_screen->make_visible(true);
+ if (editor_plugin_screen)
+ editor_plugin_screen->make_visible(false);
+ editor_plugin_screen = main_plugin;
+ editor_plugin_screen->edit(current_obj);
- int plugin_count = editor_data.get_editor_plugin_count();
- for (int i = 0; i < plugin_count; i++) {
- editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
- }
+ editor_plugin_screen->make_visible(true);
+
+ int plugin_count = editor_data.get_editor_plugin_count();
+ for (int i = 0; i < plugin_count; i++) {
+ editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
+ }
- for (int i = 0; i < editor_table.size(); i++) {
+ for (int i = 0; i < editor_table.size(); i++) {
- main_editor_buttons[i]->set_pressed(editor_table[i] == main_plugin);
+ main_editor_buttons[i]->set_pressed(editor_table[i] == main_plugin);
+ }
}
- }
- } else {
+ } else {
- editor_plugin_screen->edit(current_obj);
+ editor_plugin_screen->edit(current_obj);
+ }
}
- }
- Vector<EditorPlugin *> sub_plugins = editor_data.get_subeditors(current_obj);
+ Vector<EditorPlugin *> sub_plugins = editor_data.get_subeditors(current_obj);
- if (!sub_plugins.empty()) {
- _display_top_editors(false);
+ if (!sub_plugins.empty()) {
+ _display_top_editors(false);
- _set_top_editors(sub_plugins);
- _set_editing_top_editors(current_obj);
- _display_top_editors(true);
+ _set_top_editors(sub_plugins);
+ _set_editing_top_editors(current_obj);
+ _display_top_editors(true);
- } else if (!editor_plugins_over->get_plugins_list().empty()) {
+ } else if (!editor_plugins_over->get_plugins_list().empty()) {
- _hide_top_editors();
+ _hide_top_editors();
+ }
}
inspector_dock->update(current_obj);
@@ -4601,6 +4632,10 @@ EditorNode::EditorNode() {
Ref<EditorInspectorDefaultPlugin> eidp;
eidp.instance();
EditorInspector::add_inspector_plugin(eidp);
+
+ Ref<EditorInspectorRootMotionPlugin> rmp;
+ rmp.instance();
+ EditorInspector::add_inspector_plugin(rmp);
}
_pvrtc_register_compressors();
@@ -4626,9 +4661,7 @@ EditorNode::EditorNode() {
GLOBAL_DEF("editor/main_run_args", "");
- ClassDB::set_class_enabled("CollisionShape", true);
- ClassDB::set_class_enabled("CollisionShape2D", true);
- ClassDB::set_class_enabled("CollisionPolygon2D", true);
+ ClassDB::set_class_enabled("RootMotionView", true);
//defs here, use EDITOR_GET in logic
EDITOR_DEF("interface/scene_tabs/always_show_close_button", false);
@@ -5367,6 +5400,10 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(ShaderEditorPlugin(this)));
// FIXME: Disabled for Godot 3.0 as made incompatible, it needs to be ported to the new API.
//add_editor_plugin(memnew(ShaderGraphEditorPlugin(this)));
+ add_editor_plugin(memnew(AnimationNodeBlendTreeEditorPlugin(this)));
+ add_editor_plugin(memnew(AnimationNodeBlendSpace1DEditorPlugin(this)));
+ add_editor_plugin(memnew(AnimationNodeBlendSpace2DEditorPlugin(this)));
+ add_editor_plugin(memnew(AnimationNodeStateMachineEditorPlugin(this)));
add_editor_plugin(memnew(CameraEditorPlugin(this)));
add_editor_plugin(memnew(ThemeEditorPlugin(this)));