From 9b1f8230ec435d9289b53afa8da02367daf8b5af Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 30 May 2016 00:28:29 -0300 Subject: -Some fixes to OSX retina scaling for window functions -Implemented HiDPI detection and support for Godot Editor! --- tools/editor/plugins/editor_preview_plugins.cpp | 9 +++++++-- tools/editor/plugins/material_editor_plugin.cpp | 2 +- tools/editor/plugins/mesh_editor_plugin.cpp | 2 +- tools/editor/plugins/sample_editor_plugin.cpp | 2 +- tools/editor/plugins/script_editor_plugin.cpp | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) (limited to 'tools/editor/plugins') diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index 12d50cd4b8..300e35f94d 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -7,7 +7,7 @@ #include "scene/resources/sample.h" #include "scene/resources/mesh.h" #include "scene/resources/bit_mask.h" - +#include "tools/editor/editor_scale.h" bool EditorTexturePreviewPlugin::handles(const String& p_type) const { return (ObjectTypeDB::is_type(p_type,"ImageTexture") || ObjectTypeDB::is_type(p_type, "AtlasTexture")); @@ -36,6 +36,7 @@ Ref EditorTexturePreviewPlugin::generate(const RES& p_from) { img.clear_mipmaps(); int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + thumbnail_size*=EDSCALE; if (img.is_compressed()) { if (img.decompress()!=OK) return Ref(); @@ -111,6 +112,7 @@ Ref EditorBitmapPreviewPlugin::generate(const RES& p_from) { Image img(bm->get_size().width,bm->get_size().height,0,Image::FORMAT_GRAYSCALE,data); int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + thumbnail_size*=EDSCALE; if (img.is_compressed()) { if (img.decompress()!=OK) return Ref(); @@ -233,6 +235,7 @@ Ref EditorMaterialPreviewPlugin::generate(const RES& p_from) { VS::get_singleton()->mesh_surface_set_material(sphere,0,RID()); int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + thumbnail_size*=EDSCALE; img.resize(thumbnail_size,thumbnail_size); Ref ptex = Ref( memnew( ImageTexture )); @@ -401,6 +404,7 @@ Ref EditorScriptPreviewPlugin::generate(const RES& p_from) { int line = 0; int col=0; int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + thumbnail_size*=EDSCALE; Image img(thumbnail_size,thumbnail_size,0,Image::FORMAT_RGBA); @@ -501,7 +505,7 @@ Ref EditorSamplePreviewPlugin::generate(const RES& p_from) { int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); - + thumbnail_size*=EDSCALE; DVector img; int w = thumbnail_size; int h = thumbnail_size; @@ -815,6 +819,7 @@ Ref EditorMeshPreviewPlugin::generate(const RES& p_from) { VS::get_singleton()->instance_set_base(mesh_instance,RID()); int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + thumbnail_size*=EDSCALE; img.resize(thumbnail_size,thumbnail_size); Ref ptex = Ref( memnew( ImageTexture )); diff --git a/tools/editor/plugins/material_editor_plugin.cpp b/tools/editor/plugins/material_editor_plugin.cpp index 4ef2815a32..f4258836e5 100644 --- a/tools/editor/plugins/material_editor_plugin.cpp +++ b/tools/editor/plugins/material_editor_plugin.cpp @@ -294,7 +294,7 @@ MaterialEditor::MaterialEditor() { } - set_custom_minimum_size(Size2(1,150)); + set_custom_minimum_size(Size2(1,150)*EDSCALE); HBoxContainer *hb = memnew( HBoxContainer ); add_child(hb); diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp index ecf17fec19..51a436e58d 100644 --- a/tools/editor/plugins/mesh_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_editor_plugin.cpp @@ -141,7 +141,7 @@ MeshEditor::MeshEditor() { - set_custom_minimum_size(Size2(1,150)); + set_custom_minimum_size(Size2(1,150)*EDSCALE); HBoxContainer *hb = memnew( HBoxContainer ); add_child(hb); diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index f9217e47fa..a3891a648b 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -404,7 +404,7 @@ SampleEditor::SampleEditor() { play->connect("pressed", this,"_play_pressed"); stop->connect("pressed", this,"_stop_pressed"); - set_custom_minimum_size(Size2(1,150)); + set_custom_minimum_size(Size2(1,150)*EDSCALE); } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 6d87777a79..2453ff3190 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -978,7 +978,7 @@ void ScriptEditor::_menu_option(int p_option) { switch(p_option) { case FILE_NEW: { script_create_dialog->config("Node", ".gd"); - script_create_dialog->popup_centered(Size2(300, 300)); + script_create_dialog->popup_centered(Size2(300, 300)*EDSCALE); } break; case FILE_OPEN: { @@ -1100,7 +1100,7 @@ void ScriptEditor::_menu_option(int p_option) { switch(p_option) { case FILE_NEW: { script_create_dialog->config("Node", ".gd"); - script_create_dialog->popup_centered(Size2(300, 300)); + script_create_dialog->popup_centered(Size2(300, 300)*EDSCALE); } break; case FILE_SAVE: { -- cgit v1.2.3 From 0fc4f1bcf4daf4b6efbce3e76506d74c672db59a Mon Sep 17 00:00:00 2001 From: DimOkGamer Date: Mon, 30 May 2016 21:47:53 +0300 Subject: Added more translatable strings in code. Updated template tools.pot. also improved Russian localization. --- tools/editor/plugins/spatial_editor_plugin.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tools/editor/plugins') diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 55485d8c92..f32d0448a2 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -3954,7 +3954,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { PopupMenu *p; transform_menu = memnew( MenuButton ); - transform_menu->set_text("Transform"); + transform_menu->set_text(TTR("Transform")); hbc_menu->add_child( transform_menu ); p = transform_menu->get_popup(); @@ -3979,12 +3979,12 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { p->add_check_item(TTR("Use Default sRGB"),MENU_VIEW_USE_DEFAULT_SRGB); p->add_separator(); - p->add_check_item("1 Viewport",MENU_VIEW_USE_1_VIEWPORT,KEY_MASK_CMD+KEY_1); - p->add_check_item("2 Viewports",MENU_VIEW_USE_2_VIEWPORTS,KEY_MASK_CMD+KEY_2); - p->add_check_item("2 Viewports (Alt)",MENU_VIEW_USE_2_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_2); - p->add_check_item("3 Viewports",MENU_VIEW_USE_3_VIEWPORTS,KEY_MASK_CMD+KEY_3); - p->add_check_item("3 Viewports (Alt)",MENU_VIEW_USE_3_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_3); - p->add_check_item("4 Viewports",MENU_VIEW_USE_4_VIEWPORTS,KEY_MASK_CMD+KEY_4); + p->add_check_item(TTR("1 Viewport"),MENU_VIEW_USE_1_VIEWPORT,KEY_MASK_CMD+KEY_1); + p->add_check_item(TTR("2 Viewports"),MENU_VIEW_USE_2_VIEWPORTS,KEY_MASK_CMD+KEY_2); + p->add_check_item(TTR("2 Viewports (Alt)"),MENU_VIEW_USE_2_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_2); + p->add_check_item(TTR("3 Viewports"),MENU_VIEW_USE_3_VIEWPORTS,KEY_MASK_CMD+KEY_3); + p->add_check_item(TTR("3 Viewports (Alt)"),MENU_VIEW_USE_3_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_3); + p->add_check_item(TTR("4 Viewports"),MENU_VIEW_USE_4_VIEWPORTS,KEY_MASK_CMD+KEY_4); p->add_separator(); p->add_check_item(TTR("Display Normal"),MENU_VIEW_DISPLAY_NORMAL); -- cgit v1.2.3