mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 13:49:54 +00:00
Merge pull request #113255 from lodetrick/animation-dock
Use new dock system for Animation and AnimationTree dock
This commit is contained in:
commit
6124d5ee2b
9 changed files with 77 additions and 55 deletions
|
|
@ -266,7 +266,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_READY: {
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
||||||
panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning"));
|
panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning"));
|
||||||
} break;
|
} break;
|
||||||
|
|
|
||||||
|
|
@ -982,7 +982,7 @@ void AnimationNodeBlendTreeEditor::_update_editor_settings() {
|
||||||
|
|
||||||
void AnimationNodeBlendTreeEditor::_notification(int p_what) {
|
void AnimationNodeBlendTreeEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_READY: {
|
||||||
_update_editor_settings();
|
_update_editor_settings();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@
|
||||||
#include "core/input/input.h"
|
#include "core/input/input.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
#include "editor/animation/animation_tree_editor_plugin.h"
|
#include "editor/animation/animation_tree_editor_plugin.h"
|
||||||
|
#include "editor/docks/editor_dock_manager.h"
|
||||||
#include "editor/docks/inspector_dock.h"
|
#include "editor/docks/inspector_dock.h"
|
||||||
#include "editor/docks/scene_tree_dock.h"
|
#include "editor/docks/scene_tree_dock.h"
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
#include "editor/editor_undo_redo_manager.h"
|
#include "editor/editor_undo_redo_manager.h"
|
||||||
#include "editor/gui/editor_bottom_panel.h"
|
|
||||||
#include "editor/gui/editor_file_dialog.h"
|
#include "editor/gui/editor_file_dialog.h"
|
||||||
#include "editor/gui/editor_validation_panel.h"
|
#include "editor/gui/editor_validation_panel.h"
|
||||||
#include "editor/scene/3d/node_3d_editor_plugin.h" // For onion skinning.
|
#include "editor/scene/3d/node_3d_editor_plugin.h" // For onion skinning.
|
||||||
|
|
@ -140,14 +140,14 @@ void AnimationPlayerEditor::_notification(int p_what) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
tool_anim->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &AnimationPlayerEditor::_animation_tool_menu));
|
|
||||||
|
|
||||||
onion_skinning->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu));
|
|
||||||
|
|
||||||
blend_editor.next->connect(SceneStringName(item_selected), callable_mp(this, &AnimationPlayerEditor::_blend_editor_next_changed));
|
|
||||||
|
|
||||||
get_tree()->connect(SNAME("node_removed"), callable_mp(this, &AnimationPlayerEditor::_node_removed));
|
get_tree()->connect(SNAME("node_removed"), callable_mp(this, &AnimationPlayerEditor::_node_removed));
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
get_tree()->disconnect(SNAME("node_removed"), callable_mp(this, &AnimationPlayerEditor::_node_removed));
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_READY: {
|
||||||
EditorNode::get_singleton()->connect("scene_changed", callable_mp(this, &AnimationPlayerEditor::_find_player));
|
EditorNode::get_singleton()->connect("scene_changed", callable_mp(this, &AnimationPlayerEditor::_find_player));
|
||||||
|
|
||||||
add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SceneStringName(panel), SNAME("Panel")));
|
add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SceneStringName(panel), SNAME("Panel")));
|
||||||
|
|
@ -929,7 +929,7 @@ void AnimationPlayerEditor::set_state(const Dictionary &p_state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_update_player();
|
_update_player();
|
||||||
EditorNode::get_bottom_panel()->make_item_visible(this);
|
make_visible();
|
||||||
set_process(true);
|
set_process(true);
|
||||||
ensure_visibility();
|
ensure_visibility();
|
||||||
|
|
||||||
|
|
@ -2042,11 +2042,19 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
||||||
plugin = p_plugin;
|
plugin = p_plugin;
|
||||||
singleton = this;
|
singleton = this;
|
||||||
|
|
||||||
|
set_name(TTRC("Animation"));
|
||||||
|
set_icon_name("Animation");
|
||||||
|
set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_animation_bottom_panel", TTRC("Toggle Animation Dock"), KeyModifierMask::ALT | Key::N));
|
||||||
|
set_default_slot(DockConstants::DOCK_SLOT_BOTTOM);
|
||||||
|
set_available_layouts(EditorDock::DOCK_LAYOUT_HORIZONTAL | EditorDock::DOCK_LAYOUT_FLOATING);
|
||||||
|
|
||||||
set_focus_mode(FOCUS_ALL);
|
set_focus_mode(FOCUS_ALL);
|
||||||
set_process_shortcut_input(true);
|
set_process_shortcut_input(true);
|
||||||
|
|
||||||
|
VBoxContainer *main_vbox_container = memnew(VBoxContainer);
|
||||||
|
add_child(main_vbox_container);
|
||||||
HBoxContainer *hb = memnew(HBoxContainer);
|
HBoxContainer *hb = memnew(HBoxContainer);
|
||||||
add_child(hb);
|
main_vbox_container->add_child(hb);
|
||||||
|
|
||||||
HBoxContainer *playback_container = memnew(HBoxContainer);
|
HBoxContainer *playback_container = memnew(HBoxContainer);
|
||||||
playback_container->set_layout_direction(LAYOUT_DIRECTION_LTR);
|
playback_container->set_layout_direction(LAYOUT_DIRECTION_LTR);
|
||||||
|
|
@ -2114,6 +2122,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
||||||
tool_anim->get_popup()->add_separator();
|
tool_anim->get_popup()->add_separator();
|
||||||
tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/remove_animation", TTRC("Remove")), TOOL_REMOVE_ANIM);
|
tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/remove_animation", TTRC("Remove")), TOOL_REMOVE_ANIM);
|
||||||
tool_anim->set_disabled(true);
|
tool_anim->set_disabled(true);
|
||||||
|
tool_anim->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &AnimationPlayerEditor::_animation_tool_menu));
|
||||||
hb->add_child(tool_anim);
|
hb->add_child(tool_anim);
|
||||||
|
|
||||||
animation = memnew(OptionButton);
|
animation = memnew(OptionButton);
|
||||||
|
|
@ -2163,6 +2172,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
||||||
onion_skinning->get_popup()->add_check_item(TTR("Differences Only"), ONION_SKINNING_DIFFERENCES_ONLY);
|
onion_skinning->get_popup()->add_check_item(TTR("Differences Only"), ONION_SKINNING_DIFFERENCES_ONLY);
|
||||||
onion_skinning->get_popup()->add_check_item(TTR("Force White Modulate"), ONION_SKINNING_FORCE_WHITE_MODULATE);
|
onion_skinning->get_popup()->add_check_item(TTR("Force White Modulate"), ONION_SKINNING_FORCE_WHITE_MODULATE);
|
||||||
onion_skinning->get_popup()->add_check_item(TTR("Include Gizmos (3D)"), ONION_SKINNING_INCLUDE_GIZMOS);
|
onion_skinning->get_popup()->add_check_item(TTR("Include Gizmos (3D)"), ONION_SKINNING_INCLUDE_GIZMOS);
|
||||||
|
onion_skinning->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu));
|
||||||
hb->add_child(onion_skinning);
|
hb->add_child(onion_skinning);
|
||||||
|
|
||||||
hb->add_child(memnew(VSeparator));
|
hb->add_child(memnew(VSeparator));
|
||||||
|
|
@ -2226,6 +2236,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
||||||
|
|
||||||
blend_editor.next = memnew(OptionButton);
|
blend_editor.next = memnew(OptionButton);
|
||||||
blend_editor.next->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
blend_editor.next->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||||
|
blend_editor.next->connect(SceneStringName(item_selected), callable_mp(this, &AnimationPlayerEditor::_blend_editor_next_changed));
|
||||||
blend_vb->add_margin_child(TTR("Next (Auto Queue):"), blend_editor.next);
|
blend_vb->add_margin_child(TTR("Next (Auto Queue):"), blend_editor.next);
|
||||||
|
|
||||||
autoplay->connect(SceneStringName(pressed), callable_mp(this, &AnimationPlayerEditor::_autoplay_pressed));
|
autoplay->connect(SceneStringName(pressed), callable_mp(this, &AnimationPlayerEditor::_autoplay_pressed));
|
||||||
|
|
@ -2241,7 +2252,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
||||||
frame->connect(SceneStringName(value_changed), callable_mp(this, &AnimationPlayerEditor::_seek_value_changed).bind(false));
|
frame->connect(SceneStringName(value_changed), callable_mp(this, &AnimationPlayerEditor::_seek_value_changed).bind(false));
|
||||||
scale->connect(SceneStringName(text_submitted), callable_mp(this, &AnimationPlayerEditor::_scale_changed));
|
scale->connect(SceneStringName(text_submitted), callable_mp(this, &AnimationPlayerEditor::_scale_changed));
|
||||||
|
|
||||||
add_child(track_editor);
|
main_vbox_container->add_child(track_editor);
|
||||||
track_editor->set_v_size_flags(SIZE_EXPAND_FILL);
|
track_editor->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
track_editor->connect(SNAME("timeline_changed"), callable_mp(this, &AnimationPlayerEditor::_animation_key_editor_seek));
|
track_editor->connect(SNAME("timeline_changed"), callable_mp(this, &AnimationPlayerEditor::_animation_key_editor_seek));
|
||||||
track_editor->connect(SNAME("animation_len_changed"), callable_mp(this, &AnimationPlayerEditor::_animation_key_editor_anim_len_changed));
|
track_editor->connect(SNAME("animation_len_changed"), callable_mp(this, &AnimationPlayerEditor::_animation_key_editor_anim_len_changed));
|
||||||
|
|
@ -2309,7 +2320,7 @@ AnimationPlayerEditor::~AnimationPlayerEditor() {
|
||||||
|
|
||||||
void AnimationPlayerEditorPlugin::_notification(int p_what) {
|
void AnimationPlayerEditorPlugin::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_READY: {
|
||||||
Node3DEditor::get_singleton()->connect(SNAME("transform_key_request"), callable_mp(this, &AnimationPlayerEditorPlugin::_transform_key_request));
|
Node3DEditor::get_singleton()->connect(SNAME("transform_key_request"), callable_mp(this, &AnimationPlayerEditorPlugin::_transform_key_request));
|
||||||
InspectorDock::get_inspector_singleton()->connect(SNAME("property_keyed"), callable_mp(this, &AnimationPlayerEditorPlugin::_property_keyed));
|
InspectorDock::get_inspector_singleton()->connect(SNAME("property_keyed"), callable_mp(this, &AnimationPlayerEditorPlugin::_property_keyed));
|
||||||
anim_editor->get_track_editor()->connect(SNAME("keying_changed"), callable_mp(this, &AnimationPlayerEditorPlugin::_update_keying));
|
anim_editor->get_track_editor()->connect(SNAME("keying_changed"), callable_mp(this, &AnimationPlayerEditorPlugin::_update_keying));
|
||||||
|
|
@ -2437,7 +2448,7 @@ void AnimationPlayerEditorPlugin::make_visible(bool p_visible) {
|
||||||
if (AnimationTreeEditor::get_singleton() && AnimationTreeEditor::get_singleton()->is_visible_in_tree()) {
|
if (AnimationTreeEditor::get_singleton() && AnimationTreeEditor::get_singleton()->is_visible_in_tree()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EditorNode::get_bottom_panel()->make_item_visible(anim_editor);
|
anim_editor->make_visible();
|
||||||
anim_editor->set_process(true);
|
anim_editor->set_process(true);
|
||||||
anim_editor->ensure_visibility();
|
anim_editor->ensure_visibility();
|
||||||
}
|
}
|
||||||
|
|
@ -2445,7 +2456,7 @@ void AnimationPlayerEditorPlugin::make_visible(bool p_visible) {
|
||||||
|
|
||||||
AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin() {
|
AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin() {
|
||||||
anim_editor = memnew(AnimationPlayerEditor(this));
|
anim_editor = memnew(AnimationPlayerEditor(this));
|
||||||
EditorNode::get_bottom_panel()->add_item(TTRC("Animation"), anim_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_animation_bottom_panel", TTRC("Toggle Animation Bottom Panel"), KeyModifierMask::ALT | Key::N));
|
EditorDockManager::get_singleton()->add_dock(anim_editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationPlayerEditorPlugin::~AnimationPlayerEditorPlugin() {
|
AnimationPlayerEditorPlugin::~AnimationPlayerEditorPlugin() {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "editor/animation/animation_library_editor.h"
|
#include "editor/animation/animation_library_editor.h"
|
||||||
#include "editor/animation/animation_track_editor.h"
|
#include "editor/animation/animation_track_editor.h"
|
||||||
|
#include "editor/docks/editor_dock.h"
|
||||||
#include "editor/plugins/editor_plugin.h"
|
#include "editor/plugins/editor_plugin.h"
|
||||||
#include "scene/animation/animation_player.h"
|
#include "scene/animation/animation_player.h"
|
||||||
#include "scene/gui/dialogs.h"
|
#include "scene/gui/dialogs.h"
|
||||||
|
|
@ -43,8 +44,8 @@
|
||||||
class AnimationPlayerEditorPlugin;
|
class AnimationPlayerEditorPlugin;
|
||||||
class ImageTexture;
|
class ImageTexture;
|
||||||
|
|
||||||
class AnimationPlayerEditor : public VBoxContainer {
|
class AnimationPlayerEditor : public EditorDock {
|
||||||
GDCLASS(AnimationPlayerEditor, VBoxContainer);
|
GDCLASS(AnimationPlayerEditor, EditorDock);
|
||||||
|
|
||||||
friend AnimationPlayerEditorPlugin;
|
friend AnimationPlayerEditorPlugin;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1483,7 +1483,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_READY: {
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
||||||
panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning"));
|
panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning"));
|
||||||
} break;
|
} break;
|
||||||
|
|
@ -5529,12 +5529,11 @@ void AnimationTrackEditor::_notification(int p_what) {
|
||||||
if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) {
|
if (!EditorSettings::get_singleton()->check_changed_settings_in_group("editors/panning")) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
|
||||||
}
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
||||||
panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning"));
|
panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning"));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
add_animation_player->set_button_icon(get_editor_theme_icon(SNAME("Add")));
|
add_animation_player->set_button_icon(get_editor_theme_icon(SNAME("Add")));
|
||||||
zoom_icon->set_texture(get_editor_theme_icon(SNAME("Zoom")));
|
zoom_icon->set_texture(get_editor_theme_icon(SNAME("Zoom")));
|
||||||
|
|
@ -5577,6 +5576,9 @@ void AnimationTrackEditor::_notification(int p_what) {
|
||||||
|
|
||||||
EditorNode::get_singleton()->connect("scene_changed", callable_mp(this, &AnimationTrackEditor::_scene_changed));
|
EditorNode::get_singleton()->connect("scene_changed", callable_mp(this, &AnimationTrackEditor::_scene_changed));
|
||||||
EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", callable_mp(this, &AnimationTrackEditor::_selection_changed));
|
EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", callable_mp(this, &AnimationTrackEditor::_selection_changed));
|
||||||
|
|
||||||
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
||||||
|
panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning"));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
|
|
|
||||||
|
|
@ -176,9 +176,6 @@ void AnimationTreeEditor::enter_editor(const String &p_path) {
|
||||||
|
|
||||||
void AnimationTreeEditor::_notification(int p_what) {
|
void AnimationTreeEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
|
||||||
get_tree()->connect("node_removed", callable_mp(this, &AnimationTreeEditor::_node_removed));
|
|
||||||
} break;
|
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
ObjectID root;
|
ObjectID root;
|
||||||
if (tree && tree->get_root_animation_node().is_valid()) {
|
if (tree && tree->get_root_animation_node().is_valid()) {
|
||||||
|
|
@ -193,6 +190,11 @@ void AnimationTreeEditor::_notification(int p_what) {
|
||||||
edit_path(edited_path);
|
edit_path(edited_path);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
get_tree()->connect("node_removed", callable_mp(this, &AnimationTreeEditor::_node_removed));
|
||||||
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
get_tree()->disconnect("node_removed", callable_mp(this, &AnimationTreeEditor::_node_removed));
|
get_tree()->disconnect("node_removed", callable_mp(this, &AnimationTreeEditor::_node_removed));
|
||||||
} break;
|
} break;
|
||||||
|
|
@ -256,20 +258,33 @@ Vector<String> AnimationTreeEditor::get_animation_list() {
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationTreeEditor::AnimationTreeEditor() {
|
AnimationTreeEditor::AnimationTreeEditor() {
|
||||||
AnimationNodeAnimation::get_editable_animation_list = get_animation_list;
|
|
||||||
path_edit = memnew(ScrollContainer);
|
|
||||||
add_child(path_edit);
|
|
||||||
path_edit->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
|
|
||||||
path_hb = memnew(HBoxContainer);
|
|
||||||
path_edit->add_child(path_hb);
|
|
||||||
path_hb->add_child(memnew(Label(TTR("Path:"))));
|
|
||||||
|
|
||||||
add_child(memnew(HSeparator));
|
|
||||||
|
|
||||||
singleton = this;
|
singleton = this;
|
||||||
|
AnimationNodeAnimation::get_editable_animation_list = get_animation_list;
|
||||||
|
|
||||||
|
set_name(TTRC("AnimationTree"));
|
||||||
|
set_icon_name("AnimationTreeDock");
|
||||||
|
set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_animation_tree_bottom_panel", TTRC("Toggle AnimationTree Dock")));
|
||||||
|
set_default_slot(DockConstants::DOCK_SLOT_BOTTOM);
|
||||||
|
set_available_layouts(EditorDock::DOCK_LAYOUT_HORIZONTAL | EditorDock::DOCK_LAYOUT_FLOATING);
|
||||||
|
set_global(false);
|
||||||
|
set_transient(true);
|
||||||
|
|
||||||
|
VBoxContainer *main_vbox_container = memnew(VBoxContainer);
|
||||||
|
add_child(main_vbox_container);
|
||||||
|
|
||||||
|
path_edit = memnew(ScrollContainer);
|
||||||
|
path_edit->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
|
||||||
|
main_vbox_container->add_child(path_edit);
|
||||||
|
|
||||||
|
path_hb = memnew(HBoxContainer);
|
||||||
|
path_hb->add_child(memnew(Label(TTR("Path:"))));
|
||||||
|
path_edit->add_child(path_hb);
|
||||||
|
|
||||||
|
main_vbox_container->add_child(memnew(HSeparator));
|
||||||
|
|
||||||
editor_base = memnew(MarginContainer);
|
editor_base = memnew(MarginContainer);
|
||||||
editor_base->set_v_size_flags(SIZE_EXPAND_FILL);
|
editor_base->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
add_child(editor_base);
|
main_vbox_container->add_child(editor_base);
|
||||||
|
|
||||||
add_plugin(memnew(AnimationNodeBlendTreeEditor));
|
add_plugin(memnew(AnimationNodeBlendTreeEditor));
|
||||||
add_plugin(memnew(AnimationNodeBlendSpace1DEditor));
|
add_plugin(memnew(AnimationNodeBlendSpace1DEditor));
|
||||||
|
|
@ -287,24 +302,17 @@ bool AnimationTreeEditorPlugin::handles(Object *p_object) const {
|
||||||
|
|
||||||
void AnimationTreeEditorPlugin::make_visible(bool p_visible) {
|
void AnimationTreeEditorPlugin::make_visible(bool p_visible) {
|
||||||
if (p_visible) {
|
if (p_visible) {
|
||||||
//editor->hide_animation_player_editors();
|
anim_tree_editor->make_visible();
|
||||||
//editor->animation_panel_make_visible(true);
|
|
||||||
button->show();
|
|
||||||
EditorNode::get_bottom_panel()->make_item_visible(anim_tree_editor);
|
|
||||||
anim_tree_editor->set_process(true);
|
|
||||||
} else {
|
} else {
|
||||||
if (anim_tree_editor->is_visible_in_tree()) {
|
anim_tree_editor->close();
|
||||||
EditorNode::get_bottom_panel()->hide_bottom_panel();
|
|
||||||
}
|
|
||||||
button->hide();
|
|
||||||
anim_tree_editor->set_process(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anim_tree_editor->set_process(p_visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationTreeEditorPlugin::AnimationTreeEditorPlugin() {
|
AnimationTreeEditorPlugin::AnimationTreeEditorPlugin() {
|
||||||
anim_tree_editor = memnew(AnimationTreeEditor);
|
anim_tree_editor = memnew(AnimationTreeEditor);
|
||||||
anim_tree_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
|
anim_tree_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
|
||||||
|
EditorDockManager::get_singleton()->add_dock(anim_tree_editor);
|
||||||
button = EditorNode::get_bottom_panel()->add_item(TTRC("AnimationTree"), anim_tree_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_animation_tree_bottom_panel", TTRC("Toggle AnimationTree Bottom Panel")));
|
anim_tree_editor->close();
|
||||||
button->hide();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "editor/docks/editor_dock.h"
|
||||||
#include "editor/plugins/editor_plugin.h"
|
#include "editor/plugins/editor_plugin.h"
|
||||||
#include "scene/animation/animation_tree.h"
|
#include "scene/animation/animation_tree.h"
|
||||||
#include "scene/gui/graph_edit.h"
|
#include "scene/gui/graph_edit.h"
|
||||||
|
|
@ -46,8 +47,8 @@ public:
|
||||||
virtual void edit(const Ref<AnimationNode> &p_node) = 0;
|
virtual void edit(const Ref<AnimationNode> &p_node) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AnimationTreeEditor : public VBoxContainer {
|
class AnimationTreeEditor : public EditorDock {
|
||||||
GDCLASS(AnimationTreeEditor, VBoxContainer);
|
GDCLASS(AnimationTreeEditor, EditorDock);
|
||||||
|
|
||||||
ScrollContainer *path_edit = nullptr;
|
ScrollContainer *path_edit = nullptr;
|
||||||
HBoxContainer *path_hb = nullptr;
|
HBoxContainer *path_hb = nullptr;
|
||||||
|
|
@ -96,7 +97,6 @@ class AnimationTreeEditorPlugin : public EditorPlugin {
|
||||||
GDCLASS(AnimationTreeEditorPlugin, EditorPlugin);
|
GDCLASS(AnimationTreeEditorPlugin, EditorPlugin);
|
||||||
|
|
||||||
AnimationTreeEditor *anim_tree_editor = nullptr;
|
AnimationTreeEditor *anim_tree_editor = nullptr;
|
||||||
Button *button = nullptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual String get_plugin_name() const override { return "AnimationTree"; }
|
virtual String get_plugin_name() const override { return "AnimationTree"; }
|
||||||
|
|
|
||||||
|
|
@ -8967,9 +8967,6 @@ EditorNode::EditorNode() {
|
||||||
|
|
||||||
gui_base->add_child(project_data_missing);
|
gui_base->add_child(project_data_missing);
|
||||||
|
|
||||||
add_editor_plugin(memnew(AnimationPlayerEditorPlugin));
|
|
||||||
add_editor_plugin(memnew(AnimationTrackKeyEditEditorPlugin));
|
|
||||||
add_editor_plugin(memnew(AnimationMarkerKeyEditEditorPlugin));
|
|
||||||
add_editor_plugin(memnew(CanvasItemEditorPlugin));
|
add_editor_plugin(memnew(CanvasItemEditorPlugin));
|
||||||
add_editor_plugin(memnew(Node3DEditorPlugin));
|
add_editor_plugin(memnew(Node3DEditorPlugin));
|
||||||
add_editor_plugin(memnew(ScriptEditorPlugin));
|
add_editor_plugin(memnew(ScriptEditorPlugin));
|
||||||
|
|
@ -8990,7 +8987,9 @@ EditorNode::EditorNode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// More visually meaningful to have this later.
|
// More visually meaningful to have this later.
|
||||||
bottom_panel->move_item_to_end(AnimationPlayerEditor::get_singleton());
|
add_editor_plugin(memnew(AnimationPlayerEditorPlugin));
|
||||||
|
add_editor_plugin(memnew(AnimationTrackKeyEditEditorPlugin));
|
||||||
|
add_editor_plugin(memnew(AnimationMarkerKeyEditEditorPlugin));
|
||||||
|
|
||||||
add_editor_plugin(VersionControlEditorPlugin::get_singleton());
|
add_editor_plugin(VersionControlEditorPlugin::get_singleton());
|
||||||
|
|
||||||
|
|
|
||||||
1
editor/icons/AnimationTreeDock.svg
Normal file
1
editor/icons/AnimationTreeDock.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M1 1v14h1v-2h2v2h8v-2h2v2h1V1h-1v2h-2V1H4v2H2V1zm4 3h2v2h4v2H9v2h2v2H8a1 1 0 0 1-1-1V8H6a1 1 0 0 1-1-1zM2 5h2v2H2zm10 0h2v2h-2zM2 9h2v2H2zm10 0h2v2h-2z"/></svg>
|
||||||
|
After Width: | Height: | Size: 248 B |
Loading…
Add table
Add a link
Reference in a new issue