diff options
Diffstat (limited to 'tools/editor/editor_node.cpp')
-rw-r--r-- | tools/editor/editor_node.cpp | 523 |
1 files changed, 223 insertions, 300 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 9258637a74..3888ed23a6 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -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" @@ -1194,75 +1195,6 @@ void EditorNode::_dialog_action(String p_file) { save_translatable_strings(p_file); } break; - case FILE_SAVE_SUBSCENE: { - - List<Node*> selection = editor_selection->get_selected_node_list(); - - if (selection.size()!=1) { - - current_option=-1; - //confirmation->get_cancel()->hide(); - accept->get_ok()->set_text("I see.."); - accept->set_text("This operation requieres a single selected node."); - accept->popup_centered_minsize(); - break; - } - - Node *base = selection.front()->get(); - - Map<Node*,Node*> reown; - reown[editor_data.get_edited_scene_root()]=base; - Node *copy = base->duplicate_and_reown(reown); - if (copy) { - - Ref<PackedScene> sdata = memnew( PackedScene ); - Error err = sdata->pack(copy); - memdelete(copy); - - if (err!=OK) { - - - current_option=-1; - //accept->get_cancel()->hide(); - accept->get_ok()->set_text("I see.."); - accept->set_text("Couldn't save subscene. Likely dependencies (instances) couldn't be satisfied."); - accept->popup_centered_minsize(); - return; - } - - int flg=0; - if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) - flg|=ResourceSaver::FLAG_COMPRESS; - if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) - flg|=ResourceSaver::FLAG_RELATIVE_PATHS; - - - err = ResourceSaver::save(p_file,sdata,flg); - if (err!=OK) { - - current_option=-1; - //confirmation->get_cancel()->hide(); - accept->get_ok()->set_text("I see.."); - accept->set_text("Error saving scene."); - accept->popup_centered_minsize(); - break; - } - //EditorFileSystem::get_singleton()->update_file(p_file,sdata->get_type()); - - } else { - - current_option=-1; - //confirmation->get_cancel()->hide(); - accept->get_ok()->set_text("I see.."); - accept->set_text("Error duplicating scene to save it."); - accept->popup_centered_minsize(); - break; - - } - - - } break; - case FILE_SAVE_SCENE: case FILE_SAVE_AS_SCENE: { @@ -1810,7 +1742,7 @@ void EditorNode::_edit_current() { //p->add_item("All Methods",OBJECT_CALL_METHOD); - _update_keying(); + update_keying(); } void EditorNode::_resource_created() { @@ -2241,70 +2173,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { file->set_title("Save Translatable Strings"); file->popup_centered_ratio(); - - } break; - - case FILE_SAVE_SUBSCENE: { - - Node *scene = editor_data.get_edited_scene_root(); - - if (!scene) { - - current_option=-1; - //confirmation->get_cancel()->hide(); - accept->get_ok()->set_text("I see.."); - accept->set_text("This operation can't be done without a scene."); - accept->popup_centered_minsize(); - break; - } - - - List<Node*> selection = editor_selection->get_selected_node_list(); - - if (selection.size()!=1) { - - current_option=-1; - //confirmation->get_cancel()->hide(); - accept->get_ok()->set_text("I see.."); - accept->set_text("This operation requieres a single selected node."); - accept->popup_centered_minsize(); - break; - } - - Node *tocopy = selection.front()->get(); - - if (tocopy!=editor_data.get_edited_scene_root() && tocopy->get_filename()!="") { - - - current_option=-1; - //confirmation->get_cancel()->hide(); - accept->get_ok()->set_text("I see.."); - accept->set_text("This operation can't be done on instanced scenes."); - accept->popup_centered_minsize(); - break; - } - - file->set_mode(EditorFileDialog::MODE_SAVE_FILE); - - List<String> extensions; - Ref<PackedScene> sd = memnew( PackedScene ); - ResourceSaver::get_recognized_extensions(sd,&extensions); - file->clear_filters(); - for(int i=0;i<extensions.size();i++) { - - file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper()); - } - - - String existing; - if (extensions.size()) { - existing="new_scene."+extensions.front()->get().to_lower(); - } - file->set_current_path(existing); - - - file->popup_centered_ratio(); - file->set_title("Save Sub-Scene As.."); } break; case FILE_SAVE_OPTIMIZED: { Node *scene = editor_data.get_edited_scene_root(); @@ -2846,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: { @@ -3100,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); @@ -3113,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); + } } @@ -3465,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 "); @@ -3487,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 "); @@ -3623,7 +3486,18 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo add_io_error(txt); } - sdata->set_path(lpath,true); //take over path + if (ResourceCache::has(lpath)) { + //used from somewhere else? no problem! update state and replace sdata + Ref<PackedScene> ps = Ref<PackedScene>( ResourceCache::get(lpath)->cast_to<PackedScene>() ); + if (ps.is_valid()) { + ps->replace_state( sdata->get_state() ); + ps->set_last_modified_time( sdata->get_last_modified_time() ); + sdata=ps; + } + + } else { + sdata->set_path(lpath,true); //take over path + } Node*new_scene=sdata->instance(true); @@ -3742,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) { @@ -3750,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) { @@ -3793,6 +3667,7 @@ void EditorNode::_show_messages() { } +#if 0 void EditorNode::animation_panel_make_visible(bool p_visible) { if (!p_visible) { @@ -3805,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) { @@ -3828,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("/","::"); @@ -3921,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) { @@ -4096,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) { @@ -4770,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 @@ -5086,8 +5040,9 @@ EditorNode::EditorNode() { //scene_root_base->add_child(scene_root); - scene_root->set_meta("_editor_disable_input",true); + //scene_root->set_meta("_editor_disable_input",true); VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport(),true); + scene_root->set_disable_input(true); scene_root->set_as_audio_listener_2d(true); scene_root->set_size_override(true,Size2(Globals::get_singleton()->get("display/width"),Globals::get_singleton()->get("display/height"))); @@ -5102,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 ); @@ -5191,7 +5108,6 @@ EditorNode::EditorNode() { pm_export->set_name("Export"); p->add_child(pm_export); p->add_submenu_item("Convert To..","Export"); - pm_export->add_item("Subscene..",FILE_SAVE_SUBSCENE); pm_export->add_item("Translatable Strings..",FILE_DUMP_STRINGS); pm_export->add_separator(); pm_export->add_item("MeshLibrary..",FILE_EXPORT_MESH_LIBRARY); @@ -5459,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); @@ -5624,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 ); @@ -5672,37 +5586,40 @@ EditorNode::EditorNode() { _update_layouts_menu(); - log = memnew( EditorLog ); - center_split->add_child(log); - log->connect("close_request",this,"_close_messages"); - log->connect("show_request",this,"_show_messages"); - //left_split->set_dragger_visible(false); + 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); - old_split_ofs=0; + bottom_panel_hb = memnew( HBoxContainer ); + bottom_panel_vb->add_child(bottom_panel_hb); - 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); + log = memnew( EditorLog ); + add_bottom_panel_item("Output",log); - animation_vb->add_child(animation_editor); - center_split->connect("resized",this,"_vp_resized"); + //left_split->set_dragger_visible(false); - animation_editor->hide(); + old_split_ofs=0; + + center_split->connect("resized",this,"_vp_resized"); + /*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); @@ -5902,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 ); @@ -5928,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) ) ); @@ -5964,7 +5886,8 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( Polygon2DEditorPlugin(this) ) ); add_editor_plugin( memnew( LightOccluder2DEditorPlugin(this) ) ); add_editor_plugin( memnew( NavigationPolygonEditorPlugin(this) ) ); - add_editor_plugin( memnew( ColorRampEditorPlugin(this) ) ); + add_editor_plugin( memnew( ColorRampEditorPlugin(this,true) ) ); + add_editor_plugin( memnew( ColorRampEditorPlugin(this,false) ) ); add_editor_plugin( memnew( CollisionShape2DEditorPlugin(this) ) ); for(int i=0;i<EditorPlugins::get_plugin_count();i++) |