Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set/reset the world modified flag and 'DEF' fields #6686

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix source code test
MNikoliCC committed Oct 25, 2024
commit 73742f30c2166597bbd0653d12893a54a9ee7607
5 changes: 2 additions & 3 deletions src/webots/nodes/utils/WbWorld.cpp
Original file line number Diff line number Diff line change
@@ -225,9 +225,8 @@ bool WbWorld::needSaving() const {
}

void WbWorld::setModifiedFromSceneTree() {
if (!mIsModifiedFromSceneTree) {
mIsModifiedFromSceneTree = true;
}
mIsModifiedFromSceneTree = true;
s
if (isModifiedFromSceneTreeRestarted) {
mIsModifiedFromSceneTree = false;
isModifiedFromSceneTreeRestarted = false;
11 changes: 6 additions & 5 deletions src/webots/scene_tree/WbNodeEditor.cpp
Original file line number Diff line number Diff line change
@@ -224,7 +224,6 @@ void WbNodeEditor::apply() {
QString newDef = mDefEdit->text();
const QString &previousDef = mNode->defName();

QString initialDef = mInitialCurrentDefMap.value(mNode).first; // Access the first QString (initial DEF)
mInitialCurrentDefMap[mNode].second = newDef;

bool hasStarted = state->hasStarted();
@@ -351,13 +350,15 @@ void WbNodeEditor::switchInitialCurrentDef() {

// Iterate through the map and switch the initial DEF to the current one
for (auto it = mInitialCurrentDefMap.begin(); it != mInitialCurrentDefMap.end(); ++it) {
WbNode *node = it.key();
const WbNode *node = it.key();
QString &initialDef = it.value().first; // Reference to initial DEF name
const QString &currentDef = node->defName(); // Get the current DEF name of the node

// Switch the initial DEF to the current DEF
if (node && initialDef != currentDef)
initialDef = currentDef; // Update the initial DEF with the current one
if (node) {
const QString &currentDef = node->defName(); // Get the current DEF name of the node
if (initialDef != currentDef)
initialDef = currentDef; // Update the initial DEF with the current one
}
}

update();