Skip to content

Commit 8bdee90

Browse files
Benjamin Délèzeomichel
andauthored
Fix mesh bounding object (#6047)
* Fix when object is already in the world * Fix insert * test sources * import order * Update changelog-r2023.md --------- Co-authored-by: Olivier Michel <[email protected]>
1 parent 718dfe0 commit 8bdee90

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

docs/reference/changelog-r2023.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Released on ??
5353
- Fixed unwanted altitude change when reaching a target waypoint in `mavic2pro_patrol.c` ([#5981](https://github.com/cyberbotics/webots/pull/5981)).
5454
- Fixed the extern controller connection to a target Webots instance when a snap one is running ([#6002](https://github.com/cyberbotics/webots/pull/6002)).
5555
- Fixed the double downloading of meshes ([#6034](https://github.com/cyberbotics/webots/pull/6034)).
56+
- Fixed the loading of remote mesh bounding objects ([#6047](https://github.com/cyberbotics/webots/pull/6047)).
5657

5758
## Webots R2023a
5859
Released on November 29th, 2022.

src/webots/nodes/WbFluid.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class WbFluid : public WbMatter {
4747
public slots:
4848
// recursions through solid children with bounding objects for material updates
4949
void propagateBoundingObjectMaterialUpdate(bool onSelection = false) override;
50+
void updateBoundingObject() override;
5051

5152
protected:
5253
// this constructor is reserved for derived classes only
@@ -81,7 +82,6 @@ public slots:
8182

8283
private slots:
8384
void createOdeGeomFromInsertedGroupItem(WbBaseNode *node) override;
84-
void updateBoundingObject() override;
8585
void updateStreamVelocity();
8686
void updateDensity();
8787
void updateViscosity();

src/webots/nodes/WbMatter.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class WbMatter : public WbTransform {
8989
public slots:
9090
// recursions through bounding objects for material updates
9191
virtual void propagateBoundingObjectMaterialUpdate(bool onSelection = false) = 0;
92+
virtual void updateBoundingObject() = 0;
9293

9394
protected:
9495
// Abstract class: constructors are reserved for derived classes only
@@ -179,7 +180,6 @@ protected slots:
179180
static bool cShowMatterCenter;
180181

181182
private slots:
182-
virtual void updateBoundingObject() = 0;
183183
virtual void createOdeGeomFromInsertedGroupItem(WbBaseNode *node) = 0;
184184
void createOdeGeomFromInsertedTransformItem();
185185
void createOdeGeomFromInsertedShapeItem();

src/webots/nodes/WbMesh.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#include "WbField.hpp"
2121
#include "WbGroup.hpp"
2222
#include "WbMFString.hpp"
23+
#include "WbMatter.hpp"
2324
#include "WbNetwork.hpp"
25+
#include "WbNodeUtilities.hpp"
2426
#include "WbResizeManipulator.hpp"
2527
#include "WbTriangleMesh.hpp"
2628
#include "WbUrl.hpp"
@@ -84,6 +86,12 @@ void WbMesh::downloadUpdate() {
8486
WbGroup *group = dynamic_cast<WbGroup *>(const_cast<WbNode *>(ancestor));
8587
if (group)
8688
group->recomputeBoundingSphere();
89+
90+
if (isInBoundingObject()) {
91+
WbMatter *boundingObjectAncestor = WbNodeUtilities::findBoundingObjectAncestor(this);
92+
if (boundingObjectAncestor)
93+
boundingObjectAncestor->updateBoundingObject();
94+
}
8795
}
8896

8997
void WbMesh::preFinalize() {

src/webots/nodes/WbSolid.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ void WbSolid::validateProtoNode() {
259259
}
260260
}
261261

262+
void WbSolid::downloadAssets() {
263+
WbGroup::downloadAssets();
264+
if (boundingObject())
265+
boundingObject()->downloadAssets();
266+
}
267+
262268
void WbSolid::preFinalize() {
263269
mHasNoSolidAncestor = false;
264270

src/webots/nodes/WbSolid.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class WbSolid : public WbMatter {
5454

5555
// reimplemented public functions
5656
int nodeType() const override { return WB_NODE_SOLID; }
57+
void downloadAssets() override;
5758
void createWrenObjects() override;
5859
void preFinalize() override;
5960
void validateProtoNode() override;
@@ -245,6 +246,7 @@ public slots:
245246
void updateGraphicalGlobalCenterOfMass();
246247
void resetPhysicsIfRequired(bool changedFromSupervisor);
247248
virtual void updateChildren();
249+
void updateBoundingObject() override;
248250

249251
protected:
250252
// this constructor is reserved for derived classes only
@@ -459,7 +461,6 @@ private slots:
459461
void updatePhysics();
460462
void updateRadarCrossSection();
461463
void updateRecognitionColors();
462-
void updateBoundingObject() override;
463464
void updateOdeMass();
464465
void applyToOdeMass();
465466
void updateOdeInertiaMatrix();

0 commit comments

Comments
 (0)