keep removed attachment models around for one extra call to fixupModelsInScene

This commit is contained in:
Seth Alves 2016-03-09 14:35:14 -08:00
parent 3145069a10
commit d95d0f59cb
2 changed files with 4 additions and 0 deletions

View file

@ -540,6 +540,7 @@ glm::quat Avatar::computeRotationFromBodyToWorldUp(float proportion) const {
}
void Avatar::fixupModelsInScene() {
_attachmentsToDelete.clear();
// check to see if when we added our models to the scene they were ready, if they were not ready, then
// fix them up in the scene
@ -560,9 +561,11 @@ void Avatar::fixupModelsInScene() {
attachmentModel->addToScene(scene, pendingChanges);
}
}
for (auto& attachmentModelToRemove : _attachmentsToRemove) {
attachmentModelToRemove->removeFromScene(scene, pendingChanges);
}
_attachmentsToDelete.insert(_attachmentsToDelete.end(), _attachmentsToRemove.begin(), _attachmentsToRemove.end());
_attachmentsToRemove.clear();
scene->enqueuePendingChanges(pendingChanges);
}

View file

@ -193,6 +193,7 @@ protected:
glm::vec3 _skeletonOffset;
std::vector<std::shared_ptr<Model>> _attachmentModels;
std::vector<std::shared_ptr<Model>> _attachmentsToRemove;
std::vector<std::shared_ptr<Model>> _attachmentsToDelete;
float _bodyYawDelta; // degrees/sec