mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 09:54:19 +02:00
allow for removal and readdition of an action in one time-slice without asserting
This commit is contained in:
parent
3e88e1f400
commit
c539d9f233
2 changed files with 4 additions and 20 deletions
|
@ -263,22 +263,6 @@ void EntitySimulation::moveSimpleKinematics(const quint64& now) {
|
||||||
|
|
||||||
void EntitySimulation::addAction(EntityActionPointer action) {
|
void EntitySimulation::addAction(EntityActionPointer action) {
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
foreach (EntityActionPointer actionToAdd, _actionsToAdd) {
|
|
||||||
if (actionToAdd->getID() == action->getID()) {
|
|
||||||
qDebug() << "action added to add-list more than once";
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (QUuid actionToRemoveID, _actionsToRemove) {
|
|
||||||
if (actionToRemoveID == action->getID()) {
|
|
||||||
qDebug() << "action added to add-list and remove-list";
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_actionsToAdd += action;
|
_actionsToAdd += action;
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,16 +251,16 @@ void PhysicalEntitySimulation::addAction(EntityActionPointer action) {
|
||||||
void PhysicalEntitySimulation::applyActionChanges() {
|
void PhysicalEntitySimulation::applyActionChanges() {
|
||||||
if (_physicsEngine) {
|
if (_physicsEngine) {
|
||||||
lock();
|
lock();
|
||||||
|
foreach (QUuid actionToRemove, _actionsToRemove) {
|
||||||
|
_physicsEngine->removeAction(actionToRemove);
|
||||||
|
}
|
||||||
|
_actionsToRemove.clear();
|
||||||
foreach (EntityActionPointer actionToAdd, _actionsToAdd) {
|
foreach (EntityActionPointer actionToAdd, _actionsToAdd) {
|
||||||
if (!_actionsToRemove.contains(actionToAdd->getID())) {
|
if (!_actionsToRemove.contains(actionToAdd->getID())) {
|
||||||
_physicsEngine->addAction(actionToAdd);
|
_physicsEngine->addAction(actionToAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_actionsToAdd.clear();
|
_actionsToAdd.clear();
|
||||||
foreach (QUuid actionToRemove, _actionsToRemove) {
|
|
||||||
_physicsEngine->removeAction(actionToRemove);
|
|
||||||
}
|
|
||||||
_actionsToRemove.clear();
|
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue