diff options
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/animation_editor.cpp | 78 | ||||
-rw-r--r-- | tools/editor/animation_editor.h | 2 | ||||
-rw-r--r-- | tools/editor/code_editor.cpp | 75 | ||||
-rw-r--r-- | tools/editor/code_editor.h | 10 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 54 | ||||
-rw-r--r-- | tools/editor/editor_settings.cpp | 7 | ||||
-rw-r--r-- | tools/editor/editor_themes.cpp | 77 | ||||
-rw-r--r-- | tools/editor/editor_themes.h | 38 | ||||
-rw-r--r-- | tools/editor/icons/icon_loop_interpolation.png | bin | 0 -> 342 bytes | |||
-rw-r--r-- | tools/editor/io_plugins/editor_scene_import_plugin.cpp | 46 | ||||
-rw-r--r-- | tools/editor/plugins/animation_player_editor_plugin.cpp | 38 | ||||
-rw-r--r-- | tools/editor/plugins/animation_player_editor_plugin.h | 4 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | tools/editor/plugins/tile_map_editor_plugin.cpp | 92 | ||||
-rw-r--r-- | tools/editor/project_manager.cpp | 32 | ||||
-rw-r--r-- | tools/editor/project_manager.h | 2 |
16 files changed, 394 insertions, 165 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 08b90b5408..dd3c3fee32 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -754,7 +754,7 @@ void AnimationKeyEditor::_menu_track(int p_type) { undo_redo->add_undo_method(animation.ptr(),"track_set_interpolation_type",idx,animation->track_get_interpolation_type(idx)); if (animation->track_get_type(idx)==Animation::TYPE_VALUE) { - undo_redo->add_undo_method(animation.ptr(),"value_track_set_continuous",idx,animation->value_track_is_continuous(idx)); + undo_redo->add_undo_method(animation.ptr(),"value_track_set_update_mode",idx,animation->value_track_get_update_mode(idx)); } @@ -918,7 +918,7 @@ void AnimationKeyEditor::_menu_track(int p_type) { pos=animation->get_length(); timeline_pos=pos; track_pos->update(); - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,true); } break; case TRACK_MENU_PREV_STEP: { @@ -934,7 +934,7 @@ void AnimationKeyEditor::_menu_track(int p_type) { pos=0; timeline_pos=pos; track_pos->update(); - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,true); } break; @@ -1169,8 +1169,9 @@ void AnimationKeyEditor::_track_editor_draw() { get_icon("InterpCubic","EditorIcons") }; Ref<Texture> cont_icon[3]={ + get_icon("TrackContinuous","EditorIcons"), get_icon("TrackDiscrete","EditorIcons"), - get_icon("TrackContinuous","EditorIcons") + get_icon("TrackTrigger","EditorIcons") }; Ref<Texture> type_icon[3]={ get_icon("KeyValue","EditorIcons"), @@ -1442,15 +1443,15 @@ void AnimationKeyEditor::_track_editor_draw() { if (animation->track_get_type(idx)==Animation::TYPE_VALUE) { - int continuous = animation->value_track_is_continuous(idx)?1:0; + int umode = animation->value_track_get_update_mode(idx); icon_ofs.x-=hsep; icon_ofs.x-=down_icon->get_width(); te->draw_texture(down_icon,icon_ofs); icon_ofs.x-=hsep; - icon_ofs.x-=cont_icon[continuous]->get_width(); - te->draw_texture(cont_icon[continuous],icon_ofs); + icon_ofs.x-=cont_icon[umode]->get_width(); + te->draw_texture(cont_icon[umode],icon_ofs); } else { icon_ofs.x -= hsep*2 + cont_icon[0]->get_width() + down_icon->get_width(); @@ -1626,8 +1627,8 @@ void AnimationKeyEditor::_track_menu_selected(int p_idx) { ERR_FAIL_INDEX(cont_editing,animation->get_track_count()); undo_redo->create_action(TTR("Anim Track Change Value Mode")); - undo_redo->add_do_method(animation.ptr(),"value_track_set_continuous",cont_editing,p_idx); - undo_redo->add_undo_method(animation.ptr(),"value_track_set_continuous",cont_editing,animation->value_track_is_continuous(cont_editing)); + undo_redo->add_do_method(animation.ptr(),"value_track_set_update_mode",cont_editing,p_idx); + undo_redo->add_undo_method(animation.ptr(),"value_track_set_update_mode",cont_editing,animation->value_track_get_update_mode(cont_editing)); undo_redo->commit_action(); } @@ -1820,8 +1821,9 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { get_icon("InterpCubic","EditorIcons") }; Ref<Texture> cont_icon[3]={ + get_icon("TrackContinuous","EditorIcons"), get_icon("TrackDiscrete","EditorIcons"), - get_icon("TrackContinuous","EditorIcons") + get_icon("TrackTrigger","EditorIcons") }; Ref<Texture> type_icon[3]={ get_icon("KeyValue","EditorIcons"), @@ -1972,7 +1974,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { click.click=ClickOver::CLICK_DRAG_TIMELINE; click.at=Point2(mb.x,mb.y); click.to=click.at; - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,false); } @@ -2184,8 +2186,8 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { track_menu->clear(); track_menu->set_size(Point2(1,1)); - static const char *cont_name[3]={"Discrete","Continuous"}; - for(int i=0;i<2;i++) { + String cont_name[3]={TTR("Continuous"),TTR("Discrete"),TTR("Trigger")}; + for(int i=0;i<3;i++) { track_menu->add_icon_item(cont_icon[i],cont_name[i]); } @@ -2594,7 +2596,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { } timeline_pos=pos; - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,true); @@ -2920,6 +2922,7 @@ void AnimationKeyEditor::_notification(int p_what) { edit_button->connect("pressed",this,"_toggle_edit_curves"); loop->set_icon(get_icon("Loop","EditorIcons")); + loop_interpolation->set_icon(get_icon("LoopInterpolation","EditorIcons")); curve_edit->connect("transition_changed",this,"_curve_transition_changed"); //edit_button->add_color_override("font_color",get_color("font_color","Tree")); @@ -2940,8 +2943,9 @@ void AnimationKeyEditor::_notification(int p_what) { get_icon("InterpCubic","EditorIcons") }; Ref<Texture> cont_icon[3]={ + get_icon("TrackContinuous","EditorIcons"), get_icon("TrackDiscrete","EditorIcons"), - get_icon("TrackContinuous","EditorIcons") + get_icon("TrackTrigger","EditorIcons") }; //right_data_size_cache = remove_icon->get_width() + move_up_icon->get_width() + move_down_icon->get_width() + down_icon->get_width() *2 + interp_icon[0]->get_width() + cont_icon[0]->get_width() + add_key_icon->get_width() + hsep*11; @@ -3009,6 +3013,7 @@ void AnimationKeyEditor::_update_menu() { length->set_val(animation->get_length()); loop->set_pressed(animation->has_loop()); + loop_interpolation->set_pressed(animation->has_loop_interpolation()); step->set_val(animation->get_step()); } @@ -3311,7 +3316,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) { created=true; undo_redo->create_action(TTR("Anim Insert Track & Key")); - bool continuous=false; + Animation::UpdateMode update_mode=Animation::UPDATE_DISCRETE; if (p_id.type==Animation::TYPE_VALUE) { //wants a new tack @@ -3324,16 +3329,21 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) { PropertyInfo h = _find_hint_for_track(animation->get_track_count()-1,np); animation->remove_track(animation->get_track_count()-1); //hack - - continuous = - h.type==Variant::REAL || + if ( h.type==Variant::REAL || h.type==Variant::VECTOR2 || h.type==Variant::RECT2 || h.type==Variant::VECTOR3 || h.type==Variant::_AABB || h.type==Variant::QUAT || h.type==Variant::COLOR || - h.type==Variant::TRANSFORM ; + h.type==Variant::TRANSFORM ) { + + update_mode=Animation::UPDATE_CONTINUOUS; + } + + if (h.usage&PROPERTY_USAGE_ANIMATE_AS_TRIGGER) { + update_mode=Animation::UPDATE_TRIGGER; + } } } @@ -3342,7 +3352,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) { undo_redo->add_do_method(animation.ptr(),"add_track",p_id.type); undo_redo->add_do_method(animation.ptr(),"track_set_path",p_id.track_idx,p_id.path); if (p_id.type==Animation::TYPE_VALUE) - undo_redo->add_do_method(animation.ptr(),"value_track_set_continuous",p_id.track_idx,continuous); + undo_redo->add_do_method(animation.ptr(),"value_track_set_update_mode",p_id.track_idx,update_mode); } else { undo_redo->create_action(TTR("Anim Insert Key")); @@ -3459,6 +3469,21 @@ void AnimationKeyEditor::_animation_loop_changed() { } +void AnimationKeyEditor::_animation_loop_interpolation_changed() { + + if (updating) + return; + + if (!animation.is_null()) { + + undo_redo->create_action(TTR("Change Anim Loop Interpolation")); + undo_redo->add_do_method(animation.ptr(),"set_loop_interpolation",loop_interpolation->is_pressed()); + undo_redo->add_undo_method(animation.ptr(),"set_loop_interpolation",!loop_interpolation->is_pressed()); + undo_redo->commit_action(); + } + +} + void AnimationKeyEditor::_create_value_item(int p_type) { @@ -3536,7 +3561,7 @@ void AnimationKeyEditor::_insert_delay() { pos=animation->get_length(); timeline_pos=pos; track_pos->update(); - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,true); } insert_queue=false; } @@ -3744,6 +3769,7 @@ void AnimationKeyEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_animation_loop_changed"),&AnimationKeyEditor::_animation_loop_changed); + ObjectTypeDB::bind_method(_MD("_animation_loop_interpolation_changed"),&AnimationKeyEditor::_animation_loop_interpolation_changed); ObjectTypeDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed); ObjectTypeDB::bind_method(_MD("_create_value_item"),&AnimationKeyEditor::_create_value_item); ObjectTypeDB::bind_method(_MD("_pane_drag"),&AnimationKeyEditor::_pane_drag); @@ -3759,7 +3785,7 @@ void AnimationKeyEditor::_bind_methods() { ADD_SIGNAL( MethodInfo("resource_selected", PropertyInfo( Variant::OBJECT, "res"),PropertyInfo( Variant::STRING, "prop") ) ); ADD_SIGNAL( MethodInfo("keying_changed" ) ); - ADD_SIGNAL( MethodInfo("timeline_changed", PropertyInfo(Variant::REAL,"pos") ) ); + ADD_SIGNAL( MethodInfo("timeline_changed", PropertyInfo(Variant::REAL,"pos"), PropertyInfo(Variant::BOOL,"drag") ) ); 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") ) ); @@ -3854,6 +3880,12 @@ AnimationKeyEditor::AnimationKeyEditor() { hb->add_child(loop); loop->set_tooltip(TTR("Enable/Disable looping in animation.")); + loop_interpolation = memnew( ToolButton ); + loop_interpolation->set_toggle_mode(true); + loop_interpolation->connect("pressed",this,"_animation_loop_interpolation_changed"); + hb->add_child(loop_interpolation); + loop_interpolation->set_tooltip(TTR("Enable/Disable interpolation when looping animation.")); + hb->add_child( memnew( VSeparator ) ); menu_add_track = memnew( MenuButton ); diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h index 413c73b4b9..c8de1d87c1 100644 --- a/tools/editor/animation_editor.h +++ b/tools/editor/animation_editor.h @@ -173,6 +173,7 @@ class AnimationKeyEditor : public VBoxContainer { //MenuButton *menu; SpinBox *length; Button *loop; + Button *loop_interpolation; bool keying; ToolButton *edit_button; ToolButton *move_up_button; @@ -238,6 +239,7 @@ class AnimationKeyEditor : public VBoxContainer { void _animation_len_changed(float p_len); void _animation_loop_changed(); + void _animation_loop_interpolation_changed(); void _step_changed(float p_len); struct InsertData { diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index be5d9c47ff..644478923c 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -30,6 +30,7 @@ #include "editor_settings.h" #include "scene/gui/margin_container.h" #include "scene/gui/separator.h" +#include "scene/resources/dynamic_font.h" #include "os/keyboard.h" void GotoLineDialog::popup_find_line(TextEdit *p_edit) { @@ -974,6 +975,48 @@ FindReplaceDialog::FindReplaceDialog() { /*** CODE EDITOR ****/ +void CodeTextEditor::_text_editor_input_event(const InputEvent& p_event) { + + if (p_event.type==InputEvent::MOUSE_BUTTON) { + + const InputEventMouseButton& mb=p_event.mouse_button; + + if (mb.pressed && mb.mod.command) { + + if (mb.button_index==BUTTON_WHEEL_UP) { + + font_resize_val+=1; + + if (font_resize_timer->get_time_left()==0) + font_resize_timer->start(); + + } else if (mb.button_index==BUTTON_WHEEL_DOWN) { + + font_resize_val-=1; + + if (font_resize_timer->get_time_left()==0) + font_resize_timer->start(); + } + } + } else if (p_event.type==InputEvent::KEY) { + + const InputEventKey& k=p_event.key; + + if (k.pressed && k.mod.command) { + + if (k.scancode==KEY_0) { // reset source font size to default + + Ref<DynamicFont> font = text_editor->get_font("font"); + + if (font.is_valid()) { + EditorSettings::get_singleton()->set("global/source_font_size",14); + font->set_size(14); + } + } + } + } +} + void CodeTextEditor::_line_col_changed() { String text = String()+TTR("Line:")+" "+itos(text_editor->cursor_get_line()+1)+", "+TTR("Col:")+" "+itos(text_editor->cursor_get_column()); @@ -1011,6 +1054,22 @@ void CodeTextEditor::_complete_request() { text_editor->code_complete(strs); } +void CodeTextEditor::_font_resize_timeout() { + + Ref<DynamicFont> font = text_editor->get_font("font"); + + if (font.is_valid()) { + int size=font->get_size()+font_resize_val; + + if (size>=8 && size<=96) { + EditorSettings::get_singleton()->set("global/source_font_size",size); + font->set_size(size); + } + + font_resize_val=0; + } +} + void CodeTextEditor::set_error(const String& p_error) { if (p_error!="") { @@ -1026,15 +1085,15 @@ void CodeTextEditor::_update_font() { // FONTS String editor_font = EDITOR_DEF("text_editor/font", ""); - bool font_overrode = false; + bool font_overridden = false; if (editor_font!="") { Ref<Font> fnt = ResourceLoader::load(editor_font); if (fnt.is_valid()) { text_editor->add_font_override("font",fnt); - font_overrode = true; + font_overridden = true; } } - if(!font_overrode) + if(!font_overridden) text_editor->add_font_override("font",get_font("source","EditorFonts")); } @@ -1078,12 +1137,14 @@ void CodeTextEditor::_notification(int p_what) { void CodeTextEditor::_bind_methods() { + ObjectTypeDB::bind_method("_text_editor_input_event",&CodeTextEditor::_text_editor_input_event); ObjectTypeDB::bind_method("_line_col_changed",&CodeTextEditor::_line_col_changed); ObjectTypeDB::bind_method("_text_changed",&CodeTextEditor::_text_changed); ObjectTypeDB::bind_method("_on_settings_change",&CodeTextEditor::_on_settings_change); ObjectTypeDB::bind_method("_text_changed_idle_timeout",&CodeTextEditor::_text_changed_idle_timeout); ObjectTypeDB::bind_method("_code_complete_timer_timeout",&CodeTextEditor::_code_complete_timer_timeout); ObjectTypeDB::bind_method("_complete_request",&CodeTextEditor::_complete_request); + ObjectTypeDB::bind_method("_font_resize_timeout",&CodeTextEditor::_font_resize_timeout); } CodeTextEditor::CodeTextEditor() { @@ -1139,6 +1200,7 @@ CodeTextEditor::CodeTextEditor() { line_col->set_valign(Label::VALIGN_CENTER); + text_editor->connect("input_event", this,"_text_editor_input_event"); text_editor->connect("cursor_changed", this,"_line_col_changed"); text_editor->connect("text_changed", this,"_text_changed"); text_editor->connect("request_completion", this,"_complete_request"); @@ -1151,5 +1213,12 @@ CodeTextEditor::CodeTextEditor() { code_complete_timer->connect("timeout", this,"_code_complete_timer_timeout"); + font_resize_val=0; + font_resize_timer = memnew(Timer); + add_child(font_resize_timer); + font_resize_timer->set_one_shot(true); + font_resize_timer->set_wait_time(0.07); + font_resize_timer->connect("timeout", this, "_font_resize_timeout"); + EditorSettings::get_singleton()->connect("settings_changed",this,"_on_settings_change"); } diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index 2e1bf46c02..bdfd295ded 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -202,22 +202,27 @@ class CodeTextEditor : public VBoxContainer { Timer *code_complete_timer; bool enable_complete_timer; + Timer *font_resize_timer; + int font_resize_val; + Label *error; void _on_settings_change(); void _update_font(); void _complete_request(); + void _font_resize_timeout(); + + void _text_editor_input_event(const InputEvent& p_event); + protected: void set_error(const String& p_error); - virtual void _load_theme_settings() {} virtual void _validate_script()=0; virtual void _code_complete_script(const String& p_code, List<String>* r_options) {}; - void _text_changed_idle_timeout(); void _code_complete_timer_timeout(); void _text_changed(); @@ -225,7 +230,6 @@ protected: void _notification(int); static void _bind_methods(); - public: TextEdit *get_text_edit() { return text_editor; } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index ef65d5e506..dd50b720f7 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -29,8 +29,7 @@ #include "version.h" #include "editor_node.h" #include "print_string.h" -#include "editor_icons.h" -#include "editor_fonts.h" +#include "editor_themes.h" #include "editor_help.h" #include "core/io/resource_saver.h" @@ -1159,7 +1158,6 @@ void EditorNode::_dialog_action(String p_file) { } break; case FILE_RUN_SCRIPT: { - print_line("RUN: "+p_file); Ref<Script> scr = ResourceLoader::load(p_file,"Script",true); if (scr.is_null()) { add_io_error("Script Failed to Load:\n"+p_file); @@ -1303,7 +1301,6 @@ void EditorNode::_dialog_action(String p_file) { ret = unzGoToFirstFile(pkg); EditorProgress p("ltask",TTR("Loading Export Templates"),fc); - print_line("BEGIN IMPORT"); fc=0; @@ -1333,7 +1330,6 @@ void EditorNode::_dialog_action(String p_file) { file=file.get_file(); p.step(TTR("Importing:")+" "+file,fc); - print_line("IMPORT "+file); FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_settings_path()+"/templates/"+file,FileAccess::WRITE); @@ -3552,7 +3548,6 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo load_errors->clear(); String lpath = Globals::get_singleton()->localize_path(p_scene); - print_line("LOCAL PATH: "+lpath+" from "+p_scene); if (!lpath.begins_with("res://")) { current_option=-1; @@ -4199,7 +4194,6 @@ void EditorNode::_dock_select_input(const InputEvent& p_input) { dock_slot[dock_popup_selected]->set_current_tab(0); } - print_line("performing reparent"); dock_slot[nrect]->add_child(dock); dock_popup_selected=nrect; dock_slot[nrect]->set_current_tab(dock_slot[nrect]->get_tab_count()-1); @@ -5173,7 +5167,6 @@ EditorNode::EditorNode() { EditorSettings::create(); { int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); - print_line("DPI MODE: "+itos(dpi_mode)); if (dpi_mode==0) { editor_set_hidpi( OS::get_singleton()->get_screen_dpi(0) > 150 ); } else if (dpi_mode==2) { @@ -5233,44 +5226,9 @@ EditorNode::EditorNode() { theme_base->add_child(gui_base); gui_base->set_area_as_parent_rect(); - - theme = Ref<Theme>( memnew( Theme ) ); - theme_base->set_theme( theme ); - editor_register_icons(theme); - editor_register_fonts(theme); - - //theme->set_icon("folder","EditorFileDialog",Theme::get_default()->get_icon("folder","EditorFileDialog")); - //theme->set_color("files_disabled","EditorFileDialog",Color(0,0,0,0.7)); - - String global_font = EditorSettings::get_singleton()->get("global/custom_font"); - if (global_font!="") { - Ref<Font> fnt = ResourceLoader::load(global_font); - if (fnt.is_valid()) { - theme->set_default_theme_font(fnt); - } - } - - - - Ref<StyleBoxTexture> focus_sbt=memnew( StyleBoxTexture ); - focus_sbt->set_texture(theme->get_icon("EditorFocus","EditorIcons")); - for(int i=0;i<4;i++) { - focus_sbt->set_margin_size(Margin(i),16); - focus_sbt->set_default_margin(Margin(i),16); - } - focus_sbt->set_draw_center(false); - theme->set_stylebox("EditorFocus","EditorStyles",focus_sbt); - - - String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme"); - if (custom_theme!="") { - Ref<Theme> theme = ResourceLoader::load(custom_theme); - if (theme.is_valid()) { - gui_base->set_theme(theme); - } - } - - + theme_base->set_theme( create_default_theme() ); + theme = create_editor_theme(); + gui_base->set_theme(theme); resource_preview = memnew( EditorResourcePreview ); add_child(resource_preview); @@ -5556,8 +5514,8 @@ EditorNode::EditorNode() { p->add_submenu_item(TTR("Convert To.."),"Export"); pm_export->add_item(TTR("Translatable Strings.."),FILE_DUMP_STRINGS); pm_export->add_separator(); - pm_export->add_item(TTR("MeshLibrary.."),FILE_EXPORT_MESH_LIBRARY); - pm_export->add_item(TTR("TileSet.."),FILE_EXPORT_TILESET); + pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary..")), FILE_EXPORT_MESH_LIBRARY); + pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet..")), FILE_EXPORT_TILESET); pm_export->connect("item_pressed",this,"_menu_option"); p->add_separator(); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 4100644311..0fffaca782 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -63,7 +63,6 @@ bool EditorSettings::_set(const StringName& p_name, const Variant& p_value) { Array arr=p_value; ERR_FAIL_COND_V(arr.size() && arr.size()&1,true); - print_line("shortcuts: "+Variant(arr).get_construct_string()); for(int i=0;i<arr.size();i+=2) { String name = arr[i]; @@ -399,14 +398,11 @@ String EditorSettings::get_settings_path() const { void EditorSettings::setup_language() { String lang = get("global/editor_language"); - print_line("LANG IS "+lang); if (lang=="en") return; //none to do for(int i=0;i<translations.size();i++) { - print_line("TESTING "+translations[i]->get_locale()); if (translations[i]->get_locale()==lang) { - print_line("ok translation"); TranslationServer::get_singleton()->set_tool_translation(translations[i]); break; } @@ -515,7 +511,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("global/font_size",14); hints["global/font_size"]=PropertyInfo(Variant::INT,"global/font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); set("global/source_font_size",14); - hints["global/source_font_size"]=PropertyInfo(Variant::INT,"global/source_font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + hints["global/source_font_size"]=PropertyInfo(Variant::INT,"global/source_font_size",PROPERTY_HINT_RANGE,"8,96,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); set("global/custom_font",""); hints["global/custom_font"]=PropertyInfo(Variant::STRING,"global/custom_font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); set("global/custom_theme",""); @@ -711,7 +707,6 @@ void EditorSettings::notify_changes() { sml = OS::get_singleton()->get_main_loop()->cast_to<SceneTree>(); if (!sml) { - print_line("not SML"); return; } diff --git a/tools/editor/editor_themes.cpp b/tools/editor/editor_themes.cpp new file mode 100644 index 0000000000..44e21aee85 --- /dev/null +++ b/tools/editor/editor_themes.cpp @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* editor_themes.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "editor_themes.h" +#include "editor_icons.h" +#include "editor_fonts.h" +#include "editor_settings.h" +#include "core/io/resource_loader.h" + +Ref<Theme> create_default_theme() +{ + Ref<Theme> theme = Ref<Theme>( memnew( Theme ) ); + + editor_register_fonts(theme); + editor_register_icons(theme); + + Ref<StyleBoxTexture> focus_sbt=memnew( StyleBoxTexture ); + focus_sbt->set_texture(theme->get_icon("EditorFocus","EditorIcons")); + for(int i=0;i<4;i++) { + focus_sbt->set_margin_size(Margin(i),16); + focus_sbt->set_default_margin(Margin(i),16); + } + focus_sbt->set_draw_center(false); + theme->set_stylebox("EditorFocus","EditorStyles",focus_sbt); + + return theme; +} + +Ref<Theme> create_editor_theme() +{ + Ref<Theme> theme = NULL; + + String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme"); + if (custom_theme!="") { + theme = ResourceLoader::load(custom_theme); + } + + if (theme.is_null() || !theme.is_valid()) { + theme = create_default_theme(); + } + + String global_font = EditorSettings::get_singleton()->get("global/custom_font"); + if (global_font!="") { + Ref<Font> fnt = ResourceLoader::load(global_font); + if (fnt.is_valid()) { + theme->set_default_theme_font(fnt); + } + } + + return theme; +} diff --git a/tools/editor/editor_themes.h b/tools/editor/editor_themes.h new file mode 100644 index 0000000000..dbff8b3079 --- /dev/null +++ b/tools/editor/editor_themes.h @@ -0,0 +1,38 @@ +/*************************************************************************/ +/* editor_themes.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef EDITOR_THEMES_H +#define EDITOR_THEMES_H + +#include "scene/resources/theme.h" + +Ref<Theme> create_default_theme(); + +Ref<Theme> create_editor_theme(); + +#endif diff --git a/tools/editor/icons/icon_loop_interpolation.png b/tools/editor/icons/icon_loop_interpolation.png Binary files differnew file mode 100644 index 0000000000..2f92ab7bf3 --- /dev/null +++ b/tools/editor/icons/icon_loop_interpolation.png diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index f346306f61..ed766c6598 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -30,6 +30,7 @@ #include "globals.h" #include "tools/editor/editor_node.h" #include "scene/resources/packed_scene.h" +#include "scene/resources/box_shape.h" #include "os/file_access.h" #include "scene/3d/path.h" #include "scene/animation/animation_player.h" @@ -1073,7 +1074,7 @@ const EditorSceneImportDialog::FlagInfo EditorSceneImportDialog::scene_flag_name {EditorSceneImportPlugin::SCENE_FLAG_LINEARIZE_DIFFUSE_TEXTURES,("Actions"),"SRGB->Linear Of Diffuse Textures",false}, {EditorSceneImportPlugin::SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY,("Actions"),"Convert Normal Maps to XY",true}, {EditorSceneImportPlugin::SCENE_FLAG_SET_LIGHTMAP_TO_UV2_IF_EXISTS,("Actions"),"Set Material Lightmap to UV2 if Tex2Array Exists",true}, - {EditorSceneImportPlugin::SCENE_FLAG_CREATE_COLLISIONS,("Create"),"Create Collisions (-col},-colonly)",true}, + {EditorSceneImportPlugin::SCENE_FLAG_CREATE_COLLISIONS,("Create"),"Create Collisions and/or Rigid Bodies (-col,-colonly,-rigid)",true}, {EditorSceneImportPlugin::SCENE_FLAG_CREATE_PORTALS,("Create"),"Create Portals (-portal)",true}, {EditorSceneImportPlugin::SCENE_FLAG_CREATE_ROOMS,("Create"),"Create Rooms (-room)",true}, {EditorSceneImportPlugin::SCENE_FLAG_SIMPLIFY_ROOMS,("Create"),"Simplify Rooms",false}, @@ -1745,6 +1746,49 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> colshape->set_owner(sb->get_owner()); } + } else if (p_flags&SCENE_FLAG_CREATE_COLLISIONS && _teststr(name,"rigid") && p_node->cast_to<MeshInstance>()) { + + if (isroot) + return p_node; + + // get mesh instance and bounding box + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + AABB aabb = mi->get_aabb(); + + // create a new rigid body collision node + RigidBody * rigid_body = memnew( RigidBody ); + Node * col = rigid_body; + ERR_FAIL_COND_V(!col,NULL); + + // remove node name postfix + col->set_name(_fixstr(name,"rigid")); + // get mesh instance xform matrix to the rigid body collision node + col->cast_to<Spatial>()->set_transform(mi->get_transform()); + // save original node by duplicating it into a new instance and correcting the name + Node * mesh = p_node->duplicate(); + mesh->set_name(_fixstr(name,"rigid")); + // reset the xform matrix of the duplicated node so it can inherit parent node xform + mesh->cast_to<Spatial>()->set_transform(Transform(Matrix3())); + // reparent the new mesh node to the rigid body collision node + p_node->add_child(mesh); + mesh->set_owner(p_node->get_owner()); + // replace the original node with the rigid body collision node + p_node->replace_by(col); + memdelete(p_node); + p_node=col; + + // create an alias for the rigid body collision node + RigidBody *rb = col->cast_to<RigidBody>(); + // create a new Box collision shape and set the right extents + Ref<BoxShape> shape = memnew( BoxShape ); + shape->set_extents(aabb.get_size() * 0.5); + CollisionShape *colshape = memnew( CollisionShape); + colshape->set_name("shape"); + colshape->set_shape(shape); + // reparent the new collision shape to the rigid body collision node + rb->add_child(colshape); + colshape->set_owner(p_node->get_owner()); + } else if (p_flags&SCENE_FLAG_CREATE_COLLISIONS &&_teststr(name,"col") && p_node->cast_to<MeshInstance>()) { diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 4bbcb396af..10c7bf79a3 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -952,7 +952,7 @@ void AnimationPlayerEditor::_animation_duplicate() { } -void AnimationPlayerEditor::_seek_value_changed(float p_value) { +void AnimationPlayerEditor::_seek_value_changed(float p_value,bool p_set) { if (updating || !player || player->is_playing()) { return; @@ -980,7 +980,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value) { pos=anim->get_length(); } - if (player->is_valid()) { + if (player->is_valid() && !p_set) { float cpos = player->get_current_animation_pos(); player->seek_delta(pos,pos-cpos); @@ -988,6 +988,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value) { player->seek(pos,true); } + key_editor->set_anim_pos(pos); updating=true; @@ -1078,6 +1079,7 @@ void AnimationPlayerEditor::_editor_load(){ void AnimationPlayerEditor::_animation_key_editor_anim_len_changed(float p_len) { + frame->set_max(p_len); } @@ -1092,7 +1094,7 @@ void AnimationPlayerEditor::_animation_key_editor_anim_step_changed(float p_len) } -void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos) { +void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos,bool p_drag) { if (!is_visible()) return; @@ -1102,7 +1104,11 @@ void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos) { if (player->is_playing() ) return; - frame->set_val(p_pos); + updating=true; + frame->set_val(p_pos); + updating=false; + _seek_value_changed(p_pos,!p_drag); + EditorNode::get_singleton()->get_property_editor()->refresh(); @@ -1254,7 +1260,7 @@ void AnimationPlayerEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_animation_edit"),&AnimationPlayerEditor::_animation_edit); ObjectTypeDB::bind_method(_MD("_animation_resource_edit"),&AnimationPlayerEditor::_animation_resource_edit); ObjectTypeDB::bind_method(_MD("_dialog_action"),&AnimationPlayerEditor::_dialog_action); - ObjectTypeDB::bind_method(_MD("_seek_value_changed"),&AnimationPlayerEditor::_seek_value_changed); + ObjectTypeDB::bind_method(_MD("_seek_value_changed"),&AnimationPlayerEditor::_seek_value_changed,DEFVAL(true)); ObjectTypeDB::bind_method(_MD("_animation_player_changed"),&AnimationPlayerEditor::_animation_player_changed); ObjectTypeDB::bind_method(_MD("_blend_edited"),&AnimationPlayerEditor::_blend_edited); // ObjectTypeDB::bind_method(_MD("_seek_frame_changed"),&AnimationPlayerEditor::_seek_frame_changed); @@ -1350,19 +1356,23 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { add_anim = memnew( ToolButton ); + ED_SHORTCUT("animation_player_editor/add_animation", TTR("Create new animation in player.")); + add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/add_animation")); add_anim->set_tooltip(TTR("Create new animation in player.")); hb->add_child(add_anim); load_anim = memnew( ToolButton ); + ED_SHORTCUT("animation_player_editor/load_from_disk", TTR("Load animation from disk.")); + add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/load_from_disk")); load_anim->set_tooltip(TTR("Load an animation from disk.")); hb->add_child(load_anim); save_anim = memnew(MenuButton); save_anim->set_tooltip(TTR("Save the current animation")); - save_anim->get_popup()->add_item(TTR("Save"), ANIM_SAVE); - save_anim->get_popup()->add_item(TTR("Save As.."), ANIM_SAVE_AS); + save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save", TTR("Save")), ANIM_SAVE); + save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save_as", TTR("Save As")), ANIM_SAVE_AS); save_anim->set_focus_mode(Control::FOCUS_NONE); hb->add_child(save_anim); @@ -1372,15 +1382,21 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { duplicate_anim = memnew( ToolButton ); hb->add_child(duplicate_anim); + ED_SHORTCUT("animation_player_editor/duplicate_animation", TTR("Duplicate Animation")); + duplicate_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/duplicate_animation")); duplicate_anim->set_tooltip(TTR("Duplicate Animation")); rename_anim = memnew( ToolButton ); hb->add_child(rename_anim); + ED_SHORTCUT("animation_player_editor/rename_animation", TTR("Rename Animation")); + rename_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/rename_animation")); rename_anim->set_tooltip(TTR("Rename Animation")); remove_anim = memnew( ToolButton ); hb->add_child(remove_anim); + ED_SHORTCUT("animation_player_editor/remove_animation", TTR("Remove Animation")); + remove_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/remove_animation")); remove_anim->set_tooltip(TTR("Remove Animation")); @@ -1402,8 +1418,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { tool_anim = memnew( MenuButton); //tool_anim->set_flat(false); tool_anim->set_tooltip(TTR("Animation Tools")); - tool_anim->get_popup()->add_item(TTR("Copy Animation"),TOOL_COPY_ANIM); - tool_anim->get_popup()->add_item(TTR("Paste Animation"),TOOL_PASTE_ANIM); + tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/copy_animation", TTR("Copy Animation")),TOOL_COPY_ANIM); + tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/paste_animation", TTR("Paste Animation")),TOOL_PASTE_ANIM); //tool_anim->get_popup()->add_separator(); //tool_anim->get_popup()->add_item("Edit Anim Resource",TOOL_PASTE_ANIM); hb->add_child(tool_anim); @@ -1487,8 +1503,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { 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"); - frame->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true); - scale->connect("text_entered", this, "_scale_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); diff --git a/tools/editor/plugins/animation_player_editor_plugin.h b/tools/editor/plugins/animation_player_editor_plugin.h index 3f3cda25b2..b0c930b66e 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.h +++ b/tools/editor/plugins/animation_player_editor_plugin.h @@ -145,7 +145,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _scale_changed(const String& p_scale); void _dialog_action(String p_file); void _seek_frame_changed(const String& p_frame); - void _seek_value_changed(float p_value); + void _seek_value_changed(float p_value, bool p_set=false); void _blend_editor_next_changed(const int p_idx); void _list_changed(); @@ -158,7 +158,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _animation_player_changed(Object *p_pl); - void _animation_key_editor_seek(float p_pos); + void _animation_key_editor_seek(float p_pos, bool p_drag); void _animation_key_editor_anim_len_changed(float p_new); void _animation_key_editor_anim_step_changed(float p_len); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index a313b0053a..f459bf483a 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -2201,7 +2201,7 @@ void ScriptEditor::_editor_stop() { void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const StringArray& p_args) { - print_line("add callback! hohoho"); + //print_line("add callback! hohoho"); kinda sad to remove this ERR_FAIL_COND(!p_obj); Ref<Script> script = p_obj->get_script(); ERR_FAIL_COND( !script.is_valid() ); @@ -2243,7 +2243,6 @@ void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const void ScriptEditor::_editor_settings_changed() { - print_line("settings changed"); trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/trim_trailing_whitespace_on_save"); float autosave_time = EditorSettings::get_singleton()->get("text_editor/autosave_interval_secs"); if (autosave_time>0) { @@ -2284,7 +2283,6 @@ void ScriptEditor::_editor_settings_changed() { void ScriptEditor::_autosave_scripts() { - print_line("autosaving"); save_all_scripts(); } diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 5a40777665..d5f85d3333 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -893,59 +893,53 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) { if (tool!=TOOL_NONE || !mouse_over) return false; - if (k.scancode==KEY_DELETE) { - + if (ED_IS_SHORTCUT("tile_map_editor/erase_selection", p_event)) { _menu_option(OPTION_ERASE_SELECTION); return true; } + if (ED_IS_SHORTCUT("tile_map_editor/select", p_event)) { + tool=TOOL_SELECTING; + selection_active=false; - if (k.mod.command) { - - if (k.scancode==KEY_F) { - - search_box->select_all(); - search_box->grab_focus(); + canvas_item_editor->update(); - return true; - } - if (k.scancode==KEY_B) { + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) { + _update_copydata(); - tool=TOOL_SELECTING; - selection_active=false; + if (selection_active) { + tool=TOOL_DUPLICATING; canvas_item_editor->update(); return true; } - if (k.scancode==KEY_D) { - - _update_copydata(); - - if (selection_active) { - tool=TOOL_DUPLICATING; - - canvas_item_editor->update(); - - return true; - } - } - } else { - - if (k.scancode==KEY_A) { - - flip_h=!flip_h; - mirror_x->set_pressed(flip_h); - canvas_item_editor->update(); - return true; - } - if (k.scancode==KEY_S) { + } + if (ED_IS_SHORTCUT("tile_map_editor/find_tile", p_event)) { + search_box->select_all(); + search_box->grab_focus(); - flip_v=!flip_v; - mirror_y->set_pressed(flip_v); - canvas_item_editor->update(); - return true; - } + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/mirror_x", p_event)) { + flip_h=!flip_h; + mirror_x->set_pressed(flip_h); + canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/mirror_y", p_event)) { + flip_v=!flip_v; + mirror_y->set_pressed(flip_v); + canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/transpose", p_event)) { + transpose = !transpose; + transp->set_pressed(transpose); + canvas_item_editor->update(); + return true; } } break; } @@ -1308,6 +1302,12 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { flip_v=false; transpose=false; + ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase selection"), KEY_DELETE); + ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find tile"), KEY_MASK_CMD+KEY_F); + ED_SHORTCUT("tile_map_editor/transpose", TTR("Transpose")); + ED_SHORTCUT("tile_map_editor/mirror_x", TTR("Mirror X"), KEY_A); + ED_SHORTCUT("tile_map_editor/mirror_y", TTR("Mirror Y"), KEY_S); + search_box = memnew( LineEdit ); search_box->set_h_size_flags(SIZE_EXPAND_FILL); search_box->connect("text_entered", this, "_text_entered"); @@ -1349,9 +1349,9 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { p->add_separator(); p->add_item(TTR("Pick Tile"), OPTION_PICK_TILE, KEY_CONTROL); p->add_separator(); - p->add_item(TTR("Select"), OPTION_SELECT, KEY_MASK_CMD+KEY_B); - p->add_item(TTR("Duplicate Selection"), OPTION_DUPLICATE, KEY_MASK_CMD+KEY_D); - p->add_item(TTR("Erase Selection"), OPTION_ERASE_SELECTION, KEY_DELETE); + p->add_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_MASK_CMD+KEY_B), OPTION_SELECT); + p->add_shortcut(ED_SHORTCUT("tile_map_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD+KEY_D), OPTION_DUPLICATE); + p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION); p->connect("item_pressed", this, "_menu_option"); @@ -1361,19 +1361,19 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { transp = memnew( ToolButton ); transp->set_toggle_mode(true); - transp->set_tooltip(TTR("Transpose")); + transp->set_tooltip(TTR("Transpose") + " ("+ED_GET_SHORTCUT("tile_map_editor/transpose")->get_as_text()+")"); transp->set_focus_mode(FOCUS_NONE); transp->connect("pressed", this, "_update_transform_buttons", make_binds(transp)); toolbar->add_child(transp); mirror_x = memnew( ToolButton ); mirror_x->set_toggle_mode(true); - mirror_x->set_tooltip(TTR("Mirror X (A)")); + mirror_x->set_tooltip(TTR("Mirror X") + " ("+ED_GET_SHORTCUT("tile_map_editor/mirror_x")->get_as_text()+")"); mirror_x->set_focus_mode(FOCUS_NONE); mirror_x->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_x)); toolbar->add_child(mirror_x); mirror_y = memnew( ToolButton ); mirror_y->set_toggle_mode(true); - mirror_y->set_tooltip(TTR("Mirror Y (S)")); + mirror_y->set_tooltip(TTR("Mirror Y") + " ("+ED_GET_SHORTCUT("tile_map_editor/mirror_y")->get_as_text()+")"); mirror_y->set_focus_mode(FOCUS_NONE); mirror_y->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_y)); toolbar->add_child(mirror_y); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 419f05f2cf..d8814fd50e 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -45,8 +45,7 @@ #include "scene/gui/margin_container.h" #include "io/resource_saver.h" -#include "editor_icons.h" -#include "editor_fonts.h" +#include "editor_themes.h" #include "editor_scale.h" @@ -846,21 +845,16 @@ ProjectManager::ProjectManager() { set_area_as_parent_rect(); - Ref<Theme> theme = Ref<Theme>( memnew( Theme ) ); - set_theme(theme); - editor_register_icons(theme); - editor_register_fonts(theme); + gui_base = memnew( Control ); + add_child(gui_base); + gui_base->set_area_as_parent_rect(); - String global_font = EditorSettings::get_singleton()->get("global/font"); - if (global_font!="") { - Ref<Font> fnt = ResourceLoader::load(global_font); - if (fnt.is_valid()) { - theme->set_default_theme_font(fnt); - } - } + set_theme(create_default_theme()); + Ref<Theme> theme = create_editor_theme(); + gui_base->set_theme(theme); Panel *panel = memnew( Panel ); - add_child(panel); + gui_base->add_child(panel); panel->set_area_as_parent_rect(); VBoxContainer *vb = memnew( VBoxContainer ); @@ -961,7 +955,7 @@ ProjectManager::ProjectManager() { scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM); scan_dir->set_mode(FileDialog::MODE_OPEN_DIR); scan_dir->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") ); - add_child(scan_dir); + gui_base->add_child(scan_dir); scan_dir->connect("dir_selected",this,"_scan_begin"); @@ -1010,26 +1004,26 @@ ProjectManager::ProjectManager() { erase_ask->get_ok()->set_text(TTR("Remove")); erase_ask->get_ok()->connect("pressed", this,"_erase_project_confirm"); - add_child(erase_ask); + gui_base->add_child(erase_ask); multi_open_ask = memnew( ConfirmationDialog ); multi_open_ask->get_ok()->set_text(TTR("Edit")); multi_open_ask->get_ok()->connect("pressed", this, "_open_project_confirm"); - add_child(multi_open_ask); + gui_base->add_child(multi_open_ask); multi_run_ask = memnew( ConfirmationDialog ); multi_run_ask->get_ok()->set_text(TTR("Run")); multi_run_ask->get_ok()->connect("pressed", this, "_run_project_confirm"); - add_child(multi_run_ask); + gui_base->add_child(multi_run_ask); OS::get_singleton()->set_low_processor_usage_mode(true); npdialog = memnew( NewProjectDialog ); - add_child(npdialog); + gui_base->add_child(npdialog); npdialog->connect("project_created", this,"_load_recent_projects"); _load_recent_projects(); diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h index cfedfd7a69..2db1bb839e 100644 --- a/tools/editor/project_manager.h +++ b/tools/editor/project_manager.h @@ -67,6 +67,8 @@ class ProjectManager : public Control { TabContainer *tabs; + Control *gui_base; + void _item_doubleclicked(); |