Skip to content

Commit

Permalink
Merge pull request #6479 from cyberbotics/sync-master-0dbce8a5c
Browse files Browse the repository at this point in the history
Merge master into develop
  • Loading branch information
omichel authored Jan 16, 2024
2 parents eaaa8eb + 99b2aba commit cde3545
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/reference/changelog-r2023.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Released on XXX XXth, 2023.
- Enabled the launching of MATLAB desktop from the extern launcher ([#6366](https://github.com/cyberbotics/webots/pull/6366)).
- Improved overlays visible in Overlays menu by adding all the robots in the menu list ([#6297](https://github.com/cyberbotics/webots/pull/6297)).
- Bug fixes
- Avoided crash and provided better warnings when attempting to access PROTO nodes in a wrong way from the supervisor API ([#6473](https://github.com/cyberbotics/webots/pull/6473)).
- Fixed errors loading template PROTO if the system user name, the project path, or the temporary directory path contains the `\` character ([#6288](https://github.com/cyberbotics/webots/pull/6288)).
- Fixed Webots and libController version comparison not to take revisions into account ([#6315](https://github.com/cyberbotics/webots/pull/6315)).
- Fixed translation, rotation and scale displayed in the Position tab of the Node viewer in the scene tree ([#6309](https://github.com/cyberbotics/webots/pull/6309)).
Expand Down
16 changes: 13 additions & 3 deletions src/webots/nodes/utils/WbSupervisorUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,15 @@ WbNode *WbSupervisorUtilities::getProtoParameterNodeInstance(int nodeId, const Q
mRobot->warn(tr("%1: node not found.").arg(functionName));
return NULL;
}
return static_cast<WbBaseNode *>(node)->getFirstFinalizedProtoInstance();
WbBaseNode *proto = static_cast<WbBaseNode *>(node)->getFirstFinalizedProtoInstance();
if (!proto) {
if (node->modelName() != node->nodeModelName())
mRobot->warn(
tr("Cannot get the PROTO instance for node '%1' (derived from '%2').").arg(node->usefulName(), node->nodeModelName()));
else
mRobot->warn(tr("Cannot get the PROTO instance for node '%1'.").arg(node->usefulName()));
}
return proto;
}

void WbSupervisorUtilities::changeSimulationMode(int newMode) {
Expand Down Expand Up @@ -594,15 +602,17 @@ void WbSupervisorUtilities::handleMessage(QDataStream &stream) {
stream >> nodeId;
const QString &stateName = readString(stream);
WbNode *const node = getProtoParameterNodeInstance(nodeId, "wb_supervisor_node_load_state()");
node->reset(stateName);
if (node)
node->reset(stateName);
return;
}
case C_SUPERVISOR_NODE_SAVE_STATE: {
unsigned int nodeId;
stream >> nodeId;
const QString &stateName = readString(stream);
WbNode *const node = getProtoParameterNodeInstance(nodeId, "wb_supervisor_node_save_state()");
node->save(stateName);
if (node)
node->save(stateName);
return;
}
case C_SUPERVISOR_NODE_SET_JOINT_POSITION: {
Expand Down

0 comments on commit cde3545

Please sign in to comment.