summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/debugger/editor_debugger_node.cpp16
-rw-r--r--editor/debugger/editor_visual_profiler.cpp27
-rw-r--r--editor/editor_themes.cpp8
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.cpp25
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.h1
-rw-r--r--misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj2
-rw-r--r--misc/dist/osx_template.app/Contents/Info.plist2
-rw-r--r--modules/gdscript/gdscript.cpp2
-rw-r--r--platform/iphone/export/export_plugin.cpp53
-rw-r--r--platform/osx/export/export_plugin.cpp5
10 files changed, 115 insertions, 26 deletions
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 7c9a984b6a..1c75b2dff1 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -39,6 +39,7 @@
#include "editor/scene_tree_dock.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/tab_container.h"
+#include "scene/resources/packed_scene.h"
template <typename Func>
void _for_all(TabContainer *p_node, const Func &p_func) {
@@ -141,11 +142,22 @@ void EditorDebuggerNode::_error_selected(const String &p_file, int p_line, int p
}
void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_debugger) {
- const String file = p_debugger->get_stack_script_file();
+ String file = p_debugger->get_stack_script_file();
if (file.is_empty()) {
return;
}
- stack_script = ResourceLoader::load(file);
+ if (file.is_resource_file()) {
+ stack_script = ResourceLoader::load(file);
+ } else {
+ // If the script is built-in, it can be opened only if the scene is loaded in memory.
+ int i = file.find("::");
+ int j = file.rfind("(", i);
+ if (j > -1) { // If the script is named, the string is "name (file)", so we need to extract the path.
+ file = file.substr(j + 1, file.find(")", i) - j - 1);
+ }
+ Ref<PackedScene> ps = ResourceLoader::load(file.get_slice("::", 0));
+ stack_script = ResourceLoader::load(file);
+ }
const int line = p_debugger->get_stack_script_line() - 1;
emit_signal(SNAME("goto_script_line"), stack_script, line);
emit_signal(SNAME("set_execution"), stack_script, line);
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 2a1b0029d4..76a6dc36cb 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -143,12 +143,12 @@ void EditorVisualProfiler::_item_selected() {
}
void EditorVisualProfiler::_update_plot() {
- int w = graph->get_size().width;
- int h = graph->get_size().height;
+ const int w = graph->get_size().width;
+ const int h = graph->get_size().height;
bool reset_texture = false;
- int desired_len = w * h * 4;
+ const int desired_len = w * h * 4;
if (graph_image.size() != desired_len) {
reset_texture = true;
@@ -156,12 +156,13 @@ void EditorVisualProfiler::_update_plot() {
}
uint8_t *wr = graph_image.ptrw();
+ const Color background_color = get_theme_color("dark_color_2", "Editor");
- //clear
+ // Clear the previous frame and set the background color.
for (int i = 0; i < desired_len; i += 4) {
- wr[i + 0] = 0;
- wr[i + 1] = 0;
- wr[i + 2] = 0;
+ wr[i + 0] = Math::fast_ftoi(background_color.r * 255);
+ wr[i + 1] = Math::fast_ftoi(background_color.g * 255);
+ wr[i + 2] = Math::fast_ftoi(background_color.b * 255);
wr[i + 3] = 255;
}
@@ -259,9 +260,9 @@ void EditorVisualProfiler::_update_plot() {
uint8_t r, g, b;
if (column_cpu[j].a == 0) {
- r = 0;
- g = 0;
- b = 0;
+ r = Math::fast_ftoi(background_color.r * 255);
+ g = Math::fast_ftoi(background_color.g * 255);
+ b = Math::fast_ftoi(background_color.b * 255);
} else {
r = CLAMP((column_cpu[j].r / column_cpu[j].a) * 255.0, 0, 255);
g = CLAMP((column_cpu[j].g / column_cpu[j].a) * 255.0, 0, 255);
@@ -279,9 +280,9 @@ void EditorVisualProfiler::_update_plot() {
uint8_t r, g, b;
if (column_gpu[j].a == 0) {
- r = 0;
- g = 0;
- b = 0;
+ r = Math::fast_ftoi(background_color.r * 255);
+ g = Math::fast_ftoi(background_color.g * 255);
+ b = Math::fast_ftoi(background_color.b * 255);
} else {
r = CLAMP((column_gpu[j].r / column_gpu[j].a) * 255.0, 0, 255);
g = CLAMP((column_gpu[j].g / column_gpu[j].a) * 255.0, 0, 255);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 05aa638a4b..cdf51dda20 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -411,9 +411,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Colors
bool dark_theme = EditorSettings::get_singleton()->is_dark_theme();
- const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast);
- const Color dark_color_2 = base_color.lerp(Color(0, 0, 0, 1), contrast * 1.5);
- const Color dark_color_3 = base_color.lerp(Color(0, 0, 0, 1), contrast * 2);
+ // Ensure base colors are in the 0..1 luminance range to avoid 8-bit integer overflow or text rendering issues.
+ // Some places in the editor use 8-bit integer colors.
+ const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast).clamp();
+ const Color dark_color_2 = base_color.lerp(Color(0, 0, 0, 1), contrast * 1.5).clamp();
+ const Color dark_color_3 = base_color.lerp(Color(0, 0, 0, 1), contrast * 2).clamp();
const Color background_color = dark_color_2;
diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp
index 3489ac2c1e..6a63875324 100644
--- a/editor/plugins/sprite_2d_editor_plugin.cpp
+++ b/editor/plugins/sprite_2d_editor_plugin.cpp
@@ -122,8 +122,8 @@ void Sprite2DEditor::_menu_option(int p_option) {
switch (p_option) {
case MENU_OPTION_CONVERT_TO_MESH_2D: {
- debug_uv_dialog->get_ok_button()->set_text(TTR("Create Mesh2D"));
- debug_uv_dialog->set_title(TTR("Mesh2D Preview"));
+ debug_uv_dialog->get_ok_button()->set_text(TTR("Create MeshInstance2D"));
+ debug_uv_dialog->set_title(TTR("MeshInstance2D Preview"));
_update_mesh_data();
debug_uv_dialog->popup_centered();
@@ -338,7 +338,7 @@ void Sprite2DEditor::_convert_to_mesh_2d_node() {
mesh_instance->set_mesh(mesh);
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
- ur->create_action(TTR("Convert to Mesh2D"));
+ ur->create_action(TTR("Convert to MeshInstance2D"));
ur->add_do_method(SceneTreeDock::get_singleton(), "replace_node", node, mesh_instance, true, false);
ur->add_do_reference(mesh_instance);
ur->add_undo_method(SceneTreeDock::get_singleton(), "replace_node", mesh_instance, node, false, false);
@@ -498,6 +498,20 @@ void Sprite2DEditor::_debug_uv_draw() {
}
}
+void Sprite2DEditor::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
+ options->set_icon(get_theme_icon(SNAME("Sprite2D"), SNAME("EditorIcons")));
+
+ options->get_popup()->set_item_icon(MENU_OPTION_CONVERT_TO_MESH_2D, get_theme_icon(SNAME("MeshInstance2D"), SNAME("EditorIcons")));
+ options->get_popup()->set_item_icon(MENU_OPTION_CONVERT_TO_POLYGON_2D, get_theme_icon(SNAME("Polygon2D"), SNAME("EditorIcons")));
+ options->get_popup()->set_item_icon(MENU_OPTION_CREATE_COLLISION_POLY_2D, get_theme_icon(SNAME("CollisionPolygon2D"), SNAME("EditorIcons")));
+ options->get_popup()->set_item_icon(MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D, get_theme_icon(SNAME("LightOccluder2D"), SNAME("EditorIcons")));
+ } break;
+ }
+}
+
void Sprite2DEditor::_bind_methods() {
ClassDB::bind_method("_add_as_sibling_or_child", &Sprite2DEditor::_add_as_sibling_or_child);
}
@@ -508,9 +522,8 @@ Sprite2DEditor::Sprite2DEditor() {
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text(TTR("Sprite2D"));
- options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Sprite2D"), SNAME("EditorIcons")));
- options->get_popup()->add_item(TTR("Convert to Mesh2D"), MENU_OPTION_CONVERT_TO_MESH_2D);
+ options->get_popup()->add_item(TTR("Convert to MeshInstance2D"), MENU_OPTION_CONVERT_TO_MESH_2D);
options->get_popup()->add_item(TTR("Convert to Polygon2D"), MENU_OPTION_CONVERT_TO_POLYGON_2D);
options->get_popup()->add_item(TTR("Create CollisionPolygon2D Sibling"), MENU_OPTION_CREATE_COLLISION_POLY_2D);
options->get_popup()->add_item(TTR("Create LightOccluder2D Sibling"), MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D);
@@ -522,8 +535,6 @@ Sprite2DEditor::Sprite2DEditor() {
add_child(err_dialog);
debug_uv_dialog = memnew(ConfirmationDialog);
- debug_uv_dialog->get_ok_button()->set_text(TTR("Create Mesh2D"));
- debug_uv_dialog->set_title(TTR("Mesh 2D Preview"));
VBoxContainer *vb = memnew(VBoxContainer);
debug_uv_dialog->add_child(vb);
ScrollContainer *scroll = memnew(ScrollContainer);
diff --git a/editor/plugins/sprite_2d_editor_plugin.h b/editor/plugins/sprite_2d_editor_plugin.h
index 3e4cc17cdd..46953b0937 100644
--- a/editor/plugins/sprite_2d_editor_plugin.h
+++ b/editor/plugins/sprite_2d_editor_plugin.h
@@ -87,6 +87,7 @@ class Sprite2DEditor : public Control {
protected:
void _node_removed(Node *p_node);
+ void _notification(int p_what);
static void _bind_methods();
public:
diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
index e2505de3bf..69899cbe8d 100644
--- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
+++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
@@ -45,6 +45,7 @@
D0BCFE3418AEBDA2004A7AAE /* $binary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "$binary.app"; sourceTree = BUILT_PRODUCTS_DIR; };
D0BCFE4318AEBDA2004A7AAE /* $binary-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "$binary-Info.plist"; sourceTree = "<group>"; };
D0BCFE4518AEBDA2004A7AAE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ $pbx_locale_file_reference
D0BCFE7718AEBFEB004A7AAE /* $binary.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = "$binary.pck"; sourceTree = "<group>"; };
$pbx_launch_screen_file_reference
/* End PBXFileReference section */
@@ -207,6 +208,7 @@
isa = PBXVariantGroup;
children = (
D0BCFE4518AEBDA2004A7AAE /* en */,
+ $pbx_locale_build_reference
);
name = InfoPlist.strings;
sourceTree = "<group>";
diff --git a/misc/dist/osx_template.app/Contents/Info.plist b/misc/dist/osx_template.app/Contents/Info.plist
index a087550290..43399ec6ce 100644
--- a/misc/dist/osx_template.app/Contents/Info.plist
+++ b/misc/dist/osx_template.app/Contents/Info.plist
@@ -8,6 +8,8 @@
<string>$binary</string>
<key>CFBundleName</key>
<string>$name</string>
+ <key>CFBundleDisplayName</key>
+ <string>$name</string>
<key>CFBundleGetInfoString</key>
<string>$info</string>
<key>CFBundleIconFile</key>
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 58a788e255..8bf5fd1eda 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -796,7 +796,7 @@ void GDScript::_set_subclass_path(Ref<GDScript> &p_sc, const String &p_path) {
String GDScript::_get_debug_path() const {
if (is_built_in() && !get_name().is_empty()) {
- return get_name() + " (" + get_path().get_slice("::", 0) + ")";
+ return get_name() + " (" + get_path() + ")";
} else {
return get_path();
}
diff --git a/platform/iphone/export/export_plugin.cpp b/platform/iphone/export/export_plugin.cpp
index 69c6df8a38..2eaf5e47ac 100644
--- a/platform/iphone/export/export_plugin.cpp
+++ b/platform/iphone/export/export_plugin.cpp
@@ -389,6 +389,36 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
String value = value_format.format(value_dictionary, "$_");
strnew += lines[i].replace("$launch_screen_background_color", value) + "\n";
+ } else if (lines[i].find("$pbx_locale_file_reference") != -1) {
+ String locale_files;
+ Vector<String> translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations");
+ if (translations.size() > 0) {
+ int index = 0;
+ for (const String &E : translations) {
+ Ref<Translation> tr = ResourceLoader::load(E);
+ if (tr.is_valid()) {
+ String lang = tr->get_locale();
+ locale_files += "D0BCFE4518AEBDA2004A" + itos(index).pad_zeros(4) + " /* " + lang + " */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = " + lang + "; path = " + lang + ".lproj/InfoPlist.strings; sourceTree = \"<group>\"; };";
+ }
+ index++;
+ }
+ }
+ strnew += lines[i].replace("$pbx_locale_file_reference", locale_files);
+ } else if (lines[i].find("$pbx_locale_build_reference") != -1) {
+ String locale_files;
+ Vector<String> translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations");
+ if (translations.size() > 0) {
+ int index = 0;
+ for (const String &E : translations) {
+ Ref<Translation> tr = ResourceLoader::load(E);
+ if (tr.is_valid()) {
+ String lang = tr->get_locale();
+ locale_files += "D0BCFE4518AEBDA2004A" + itos(index).pad_zeros(4) + " /* " + lang + " */,";
+ }
+ index++;
+ }
+ }
+ strnew += lines[i].replace("$pbx_locale_build_reference", locale_files);
} else {
strnew += lines[i] + "\n";
}
@@ -1593,6 +1623,29 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
return ERR_FILE_NOT_FOUND;
}
+ Vector<String> translations = ProjectSettings::get_singleton()->get("internationalization/locale/translations");
+ if (translations.size() > 0) {
+ {
+ String fname = dest_dir + binary_name + "/en.lproj";
+ tmp_app_path->make_dir_recursive(fname);
+ FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE);
+ f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get("application/config/name").operator String() + "\";");
+ }
+
+ for (const String &E : translations) {
+ Ref<Translation> tr = ResourceLoader::load(E);
+ if (tr.is_valid()) {
+ String fname = dest_dir + binary_name + "/" + tr->get_locale() + ".lproj";
+ tmp_app_path->make_dir_recursive(fname);
+ FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE);
+ String prop = "application/config/name_" + tr->get_locale();
+ if (ProjectSettings::get_singleton()->has_setting(prop)) {
+ f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get(prop).operator String() + "\";");
+ }
+ }
+ }
+ }
+
// Copy project static libs to the project
Vector<Ref<EditorExportPlugin>> export_plugins = EditorExport::get_singleton()->get_export_plugins();
for (int i = 0; i < export_plugins.size(); i++) {
diff --git a/platform/osx/export/export_plugin.cpp b/platform/osx/export/export_plugin.cpp
index 24b9bc02a2..4d0fc9add6 100644
--- a/platform/osx/export/export_plugin.cpp
+++ b/platform/osx/export/export_plugin.cpp
@@ -787,6 +787,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
String fname = tmp_app_path_name + "/Contents/Resources/en.lproj";
tmp_app_dir->make_dir_recursive(fname);
FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE);
+ f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get("application/config/name").operator String() + "\";");
}
for (const String &E : translations) {
@@ -795,6 +796,10 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
String fname = tmp_app_path_name + "/Contents/Resources/" + tr->get_locale() + ".lproj";
tmp_app_dir->make_dir_recursive(fname);
FileAccessRef f = FileAccess::open(fname + "/InfoPlist.strings", FileAccess::WRITE);
+ String prop = "application/config/name_" + tr->get_locale();
+ if (ProjectSettings::get_singleton()->has_setting(prop)) {
+ f->store_line("CFBundleDisplayName = \"" + ProjectSettings::get_singleton()->get(prop).operator String() + "\";");
+ }
}
}
}