mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
Merge pull request #7300 from sethalves/fix-detach-crash
fix removing attachments
This commit is contained in:
commit
82ca78b37b
2 changed files with 4 additions and 0 deletions
|
@ -540,6 +540,7 @@ glm::quat Avatar::computeRotationFromBodyToWorldUp(float proportion) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::fixupModelsInScene() {
|
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
|
// 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
|
// fix them up in the scene
|
||||||
|
@ -560,9 +561,11 @@ void Avatar::fixupModelsInScene() {
|
||||||
attachmentModel->addToScene(scene, pendingChanges);
|
attachmentModel->addToScene(scene, pendingChanges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& attachmentModelToRemove : _attachmentsToRemove) {
|
for (auto& attachmentModelToRemove : _attachmentsToRemove) {
|
||||||
attachmentModelToRemove->removeFromScene(scene, pendingChanges);
|
attachmentModelToRemove->removeFromScene(scene, pendingChanges);
|
||||||
}
|
}
|
||||||
|
_attachmentsToDelete.insert(_attachmentsToDelete.end(), _attachmentsToRemove.begin(), _attachmentsToRemove.end());
|
||||||
_attachmentsToRemove.clear();
|
_attachmentsToRemove.clear();
|
||||||
scene->enqueuePendingChanges(pendingChanges);
|
scene->enqueuePendingChanges(pendingChanges);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,7 @@ protected:
|
||||||
glm::vec3 _skeletonOffset;
|
glm::vec3 _skeletonOffset;
|
||||||
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
||||||
std::vector<std::shared_ptr<Model>> _attachmentsToRemove;
|
std::vector<std::shared_ptr<Model>> _attachmentsToRemove;
|
||||||
|
std::vector<std::shared_ptr<Model>> _attachmentsToDelete;
|
||||||
|
|
||||||
float _bodyYawDelta; // degrees/sec
|
float _bodyYawDelta; // degrees/sec
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue