summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp2
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp2
-rw-r--r--editor/code_editor.cpp3
-rw-r--r--editor/editor_themes.cpp99
-rw-r--r--editor/script_create_dialog.cpp2
-rw-r--r--modules/svg/image_loader_svg.cpp13
-rw-r--r--platform/osx/detect.py18
-rw-r--r--platform/osx/os_osx.mm26
-rw-r--r--scene/gui/tab_container.cpp16
-rw-r--r--scene/gui/tab_container.h2
10 files changed, 118 insertions, 65 deletions
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 24b89aedc2..5dec6f2fee 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -80,7 +80,7 @@ static String _opstr(SL::Operator p_op) {
static String _mkid(const String &p_id) {
- String id = "m_" + p_id;
+ String id = "m_" + p_id.replace("__", "_dus_");
return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl
}
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index f43943bdff..4e4d896bd7 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -166,7 +166,7 @@ static String _opstr(SL::Operator p_op) {
static String _mkid(const String &p_id) {
- String id = "m_" + p_id;
+ String id = "m_" + p_id.replace("__", "_dus_");
return id.replace("__", "_dus_"); //doubleunderscore is reserved in glsl
}
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 4f684c7bdc..e05ace53da 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -277,7 +277,8 @@ void FindReplaceBar::_replace_all() {
}
text_edit->set_v_scroll(vsval);
- set_error(vformat(TTR("Replaced %d occurrence(s)."), rc));
+ matches_label->add_color_override("font_color", rc > 0 ? get_color("font_color", "Label") : get_color("error_color", "Editor"));
+ matches_label->set_text(vformat(TTR("%d replaced."), rc));
text_edit->call_deferred("connect", "text_changed", this, "_editor_text_changed");
results_count = -1;
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 621f531687..8037045e77 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -89,7 +89,11 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float
// dumb gizmo check
bool is_gizmo = String(editor_icons_names[p_index]).begins_with("Gizmo");
- ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, true, p_convert_color);
+ // Upsample icon generation only if the editor scale isn't an integer multiplier.
+ // Generating upsampled icons is slower, and the benefit is hardly visible
+ // with integer editor scales.
+ const bool upsample = !Math::is_equal_approx(Math::round(p_scale), p_scale);
+ ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, upsample, p_convert_color);
if ((p_scale - (float)((int)p_scale)) > 0.0 || is_gizmo || p_force_filter)
icon->create_from_image(img); // in this case filter really helps
@@ -106,7 +110,15 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float
void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = true, int p_thumb_size = 32, bool p_only_thumbs = false) {
#ifdef SVG_ENABLED
+ // The default icon theme is designed to be used for a dark theme.
+ // This dictionary stores color codes to convert to other colors
+ // for better readability on a light theme.
Dictionary dark_icon_color_dictionary;
+
+ // The names of the icons to never convert, even if one of their colors
+ // are contained in the dictionary above.
+ Set<StringName> exceptions;
+
if (!p_dark_theme) {
// convert color: FROM TO
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e0e0e0", "#5a5a5a"); // common icon color
@@ -172,9 +184,31 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#69ec9a", "#2ce573"); // VS rid
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#79f3e8", "#12d5c3"); // VS object
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#77edb1", "#57e99f"); // VS dict
+
+ exceptions.insert("EditorPivot");
+ exceptions.insert("EditorHandle");
+ exceptions.insert("Editor3DHandle");
+ exceptions.insert("Godot");
+ exceptions.insert("PanoramaSky");
+ exceptions.insert("ProceduralSky");
+ exceptions.insert("EditorControlAnchor");
+ exceptions.insert("DefaultProjectIcon");
+ exceptions.insert("GuiCloseCustomizable");
+ exceptions.insert("GuiGraphNodePort");
+ exceptions.insert("GuiResizer");
+ exceptions.insert("ZoomMore");
+ exceptions.insert("ZoomLess");
+ exceptions.insert("ZoomReset");
+ exceptions.insert("LockViewport");
+ exceptions.insert("GroupViewport");
+ exceptions.insert("StatusError");
+ exceptions.insert("StatusSuccess");
+ exceptions.insert("StatusWarning");
+ exceptions.insert("NodeWarning");
+ exceptions.insert("OverbrightIndicator");
}
- // these ones should be converted even if we are using a dark theme
+ // These ones should be converted even if we are using a dark theme.
const Color error_color = p_theme->get_color("error_color", "Editor");
const Color success_color = p_theme->get_color("success_color", "Editor");
const Color warning_color = p_theme->get_color("warning_color", "Editor");
@@ -182,65 +216,44 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
dark_icon_color_dictionary[Color::html("#45ff8b")] = success_color;
dark_icon_color_dictionary[Color::html("#dbab09")] = warning_color;
- List<String> exceptions;
- exceptions.push_back("EditorPivot");
- exceptions.push_back("EditorHandle");
- exceptions.push_back("Editor3DHandle");
- exceptions.push_back("Godot");
- exceptions.push_back("PanoramaSky");
- exceptions.push_back("ProceduralSky");
- exceptions.push_back("EditorControlAnchor");
- exceptions.push_back("DefaultProjectIcon");
- exceptions.push_back("GuiCloseCustomizable");
- exceptions.push_back("GuiGraphNodePort");
- exceptions.push_back("GuiResizer");
- exceptions.push_back("ZoomMore");
- exceptions.push_back("ZoomLess");
- exceptions.push_back("ZoomReset");
- exceptions.push_back("LockViewport");
- exceptions.push_back("GroupViewport");
- exceptions.push_back("StatusError");
- exceptions.push_back("StatusSuccess");
- exceptions.push_back("StatusWarning");
- exceptions.push_back("NodeWarning");
- exceptions.push_back("OverbrightIndicator");
-
ImageLoaderSVG::set_convert_colors(&dark_icon_color_dictionary);
- // generate icons
- if (!p_only_thumbs)
+ // Generate icons.
+ if (!p_only_thumbs) {
for (int i = 0; i < editor_icons_count; i++) {
- List<String>::Element *is_exception = exceptions.find(editor_icons_names[i]);
- if (is_exception) exceptions.erase(is_exception);
- Ref<ImageTexture> icon = editor_generate_icon(i, !is_exception);
+ const int is_exception = exceptions.has(editor_icons_names[i]);
+ const Ref<ImageTexture> icon = editor_generate_icon(i, !is_exception);
+
p_theme->set_icon(editor_icons_names[i], "EditorIcons", icon);
}
+ }
- // generate thumb files with the given thumb size
- bool force_filter = p_thumb_size != 64 && p_thumb_size != 32; // we don't need filter with original resolution
+ // Generate thumbnail icons with the given thumbnail size.
+ // We don't need filtering when generating at one of the default resolutions.
+ const bool force_filter = p_thumb_size != 64 && p_thumb_size != 32;
if (p_thumb_size >= 64) {
- float scale = (float)p_thumb_size / 64.0 * EDSCALE;
+ const float scale = (float)p_thumb_size / 64.0 * EDSCALE;
for (int i = 0; i < editor_bg_thumbs_count; i++) {
- int index = editor_bg_thumbs_indices[i];
- List<String>::Element *is_exception = exceptions.find(editor_icons_names[index]);
- if (is_exception) exceptions.erase(is_exception);
- Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
+ const int index = editor_bg_thumbs_indices[i];
+ const int is_exception = exceptions.has(editor_icons_names[index]);
+ const Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
+
p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon);
}
} else {
- float scale = (float)p_thumb_size / 32.0 * EDSCALE;
+ const float scale = (float)p_thumb_size / 32.0 * EDSCALE;
for (int i = 0; i < editor_md_thumbs_count; i++) {
- int index = editor_md_thumbs_indices[i];
- List<String>::Element *is_exception = exceptions.find(editor_icons_names[index]);
- if (is_exception) exceptions.erase(is_exception);
- Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
+ const int index = editor_md_thumbs_indices[i];
+ const bool is_exception = exceptions.has(editor_icons_names[index]);
+ const Ref<ImageTexture> icon = editor_generate_icon(index, !p_dark_theme && !is_exception, scale, force_filter);
+
p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon);
}
}
ImageLoaderSVG::set_convert_colors(NULL);
#else
- print_line("SVG support disabled, editor icons won't be rendered.");
+ WARN_PRINT("SVG support disabled, editor icons won't be rendered.");
#endif
}
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 35d5fe5f70..a982724d4c 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -644,7 +644,7 @@ void ScriptCreateDialog::_update_dialog() {
}
if (script_ok) {
- _msg_script_valid(true, TTR("Script is valid."));
+ _msg_script_valid(true, TTR("Script path/name is valid."));
}
// Does script have named classes?
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index 57097aaa06..11ae2f81bf 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -103,15 +103,17 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t
ERR_PRINT("SVG Corrupted");
return ERR_FILE_CORRUPT;
}
- if (convert_colors)
+
+ if (convert_colors) {
_convert_colors(svg_image);
+ }
- float upscale = upsample ? 2.0 : 1.0;
+ const float upscale = upsample ? 2.0 : 1.0;
- int w = (int)(svg_image->width * p_scale * upscale);
+ const int w = (int)(svg_image->width * p_scale * upscale);
ERR_FAIL_COND_V_MSG(w > Image::MAX_WIDTH, ERR_PARAMETER_RANGE_ERROR, vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max width.", rtos(p_scale)));
- int h = (int)(svg_image->height * p_scale * upscale);
+ const int h = (int)(svg_image->height * p_scale * upscale);
ERR_FAIL_COND_V_MSG(h > Image::MAX_HEIGHT, ERR_PARAMETER_RANGE_ERROR, vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max height.", rtos(p_scale)));
PoolVector<uint8_t> dst_image;
@@ -123,8 +125,9 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t
dw.release();
p_image->create(w, h, false, Image::FORMAT_RGBA8, dst_image);
- if (upsample)
+ if (upsample) {
p_image->shrink_x2();
+ }
nsvgDelete(svg_image);
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 7882253e7a..fe839199e8 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -27,6 +27,9 @@ def get_opts():
('MACOS_SDK_PATH', 'Path to the macOS SDK', ''),
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False),
+ BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
+ BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
+ BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False),
]
@@ -122,6 +125,21 @@ def configure(env):
env["CC"] = "clang"
env["LINK"] = "clang++"
+ if env['use_ubsan'] or env['use_asan'] or env['use_tsan']:
+ env.extra_suffix += "s"
+
+ if env['use_ubsan']:
+ env.Append(CCFLAGS=['-fsanitize=undefined'])
+ env.Append(LINKFLAGS=['-fsanitize=undefined'])
+
+ if env['use_asan']:
+ env.Append(CCFLAGS=['-fsanitize=address'])
+ env.Append(LINKFLAGS=['-fsanitize=address'])
+
+ if env['use_tsan']:
+ env.Append(CCFLAGS=['-fsanitize=thread'])
+ env.Append(LINKFLAGS=['-fsanitize=thread'])
+
## Dependencies
if env['builtin_libtheora']:
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 6a214b8669..53fe11b3bb 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -115,6 +115,20 @@ static Vector2 get_mouse_pos(NSPoint locationInWindow, CGFloat backingScaleFacto
return Vector2(mouse_x, mouse_y);
}
+static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) {
+ if ([NSCursor respondsToSelector:selector]) {
+ id object = [NSCursor performSelector:selector];
+ if ([object isKindOfClass:[NSCursor class]]) {
+ return object;
+ }
+ }
+ if (fallback) {
+ // Fallback should be a reasonable default, no need to check.
+ return [NSCursor performSelector:fallback];
+ }
+ return [NSCursor arrowCursor];
+}
+
@interface GodotApplication : NSApplication
@end
@@ -1813,15 +1827,15 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {
case CURSOR_BUSY: [[NSCursor arrowCursor] set]; break;
case CURSOR_DRAG: [[NSCursor closedHandCursor] set]; break;
case CURSOR_CAN_DROP: [[NSCursor openHandCursor] set]; break;
- case CURSOR_FORBIDDEN: [[NSCursor arrowCursor] set]; break;
- case CURSOR_VSIZE: [[NSCursor resizeUpDownCursor] set]; break;
- case CURSOR_HSIZE: [[NSCursor resizeLeftRightCursor] set]; break;
- case CURSOR_BDIAGSIZE: [[NSCursor arrowCursor] set]; break;
- case CURSOR_FDIAGSIZE: [[NSCursor arrowCursor] set]; break;
+ case CURSOR_FORBIDDEN: [[NSCursor operationNotAllowedCursor] set]; break;
+ case CURSOR_VSIZE: [cursorFromSelector(@selector(_windowResizeNorthSouthCursor), @selector(resizeUpDownCursor)) set]; break;
+ case CURSOR_HSIZE: [cursorFromSelector(@selector(_windowResizeEastWestCursor), @selector(resizeLeftRightCursor)) set]; break;
+ case CURSOR_BDIAGSIZE: [cursorFromSelector(@selector(_windowResizeNorthEastSouthWestCursor)) set]; break;
+ case CURSOR_FDIAGSIZE: [cursorFromSelector(@selector(_windowResizeNorthWestSouthEastCursor)) set]; break;
case CURSOR_MOVE: [[NSCursor arrowCursor] set]; break;
case CURSOR_VSPLIT: [[NSCursor resizeUpDownCursor] set]; break;
case CURSOR_HSPLIT: [[NSCursor resizeLeftRightCursor] set]; break;
- case CURSOR_HELP: [[NSCursor arrowCursor] set]; break;
+ case CURSOR_HELP: [cursorFromSelector(@selector(_helpCursor)) set]; break;
default: {
};
}
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index c3ddc41813..b045ff4fe1 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -785,23 +785,25 @@ TabContainer::TabAlign TabContainer::get_tab_align() const {
return align;
}
-void TabContainer::set_tabs_visible(bool p_visibe) {
+void TabContainer::set_tabs_visible(bool p_visible) {
- if (p_visibe == tabs_visible)
+ if (p_visible == tabs_visible)
return;
- tabs_visible = p_visibe;
+ tabs_visible = p_visible;
Vector<Control *> tabs = _get_tabs();
for (int i = 0; i < tabs.size(); i++) {
Control *c = tabs[i];
- if (p_visibe)
+ if (p_visible)
c->set_margin(MARGIN_TOP, _get_top_margin());
else
c->set_margin(MARGIN_TOP, 0);
}
+
update();
+ minimum_size_changed();
}
bool TabContainer::are_tabs_visible() const {
@@ -936,8 +938,10 @@ Size2 TabContainer::get_minimum_size() const {
Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
Ref<Font> font = get_font("font");
- ms.y += MAX(MAX(tab_bg->get_minimum_size().y, tab_fg->get_minimum_size().y), tab_disabled->get_minimum_size().y);
- ms.y += font->get_height();
+ if (tabs_visible) {
+ ms.y += MAX(MAX(tab_bg->get_minimum_size().y, tab_fg->get_minimum_size().y), tab_disabled->get_minimum_size().y);
+ ms.y += font->get_height();
+ }
Ref<StyleBox> sb = get_stylebox("panel");
ms += sb->get_minimum_size();
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index e69c2ae289..c5a9045ca6 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -87,7 +87,7 @@ public:
void set_tab_align(TabAlign p_align);
TabAlign get_tab_align() const;
- void set_tabs_visible(bool p_visibe);
+ void set_tabs_visible(bool p_visible);
bool are_tabs_visible() const;
void set_tab_title(int p_tab, const String &p_title);