diff options
Diffstat (limited to 'tools/editor')
| -rw-r--r-- | tools/editor/code_editor.cpp | 18 | ||||
| -rw-r--r-- | tools/editor/code_editor.h | 4 | ||||
| -rw-r--r-- | tools/editor/editor_node.cpp | 8 | ||||
| -rw-r--r-- | tools/editor/editor_settings.cpp | 10 | ||||
| -rw-r--r-- | tools/editor/property_editor.cpp | 9 |
5 files changed, 44 insertions, 5 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index ca1e769ff..ea87ac625 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -510,6 +510,20 @@ void CodeTextEditor::set_error(const String& p_error) { } +void CodeTextEditor::_update_font() { + + String editor_font = EditorSettings::get_singleton()->get("text_editor/font"); + if (editor_font!="") { + Ref<Font> fnt = ResourceLoader::load(editor_font); + if (fnt.is_valid()) { + text_editor->add_font_override("font",fnt); + return; + } + } + + text_editor->add_font_override("font",get_font("source","Fonts")); +} + void CodeTextEditor::_text_changed_idle_timeout() { @@ -527,8 +541,9 @@ void CodeTextEditor::_bind_methods() { ObjectTypeDB::bind_method("_line_col_changed",&CodeTextEditor::_line_col_changed); ObjectTypeDB::bind_method("_text_changed",&CodeTextEditor::_text_changed); + ObjectTypeDB::bind_method("_update_font",&CodeTextEditor::_update_font); ObjectTypeDB::bind_method("_text_changed_idle_timeout",&CodeTextEditor::_text_changed_idle_timeout); - ObjectTypeDB::bind_method("_complete_request",&CodeTextEditor::_complete_request); + ObjectTypeDB::bind_method("_complete_request",&CodeTextEditor::_complete_request); } CodeTextEditor::CodeTextEditor() { @@ -571,4 +586,5 @@ CodeTextEditor::CodeTextEditor() { text_editor->set_completion(true,cs); idle->connect("timeout", this,"_text_changed_idle_timeout"); + EditorSettings::get_singleton()->connect("settings_changed",this,"_update_font"); } diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index fc8285d16..5a588d2cc 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -131,7 +131,9 @@ class CodeTextEditor : public Control { Label *error; - void _complete_request(const String& p_request,int p_line); + void _update_font(); + + void _complete_request(const String& p_request,int p_line); protected: void set_error(const String& p_error); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index af61022af..efb0f7223 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3263,6 +3263,14 @@ EditorNode::EditorNode() { editor_register_icons(theme); editor_register_fonts(theme); + 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); + } + } + Ref<StyleBoxTexture> focus_sbt=memnew( StyleBoxTexture ); focus_sbt->set_texture(theme->get_icon("EditorFocus","EditorIcons")); for(int i=0;i<4;i++) { diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 6f4db7412..6d3384d0f 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -384,6 +384,9 @@ void EditorSettings::_load_defaults() { _THREAD_SAFE_METHOD_ + set("global/font",""); + hints["global/font"]=PropertyInfo(Variant::STRING,"global/font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt"); + set("text_editor/background_color",Color::html("3b000000")); set("text_editor/text_color",Color::html("aaaaaa")); set("text_editor/text_selected_color",Color::html("000000")); @@ -398,6 +401,9 @@ void EditorSettings::_load_defaults() { set("text_editor/idle_parse_delay",2); set("text_editor/create_signal_callbacks",true); set("text_editor/autosave_interval_seconds",60); + set("text_editor/font",""); + hints["text_editor/font"]=PropertyInfo(Variant::STRING,"text_editor/font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt"); + set("3d_editor/default_fov",45.0); set("3d_editor/default_z_near",0.1); @@ -429,9 +435,9 @@ void EditorSettings::_load_defaults() { set("import/pvrtc_texture_tool",""); #ifdef WINDOWS_ENABLED - hints["import/pvrtc_texture_tool"]=PropertyInfo(Variant::STRING,"import/pvrtc_texture_tool",PROPERTY_HINT_FILE,"*.exe"); + hints["import/pvrtc_texture_tool"]=PropertyInfo(Variant::STRING,"import/pvrtc_texture_tool",PROPERTY_HINT_GLOBAL_FILE,"*.exe"); #else - hints["import/pvrtc_texture_tool"]=PropertyInfo(Variant::STRING,"import/pvrtc_texture_tool",PROPERTY_HINT_FILE,""); + hints["import/pvrtc_texture_tool"]=PropertyInfo(Variant::STRING,"import/pvrtc_texture_tool",PROPERTY_HINT_GLOBAL_FILE,""); #endif set("PVRTC/fast_conversion",false); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 1cce161d0..c2243bcc0 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -909,7 +909,14 @@ void CustomPropertyEditor::_action_pressed(int p_which) { Vector<String> extensions=hint_text.split(","); for(int i=0;i<extensions.size();i++) { - file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper() ); + String filter = extensions[i]; + if (filter.begins_with(".")) + filter="*"+extensions[i]; + else if (!filter.begins_with("*")) + filter="*."+extensions[i]; + + + file->add_filter(filter+" ; "+extensions[i].to_upper() ); } } |
