mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
trying another solution
This commit is contained in:
parent
bed2ea052d
commit
4c0a173287
1 changed files with 14 additions and 4 deletions
|
@ -65,7 +65,7 @@ public:
|
|||
|
||||
|
||||
EntityTree::EntityTree(bool shouldReaverage) :
|
||||
Octree(shouldReaverage), _needsParentFixupLock(QReadWriteLock::Recursive)
|
||||
Octree(shouldReaverage)
|
||||
{
|
||||
resetClientEditStats();
|
||||
|
||||
|
@ -1682,10 +1682,14 @@ void EntityTree::entityChanged(EntityItemPointer entity) {
|
|||
void EntityTree::fixupNeedsParentFixups() {
|
||||
PROFILE_RANGE(simulation_physics, "FixupParents");
|
||||
MovingEntitiesOperator moveOperator;
|
||||
QVector<EntityItemWeakPointer> entitiesToFixup;
|
||||
{
|
||||
QWriteLocker locker(&_needsParentFixupLock);
|
||||
entitiesToFixup = _needsParentFixup;
|
||||
_needsParentFixup.clear();
|
||||
}
|
||||
|
||||
QWriteLocker locker(&_needsParentFixupLock);
|
||||
|
||||
QMutableVectorIterator<EntityItemWeakPointer> iter(_needsParentFixup);
|
||||
QMutableVectorIterator<EntityItemWeakPointer> iter(entitiesToFixup);
|
||||
while (iter.hasNext()) {
|
||||
EntityItemWeakPointer entityWP = iter.next();
|
||||
EntityItemPointer entity = entityWP.lock();
|
||||
|
@ -1748,6 +1752,12 @@ void EntityTree::fixupNeedsParentFixups() {
|
|||
PerformanceTimer perfTimer("recurseTreeWithOperator");
|
||||
recurseTreeWithOperator(&moveOperator);
|
||||
}
|
||||
|
||||
{
|
||||
QWriteLocker locker(&_needsParentFixupLock);
|
||||
// add back the entities that did not get fixup
|
||||
_needsParentFixup.append(entitiesToFixup);
|
||||
}
|
||||
}
|
||||
|
||||
void EntityTree::deleteDescendantsOfAvatar(QUuid avatarID) {
|
||||
|
|
Loading…
Reference in a new issue