From 92352acc572976b39c30fe77cb9dcb83acea4313 Mon Sep 17 00:00:00 2001 From: CoolSpy3 <55305038+CoolSpy3@users.noreply.github.com> Date: Sun, 15 Jun 2025 10:17:57 -0700 Subject: [PATCH 1/4] Fix `wb_speaker_play_sound` Request Message (#6843) * fix speaker_play_sound message * update changelog * changelog clarification --- docs/reference/changelog-r2025.md | 1 + src/controller/c/speaker.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/reference/changelog-r2025.md b/docs/reference/changelog-r2025.md index 8dcb0004235..99dd770f49c 100644 --- a/docs/reference/changelog-r2025.md +++ b/docs/reference/changelog-r2025.md @@ -3,6 +3,7 @@ ## Webots R2025b - Bug Fixes - Fixed a bug preventing the `webots-controller` executable from running on arm-based mac devices ([#6806](https://github.com/cyberbotics/webots/pull/6806)). + - Fixed a bug causing Webots to crash when multiple sounds were used with a [Speaker](speaker.md) node ([#6843](https://github.com/cyberbotics/webots/pull/6843)). ## Webots R2025a Released on January 31st, 2025. diff --git a/src/controller/c/speaker.c b/src/controller/c/speaker.c index cd11ce8e3c6..32e02cd1118 100644 --- a/src/controller/c/speaker.c +++ b/src/controller/c/speaker.c @@ -258,17 +258,17 @@ static void speaker_write_request(WbDevice *d, WbRequest *r) { request_write_char(r, 1); else request_write_char(r, 0); - } - request_write_int32(r, sound->upload_size); - if (sound->upload_size) { - /* Sound data available to stream, send it one time and discard it. - * Webots will cache the data inside the device. - */ - request_write_data(r, sound->upload_data, sound->upload_size); - free(sound->upload_data); - sound->upload_data = NULL; - sound->upload_size = 0; + request_write_int32(r, sound->upload_size); + if (sound->upload_size) { + /* Sound data available to stream, send it one time and discard it. + * Webots will cache the data inside the device. + */ + request_write_data(r, sound->upload_data, sound->upload_size); + free(sound->upload_data); + sound->upload_data = NULL; + sound->upload_size = 0; + } } sound->need_update = false; From 5e8942c0993e49e19b42ef8ebefcc2c346ab7b4a Mon Sep 17 00:00:00 2001 From: CoolSpy3 <55305038+CoolSpy3@users.noreply.github.com> Date: Sun, 15 Jun 2025 22:47:13 -0700 Subject: [PATCH 2/4] Fix Checking of Reload/Reset Selection in WbBuildEditor (#6844) * fix reload button checking in WbBuildEditor popup * update changelog * fix pointer syntax * use const-pointers where applicable --- docs/reference/changelog-r2025.md | 1 + src/webots/editor/WbBuildEditor.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/reference/changelog-r2025.md b/docs/reference/changelog-r2025.md index 99dd770f49c..114982338d7 100644 --- a/docs/reference/changelog-r2025.md +++ b/docs/reference/changelog-r2025.md @@ -4,6 +4,7 @@ - Bug Fixes - Fixed a bug preventing the `webots-controller` executable from running on arm-based mac devices ([#6806](https://github.com/cyberbotics/webots/pull/6806)). - Fixed a bug causing Webots to crash when multiple sounds were used with a [Speaker](speaker.md) node ([#6843](https://github.com/cyberbotics/webots/pull/6843)). + - Fixed a bug causing the "Reload/Reset" buttons in the controller recompilation popup to not work on Windows ([#6844](https://github.com/cyberbotics/webots/pull/6844)). ## Webots R2025a Released on January 31st, 2025. diff --git a/src/webots/editor/WbBuildEditor.cpp b/src/webots/editor/WbBuildEditor.cpp index 51da84d4b93..9bc52adda9d 100644 --- a/src/webots/editor/WbBuildEditor.cpp +++ b/src/webots/editor/WbBuildEditor.cpp @@ -28,6 +28,7 @@ #include "../../../include/controller/c/webots/utils/ansi_codes.h" #include +#include #include #include @@ -268,12 +269,16 @@ void WbBuildEditor::reloadMessageBoxIfNeeded() { if (WbMessageBox::enabled()) { QMessageBox messageBox(QMessageBox::Question, tr("Compilation successful"), tr("Do you want to reset or reload the world?"), QMessageBox::Cancel, this); - messageBox.addButton(tr("Reload"), QMessageBox::AcceptRole); - messageBox.setDefaultButton(messageBox.addButton(tr("Reset"), QMessageBox::AcceptRole)); - const int ret = messageBox.exec(); - if (ret == 0) + const QPushButton *reloadButton = messageBox.addButton(tr("Reload"), QMessageBox::AcceptRole); + QPushButton *resetButton = messageBox.addButton(tr("Reset"), QMessageBox::AcceptRole); + messageBox.setDefaultButton(resetButton); + + messageBox.exec(); + + const QAbstractButton *clickedButton = messageBox.clickedButton(); + if (clickedButton == reloadButton) emit reloadRequested(); - else if (ret == 1) + else if (clickedButton == resetButton) emit resetRequested(); } } else From ee34f4e2d1eb936ccf32e3e2c38f55940374d4c8 Mon Sep 17 00:00:00 2001 From: CoolSpy3 <55305038+CoolSpy3@users.noreply.github.com> Date: Tue, 24 Jun 2025 12:14:50 -0700 Subject: [PATCH 3/4] use QImage::flipped instead of QImage::mirrored in WbWrenTextureOverlay (#6850) --- src/webots/wren/WbWrenTextureOverlay.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/webots/wren/WbWrenTextureOverlay.cpp b/src/webots/wren/WbWrenTextureOverlay.cpp index b8647c2b78a..80aa032dc2c 100644 --- a/src/webots/wren/WbWrenTextureOverlay.cpp +++ b/src/webots/wren/WbWrenTextureOverlay.cpp @@ -272,7 +272,15 @@ WrTexture2d *WbWrenTextureOverlay::createIconTexture(QString filePath) { return imageTexture; QImageReader imageReader(filePath); - QImage image = imageReader.read().mirrored(false, true); // account for inverted Y axis in OpenGL + QImage image = imageReader.read(); + + // account for inverted Y axis in OpenGL +#ifdef _WIN32 // Windows builds against a newer version of Qt, which deprecates `mirrored` + image = image.flipped(Qt::Vertical); +#else + image = image.mirrored(false, true); +#endif + const bool isTranslucent = image.pixelFormat().alphaUsage() == QPixelFormat::UsesAlpha; imageTexture = wr_texture_2d_new(); From ec05c25bbddb4e34b19132828686e63b30004ab0 Mon Sep 17 00:00:00 2001 From: CoolSpy3 <55305038+CoolSpy3@users.noreply.github.com> Date: Wed, 25 Jun 2025 23:00:38 -0700 Subject: [PATCH 4/4] use stdbool instead of boolean.h (#6853) --- .../controllers/contest_manager/boolean.h | 28 ------------------- .../contest_manager/maze_definition.h | 2 +- .../contest_manager/round_manager.c | 2 +- .../contest_manager/texture_generator.c | 2 +- 4 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 projects/samples/contests/ratslife/controllers/contest_manager/boolean.h diff --git a/projects/samples/contests/ratslife/controllers/contest_manager/boolean.h b/projects/samples/contests/ratslife/controllers/contest_manager/boolean.h deleted file mode 100644 index 6959f499ac4..00000000000 --- a/projects/samples/contests/ratslife/controllers/contest_manager/boolean.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 1996-2024 Cyberbotics Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Description: Boolean type - */ - -#ifndef BOOLEAN_H -#define BOOLEAN_H - -#if !defined(bool) && !defined(true) && !defined(false) -typedef enum { false, true } bool; -#endif - -#endif diff --git a/projects/samples/contests/ratslife/controllers/contest_manager/maze_definition.h b/projects/samples/contests/ratslife/controllers/contest_manager/maze_definition.h index bc7ab74ea16..d255852cc7f 100644 --- a/projects/samples/contests/ratslife/controllers/contest_manager/maze_definition.h +++ b/projects/samples/contests/ratslife/controllers/contest_manager/maze_definition.h @@ -21,7 +21,7 @@ #ifndef MAZE_DEFINITION_H #define MAZE_DEFINITION_H -#include "boolean.h" +#include #include "linked_list.h" // enum typedef enum { North, South, East, West, None } Orientation; diff --git a/projects/samples/contests/ratslife/controllers/contest_manager/round_manager.c b/projects/samples/contests/ratslife/controllers/contest_manager/round_manager.c index 62fd710bd7e..ad2ea940b7b 100644 --- a/projects/samples/contests/ratslife/controllers/contest_manager/round_manager.c +++ b/projects/samples/contests/ratslife/controllers/contest_manager/round_manager.c @@ -20,7 +20,7 @@ #include "round_manager.h" -#include "boolean.h" +#include #include "helper.h" #include diff --git a/projects/samples/contests/ratslife/controllers/contest_manager/texture_generator.c b/projects/samples/contests/ratslife/controllers/contest_manager/texture_generator.c index e6c9ad58dbe..f1b9a7f923a 100644 --- a/projects/samples/contests/ratslife/controllers/contest_manager/texture_generator.c +++ b/projects/samples/contests/ratslife/controllers/contest_manager/texture_generator.c @@ -22,7 +22,7 @@ #include #include -#include "boolean.h" +#include #include "helper.h" #include "parameters.h" #include "texture_generator.h"