diff options
Diffstat (limited to 'tools/editor/plugins')
18 files changed, 259 insertions, 228 deletions
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 12a707b2ca..b56140b32d 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -32,20 +32,20 @@ #include "io/resource_saver.h" #include "os/keyboard.h" #include "tools/editor/editor_settings.h" +#include "tools/editor/animation_editor.h" void AnimationPlayerEditor::_node_removed(Node *p_node) { if (player && player == p_node) { player=NULL; - hide(); + set_process(false); - if (edit_anim->is_pressed()) { - editor->get_animation_editor()->set_animation(Ref<Animation>()); - editor->get_animation_editor()->set_root(NULL); - editor->animation_editor_make_visible(false); - edit_anim->set_pressed(false); - } + key_editor->set_animation(Ref<Animation>()); + key_editor->set_root(NULL); + _update_player(); + //editor->animation_editor_make_visible(false); + } } @@ -72,19 +72,18 @@ void AnimationPlayerEditor::_notification(int p_what) { Ref<Animation> anim = player->get_animation(animname); if (!anim.is_null()) { - seek->set_max(anim->get_length()); + frame->set_max(anim->get_length()); } } } - seek->set_val(player->get_current_animation_pos()); - if (edit_anim->is_pressed()) - editor->get_animation_editor()->set_anim_pos(player->get_current_animation_pos()); + frame->set_val(player->get_current_animation_pos()); + key_editor->set_anim_pos(player->get_current_animation_pos()); EditorNode::get_singleton()->get_property_editor()->refresh(); } else if (last_active) { //need the last frame after it stopped - seek->set_val(player->get_current_animation_pos()); + frame->set_val(player->get_current_animation_pos()); } last_active=player->is_playing(); @@ -103,7 +102,7 @@ void AnimationPlayerEditor::_notification(int p_what) { save_anim->set_icon(get_icon("Save", "EditorIcons")); save_anim->get_popup()->connect("item_pressed", this, "_animation_save_menu"); remove_anim->set_icon( get_icon("Remove","EditorIcons") ); - edit_anim->set_icon( get_icon("Edit","EditorIcons") ); + blend_anim->set_icon( get_icon("Blend","EditorIcons") ); play->set_icon( get_icon("PlayStart","EditorIcons") ); play_from->set_icon( get_icon("Play","EditorIcons") ); @@ -113,13 +112,14 @@ void AnimationPlayerEditor::_notification(int p_what) { autoplay_icon=get_icon("AutoPlay","EditorIcons"); stop->set_icon( get_icon("Stop","EditorIcons") ); resource_edit_anim->set_icon( get_icon("EditResource","EditorIcons") ); - pin->set_normal_texture(get_icon("Pin","EditorIcons") ); - pin->set_pressed_texture( get_icon("PinPressed","EditorIcons") ); + pin->set_icon(get_icon("Pin","EditorIcons") ); tool_anim->set_icon(get_icon("Tools","EditorIcons")); tool_anim->get_popup()->connect("item_pressed",this,"_animation_tool_menu"); blend_editor.next->connect("text_changed",this,"_blend_editor_next_changed"); + nodename->set_icon(get_icon("AnimationPlayer","EditorIcons")); + /* anim_editor_load->set_normal_texture( get_icon("AnimGet","EditorIcons")); anim_editor_store->set_normal_texture( get_icon("AnimSet","EditorIcons")); @@ -295,22 +295,25 @@ void AnimationPlayerEditor::_animation_selected(int p_which) { player->set_current_animation( current ); Ref<Animation> anim = player->get_animation(current); - if (edit_anim->is_pressed()) { - Ref<Animation> anim = player->get_animation(current); - editor->get_animation_editor()->set_animation(anim); + { + + key_editor->set_animation(anim); Node *root = player->get_node(player->get_root()); if (root) { - editor->get_animation_editor()->set_root(root); + key_editor->set_root(root); } } - seek->set_max(anim->get_length()); + frame->set_max(anim->get_length()); + if (anim->get_step()) + frame->set_step(anim->get_step()); + else + frame->set_step(0.00001); + } else { - if (edit_anim->is_pressed()) { - editor->get_animation_editor()->set_animation(Ref<Animation>()); - editor->get_animation_editor()->set_root(NULL); - } + key_editor->set_animation(Ref<Animation>()); + key_editor->set_root(NULL); } @@ -631,7 +634,7 @@ Dictionary AnimationPlayerEditor::get_state() const { if (is_visible() && player) { d["player"]=EditorNode::get_singleton()->get_edited_scene()->get_path_to(player); d["animation"]=player->get_current_animation(); - d["editing"]=edit_anim->is_pressed(); + } return d; @@ -648,16 +651,12 @@ void AnimationPlayerEditor::set_state(const Dictionary& p_state) { show(); set_process(true); ensure_visibility(); - EditorNode::get_singleton()->animation_panel_make_visible(true); +// EditorNode::get_singleton()->animation_panel_make_visible(true); if (p_state.has("animation")) { String anim = p_state["animation"]; _select_anim_by_name(anim); - if (p_state.has("editing") && p_state["editing"]) { - - edit_anim->set_pressed(true); - _animation_edit(); - } + _animation_edit(); } } @@ -678,36 +677,22 @@ void AnimationPlayerEditor::_animation_resource_edit() { void AnimationPlayerEditor::_animation_edit() { -// if (animation->get_item_count()==0) -// return; - - if (edit_anim->is_pressed()) { - editor->animation_editor_make_visible(true); - - //editor->get_animation_editor()->set_root(player->get_roo); - get root pending - if (animation->get_item_count()) { - String current = animation->get_item_text(animation->get_selected()); - Ref<Animation> anim = player->get_animation(current); - editor->get_animation_editor()->set_animation(anim); - Node *root = player->get_node(player->get_root()); - if (root) { - editor->get_animation_editor()->set_root(root); - } + if (animation->get_item_count()) { + String current = animation->get_item_text(animation->get_selected()); + Ref<Animation> anim = player->get_animation(current); + key_editor->set_animation(anim); + Node *root = player->get_node(player->get_root()); + if (root) { + key_editor->set_root(root); + } - } else { + } else { - editor->get_animation_editor()->set_animation(Ref<Animation>()); - editor->get_animation_editor()->set_root(NULL); + key_editor->set_animation(Ref<Animation>()); + key_editor->set_root(NULL); - } - } else { - editor->animation_editor_make_visible(false); - editor->get_animation_editor()->set_animation(Ref<Animation>()); - editor->get_animation_editor()->set_root(NULL); } - //get_scene()->get_root_node()->call("_resource_selected",anim,""); - } void AnimationPlayerEditor::_dialog_action(String p_file) { @@ -800,16 +785,21 @@ void AnimationPlayerEditor::_update_animation() { void AnimationPlayerEditor::_update_player() { - if (!player) - return; updating=true; List<StringName> animlist; - player->get_animation_list(&animlist); + if (player) + player->get_animation_list(&animlist); animation->clear(); - nodename->set_text(player->get_name()); + if (player) + nodename->set_text(player->get_name()); + else + nodename->set_text("<empty>"); + + add_anim->set_disabled(player==NULL); + load_anim->set_disabled(player==NULL); stop->set_disabled(animlist.size()==0); play->set_disabled(animlist.size()==0); play_bw->set_disabled(animlist.size()==0); @@ -837,6 +827,9 @@ void AnimationPlayerEditor::_update_player() { } + if (!player) + return; + updating=false; if (active_idx!=-1) { animation->select(active_idx); @@ -852,17 +845,14 @@ void AnimationPlayerEditor::_update_player() { //pause->set_pressed(player->is_paused()); - if (edit_anim->is_pressed()) { - - if (animation->get_item_count()) { - String current = animation->get_item_text(animation->get_selected()); - Ref<Animation> anim = player->get_animation(current); - editor->get_animation_editor()->set_animation(anim); - Node *root = player->get_node(player->get_root()); - if (root) { - editor->get_animation_editor()->set_root(root); - } + if (animation->get_item_count()) { + String current = animation->get_item_text(animation->get_selected()); + Ref<Animation> anim = player->get_animation(current); + key_editor->set_animation(anim); + Node *root = player->get_node(player->get_root()); + if (root) { + key_editor->set_root(root); } } @@ -958,7 +948,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value) { Ref<Animation> anim; anim=player->get_animation(current); - float pos = anim->get_length() * (p_value / seek->get_max()); + float pos = anim->get_length() * (p_value / frame->get_max()); if (player->is_valid()) { float cpos = player->get_current_animation_pos(); @@ -968,8 +958,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value) { player->seek(pos,true); } - if (edit_anim->is_pressed()) - editor->get_animation_editor()->set_anim_pos(pos); + key_editor->set_anim_pos(pos); updating=true; }; @@ -999,19 +988,19 @@ void AnimationPlayerEditor::_editor_store() { String current = animation->get_item_text(animation->get_selected()); Ref<Animation> anim = player->get_animation(current); - if (editor->get_animation_editor()->get_current_animation()==anim) + if (key_editor->get_current_animation()==anim) return; //already there undo_redo->create_action("Store anim in editor"); - undo_redo->add_do_method(editor->get_animation_editor(),"set_animation",anim); - undo_redo->add_undo_method(editor->get_animation_editor(),"remove_animation",anim); + undo_redo->add_do_method(key_editor,"set_animation",anim); + undo_redo->add_undo_method(key_editor,"remove_animation",anim); undo_redo->commit_action(); } void AnimationPlayerEditor::_editor_load(){ - Ref<Animation> anim = editor->get_animation_editor()->get_current_animation(); + Ref<Animation> anim = key_editor->get_current_animation(); if (anim.is_null()) return; @@ -1059,7 +1048,16 @@ void AnimationPlayerEditor::_editor_load(){ void AnimationPlayerEditor::_animation_key_editor_anim_len_changed(float p_len) { - seek->set_max(p_len); + frame->set_max(p_len); + +} + +void AnimationPlayerEditor::_animation_key_editor_anim_step_changed(float p_len) { + + if (p_len) + frame->set_step(p_len); + else + frame->set_step(0.00001); } @@ -1074,7 +1072,7 @@ void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos) { if (player->is_playing() ) return; - seek->set_val(p_pos); + frame->set_val(p_pos); EditorNode::get_singleton()->get_property_editor()->refresh(); @@ -1087,13 +1085,11 @@ void AnimationPlayerEditor::_hide_anim_editors() { player=NULL; hide(); set_process(false); - if (edit_anim->is_pressed()) { - editor->get_animation_editor()->set_animation(Ref<Animation>()); - editor->get_animation_editor()->set_root(NULL); - editor->animation_editor_make_visible(false); - edit_anim->set_pressed(false); - } + key_editor->set_animation(Ref<Animation>()); + key_editor->set_root(NULL); +// editor->animation_editor_make_visible(false); + } @@ -1238,6 +1234,7 @@ void AnimationPlayerEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_list_changed"),&AnimationPlayerEditor::_list_changed); ObjectTypeDB::bind_method(_MD("_animation_key_editor_seek"),&AnimationPlayerEditor::_animation_key_editor_seek); ObjectTypeDB::bind_method(_MD("_animation_key_editor_anim_len_changed"),&AnimationPlayerEditor::_animation_key_editor_anim_len_changed); + ObjectTypeDB::bind_method(_MD("_animation_key_editor_anim_step_changed"),&AnimationPlayerEditor::_animation_key_editor_anim_step_changed); ObjectTypeDB::bind_method(_MD("_hide_anim_editors"),&AnimationPlayerEditor::_hide_anim_editors); ObjectTypeDB::bind_method(_MD("_animation_duplicate"),&AnimationPlayerEditor::_animation_duplicate); ObjectTypeDB::bind_method(_MD("_blend_editor_next_changed"),&AnimationPlayerEditor::_blend_editor_next_changed); @@ -1278,6 +1275,50 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { add_child(hb); + play_bw_from = memnew( ToolButton ); + play_bw_from->set_tooltip("Play backwards selected animation from current pos. (A)"); + hb->add_child(play_bw_from); + + play_bw = memnew( ToolButton ); + play_bw->set_tooltip("Play backwards selected animation from end. (Shift+A)"); + hb->add_child(play_bw); + + stop = memnew( ToolButton ); + stop->set_toggle_mode(true); + hb->add_child(stop); + stop->set_tooltip("Stop animation playback. (S)"); + + play = memnew( ToolButton ); + play->set_tooltip("Play selected animation from start. (Shift+D)"); + hb->add_child(play); + + + play_from = memnew( ToolButton ); + play_from->set_tooltip("Play selected animation from current pos. (D)"); + hb->add_child(play_from); + + + + //pause = memnew( Button ); + //pause->set_toggle_mode(true); + //hb->add_child(pause); + + frame = memnew( SpinBox ); + hb->add_child(frame); + frame->set_custom_minimum_size(Size2(80,0)); + frame->set_stretch_ratio(2); + frame->set_tooltip("Animation position (in seconds)."); + + hb->add_child( memnew( VSeparator)); + + scale = memnew( LineEdit ); + hb->add_child(scale); + scale->set_h_size_flags(SIZE_EXPAND_FILL); + scale->set_stretch_ratio(1); + scale->set_tooltip("Scale animation playback globally for the node."); + scale->hide(); + + add_anim = memnew( ToolButton ); add_anim->set_tooltip("Create new animation in player."); @@ -1337,68 +1378,14 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { //tool_anim->get_popup()->add_item("Edit Anim Resource",TOOL_PASTE_ANIM); hb->add_child(tool_anim); - - edit_anim = memnew( ToolButton ); - edit_anim->set_toggle_mode(true); - hb->add_child(edit_anim); - edit_anim->set_tooltip("Open animation editor.\nProperty editor will displays all editable keys too."); - - - hb = memnew (HBoxContainer); - add_child(hb); - - play_bw_from = memnew( ToolButton ); - play_bw_from->set_tooltip("Play backwards selected animation from current pos. (A)"); - hb->add_child(play_bw_from); - - play_bw = memnew( ToolButton ); - play_bw->set_tooltip("Play backwards selected animation from end. (Shift+A)"); - hb->add_child(play_bw); - - stop = memnew( ToolButton ); - stop->set_toggle_mode(true); - hb->add_child(stop); - stop->set_tooltip("Stop animation playback. (S)"); - - play = memnew( ToolButton ); - play->set_tooltip("Play selected animation from start. (Shift+D)"); - hb->add_child(play); - - - play_from = memnew( ToolButton ); - play_from->set_tooltip("Play selected animation from current pos. (D)"); - hb->add_child(play_from); - - - - //pause = memnew( Button ); - //pause->set_toggle_mode(true); - //hb->add_child(pause); - - seek = memnew( HSlider ); - seek->set_val(0); - seek->set_step(0.01); - hb->add_child(seek); - seek->set_h_size_flags(SIZE_EXPAND_FILL); - seek->set_stretch_ratio(8); - seek->set_tooltip("Seek animation (when stopped)."); - - frame = memnew( SpinBox ); - hb->add_child(frame); - frame->set_h_size_flags(SIZE_EXPAND_FILL); - frame->set_stretch_ratio(2); - frame->set_tooltip("Animation position (in seconds)."); - seek->share(frame); + nodename = memnew( Button ); + hb->add_child(nodename); + pin = memnew( ToolButton ); + pin->set_toggle_mode(true); + hb->add_child(pin); - scale = memnew( LineEdit ); - hb->add_child(scale); - scale->set_h_size_flags(SIZE_EXPAND_FILL); - scale->set_stretch_ratio(1); - scale->set_tooltip("Scale animation playback globally for the node."); - scale->hide(); - resource_edit_anim= memnew( Button ); hb->add_child(resource_edit_anim); resource_edit_anim->hide(); @@ -1464,30 +1451,31 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { load_anim->connect("pressed", this,"_animation_load"); duplicate_anim->connect("pressed", this,"_animation_duplicate"); //frame->connect("text_entered", this,"_seek_frame_changed"); - edit_anim->connect("pressed", this,"_animation_edit"); + blend_anim->connect("pressed", this,"_animation_blend"); remove_anim->connect("pressed", this,"_animation_remove"); animation->connect("item_selected", this,"_animation_selected",Vector<Variant>(),true); resource_edit_anim->connect("pressed", this,"_animation_resource_edit"); file->connect("file_selected", this,"_dialog_action"); - seek->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true); + frame->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true); scale->connect("text_entered", this, "_scale_changed",Vector<Variant>(),true); - editor->get_animation_editor()->connect("timeline_changed",this,"_animation_key_editor_seek"); - editor->get_animation_editor()->connect("animation_len_changed",this,"_animation_key_editor_anim_len_changed"); - - HBoxContainer *ahb = editor->get_animation_panel_hb(); - nodename = memnew( Label ); - ahb->add_child(nodename); - nodename->set_h_size_flags(SIZE_EXPAND_FILL); - nodename->set_opacity(0.5); - pin = memnew( TextureButton ); - pin->set_toggle_mode(true); - ahb->add_child(pin); + + renaming=false; last_active=false; set_process_unhandled_key_input(true); + + key_editor = memnew( AnimationKeyEditor); + add_child(key_editor); + add_constant_override("separation",get_constant("separation","VBoxContainer")); + key_editor->set_v_size_flags(SIZE_EXPAND_FILL); + key_editor->connect("timeline_changed",this,"_animation_key_editor_seek"); + key_editor->connect("animation_len_changed",this,"_animation_key_editor_anim_len_changed"); + key_editor->connect("animation_step_changed",this,"_animation_key_editor_anim_step_changed"); + + _update_player(); } @@ -1510,7 +1498,7 @@ void AnimationPlayerEditorPlugin::make_visible(bool p_visible) { anim_editor->show(); anim_editor->set_process(true); anim_editor->ensure_visibility(); - editor->animation_panel_make_visible(true); +// editor->animation_panel_make_visible(true); } else { // anim_editor->hide(); @@ -1524,7 +1512,8 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) { editor=p_node; anim_editor = memnew( AnimationPlayerEditor(editor) ); anim_editor->set_undo_redo(editor->get_undo_redo()); - editor->get_animation_panel()->add_child(anim_editor); + + editor->add_bottom_panel_item("Animation",anim_editor); /* editor->get_viewport()->add_child(anim_editor); anim_editor->set_area_as_parent_rect(); diff --git a/tools/editor/plugins/animation_player_editor_plugin.h b/tools/editor/plugins/animation_player_editor_plugin.h index 9fbd92e4f0..0ad849c2f9 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.h +++ b/tools/editor/plugins/animation_player_editor_plugin.h @@ -41,7 +41,7 @@ /** @author Juan Linietsky <reduzio@gmail.com> */ - +class AnimationKeyEditor; class AnimationPlayerEditor : public VBoxContainer { OBJ_TYPE(AnimationPlayerEditor, VBoxContainer ); @@ -78,17 +78,16 @@ class AnimationPlayerEditor : public VBoxContainer { Button *autoplay; Button *rename_anim; Button *duplicate_anim; - Button *edit_anim; + Button *resource_edit_anim; Button *load_anim; MenuButton *save_anim; Button *blend_anim; Button *remove_anim; MenuButton *tool_anim; - TextureButton *pin; - Label *nodename; + ToolButton *pin; + Button *nodename; SpinBox *frame; - HSlider *seek; LineEdit *scale; LineEdit *name; Label *name_title; @@ -117,6 +116,9 @@ class AnimationPlayerEditor : public VBoxContainer { bool updating; bool updating_blends; + AnimationKeyEditor *key_editor; + + void _select_anim_by_name(const String& p_anim); void _play_pressed(); void _play_from_pressed(); @@ -158,6 +160,8 @@ class AnimationPlayerEditor : public VBoxContainer { void _animation_key_editor_seek(float p_pos); void _animation_key_editor_anim_len_changed(float p_new); + void _animation_key_editor_anim_step_changed(float p_len); + void _unhandled_key_input(const InputEvent& p_ev); void _animation_tool_menu(int p_option); void _animation_save_menu(int p_option); @@ -175,6 +179,7 @@ public: AnimationPlayer *get_player() const; static AnimationPlayerEditor *singleton; + AnimationKeyEditor* get_key_editor() { return key_editor; } Dictionary get_state() const; void set_state(const Dictionary& p_state); diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index 609b1ccb63..d85553b4db 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -1498,18 +1498,17 @@ bool AnimationTreeEditorPlugin::handles(Object *p_object) const { void AnimationTreeEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - editor->hide_animation_player_editors(); - editor->animation_panel_make_visible(true); - anim_tree_editor->show(); +// editor->hide_animation_player_editors(); +// editor->animation_panel_make_visible(true); + button->show(); + editor->make_bottom_panel_item_visible(anim_tree_editor); anim_tree_editor->set_fixed_process(true); - EditorNode::get_top_split()->set_collapsed(false); - } else { - anim_tree_editor->hide(); + if (anim_tree_editor->is_visible()) + editor->hide_bottom_panel(); + button->hide(); anim_tree_editor->set_fixed_process(false); - editor->animation_panel_make_visible(false); - EditorNode::get_top_split()->set_collapsed(true); } } @@ -1517,12 +1516,10 @@ AnimationTreeEditorPlugin::AnimationTreeEditorPlugin(EditorNode *p_node) { editor=p_node; anim_tree_editor = memnew( AnimationTreeEditor ); - //editor->get_viewport()->add_child(anim_tree_editor); - //anim_tree_editor->set_area_as_parent_rect(); - editor->get_animation_panel()->add_child(anim_tree_editor); - anim_tree_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); - anim_tree_editor->hide(); + anim_tree_editor->set_custom_minimum_size(Size2(0,300)); + button=editor->add_bottom_panel_item("AnimationTree",anim_tree_editor); + button->hide(); diff --git a/tools/editor/plugins/animation_tree_editor_plugin.h b/tools/editor/plugins/animation_tree_editor_plugin.h index fb7eb58f8d..4884a22d90 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.h +++ b/tools/editor/plugins/animation_tree_editor_plugin.h @@ -176,6 +176,7 @@ class AnimationTreeEditorPlugin : public EditorPlugin { AnimationTreeEditor *anim_tree_editor; EditorNode *editor; + Button *button; public: diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 2eaf017d08..a259fa0fcc 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -37,6 +37,8 @@ #include "os/input.h" #include "tools/editor/editor_settings.h" #include "scene/gui/grid_container.h" +#include "tools/editor/animation_editor.h" +#include "tools/editor/plugins/animation_player_editor_plugin.h" class SnapDialog : public ConfirmationDialog { @@ -194,7 +196,7 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2& mouse_pos) { void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { - if (!is_visible() || window_has_modal_stack()) + if (!is_visible() || get_viewport()->gui_has_modal_stack()) return; if (p_ev.key.mod.control) // prevent to change tool mode when control key is pressed @@ -407,7 +409,7 @@ void CanvasItemEditor::_node_removed(Node *p_node) { void CanvasItemEditor::_keying_changed() { - if (editor->get_animation_editor()->has_keying()) + if (AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) animation_hb->show(); else animation_hb->hide(); @@ -2695,11 +2697,11 @@ void CanvasItemEditor::_popup_callback(int p_op) { Node2D *n2d = canvas_item->cast_to<Node2D>(); if (key_pos) - editor->get_animation_editor()->insert_node_value_key(n2d,"transform/pos",n2d->get_pos(),existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(n2d,"transform/pos",n2d->get_pos(),existing); if (key_rot) - editor->get_animation_editor()->insert_node_value_key(n2d,"transform/rot",Math::rad2deg(n2d->get_rot()),existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(n2d,"transform/rot",Math::rad2deg(n2d->get_rot()),existing); if (key_scale) - editor->get_animation_editor()->insert_node_value_key(n2d,"transform/scale",n2d->get_scale(),existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(n2d,"transform/scale",n2d->get_scale(),existing); if (n2d->has_meta("_edit_bone_") && n2d->get_parent_item()) { @@ -2727,11 +2729,11 @@ void CanvasItemEditor::_popup_callback(int p_op) { for(List<Node2D*>::Element *F=ik_chain.front();F;F=F->next()) { if (key_pos) - editor->get_animation_editor()->insert_node_value_key(F->get(),"transform/pos",F->get()->get_pos(),existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(F->get(),"transform/pos",F->get()->get_pos(),existing); if (key_rot) - editor->get_animation_editor()->insert_node_value_key(F->get(),"transform/rot",Math::rad2deg(F->get()->get_rot()),existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(F->get(),"transform/rot",Math::rad2deg(F->get()->get_rot()),existing); if (key_scale) - editor->get_animation_editor()->insert_node_value_key(F->get(),"transform/scale",F->get()->get_scale(),existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(F->get(),"transform/scale",F->get()->get_scale(),existing); } @@ -2743,9 +2745,9 @@ void CanvasItemEditor::_popup_callback(int p_op) { Control *ctrl = canvas_item->cast_to<Control>(); if (key_pos) - editor->get_animation_editor()->insert_node_value_key(ctrl,"rect/pos",ctrl->get_pos(),existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl,"rect/pos",ctrl->get_pos(),existing); if (key_scale) - editor->get_animation_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size(),existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size(),existing); } } @@ -2867,7 +2869,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { if (key_pos) ctrl->set_pos(Point2()); //if (key_scale) - // editor->get_animation_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size()); + // AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size()); } } @@ -3416,7 +3418,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { box_selecting=false; //zoom=0.5; singleton=this; - editor->get_animation_editor()->connect("keying_changed",this,"_keying_changed"); + AnimationPlayerEditor::singleton->get_key_editor()->connect("keying_changed",this,"_keying_changed"); set_process_unhandled_key_input(true); can_move_pivot=false; drag=DRAG_NONE; diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.cpp b/tools/editor/plugins/resource_preloader_editor_plugin.cpp index 403a919f5d..8490f63ff0 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/tools/editor/plugins/resource_preloader_editor_plugin.cpp @@ -356,11 +356,16 @@ bool ResourcePreloaderEditorPlugin::handles(Object *p_object) const { void ResourcePreloaderEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - preloader_editor->show(); + //preloader_editor->show(); + button->show(); + editor->make_bottom_panel_item_visible(preloader_editor); // preloader_editor->set_process(true); } else { - preloader_editor->hide(); + if (preloader_editor->is_visible()) + editor->hide_bottom_panel(); + button->hide(); + //preloader_editor->hide(); // preloader_editor->set_process(false); } @@ -370,11 +375,14 @@ ResourcePreloaderEditorPlugin::ResourcePreloaderEditorPlugin(EditorNode *p_node) editor=p_node; preloader_editor = memnew( ResourcePreloaderEditor ); - editor->get_viewport()->add_child(preloader_editor); - preloader_editor->set_area_as_parent_rect(); + preloader_editor->set_custom_minimum_size(Size2(0,250)); + + button=editor->add_bottom_panel_item("ResourcePreloader",preloader_editor); + button->hide(); + // preloader_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END); // preloader_editor->set_margin( MARGIN_TOP, 120 ); - preloader_editor->hide(); + diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.h b/tools/editor/plugins/resource_preloader_editor_plugin.h index 49ef86b4c2..53436797a9 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.h +++ b/tools/editor/plugins/resource_preloader_editor_plugin.h @@ -85,6 +85,7 @@ class ResourcePreloaderEditorPlugin : public EditorPlugin { ResourcePreloaderEditor *preloader_editor; EditorNode *editor; + Button *button; public: diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index 493ae405ba..a28fbb2ec8 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -423,11 +423,16 @@ bool SampleLibraryEditorPlugin::handles(Object *p_object) const { void SampleLibraryEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - sample_library_editor->show(); + //sample_library_editor->show(); + button->show(); + editor->make_bottom_panel_item_visible(sample_library_editor); // sample_library_editor->set_process(true); } else { - sample_library_editor->hide(); + if (sample_library_editor->is_visible()) + editor->hide_bottom_panel(); + button->hide(); + // sample_library_editor->set_process(false); } @@ -437,11 +442,16 @@ SampleLibraryEditorPlugin::SampleLibraryEditorPlugin(EditorNode *p_node) { editor=p_node; sample_library_editor = memnew( SampleLibraryEditor ); - editor->get_viewport()->add_child(sample_library_editor); - sample_library_editor->set_area_as_parent_rect(); + + //editor->get_viewport()->add_child(sample_library_editor); + sample_library_editor->set_custom_minimum_size(Size2(0,250)); + button=p_node->add_bottom_panel_item("SampleLibrary",sample_library_editor); + button->hide(); + + //sample_library_editor->set_area_as_parent_rect(); // sample_library_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END); // sample_library_editor->set_margin( MARGIN_TOP, 120 ); - sample_library_editor->hide(); + //sample_library_editor->hide(); diff --git a/tools/editor/plugins/sample_library_editor_plugin.h b/tools/editor/plugins/sample_library_editor_plugin.h index 6627d8d6de..cbdcf5fc3f 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.h +++ b/tools/editor/plugins/sample_library_editor_plugin.h @@ -90,6 +90,7 @@ class SampleLibraryEditorPlugin : public EditorPlugin { SampleLibraryEditor *sample_library_editor; EditorNode *editor; + Button *button; public: diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 8adfe9d2cf..1e16f32e6e 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -2321,12 +2321,9 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { menu_hb = memnew( HBoxContainer ); add_child(menu_hb); - v_split = memnew( VSplitContainer ); - add_child(v_split); - v_split->set_v_size_flags(SIZE_EXPAND_FILL); script_split = memnew( HSplitContainer ); - v_split->add_child(script_split); + add_child(script_split); script_split->set_v_size_flags(SIZE_EXPAND_FILL); script_list = memnew( ItemList ); @@ -2416,7 +2413,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { debug_menu->get_popup()->add_item("Break",DEBUG_BREAK); debug_menu->get_popup()->add_item("Continue",DEBUG_CONTINUE); debug_menu->get_popup()->add_separator(); - debug_menu->get_popup()->add_check_item("Show Debugger",DEBUG_SHOW); + //debug_menu->get_popup()->add_check_item("Show Debugger",DEBUG_SHOW); debug_menu->get_popup()->add_check_item("Keep Debugger Open",DEBUG_SHOW_KEEP_OPEN); debug_menu->get_popup()->connect("item_pressed", this,"_menu_option"); @@ -2545,7 +2542,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { quick_open->connect("goto_line",this,"_goto_script_line2"); - v_split->add_child(debugger); + + Button *db = EditorNode::get_singleton()->add_bottom_panel_item("Debugger",debugger); + debugger->set_tool_button(db); + + debugger->connect("breaked",this,"_breaked"); autosave_timer = memnew( Timer ); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index b829d4e0e5..c52da41a43 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -212,8 +212,6 @@ class ScriptEditor : public VBoxContainer { Tree *disk_changed_list; ConfirmationDialog *disk_changed; - VSplitContainer *v_split; - bool restoring_layout; String _get_debug_tooltip(const String&p_text,Node *_ste); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index e47dcbf30f..153d71e9cb 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -39,6 +39,9 @@ #include "scene/resources/surface_tool.h" #include "tools/editor/spatial_editor_gizmos.h" #include "globals.h" +#include "tools/editor/plugins/animation_player_editor_plugin.h" +#include "tools/editor/animation_editor.h" + #define DISTANCE_DEFAULT 4 @@ -1691,7 +1694,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (!get_selected_count() || _edit.mode!=TRANSFORM_NONE) break; - if (!editor->get_animation_editor()->has_keying()) { + if (!AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) { set_message("Keying is disabled (no key inserted)."); break; } @@ -3529,7 +3532,7 @@ void SpatialEditor::_instance_scene() { void SpatialEditor::_unhandled_key_input(InputEvent p_event) { - if (!is_visible() || window_has_modal_stack()) + if (!is_visible() || get_viewport()->gui_has_modal_stack()) return; { diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 048df2d682..af73828b61 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -485,11 +485,15 @@ bool SpriteFramesEditorPlugin::handles(Object *p_object) const { void SpriteFramesEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - frames_editor->show(); + button->show(); + editor->make_bottom_panel_item_visible(frames_editor); // frames_editor->set_process(true); } else { - frames_editor->hide(); + button->hide(); + if (frames_editor->is_visible()) + editor->hide_bottom_panel(); + // frames_editor->set_process(false); } @@ -499,11 +503,9 @@ SpriteFramesEditorPlugin::SpriteFramesEditorPlugin(EditorNode *p_node) { editor=p_node; frames_editor = memnew( SpriteFramesEditor ); - editor->get_viewport()->add_child(frames_editor); - frames_editor->set_area_as_parent_rect(); -// frames_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END); -// frames_editor->set_margin( MARGIN_TOP, 120 ); - frames_editor->hide(); + frames_editor->set_custom_minimum_size(Size2(0,300)); + button=editor->add_bottom_panel_item("SpriteFrames",frames_editor); + button->hide(); diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.h b/tools/editor/plugins/sprite_frames_editor_plugin.h index e4088da297..5d0a6cb035 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.h +++ b/tools/editor/plugins/sprite_frames_editor_plugin.h @@ -94,6 +94,7 @@ class SpriteFramesEditorPlugin : public EditorPlugin { SpriteFramesEditor *frames_editor; EditorNode *editor; + Button *button; public: diff --git a/tools/editor/plugins/style_box_editor_plugin.cpp b/tools/editor/plugins/style_box_editor_plugin.cpp index 58e9038840..3d7cf4135d 100644 --- a/tools/editor/plugins/style_box_editor_plugin.cpp +++ b/tools/editor/plugins/style_box_editor_plugin.cpp @@ -90,19 +90,24 @@ bool StyleBoxEditorPlugin::handles(Object *p_node) const{ void StyleBoxEditorPlugin::make_visible(bool p_visible){ - if (p_visible) - stylebox_editor->show(); - else - stylebox_editor->hide(); + if (p_visible) { + button->show(); + + } else { + if (stylebox_editor->is_visible()) + EditorNode::get_singleton()->hide_bottom_panel(); + button->hide(); + } } StyleBoxEditorPlugin::StyleBoxEditorPlugin(EditorNode *p_node) { stylebox_editor = memnew( StyleBoxEditor ); + stylebox_editor->set_custom_minimum_size(Size2(0,250)); - p_node->get_viewport()->add_child(stylebox_editor); - stylebox_editor->set_area_as_parent_rect(); - stylebox_editor->hide(); + //p_node->get_viewport()->add_child(stylebox_editor); + button = p_node->add_bottom_panel_item("StyleBox",stylebox_editor); + button->hide(); } diff --git a/tools/editor/plugins/style_box_editor_plugin.h b/tools/editor/plugins/style_box_editor_plugin.h index 3b3f8d8d0f..737f830bbb 100644 --- a/tools/editor/plugins/style_box_editor_plugin.h +++ b/tools/editor/plugins/style_box_editor_plugin.h @@ -65,6 +65,7 @@ class StyleBoxEditorPlugin : public EditorPlugin { StyleBoxEditor *stylebox_editor; EditorNode *editor; + Button *button; public: diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index f67f049b36..ef7b3b17c3 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -831,21 +831,26 @@ bool ThemeEditorPlugin::handles(Object *p_node) const{ void ThemeEditorPlugin::make_visible(bool p_visible){ if (p_visible) { - theme_editor->show(); theme_editor->set_process(true); + button->show(); } else { - theme_editor->hide(); theme_editor->set_process(false); + if (theme_editor->is_visible()) + EditorNode::get_singleton()->hide_bottom_panel(); + button->hide(); } } ThemeEditorPlugin::ThemeEditorPlugin(EditorNode *p_node) { + editor=p_node; theme_editor = memnew( ThemeEditor ); + theme_editor->set_custom_minimum_size(Size2(0,500)); + +// p_node->get_viewport()->add_child(theme_editor); + button=EditorNode::get_singleton()->add_bottom_panel_item("Theme",theme_editor); + button->hide(); - p_node->get_viewport()->add_child(theme_editor); - theme_editor->set_area_as_parent_rect(); - theme_editor->hide(); } diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index f5e7192a73..52c4aed839 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -102,6 +102,7 @@ class ThemeEditorPlugin : public EditorPlugin { ThemeEditor *theme_editor; EditorNode *editor; + Button *button; public: |