summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/image.cpp2
-rw-r--r--editor/editor_fonts.cpp2
-rw-r--r--modules/basis_universal/register_types.cpp3
-rw-r--r--modules/csg/csg_shape.cpp4
-rw-r--r--platform/osx/display_server_osx.h2
-rw-r--r--platform/osx/display_server_osx.mm88
-rw-r--r--scene/main/window.cpp2
-rw-r--r--scene/resources/mesh.cpp2
-rw-r--r--scene/resources/mesh_data_tool.cpp28
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp7
-rw-r--r--servers/visual_server.cpp3
11 files changed, 76 insertions, 67 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 2c39c9b882..d691c4f442 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -1680,7 +1680,7 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con
int pixel_ofs = y * w + x;
Color c = _get_color_at_ofs(ptr, pixel_ofs);
- float roughness;
+ float roughness = 0;
switch (p_roughness_channel) {
case ROUGHNESS_CHANNEL_R: {
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index 171b7a2176..8aadf02ea6 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -231,7 +231,7 @@ void editor_register_fonts(Ref<Theme> p_theme) {
// Default font
MAKE_DEFAULT_FONT(df, default_font_size);
- p_theme->set_default_theme_font(df);
+ p_theme->set_font("font", "Node", df); // Default theme font
p_theme->set_font("main", "EditorFonts", df);
// Bold font
diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp
index 062b5b59f8..c29e91b5aa 100644
--- a/modules/basis_universal/register_types.cpp
+++ b/modules/basis_universal/register_types.cpp
@@ -174,7 +174,8 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
//format = basist::transcoder_texture_format::cTFETC1; // get this from renderer
//imgfmt = Image::FORMAT_RGTC_RG;
} else {
- //decompress
+ // FIXME: There wasn't anything here, but then imgformat is used uninitialized.
+ ERR_FAIL_V(image);
}
} break;
case BASIS_DECOMPRESS_RGB: {
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 54635ae320..746c66bdf1 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -741,7 +741,7 @@ CSGBrush *CSGMesh::_build_brush() {
const Vector3 *vr = avertices.ptr();
Vector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL];
- const Vector3 *nr;
+ const Vector3 *nr = NULL;
bool nr_used = false;
if (anormals.size()) {
nr = anormals.ptr();
@@ -749,7 +749,7 @@ CSGBrush *CSGMesh::_build_brush() {
}
Vector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV];
- const Vector2 *uvr;
+ const Vector2 *uvr = NULL;
bool uvr_used = false;
if (auvs.size()) {
uvr = auvs.ptr();
diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h
index d0e2babd06..33f483bd0e 100644
--- a/platform/osx/display_server_osx.h
+++ b/platform/osx/display_server_osx.h
@@ -148,6 +148,7 @@ public:
void _push_input(const Ref<InputEvent> &p_event);
void _process_key_events();
+ void _release_pressed_events();
String rendering_driver;
@@ -165,6 +166,7 @@ public:
bool window_focused;
bool drop_events;
+ bool in_dispatch_input_event = false;
public:
virtual bool has_feature(Feature p_feature) const;
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index a7099c1207..3bdd12ec9d 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -286,8 +286,15 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
DS_OSX->window_set_transient(wd.transient_children.front()->get(), DisplayServerOSX::INVALID_WINDOW_ID);
}
+ DS_OSX->windows.erase(window_id);
+
if (wd.transient_parent != DisplayServerOSX::INVALID_WINDOW_ID) {
+ DisplayServerOSX::WindowData &pwd = DS_OSX->windows[wd.transient_parent];
+ [pwd.window_object makeKeyAndOrderFront:nil]; // Move focus back to parent.
DS_OSX->window_set_transient(window_id, DisplayServerOSX::INVALID_WINDOW_ID);
+ } else if ((window_id != DisplayServerOSX::MAIN_WINDOW_ID) && (DS_OSX->windows.size() == 1)) {
+ DisplayServerOSX::WindowData &pwd = DS_OSX->windows[DisplayServerOSX::MAIN_WINDOW_ID];
+ [pwd.window_object makeKeyAndOrderFront:nil]; // Move focus back to main window if there is no parent or other windows left.
}
#ifdef VULKAN_ENABLED
@@ -295,7 +302,6 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
DS_OSX->context_vulkan->window_destroy(window_id);
}
#endif
- DS_OSX->windows.erase(window_id);
}
- (void)windowDidEnterFullScreen:(NSNotification *)notification {
@@ -414,9 +420,7 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
- (void)windowDidMove:(NSNotification *)notification {
- if (InputFilter::get_singleton()) {
- InputFilter::get_singleton()->release_pressed_events();
- }
+ DS_OSX->_release_pressed_events();
}
- (void)windowDidBecomeKey:(NSNotification *)notification {
@@ -437,7 +441,7 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
DS_OSX->window_focused = false;
- InputFilter::get_singleton()->release_pressed_events();
+ DS_OSX->_release_pressed_events();
DS_OSX->_send_window_event(wd, DisplayServerOSX::WINDOW_EVENT_FOCUS_OUT);
}
@@ -447,7 +451,7 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
DS_OSX->window_focused = false;
- InputFilter::get_singleton()->release_pressed_events();
+ DS_OSX->_release_pressed_events();
DS_OSX->_send_window_event(wd, DisplayServerOSX::WINDOW_EVENT_FOCUS_OUT);
}
@@ -2139,7 +2143,7 @@ Rect2i DisplayServerOSX::screen_get_usable_rect(int p_screen) const {
Point2i position = Point2i(nsrect.origin.x, nsrect.origin.y + nsrect.size.height) * displayScale - _get_screens_origin();
position.y *= -1;
- Size2i size = Size2i(nsrect.size.width, nsrect.size.height) * displayScale;
+ Size2i size = Size2i(nsrect.size.width, nsrect.size.height) / displayScale;
return Rect2i(position, size);
}
@@ -2172,6 +2176,8 @@ DisplayServer::WindowID DisplayServerOSX::create_sub_window(WindowMode p_mode, u
}
void DisplayServerOSX::_send_window_event(const WindowData &wd, WindowEvent p_event) {
+ _THREAD_SAFE_METHOD_
+
if (!wd.event_callback.is_null()) {
Variant event = int(p_event);
Variant *eventp = &event;
@@ -2222,20 +2228,8 @@ void DisplayServerOSX::delete_sub_window(WindowID p_id) {
WindowData &wd = windows[p_id];
- while (wd.transient_children.size()) {
- window_set_transient(wd.transient_children.front()->get(), INVALID_WINDOW_ID);
- }
-
- if (wd.transient_parent != INVALID_WINDOW_ID) {
- WindowData &pwd = windows[wd.transient_parent];
- [pwd.window_object makeKeyAndOrderFront:nil]; // Move focus back to parent.
- window_set_transient(p_id, INVALID_WINDOW_ID);
- }
-
[wd.window_object setContentView:nil];
[wd.window_object close];
-
- windows.erase(p_id);
}
void DisplayServerOSX::window_set_title(const String &p_title, WindowID p_window) {
@@ -3011,6 +3005,13 @@ void DisplayServerOSX::_push_input(const Ref<InputEvent> &p_event) {
InputFilter::get_singleton()->accumulate_input_event(ev);
}
+void DisplayServerOSX::_release_pressed_events() {
+ _THREAD_SAFE_METHOD_
+ if (InputFilter::get_singleton()) {
+ InputFilter::get_singleton()->release_pressed_events();
+ }
+}
+
void DisplayServerOSX::_process_key_events() {
Ref<InputEventKey> k;
for (int i = 0; i < key_event_pos; i++) {
@@ -3337,30 +3338,37 @@ void DisplayServerOSX::_dispatch_input_events(const Ref<InputEvent> &p_event) {
}
void DisplayServerOSX::_dispatch_input_event(const Ref<InputEvent> &p_event) {
- Variant ev = p_event;
- Variant *evp = &ev;
- Variant ret;
- Callable::CallError ce;
-
- Ref<InputEventFromWindow> event_from_window = p_event;
- if (event_from_window.is_valid() && event_from_window->get_window_id() != INVALID_WINDOW_ID) {
- //send to a window
- if (windows.has(event_from_window->get_window_id())) {
- Callable callable = windows[event_from_window->get_window_id()].input_event_callback;
- if (callable.is_null()) {
- return;
+ _THREAD_SAFE_METHOD_
+ if (!in_dispatch_input_event) {
+ in_dispatch_input_event = true;
+
+ Variant ev = p_event;
+ Variant *evp = &ev;
+ Variant ret;
+ Callable::CallError ce;
+
+ Ref<InputEventFromWindow> event_from_window = p_event;
+ if (event_from_window.is_valid() && event_from_window->get_window_id() != INVALID_WINDOW_ID) {
+ //send to a window
+ if (windows.has(event_from_window->get_window_id())) {
+ Callable callable = windows[event_from_window->get_window_id()].input_event_callback;
+ if (callable.is_null()) {
+ return;
+ }
+ callable.call((const Variant **)&evp, 1, ret, ce);
}
- callable.call((const Variant **)&evp, 1, ret, ce);
- }
- } else {
- //send to all windows
- for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
- Callable callable = E->get().input_event_callback;
- if (callable.is_null()) {
- continue;
+ } else {
+ //send to all windows
+ for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
+ Callable callable = E->get().input_event_callback;
+ if (callable.is_null()) {
+ continue;
+ }
+ callable.call((const Variant **)&evp, 1, ret, ce);
}
- callable.call((const Variant **)&evp, 1, ret, ce);
}
+
+ in_dispatch_input_event = false;
}
}
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index a2a49aea75..b22b99c50c 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -1331,7 +1331,7 @@ void Window::_bind_methods() {
ClassDB::bind_method(D_METHOD("popup_on_parent", "parent_rect"), &Window::popup_on_parent);
ClassDB::bind_method(D_METHOD("popup_centered_ratio", "ratio"), &Window::popup_centered_ratio, DEFVAL(0.8));
ClassDB::bind_method(D_METHOD("popup_centered", "minsize"), &Window::popup_centered, DEFVAL(Size2i()));
- ClassDB::bind_method(D_METHOD("popup_centered_clamped", "minsize", "fallback_ratio"), &Window::popup_centered, DEFVAL(Size2i()), DEFVAL(0.75));
+ ClassDB::bind_method(D_METHOD("popup_centered_clamped", "minsize", "fallback_ratio"), &Window::popup_centered_clamped, DEFVAL(Size2i()), DEFVAL(0.75));
ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "position"), "set_position", "get_position");
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index f93b7ced98..9f3433be0f 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -372,7 +372,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>());
{
- int *ir;
+ int *ir = NULL;
Vector<int> indices = arrays[ARRAY_INDEX];
bool has_indices = false;
Vector<Vector3> vertices = arrays[ARRAY_VERTEX];
diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp
index 675cfc6d64..8b7f8288b8 100644
--- a/scene/resources/mesh_data_tool.cpp
+++ b/scene/resources/mesh_data_tool.cpp
@@ -58,30 +58,30 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
const Vector3 *vr = varray.ptr();
- const Vector3 *nr;
+ const Vector3 *nr = NULL;
if (arrays[Mesh::ARRAY_NORMAL].get_type() != Variant::NIL)
nr = arrays[Mesh::ARRAY_NORMAL].operator Vector<Vector3>().ptr();
- const real_t *ta;
+ const real_t *ta = NULL;
if (arrays[Mesh::ARRAY_TANGENT].get_type() != Variant::NIL)
ta = arrays[Mesh::ARRAY_TANGENT].operator Vector<real_t>().ptr();
- const Vector2 *uv;
+ const Vector2 *uv = NULL;
if (arrays[Mesh::ARRAY_TEX_UV].get_type() != Variant::NIL)
uv = arrays[Mesh::ARRAY_TEX_UV].operator Vector<Vector2>().ptr();
- const Vector2 *uv2;
+ const Vector2 *uv2 = NULL;
if (arrays[Mesh::ARRAY_TEX_UV2].get_type() != Variant::NIL)
uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator Vector<Vector2>().ptr();
- const Color *col;
+ const Color *col = NULL;
if (arrays[Mesh::ARRAY_COLOR].get_type() != Variant::NIL)
col = arrays[Mesh::ARRAY_COLOR].operator Vector<Color>().ptr();
- const int *bo;
+ const int *bo = NULL;
if (arrays[Mesh::ARRAY_BONES].get_type() != Variant::NIL)
bo = arrays[Mesh::ARRAY_BONES].operator Vector<int>().ptr();
- const real_t *we;
+ const real_t *we = NULL;
if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL)
we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<real_t>().ptr();
@@ -202,43 +202,43 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) {
v.resize(vcount);
Vector3 *vr = v.ptrw();
- Vector3 *nr;
+ Vector3 *nr = NULL;
if (format & Mesh::ARRAY_FORMAT_NORMAL) {
n.resize(vcount);
nr = n.ptrw();
}
- real_t *ta;
+ real_t *ta = NULL;
if (format & Mesh::ARRAY_FORMAT_TANGENT) {
t.resize(vcount * 4);
ta = t.ptrw();
}
- Vector2 *uv;
+ Vector2 *uv = NULL;
if (format & Mesh::ARRAY_FORMAT_TEX_UV) {
u.resize(vcount);
uv = u.ptrw();
}
- Vector2 *uv2;
+ Vector2 *uv2 = NULL;
if (format & Mesh::ARRAY_FORMAT_TEX_UV2) {
u2.resize(vcount);
uv2 = u2.ptrw();
}
- Color *col;
+ Color *col = NULL;
if (format & Mesh::ARRAY_FORMAT_COLOR) {
c.resize(vcount);
col = c.ptrw();
}
- int *bo;
+ int *bo = NULL;
if (format & Mesh::ARRAY_FORMAT_BONES) {
b.resize(vcount * 4);
bo = b.ptrw();
}
- real_t *we;
+ real_t *we = NULL;
if (format & Mesh::ARRAY_FORMAT_WEIGHTS) {
w.resize(vcount * 4);
we = w.ptrw();
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
index 1bc181bea3..70219a3981 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
@@ -749,7 +749,6 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
RD::get_singleton()->draw_list_bind_uniform_set(draw_list, default_vec4_xform_uniform_set, TRANSFORMS_UNIFORM_SET);
MaterialData *prev_material = nullptr;
- // ShaderData *prev_shader = nullptr;
RID prev_vertex_array_rd;
RID prev_index_array_rd;
@@ -809,12 +808,11 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
}
}
- ShaderVersion shader_version;
+ ShaderVersion shader_version = SHADER_VERSION_MAX; // Assigned to silence wrong -Wmaybe-initialized.
switch (p_pass_mode) {
case PASS_MODE_COLOR:
case PASS_MODE_COLOR_TRANSPARENT: {
-
if (e->uses_lightmap) {
shader_version = SHADER_VERSION_LIGHTMAP_COLOR_PASS;
} else if (e->uses_vct) {
@@ -822,7 +820,6 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
} else {
shader_version = SHADER_VERSION_COLOR_PASS;
}
-
} break;
case PASS_MODE_COLOR_SPECULAR: {
if (e->uses_lightmap) {
@@ -855,7 +852,7 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
pipeline = &shader->pipelines[cull_variant][primitive][shader_version];
- RD::VertexFormatID vertex_format;
+ RD::VertexFormatID vertex_format = -1;
RID vertex_array_rd;
RID index_array_rd;
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 1e4ee5cb50..fecaf563db 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -333,7 +333,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
uint8_t *vw = r_vertex_array.ptrw();
- uint8_t *iw;
+ uint8_t *iw = NULL;
if (r_index_array.size()) {
iw = r_index_array.ptrw();
}
@@ -617,6 +617,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
} break;
case VS::ARRAY_INDEX: {
+ ERR_FAIL_NULL_V(iw, ERR_INVALID_DATA);
ERR_FAIL_COND_V(p_index_array_len <= 0, ERR_INVALID_DATA);
ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_INT32_ARRAY, ERR_INVALID_PARAMETER);