-Massive editor dialog cleanup

-Added a bottom menu list
This commit is contained in:
Juan Linietsky 2016-01-17 20:03:57 -03:00
parent 72fcb8a35b
commit 74a48a0140
32 changed files with 597 additions and 519 deletions

View file

@ -387,7 +387,7 @@ void Control::_notification(int p_notification) {
data.parent_canvas_item->disconnect("item_rect_changed",this,"_size_changed");
data.parent_canvas_item=NULL;
} else {
} else if (!is_set_as_toplevel()) {
//disconnect viewport
get_viewport()->disconnect("size_changed",this,"_size_changed");

View file

@ -109,7 +109,7 @@ void SplitContainer::_resort() {
int sep=get_constant("separation");
Ref<Texture> g = get_icon("grabber");
if (collapsed || !dragger_visible) {
if (dragger_visibility==DRAGGER_HIDDEN_COLLAPSED) {
sep=0;
} else {
sep=MAX(sep,vertical?g->get_height():g->get_width());
@ -221,7 +221,7 @@ Size2 SplitContainer::get_minimum_size() const {
Size2i minimum;
int sep=get_constant("separation");
Ref<Texture> g = get_icon("grabber");
sep=dragger_visible?MAX(sep,vertical?g->get_height():g->get_width()):0;
sep=(dragger_visibility!=DRAGGER_HIDDEN_COLLAPSED)?MAX(sep,vertical?g->get_height():g->get_width()):0;
for(int i=0;i<2;i++) {
@ -278,19 +278,19 @@ void SplitContainer::_notification(int p_what) {
if (collapsed || (!mouse_inside && get_constant("autohide")))
return;
int sep=dragger_visible?get_constant("separation"):0;
int sep=dragger_visibility!=DRAGGER_HIDDEN_COLLAPSED?get_constant("separation"):0;
Ref<Texture> tex = get_icon("grabber");
Size2 size=get_size();
if (vertical) {
//draw_style_box( get_stylebox("bg"), Rect2(0,middle_sep,get_size().width,sep));
if (dragger_visible)
if (dragger_visibility==DRAGGER_VISIBLE)
draw_texture(tex,Point2i((size.x-tex->get_width())/2,middle_sep+(sep-tex->get_height())/2));
} else {
//draw_style_box( get_stylebox("bg"), Rect2(middle_sep,0,sep,get_size().height));
if (dragger_visible)
if (dragger_visibility==DRAGGER_VISIBLE)
draw_texture(tex,Point2i(middle_sep+(sep-tex->get_width())/2,(size.y-tex->get_height())/2));
}
@ -301,7 +301,7 @@ void SplitContainer::_notification(int p_what) {
void SplitContainer::_input_event(const InputEvent& p_event) {
if (collapsed || !_getch(0) || !_getch(1) || !dragger_visible)
if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility!=DRAGGER_VISIBLE)
return;
if (p_event.type==InputEvent::MOUSE_BUTTON) {
@ -400,19 +400,19 @@ void SplitContainer::set_collapsed(bool p_collapsed) {
}
void SplitContainer::set_dragger_visible(bool p_true) {
void SplitContainer::set_dragger_visibility(DraggerVisibility p_visibility) {
dragger_visible=p_true;
dragger_visibility=p_visibility;
queue_sort();
update();
}
bool SplitContainer::is_dragger_visible() const{
SplitContainer::DraggerVisibility SplitContainer::get_dragger_visibility() const {
return dragger_visible;
return dragger_visibility;
}
bool SplitContainer::is_collapsed() const {
@ -429,15 +429,18 @@ void SplitContainer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_collapsed","collapsed"),&SplitContainer::set_collapsed);
ObjectTypeDB::bind_method(_MD("is_collapsed"),&SplitContainer::is_collapsed);
ObjectTypeDB::bind_method(_MD("set_dragger_visible","visible"),&SplitContainer::set_dragger_visible);
ObjectTypeDB::bind_method(_MD("is_dragger_visible"),&SplitContainer::is_dragger_visible);
ObjectTypeDB::bind_method(_MD("set_dragger_visibility","mode"),&SplitContainer::set_dragger_visibility);
ObjectTypeDB::bind_method(_MD("get_dragger_visibility"),&SplitContainer::get_dragger_visibility);
ADD_SIGNAL( MethodInfo("dragged",PropertyInfo(Variant::INT,"offset")));
ADD_PROPERTY( PropertyInfo(Variant::INT,"split/offset"),_SCS("set_split_offset"),_SCS("get_split_offset"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"split/collapsed"),_SCS("set_collapsed"),_SCS("is_collapsed"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"split/dragger_visible"),_SCS("set_dragger_visible"),_SCS("is_dragger_visible"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"split/dragger_visibility",PROPERTY_HINT_ENUM,"Visible,Hidden,Hidden & Collapsed"),_SCS("set_dragger_visibility"),_SCS("get_dragger_visibility"));
BIND_CONSTANT( DRAGGER_VISIBLE );
BIND_CONSTANT( DRAGGER_HIDDEN );
BIND_CONSTANT( DRAGGER_HIDDEN_COLLAPSED );
}
@ -450,7 +453,7 @@ SplitContainer::SplitContainer(bool p_vertical) {
vertical=p_vertical;
dragging=false;
collapsed=false;
dragger_visible=true;
dragger_visibility=DRAGGER_VISIBLE;
}

View file

@ -35,7 +35,13 @@
class SplitContainer : public Container {
OBJ_TYPE(SplitContainer,Container);
public:
enum DraggerVisibility {
DRAGGER_VISIBLE,
DRAGGER_HIDDEN,
DRAGGER_HIDDEN_COLLAPSED
};
private:
bool vertical;
int expand_ofs;
int middle_sep;
@ -43,7 +49,7 @@ class SplitContainer : public Container {
int drag_from;
int drag_ofs;
bool collapsed;
bool dragger_visible;
DraggerVisibility dragger_visibility;
bool mouse_inside;
@ -66,8 +72,8 @@ public:
void set_collapsed(bool p_collapsed);
bool is_collapsed() const;
void set_dragger_visible(bool p_true);
bool is_dragger_visible() const;
void set_dragger_visibility(DraggerVisibility p_visibility);
DraggerVisibility get_dragger_visibility() const;
virtual CursorShape get_cursor_shape(const Point2& p_pos=Point2i());
@ -76,6 +82,7 @@ public:
SplitContainer(bool p_vertical=false);
};
VARIANT_ENUM_CAST(SplitContainer::DraggerVisibility);
class HSplitContainer : public SplitContainer {

View file

@ -1085,6 +1085,7 @@ void AnimationKeyEditor::_track_editor_draw() {
move_up_button->set_disabled(true);
move_down_button->set_disabled(true);
remove_button->set_disabled(true);
return;
}
@ -3023,7 +3024,7 @@ void AnimationKeyEditor::set_keying(bool p_enabled) {
bool AnimationKeyEditor::has_keying() const {
return keying;
return is_visible();
}
void AnimationKeyEditor::_query_insert(const InsertData& p_id) {
@ -3352,6 +3353,7 @@ Ref<Animation> AnimationKeyEditor::get_current_animation() const {
void AnimationKeyEditor::_animation_len_changed(float p_len) {
if (updating)
return;
@ -3479,8 +3481,10 @@ void AnimationKeyEditor::_insert_delay() {
void AnimationKeyEditor::_step_changed(float p_len) {
updating=true;
if (!animation.is_null())
if (!animation.is_null()) {
animation->set_step(p_len);
emit_signal("animation_step_changed",animation->get_length());
}
updating=false;
}
@ -3691,21 +3695,33 @@ void AnimationKeyEditor::_bind_methods() {
ADD_SIGNAL( MethodInfo("keying_changed" ) );
ADD_SIGNAL( MethodInfo("timeline_changed", PropertyInfo(Variant::REAL,"pos") ) );
ADD_SIGNAL( MethodInfo("animation_len_changed", PropertyInfo(Variant::REAL,"len") ) );
ADD_SIGNAL( MethodInfo("animation_step_changed", PropertyInfo(Variant::REAL,"step") ) );
ADD_SIGNAL( MethodInfo("key_edited", PropertyInfo(Variant::INT,"track"), PropertyInfo(Variant::INT,"key") ) );
}
AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_history,EditorSelection *p_selection) {
AnimationKeyEditor::AnimationKeyEditor() {
alc="animation_len_changed";
editor_selection=p_selection;
editor_selection=EditorNode::get_singleton()->get_editor_selection();
selected_track=-1;
updating=false;
te_drawing=false;
undo_redo=p_undo_redo;
history=p_history;
undo_redo=EditorNode::get_singleton()->get_undo_redo();
history=EditorNode::get_singleton()->get_editor_history();
ec = memnew (Control);
ec->set_custom_minimum_size(Size2(0,150));
add_child(ec);
ec->set_v_size_flags(SIZE_EXPAND_FILL);
h_scroll = memnew( HScrollBar );
h_scroll->connect("value_changed",this,"_scroll_changed");
add_child(h_scroll);
h_scroll->set_val(0);
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
@ -3863,10 +3879,6 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
// menu->get_popup()->connect("item_pressed",this,"_menu_callback");
ec = memnew (Control);
ec->set_custom_minimum_size(Size2(0,150));
add_child(ec);
ec->set_v_size_flags(SIZE_EXPAND_FILL);
hb = memnew( HBoxContainer);
hb->set_area_as_parent_rect();
@ -3943,12 +3955,6 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
curve_edit->set_v_size_flags(SIZE_EXPAND_FILL);
key_editor_tab->add_child(curve_vb);
h_scroll = memnew( HScrollBar );
h_scroll->connect("value_changed",this,"_scroll_changed");
add_child(h_scroll);
h_scroll->set_val(0);
track_name = memnew( LineEdit );
track_name->set_as_toplevel(true);
track_name->hide();
@ -4025,6 +4031,7 @@ AnimationKeyEditor::AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_h
cleanup_dialog->connect("confirmed",this,"_menu_track",varray(TRACK_MENU_CLEAN_UP_CONFIRM));
add_constant_override("separation",get_constant("separation","VBoxContainer"));
}

View file

@ -262,7 +262,7 @@ class AnimationKeyEditor : public VBoxContainer {
EditorSelection *editor_selection;
AnimationKeyEditor();
float _get_zoom_scale() const;
@ -334,7 +334,7 @@ public:
void insert_value_key(const String& p_property, const Variant& p_value, bool p_advance);
void insert_transform_key(Spatial *p_node,const String& p_sub,const Transform& p_xform);
AnimationKeyEditor(UndoRedo *p_undo_redo, EditorHistory *p_history, EditorSelection *p_selection);
AnimationKeyEditor();
~AnimationKeyEditor();
};

View file

@ -79,8 +79,6 @@ void EditorLog::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
log->add_color_override("default_color",get_color("font_color","Tree"));
tb->set_normal_texture( get_icon("Collapse","EditorIcons"));
tb->set_hover_texture( get_icon("CollapseHl","EditorIcons"));
//button->set_icon(get_icon("Console","EditorIcons"));
}
@ -98,11 +96,6 @@ void EditorLog::_notification(int p_what) {
}
void EditorLog::_close_request() {
_flip_request();
}
void EditorLog::_clear_request() {
@ -122,17 +115,17 @@ void EditorLog::add_message(const String& p_msg,bool p_error) {
if (p_error) {
Ref<Texture> icon = get_icon("Error","EditorIcons");
log->add_image( icon );
button->set_icon(icon);
//button->set_icon(icon);
log->push_color(get_color("fg_error","Editor"));
} else {
button->set_icon(Ref<Texture>());
//button->set_icon(Ref<Texture>());
}
log->add_newline();
log->add_text(p_msg);
button->set_text(p_msg);
// button->set_text(p_msg);
if (p_error)
log->pop();
@ -156,21 +149,7 @@ void EditorLog::_dragged(const Point2& p_ofs) {
*/
Button *EditorLog::get_button() {
return button;
}
void EditorLog::_flip_request() {
if (is_visible()) {
hide();
button->show();
} else {
show();
button->hide();
}
}
void EditorLog::_undo_redo_cbk(void *p_self,const String& p_name) {
@ -181,21 +160,16 @@ void EditorLog::_undo_redo_cbk(void *p_self,const String& p_name) {
void EditorLog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_close_request"),&EditorLog::_close_request );
ObjectTypeDB::bind_method(_MD("_flip_request"),&EditorLog::_flip_request );
ObjectTypeDB::bind_method(_MD("_clear_request"),&EditorLog::_clear_request );
//ObjectTypeDB::bind_method(_MD("_dragged"),&EditorLog::_dragged );
ADD_SIGNAL( MethodInfo("close_request"));
ADD_SIGNAL( MethodInfo("show_request"));
ADD_SIGNAL( MethodInfo("clear_request"));
}
EditorLog::EditorLog() {
VBoxContainer *vb = memnew( VBoxContainer);
add_child(vb);
vb->set_v_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *vb = this;
add_constant_override("separation",get_constant("separation","VBoxContainer"));
HBoxContainer *hb = memnew( HBoxContainer );
vb->add_child(hb);
@ -204,14 +178,6 @@ EditorLog::EditorLog() {
title->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(title);
button = memnew( Button );
button->set_text_align(Button::ALIGN_LEFT);
button->connect("pressed",this,"_flip_request");
button->set_focus_mode(FOCUS_NONE);
button->set_clip_text(true);
button->set_tooltip("Open/Close output panel.");
//pd = memnew( PaneDrag );
//hb->add_child(pd);
//pd->connect("dragged",this,"_dragged");
@ -222,14 +188,9 @@ EditorLog::EditorLog() {
clearbutton->set_text("Clear");
clearbutton->connect("pressed", this,"_clear_request");
tb = memnew( TextureButton );
hb->add_child(tb);
tb->connect("pressed",this,"_close_request");
ec = memnew( Control);
vb->add_child(ec);
ec->set_custom_minimum_size(Size2(0,100));
ec->set_custom_minimum_size(Size2(0,180));
ec->set_v_size_flags(SIZE_EXPAND_FILL);
@ -245,7 +206,6 @@ EditorLog::EditorLog() {
pc->add_child(log);
add_message(VERSION_FULL_NAME" (c) 2008-2016 Juan Linietsky, Ariel Manzur.");
//log->add_text("Initialization Complete.\n"); //because it looks cool.
add_style_override("panel",get_stylebox("panelf","Panel"));
eh.errfunc=_error_handler;
eh.userdata=this;
@ -255,7 +215,6 @@ EditorLog::EditorLog() {
EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk,this);
hide();
}

View file

@ -40,15 +40,13 @@
#include "scene/gui/tool_button.h"
#include "pane_drag.h"
#include "os/thread.h"
class EditorLog : public PanelContainer {
class EditorLog : public VBoxContainer {
OBJ_TYPE( EditorLog, PanelContainer );
OBJ_TYPE( EditorLog, VBoxContainer );
Button *button;
Button *clearbutton;
Label *title;
RichTextLabel *log;
TextureButton *tb;
HBoxContainer *title_hb;
// PaneDrag *pd;
Control *ec;
@ -60,8 +58,6 @@ class EditorLog : public PanelContainer {
Thread::ID current;
// void _dragged(const Point2& p_ofs);
void _close_request();
void _flip_request();
void _clear_request();
static void _undo_redo_cbk(void *p_self,const String& p_name);
protected:
@ -73,7 +69,7 @@ public:
void add_message(const String& p_msg, bool p_error=false);
void deinit();
Button *get_button();
void clear();
EditorLog();
~EditorLog();

View file

@ -55,6 +55,7 @@
#include "bind/core_bind.h"
#include "io/zip_io.h"
#include "io/config_file.h"
#include "animation_editor.h"
// plugins
#include "plugins/sprite_frames_editor_plugin.h"
@ -1741,7 +1742,7 @@ void EditorNode::_edit_current() {
//p->add_item("All Methods",OBJECT_CALL_METHOD);
_update_keying();
update_keying();
}
void EditorNode::_resource_created() {
@ -2713,11 +2714,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
//optimized_presets->popup_centered_ratio();
} break;
case SETTINGS_SHOW_ANIMATION: {
animation_panel_make_visible( ! animation_panel->is_visible() );
} break;
case SETTINGS_LOAD_EXPORT_TEMPLATES: {
@ -2967,7 +2963,7 @@ void EditorNode::set_edited_scene(Node *p_scene) {
if (get_editor_data().get_edited_scene_root()) {
if (get_editor_data().get_edited_scene_root()->get_parent()==scene_root)
scene_root->remove_child(get_editor_data().get_edited_scene_root());
animation_editor->set_root(NULL);
}
get_editor_data().set_edited_scene_root(p_scene);
@ -2980,7 +2976,7 @@ void EditorNode::set_edited_scene(Node *p_scene) {
if (p_scene) {
if (p_scene->get_parent()!=scene_root)
scene_root->add_child(p_scene);
animation_editor->set_root(p_scene);
}
}
@ -3332,7 +3328,7 @@ void EditorNode::set_current_scene(int p_idx) {
if (get_editor_data().get_edited_scene_root()) {
if (get_editor_data().get_edited_scene_root()->get_parent()==scene_root)
scene_root->remove_child(get_editor_data().get_edited_scene_root());
animation_editor->set_root(NULL);
}
//print_line("set current 2 ");
@ -3354,7 +3350,7 @@ void EditorNode::set_current_scene(int p_idx) {
if (new_scene) {
if (new_scene->get_parent()!=scene_root)
scene_root->add_child(new_scene);
animation_editor->set_root(new_scene);
}
//print_line("set current 4 ");
@ -3620,7 +3616,7 @@ void EditorNode::_instance_request(const String& p_path){
void EditorNode::_property_keyed(const String& p_keyed,const Variant& p_value,bool p_advance) {
animation_editor->insert_value_key(p_keyed,p_value,p_advance);
AnimationPlayerEditor::singleton->get_key_editor()->insert_value_key(p_keyed,p_value,p_advance);
}
void EditorNode::_transform_keyed(Object *sp,const String& p_sub,const Transform& p_key) {
@ -3628,16 +3624,16 @@ void EditorNode::_transform_keyed(Object *sp,const String& p_sub,const Transform
Spatial *s=sp->cast_to<Spatial>();
if (!s)
return;
animation_editor->insert_transform_key(s,p_sub,p_key);
AnimationPlayerEditor::singleton->get_key_editor()->insert_transform_key(s,p_sub,p_key);
}
void EditorNode::_update_keying() {
void EditorNode::update_keying() {
//print_line("KR: "+itos(p_enabled));
bool valid=false;
if (animation_editor->has_keying()) {
if (AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) {
if (editor_history.get_path_size()>=1) {
@ -3671,6 +3667,7 @@ void EditorNode::_show_messages() {
}
#if 0
void EditorNode::animation_panel_make_visible(bool p_visible) {
if (!p_visible) {
@ -3683,6 +3680,7 @@ void EditorNode::animation_panel_make_visible(bool p_visible) {
settings_menu->get_popup()->set_item_checked(idx,p_visible);
}
void EditorNode::animation_editor_make_visible(bool p_visible) {
if (p_visible) {
@ -3706,7 +3704,7 @@ void EditorNode::animation_editor_make_visible(bool p_visible) {
animation_editor->set_keying(p_visible);
}
#endif
void EditorNode::_add_to_recent_scenes(const String& p_scene) {
String base="_"+Globals::get_singleton()->get_resource_path().replace("\\","::").replace("/","::");
@ -3799,11 +3797,6 @@ void EditorNode::_update_recent_scenes() {
}
void EditorNode::hide_animation_player_editors() {
emit_signal("hide_animation_player_editors");
}
void EditorNode::_quick_opened() {
if (current_option==FILE_QUICK_OPEN_FILE) {
@ -3974,90 +3967,6 @@ void EditorNode::progress_end_task_bg(const String& p_task) {
}
void EditorNode::_bind_methods() {
ObjectTypeDB::bind_method("_menu_option",&EditorNode::_menu_option);
ObjectTypeDB::bind_method("_menu_confirm_current",&EditorNode::_menu_confirm_current);
ObjectTypeDB::bind_method("_dialog_action",&EditorNode::_dialog_action);
ObjectTypeDB::bind_method("_resource_selected",&EditorNode::_resource_selected,DEFVAL(""));
ObjectTypeDB::bind_method("_property_editor_forward",&EditorNode::_property_editor_forward);
ObjectTypeDB::bind_method("_property_editor_back",&EditorNode::_property_editor_back);
ObjectTypeDB::bind_method("_editor_select",&EditorNode::_editor_select);
ObjectTypeDB::bind_method("_node_renamed",&EditorNode::_node_renamed);
ObjectTypeDB::bind_method("edit_node",&EditorNode::edit_node);
ObjectTypeDB::bind_method("_imported",&EditorNode::_imported);
ObjectTypeDB::bind_method("_unhandled_input",&EditorNode::_unhandled_input);
ObjectTypeDB::bind_method("_get_scene_metadata",&EditorNode::_get_scene_metadata);
ObjectTypeDB::bind_method("set_edited_scene",&EditorNode::set_edited_scene);
ObjectTypeDB::bind_method("open_request",&EditorNode::open_request);
ObjectTypeDB::bind_method("_instance_request",&EditorNode::_instance_request);
ObjectTypeDB::bind_method("_update_keying",&EditorNode::_update_keying);
ObjectTypeDB::bind_method("_property_keyed",&EditorNode::_property_keyed);
ObjectTypeDB::bind_method("_transform_keyed",&EditorNode::_transform_keyed);
ObjectTypeDB::bind_method("_close_messages",&EditorNode::_close_messages);
ObjectTypeDB::bind_method("_show_messages",&EditorNode::_show_messages);
ObjectTypeDB::bind_method("_vp_resized",&EditorNode::_vp_resized);
ObjectTypeDB::bind_method("_quick_opened",&EditorNode::_quick_opened);
ObjectTypeDB::bind_method("_quick_run",&EditorNode::_quick_run);
ObjectTypeDB::bind_method("_resource_created",&EditorNode::_resource_created);
ObjectTypeDB::bind_method("_import_action",&EditorNode::_import_action);
//ObjectTypeDB::bind_method("_import",&EditorNode::_import);
// ObjectTypeDB::bind_method("_import_conflicts_solved",&EditorNode::_import_conflicts_solved);
ObjectTypeDB::bind_method("_open_recent_scene",&EditorNode::_open_recent_scene);
// ObjectTypeDB::bind_method("_open_recent_scene_confirm",&EditorNode::_open_recent_scene_confirm);
ObjectTypeDB::bind_method("_save_optimized",&EditorNode::_save_optimized);
ObjectTypeDB::bind_method(_MD("animation_panel_make_visible","enable"),&EditorNode::animation_panel_make_visible);
ObjectTypeDB::bind_method("stop_child_process",&EditorNode::stop_child_process);
ObjectTypeDB::bind_method("_sources_changed",&EditorNode::_sources_changed);
ObjectTypeDB::bind_method("_fs_changed",&EditorNode::_fs_changed);
ObjectTypeDB::bind_method("_dock_select_draw",&EditorNode::_dock_select_draw);
ObjectTypeDB::bind_method("_dock_select_input",&EditorNode::_dock_select_input);
ObjectTypeDB::bind_method("_dock_pre_popup",&EditorNode::_dock_pre_popup);
ObjectTypeDB::bind_method("_dock_split_dragged",&EditorNode::_dock_split_dragged);
ObjectTypeDB::bind_method("_save_docks",&EditorNode::_save_docks);
ObjectTypeDB::bind_method("_dock_popup_exit",&EditorNode::_dock_popup_exit);
ObjectTypeDB::bind_method("_dock_move_left",&EditorNode::_dock_move_left);
ObjectTypeDB::bind_method("_dock_move_right",&EditorNode::_dock_move_right);
ObjectTypeDB::bind_method("_layout_menu_option",&EditorNode::_layout_menu_option);
ObjectTypeDB::bind_method("set_current_scene",&EditorNode::set_current_scene);
ObjectTypeDB::bind_method("set_current_version",&EditorNode::set_current_version);
ObjectTypeDB::bind_method("_scene_tab_changed",&EditorNode::_scene_tab_changed);
ObjectTypeDB::bind_method("_scene_tab_closed",&EditorNode::_scene_tab_closed);
ObjectTypeDB::bind_method("_scene_tab_script_edited",&EditorNode::_scene_tab_script_edited);
ObjectTypeDB::bind_method("_set_main_scene_state",&EditorNode::_set_main_scene_state);
ObjectTypeDB::bind_method("_update_scene_tabs",&EditorNode::_update_scene_tabs);
ObjectTypeDB::bind_method("_prepare_history",&EditorNode::_prepare_history);
ObjectTypeDB::bind_method("_select_history",&EditorNode::_select_history);
ObjectTypeDB::bind_method("_toggle_search_bar",&EditorNode::_toggle_search_bar);
ObjectTypeDB::bind_method("_clear_search_box",&EditorNode::_clear_search_box);
ObjectTypeDB::bind_method("_clear_undo_history",&EditorNode::_clear_undo_history);
ObjectTypeDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin);
ObjectTypeDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin);
ObjectTypeDB::bind_method(_MD("get_gui_base"), &EditorNode::get_gui_base);
ADD_SIGNAL( MethodInfo("play_pressed") );
ADD_SIGNAL( MethodInfo("pause_pressed") );
ADD_SIGNAL( MethodInfo("stop_pressed") );
ADD_SIGNAL( MethodInfo("hide_animation_player_editors") );
ADD_SIGNAL( MethodInfo("request_help") );
ADD_SIGNAL( MethodInfo("script_add_function_request",PropertyInfo(Variant::OBJECT,"obj"),PropertyInfo(Variant::STRING,"function"),PropertyInfo(Variant::STRING_ARRAY,"args")) );
ADD_SIGNAL( MethodInfo("resource_saved",PropertyInfo(Variant::OBJECT,"obj")) );
}
Ref<Texture> EditorNode::_file_dialog_get_icon(const String& p_path) {
@ -4648,6 +4557,173 @@ void EditorNode::_clear_search_box() {
property_editor->update_tree();
}
ToolButton *EditorNode::add_bottom_panel_item(String p_text,Control *p_item) {
ToolButton *tb = memnew( ToolButton );
tb->connect("toggled",this,"_bottom_panel_switch",varray(bottom_panel_items.size()));
tb->set_text(p_text);
tb->set_toggle_mode(true);
tb->set_focus_mode(Control::FOCUS_NONE);
bottom_panel_vb->add_child(p_item);
bottom_panel_hb->raise();
bottom_panel_hb->add_child(tb);
p_item->set_v_size_flags(Control::SIZE_EXPAND_FILL);
p_item->hide();
BottomPanelItem bpi;
bpi.button=tb;
bpi.control=p_item;
bpi.name=p_text;
bottom_panel_items.push_back(bpi);
return tb;
}
void EditorNode::hide_bottom_panel() {
_bottom_panel_switch(false,0);
}
void EditorNode::make_bottom_panel_item_visible(Control *p_item) {
for(int i=0;i<bottom_panel_items.size();i++) {
if (bottom_panel_items[i].control==p_item) {
_bottom_panel_switch(true,i);
break;
}
}
}
void EditorNode::raise_bottom_panel_item(Control *p_item) {
for(int i=0;i<bottom_panel_items.size();i++) {
if (bottom_panel_items[i].control==p_item) {
bottom_panel_items[i].button->raise();
SWAP( bottom_panel_items[i], bottom_panel_items[bottom_panel_items.size()-1]);
break;
}
}
for(int i=0;i<bottom_panel_items.size();i++) {
bottom_panel_items[i].button->disconnect("toggled",this,"_bottom_panel_switch");
bottom_panel_items[i].button->connect("toggled",this,"_bottom_panel_switch",varray(i));
}
}
void EditorNode::_bottom_panel_switch(bool p_enable,int p_idx) {
ERR_FAIL_INDEX(p_idx,bottom_panel_items.size());
if (p_enable) {
for(int i=0;i<bottom_panel_items.size();i++) {
bottom_panel_items[i].button->set_pressed(i==p_idx);
bottom_panel_items[i].control->set_hidden(i!=p_idx);
}
center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE);
center_split->set_collapsed(false);
} else {
for(int i=0;i<bottom_panel_items.size();i++) {
bottom_panel_items[i].button->set_pressed(false);
bottom_panel_items[i].control->set_hidden(true);
}
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
center_split->set_collapsed(true);
}
}
void EditorNode::_bind_methods() {
ObjectTypeDB::bind_method("_menu_option",&EditorNode::_menu_option);
ObjectTypeDB::bind_method("_menu_confirm_current",&EditorNode::_menu_confirm_current);
ObjectTypeDB::bind_method("_dialog_action",&EditorNode::_dialog_action);
ObjectTypeDB::bind_method("_resource_selected",&EditorNode::_resource_selected,DEFVAL(""));
ObjectTypeDB::bind_method("_property_editor_forward",&EditorNode::_property_editor_forward);
ObjectTypeDB::bind_method("_property_editor_back",&EditorNode::_property_editor_back);
ObjectTypeDB::bind_method("_editor_select",&EditorNode::_editor_select);
ObjectTypeDB::bind_method("_node_renamed",&EditorNode::_node_renamed);
ObjectTypeDB::bind_method("edit_node",&EditorNode::edit_node);
ObjectTypeDB::bind_method("_imported",&EditorNode::_imported);
ObjectTypeDB::bind_method("_unhandled_input",&EditorNode::_unhandled_input);
ObjectTypeDB::bind_method("_get_scene_metadata",&EditorNode::_get_scene_metadata);
ObjectTypeDB::bind_method("set_edited_scene",&EditorNode::set_edited_scene);
ObjectTypeDB::bind_method("open_request",&EditorNode::open_request);
ObjectTypeDB::bind_method("_instance_request",&EditorNode::_instance_request);
ObjectTypeDB::bind_method("update_keying",&EditorNode::update_keying);
ObjectTypeDB::bind_method("_property_keyed",&EditorNode::_property_keyed);
ObjectTypeDB::bind_method("_transform_keyed",&EditorNode::_transform_keyed);
ObjectTypeDB::bind_method("_close_messages",&EditorNode::_close_messages);
ObjectTypeDB::bind_method("_show_messages",&EditorNode::_show_messages);
ObjectTypeDB::bind_method("_vp_resized",&EditorNode::_vp_resized);
ObjectTypeDB::bind_method("_quick_opened",&EditorNode::_quick_opened);
ObjectTypeDB::bind_method("_quick_run",&EditorNode::_quick_run);
ObjectTypeDB::bind_method("_resource_created",&EditorNode::_resource_created);
ObjectTypeDB::bind_method("_import_action",&EditorNode::_import_action);
//ObjectTypeDB::bind_method("_import",&EditorNode::_import);
// ObjectTypeDB::bind_method("_import_conflicts_solved",&EditorNode::_import_conflicts_solved);
ObjectTypeDB::bind_method("_open_recent_scene",&EditorNode::_open_recent_scene);
// ObjectTypeDB::bind_method("_open_recent_scene_confirm",&EditorNode::_open_recent_scene_confirm);
ObjectTypeDB::bind_method("_save_optimized",&EditorNode::_save_optimized);
ObjectTypeDB::bind_method("stop_child_process",&EditorNode::stop_child_process);
ObjectTypeDB::bind_method("_sources_changed",&EditorNode::_sources_changed);
ObjectTypeDB::bind_method("_fs_changed",&EditorNode::_fs_changed);
ObjectTypeDB::bind_method("_dock_select_draw",&EditorNode::_dock_select_draw);
ObjectTypeDB::bind_method("_dock_select_input",&EditorNode::_dock_select_input);
ObjectTypeDB::bind_method("_dock_pre_popup",&EditorNode::_dock_pre_popup);
ObjectTypeDB::bind_method("_dock_split_dragged",&EditorNode::_dock_split_dragged);
ObjectTypeDB::bind_method("_save_docks",&EditorNode::_save_docks);
ObjectTypeDB::bind_method("_dock_popup_exit",&EditorNode::_dock_popup_exit);
ObjectTypeDB::bind_method("_dock_move_left",&EditorNode::_dock_move_left);
ObjectTypeDB::bind_method("_dock_move_right",&EditorNode::_dock_move_right);
ObjectTypeDB::bind_method("_layout_menu_option",&EditorNode::_layout_menu_option);
ObjectTypeDB::bind_method("set_current_scene",&EditorNode::set_current_scene);
ObjectTypeDB::bind_method("set_current_version",&EditorNode::set_current_version);
ObjectTypeDB::bind_method("_scene_tab_changed",&EditorNode::_scene_tab_changed);
ObjectTypeDB::bind_method("_scene_tab_closed",&EditorNode::_scene_tab_closed);
ObjectTypeDB::bind_method("_scene_tab_script_edited",&EditorNode::_scene_tab_script_edited);
ObjectTypeDB::bind_method("_set_main_scene_state",&EditorNode::_set_main_scene_state);
ObjectTypeDB::bind_method("_update_scene_tabs",&EditorNode::_update_scene_tabs);
ObjectTypeDB::bind_method("_prepare_history",&EditorNode::_prepare_history);
ObjectTypeDB::bind_method("_select_history",&EditorNode::_select_history);
ObjectTypeDB::bind_method("_toggle_search_bar",&EditorNode::_toggle_search_bar);
ObjectTypeDB::bind_method("_clear_search_box",&EditorNode::_clear_search_box);
ObjectTypeDB::bind_method("_clear_undo_history",&EditorNode::_clear_undo_history);
ObjectTypeDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin);
ObjectTypeDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin);
ObjectTypeDB::bind_method(_MD("get_gui_base"), &EditorNode::get_gui_base);
ObjectTypeDB::bind_method(_MD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch);
ADD_SIGNAL( MethodInfo("play_pressed") );
ADD_SIGNAL( MethodInfo("pause_pressed") );
ADD_SIGNAL( MethodInfo("stop_pressed") );
ADD_SIGNAL( MethodInfo("request_help") );
ADD_SIGNAL( MethodInfo("script_add_function_request",PropertyInfo(Variant::OBJECT,"obj"),PropertyInfo(Variant::STRING,"function"),PropertyInfo(Variant::STRING_ARRAY,"args")) );
ADD_SIGNAL( MethodInfo("resource_saved",PropertyInfo(Variant::OBJECT,"obj")) );
}
EditorNode::EditorNode() {
EditorHelp::generate_doc(); //before any editor classes are crated
@ -4981,44 +5057,6 @@ EditorNode::EditorNode() {
scene_root_parent->add_child(viewport);
PanelContainer *pc = memnew( PanelContainer );
top_split->add_child(pc);
animation_vb = memnew( VBoxContainer );
animation_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
pc->add_child(animation_vb);
animation_panel=pc;
animation_panel->hide();
HBoxContainer *animation_hb = memnew( HBoxContainer);
animation_vb->add_child(animation_hb);
Label *l= memnew( Label );
l->set_text("Animation:");
//l->set_h_size_flags(Control::SIZE_);
animation_hb->add_child(l);
animation_panel_hb = memnew( HBoxContainer );
animation_hb->add_child(animation_panel_hb);
animation_panel_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
/*pd_anim = memnew( PaneDrag );
animation_hb->add_child(pd_anim);
pd_anim->connect("dragged",this,"_dragged");
pd_anim->set_default_cursor_shape(Control::CURSOR_MOVE);
pd_anim->hide();*/
anim_close = memnew( TextureButton );
animation_hb->add_child(anim_close);
anim_close->connect("pressed",this,"animation_panel_make_visible",make_binds(false));
anim_close->set_normal_texture( anim_close->get_icon("Close","EditorIcons"));
anim_close->set_hover_texture( anim_close->get_icon("CloseHover","EditorIcons"));
anim_close->set_pressed_texture( anim_close->get_icon("Close","EditorIcons"));
PanelContainer *top_region = memnew( PanelContainer );
top_region->add_style_override("panel",gui_base->get_stylebox("hover","Button"));
HBoxContainer *left_menu_hb = memnew( HBoxContainer );
@ -5337,8 +5375,6 @@ EditorNode::EditorNode() {
editor_layouts->connect("item_pressed",this,"_layout_menu_option");
p->add_submenu_item("Editor Layout", "Layouts");
p->add_separator();
p->add_check_item("Show Animation",SETTINGS_SHOW_ANIMATION,KEY_MASK_CMD+KEY_N);
p->add_separator();
p->add_item("Install Export Templates",SETTINGS_LOAD_EXPORT_TEMPLATES);
p->add_separator();
p->add_item("About",SETTINGS_ABOUT);
@ -5502,7 +5538,7 @@ EditorNode::EditorNode() {
prop_editor_base->add_child(search_bar);
search_bar->hide();
l = memnew( Label("Search: ") );
Label *l = memnew( Label("Search: ") );
search_bar->add_child(l);
search_box = memnew( LineEdit );
@ -5550,37 +5586,40 @@ EditorNode::EditorNode() {
_update_layouts_menu();
bottom_panel = memnew( PanelContainer );
bottom_panel->add_style_override("panel",gui_base->get_stylebox("panelf","Panel"));
center_split->add_child(bottom_panel);
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
bottom_panel_vb = memnew( VBoxContainer );
bottom_panel->add_child(bottom_panel_vb);
//bottom_panel_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
bottom_panel_hb = memnew( HBoxContainer );
bottom_panel_vb->add_child(bottom_panel_hb);
log = memnew( EditorLog );
center_split->add_child(log);
log->connect("close_request",this,"_close_messages");
log->connect("show_request",this,"_show_messages");
add_bottom_panel_item("Output",log);
//left_split->set_dragger_visible(false);
old_split_ofs=0;
animation_editor = memnew( AnimationKeyEditor(get_undo_redo(),&editor_history,editor_selection) );
animation_editor->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,0);
animation_editor->set_margin(MARGIN_BOTTOM,200);
animation_editor->connect("keying_changed",this,"_update_keying");
animation_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
animation_vb->add_child(animation_editor);
center_split->connect("resized",this,"_vp_resized");
animation_editor->hide();
/*PanelContainer *bottom_pc = memnew( PanelContainer );
srt->add_child(bottom_pc);
bottom_hb = memnew( HBoxContainer );
bottom_pc->add_child(bottom_hb);*/
center_vb->add_child( log->get_button() );
log->get_button()->set_h_size_flags(Control::SIZE_EXPAND_FILL);
// center_vb->add_child( log->get_button() );
// log->get_button()->set_h_size_flags(Control::SIZE_EXPAND_FILL);
//progress_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
@ -5780,7 +5819,7 @@ EditorNode::EditorNode() {
file_templates->connect("file_selected", this,"_dialog_action");
property_editor->connect("resource_selected", this,"_resource_selected");
property_editor->connect("property_keyed", this,"_property_keyed");
animation_editor->connect("resource_selected", this,"_resource_selected");
//plugin stuff
file_server = memnew( EditorFileServer );
@ -5806,10 +5845,15 @@ EditorNode::EditorNode() {
editor_import_export->add_export_plugin( Ref<EditorSampleExportPlugin>( memnew(EditorSampleExportPlugin)));
editor_import_export->add_export_plugin( Ref<EditorSceneExportPlugin>( memnew(EditorSceneExportPlugin)));
add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
add_editor_plugin( memnew( CanvasItemEditorPlugin(this) ) );
add_editor_plugin( memnew( SpatialEditorPlugin(this) ) );
add_editor_plugin( memnew( ScriptEditorPlugin(this) ) );
add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
//more visually meaningful to have this later
raise_bottom_panel_item(AnimationPlayerEditor::singleton);
add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,true) ) );
add_editor_plugin( memnew( ShaderGraphEditorPlugin(this,false) ) );
add_editor_plugin( memnew( ShaderEditorPlugin(this,true) ) );

View file

@ -56,7 +56,7 @@
#include "tools/editor/editor_run.h"
#include "tools/editor/pane_drag.h"
#include "tools/editor/animation_editor.h"
#include "tools/editor/script_create_dialog.h"
#include "tools/editor/run_settings_dialog.h"
#include "tools/editor/project_settings.h"
@ -169,7 +169,6 @@ class EditorNode : public Node {
SETTINGS_LAYOUT_SAVE,
SETTINGS_LAYOUT_DELETE,
SETTINGS_LAYOUT_DEFAULT,
SETTINGS_SHOW_ANIMATION,
SETTINGS_LOAD_EXPORT_TEMPLATES,
SETTINGS_HELP,
SETTINGS_ABOUT,
@ -230,7 +229,6 @@ class EditorNode : public Node {
Control *vp_base;
PaneDrag *pd;
//PaneDrag *pd_anim;
TextureButton *anim_close;
Panel *menu_panel;
@ -250,7 +248,6 @@ class EditorNode : public Node {
ToolButton *pause_button;
ToolButton *stop_button;
ToolButton *run_settings_button;
ToolButton *animation_menu;
ToolButton *play_scene_button;
ToolButton *play_custom_scene_button;
MenuButton *debug_button;
@ -316,15 +313,12 @@ class EditorNode : public Node {
String defer_export_platform;
bool defer_export_debug;
Node *_last_instanced_scene;
PanelContainer *animation_panel;
HBoxContainer *animation_panel_hb;
VBoxContainer *animation_vb;
EditorPath *editor_path;
ToolButton *resource_new_button;
ToolButton *resource_load_button;
MenuButton *resource_save_button;
MenuButton *editor_history_menu;
AnimationKeyEditor *animation_editor;
EditorLog *log;
CenterContainer *tabs_center;
EditorQuickOpen *quick_open;
@ -387,6 +381,21 @@ class EditorNode : public Node {
EditorFileServer *file_server;
struct BottomPanelItem {
String name;
Control *control;
ToolButton *button;
};
Vector<BottomPanelItem> bottom_panel_items;
PanelContainer *bottom_panel;
HBoxContainer *bottom_panel_hb;
VBoxContainer *bottom_panel_vb;
void _bottom_panel_switch(bool p_enable, int p_idx);
String external_file;
List<String> previous_scenes;
bool opening_prev;
@ -436,7 +445,6 @@ class EditorNode : public Node {
void _property_keyed(const String& p_keyed, const Variant& p_value, bool p_advance);
void _transform_keyed(Object *sp,const String& p_sub,const Transform& p_key);
void _update_keying();
void _hide_top_editors();
void _quick_opened();
void _quick_run(const String& p_resource);
@ -586,13 +594,10 @@ public:
static EditorLog *get_log() { return singleton->log; }
Control* get_viewport();
AnimationKeyEditor *get_animation_editor() const { return animation_editor; }
Control *get_animation_panel() { return animation_vb; }
HBoxContainer *get_animation_panel_hb() { return animation_panel_hb; }
void animation_editor_make_visible(bool p_visible);
void hide_animation_player_editors();
void animation_panel_make_visible(bool p_visible);
//void animation_editor_make_visible(bool p_visible);
//void hide_animation_player_editors();
//void animation_panel_make_visible(bool p_visible);
void set_edited_scene(Node *p_scene);
@ -612,6 +617,7 @@ public:
void set_current_scene(int p_idx);
static EditorData& get_editor_data() { return singleton->editor_data; }
EditorHistory * get_editor_history() { return &editor_history; }
static VSplitContainer *get_top_split() { return singleton->top_split; }
@ -660,6 +666,14 @@ public:
void save_layout();
void update_keying();
ToolButton* add_bottom_panel_item(String p_text,Control *p_item);
void make_bottom_panel_item_visible(Control *p_item);
void raise_bottom_panel_item(Control *p_item);
void hide_bottom_panel();
EditorNode();
~EditorNode();
void get_singleton(const char* arg1, bool arg2);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 428 B

View file

@ -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);
}
set_process(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,35 +677,21 @@ 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);
}
} else {
editor->get_animation_editor()->set_animation(Ref<Animation>());
editor->get_animation_editor()->set_root(NULL);
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 {
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,"");
} else {
key_editor->set_animation(Ref<Animation>());
key_editor->set_root(NULL);
}
}
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,67 +1378,13 @@ 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.");
nodename = memnew( Button );
hb->add_child(nodename);
pin = memnew( ToolButton );
pin->set_toggle_mode(true);
hb->add_child(pin);
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);
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);
@ -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();

View file

@ -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);

View file

@ -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();

View file

@ -176,6 +176,7 @@ class AnimationTreeEditorPlugin : public EditorPlugin {
AnimationTreeEditor *anim_tree_editor;
EditorNode *editor;
Button *button;
public:

View file

@ -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 {
@ -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;

View file

@ -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();

View file

@ -85,6 +85,7 @@ class ResourcePreloaderEditorPlugin : public EditorPlugin {
ResourcePreloaderEditor *preloader_editor;
EditorNode *editor;
Button *button;
public:

View file

@ -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();

View file

@ -90,6 +90,7 @@ class SampleLibraryEditorPlugin : public EditorPlugin {
SampleLibraryEditor *sample_library_editor;
EditorNode *editor;
Button *button;
public:

View file

@ -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 );

View file

@ -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);

View file

@ -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;
}

View file

@ -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();

View file

@ -94,6 +94,7 @@ class SpriteFramesEditorPlugin : public EditorPlugin {
SpriteFramesEditor *frames_editor;
EditorNode *editor;
Button *button;
public:

View file

@ -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();
}

View file

@ -65,6 +65,7 @@ class StyleBoxEditorPlugin : public EditorPlugin {
StyleBoxEditor *stylebox_editor;
EditorNode *editor;
Button *button;
public:

View file

@ -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();
}

View file

@ -102,6 +102,7 @@ class ThemeEditorPlugin : public EditorPlugin {
ThemeEditor *theme_editor;
EditorNode *editor;
Button *button;
public:

View file

@ -37,6 +37,8 @@
#include "tools/editor/plugins/script_editor_plugin.h"
#include "core/io/resource_saver.h"
#include "multi_node_edit.h"
#include "tools/editor/plugins/animation_player_editor_plugin.h"
#include "animation_editor.h"
void SceneTreeDock::_unhandled_key_input(InputEvent p_event) {
@ -292,7 +294,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
for (int i = 0; i < selection.size(); i++) {
Node *top_node = selection[i];
Node *bottom_node = selection[selection.size() - 1 - i];
ERR_FAIL_COND(!top_node->get_parent());
ERR_FAIL_COND(!bottom_node->get_parent());
@ -398,7 +400,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().add_do_method(d,"set_owner",node->get_owner());
}
editor_data->get_undo_redo().add_do_method(editor_selection,"add_node",dup);
editor_data->get_undo_redo().add_undo_method(parent,"remove_child",dup);
editor_data->get_undo_redo().add_undo_method(parent,"remove_child",dup);
editor_data->get_undo_redo().add_do_reference(dup);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
@ -924,7 +926,7 @@ bool SceneTreeDock::_validate_no_foreign() {
}
if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get()))>=0) {
if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get()))>=0) {
accept->get_ok()->set_text("Makes Sense!");
accept->set_text("Can't operate on nodes the current scene inherits from!");
@ -1017,8 +1019,8 @@ void SceneTreeDock::_node_reparent(NodePath p_path,bool p_keep_global_xform) {
editor_data->get_undo_redo().add_do_method(this,"_set_owners",edited_scene,owners);
if (editor->get_animation_editor()->get_root()==node)
editor_data->get_undo_redo().add_do_method(editor->get_animation_editor(),"set_root",node);
if (AnimationPlayerEditor::singleton->get_key_editor()->get_root()==node)
editor_data->get_undo_redo().add_do_method(AnimationPlayerEditor::singleton->get_key_editor(),"set_root",node);
editor_data->get_undo_redo().add_undo_method(new_parent,"remove_child",node);
@ -1045,8 +1047,8 @@ void SceneTreeDock::_node_reparent(NodePath p_path,bool p_keep_global_xform) {
editor_data->get_undo_redo().add_undo_method(node->get_parent(),"add_child",node);
editor_data->get_undo_redo().add_undo_method(node->get_parent(),"move_child",node,child_pos);
editor_data->get_undo_redo().add_undo_method(this,"_set_owners",edited_scene,owners);
if (editor->get_animation_editor()->get_root()==node)
editor_data->get_undo_redo().add_undo_method(editor->get_animation_editor(),"set_root",node);
if (AnimationPlayerEditor::singleton->get_key_editor()->get_root()==node)
editor_data->get_undo_redo().add_undo_method(AnimationPlayerEditor::singleton->get_key_editor(),"set_root",node);
if (p_keep_global_xform) {
if (node->cast_to<Node2D>())
@ -1152,8 +1154,8 @@ void SceneTreeDock::_delete_confirm() {
editor_data->get_undo_redo().add_do_method(n->get_parent(),"remove_child",n);
editor_data->get_undo_redo().add_undo_method(n->get_parent(),"add_child",n);
editor_data->get_undo_redo().add_undo_method(n->get_parent(),"move_child",n,n->get_index());
if (editor->get_animation_editor()->get_root()==n)
editor_data->get_undo_redo().add_undo_method(editor->get_animation_editor(),"set_root",n);
if (AnimationPlayerEditor::singleton->get_key_editor()->get_root()==n)
editor_data->get_undo_redo().add_undo_method(AnimationPlayerEditor::singleton->get_key_editor(),"set_root",n);
editor_data->get_undo_redo().add_undo_method(this,"_set_owners",edited_scene,owners);
//editor_data->get_undo_redo().add_undo_method(n,"set_owner",n->get_owner());
editor_data->get_undo_redo().add_undo_reference(n);
@ -1329,7 +1331,7 @@ void SceneTreeDock::_create() {
editor->push_item(newnode);
memdelete(n);
_update_tool_buttons();
}

View file

@ -210,6 +210,8 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat
OS::get_singleton()->move_window_to_foreground();
tabs->set_current_tab(0);
EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
} else if (p_msg=="debug_exit") {
breaked=false;
@ -358,7 +360,7 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat
if (EditorNode::get_log()->is_hidden()) {
log_forced_visible=true;
EditorNode::get_log()->show();
EditorNode::get_singleton()->make_bottom_panel_item_visible(EditorNode::get_log());
}
EditorNode::get_log()->add_message(t);
@ -551,8 +553,14 @@ void ScriptEditorDebugger::_notification(int p_what) {
if (error_count==0) {
error_split->set_name("Errors");
debugger_button->set_text("Debugger");
debugger_button->set_icon(Ref<Texture>());
tabs->set_tab_icon(error_split->get_index(),Ref<Texture>());
} else {
error_split->set_name("Errors ("+itos(error_count)+")");
debugger_button->set_text("Debugger ("+itos(error_count)+")");
debugger_button->set_icon(get_icon("Error","EditorIcons"));
tabs->set_tab_icon(error_split->get_index(),get_icon("Error","EditorIcons"));
}
last_error_count=error_count;
}
@ -569,8 +577,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
ppeer->set_stream_peer(connection);
show();
emit_signal("show_debugger",true);
//EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
//emit_signal("show_debugger",true);
dobreak->set_disabled(false);
tabs->set_current_tab(0);
@ -727,7 +735,9 @@ void ScriptEditorDebugger::stop(){
message.clear();
if (log_forced_visible) {
EditorNode::get_log()->hide();
//EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
if (EditorNode::get_log()->is_visible())
EditorNode::get_singleton()->hide_bottom_panel();
log_forced_visible=false;
}
@ -738,7 +748,8 @@ void ScriptEditorDebugger::stop(){
if (hide_on_stop) {
hide();
if (is_visible())
EditorNode::get_singleton()->hide_bottom_panel();
emit_signal("show_debugger",false);
}
@ -770,7 +781,8 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() {
void ScriptEditorDebugger::_hide_request() {
hide();
if (EditorNode::get_log()->is_visible())
EditorNode::get_singleton()->hide_bottom_panel();
emit_signal("show_debugger",false);
}
@ -1227,12 +1239,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){
vbc->add_child(hbc);
reason = memnew( Label );
reason = memnew( LineEdit );
reason->set_text("");
reason->set_editable(false);
hbc->add_child(reason);
reason->add_color_override("font_color",Color(1,0.4,0.0,0.8));
reason->set_h_size_flags(SIZE_EXPAND_FILL);
reason->set_clip_text(true);
//reason->set_clip_text(true);
hbc->add_child( memnew( VSeparator) );
@ -1459,7 +1472,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){
msgdialog = memnew( AcceptDialog );
add_child(msgdialog);
hide();
log_forced_visible=false;
p_editor->get_undo_redo()->set_method_notify_callback(_method_changeds,this);

View file

@ -54,6 +54,7 @@ class ScriptEditorDebugger : public Control {
AcceptDialog *msgdialog;
Button *debugger_button;
LineEdit *clicked_ctrl;
LineEdit *clicked_ctrl_type;
@ -80,7 +81,7 @@ class ScriptEditorDebugger : public Control {
TabContainer *tabs;
Label *reason;
LineEdit *reason;
bool log_forced_visible;
ScriptEditorDebuggerVariables *variables;
@ -186,6 +187,8 @@ public:
void set_hide_on_stop(bool p_hide);
void set_tool_button(Button *p_tb) { debugger_button=p_tb; }
virtual Size2 get_minimum_size() const;
ScriptEditorDebugger(EditorNode *p_editor=NULL);
~ScriptEditorDebugger();