mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:47:11 +02:00
make soft attachments cauterized for MyAvatar
This commit is contained in:
parent
5a2e337758
commit
9631864ae2
1 changed files with 8 additions and 5 deletions
|
@ -1044,11 +1044,14 @@ void Avatar::setModelURLFinished(bool success) {
|
||||||
|
|
||||||
|
|
||||||
// create new model, can return an instance of a SoftAttachmentModel rather then Model
|
// create new model, can return an instance of a SoftAttachmentModel rather then Model
|
||||||
static std::shared_ptr<Model> allocateAttachmentModel(bool isSoft, RigPointer rigOverride) {
|
static std::shared_ptr<Model> allocateAttachmentModel(bool isSoft, RigPointer rigOverride, bool isCauterized) {
|
||||||
if (isSoft) {
|
if (isSoft) {
|
||||||
// cast to std::shared_ptr<Model>
|
// cast to std::shared_ptr<Model>
|
||||||
// TODO: re-enable cauterization for the SoftAttachmentModel when this is MyAvatar
|
std::shared_ptr<SoftAttachmentModel> softModel = std::make_shared<SoftAttachmentModel>(std::make_shared<Rig>(), nullptr, rigOverride);
|
||||||
return std::dynamic_pointer_cast<Model>(std::make_shared<SoftAttachmentModel>(std::make_shared<Rig>(), nullptr, rigOverride));
|
if (isCauterized) {
|
||||||
|
softModel->flagAsCauterized();
|
||||||
|
}
|
||||||
|
return std::dynamic_pointer_cast<Model>(softModel);
|
||||||
} else {
|
} else {
|
||||||
return std::make_shared<Model>(std::make_shared<Rig>());
|
return std::make_shared<Model>(std::make_shared<Rig>());
|
||||||
}
|
}
|
||||||
|
@ -1074,12 +1077,12 @@ void Avatar::setAttachmentData(const QVector<AttachmentData>& attachmentData) {
|
||||||
for (int i = 0; i < attachmentData.size(); i++) {
|
for (int i = 0; i < attachmentData.size(); i++) {
|
||||||
if (i == (int)_attachmentModels.size()) {
|
if (i == (int)_attachmentModels.size()) {
|
||||||
// if number of attachments has been increased, we need to allocate a new model
|
// if number of attachments has been increased, we need to allocate a new model
|
||||||
_attachmentModels.push_back(allocateAttachmentModel(attachmentData[i].isSoft, _skeletonModel->getRig()));
|
_attachmentModels.push_back(allocateAttachmentModel(attachmentData[i].isSoft, _skeletonModel->getRig(), isMyAvatar()));
|
||||||
}
|
}
|
||||||
else if (i < oldAttachmentData.size() && oldAttachmentData[i].isSoft != attachmentData[i].isSoft) {
|
else if (i < oldAttachmentData.size() && oldAttachmentData[i].isSoft != attachmentData[i].isSoft) {
|
||||||
// if the attachment has changed type, we need to re-allocate a new one.
|
// if the attachment has changed type, we need to re-allocate a new one.
|
||||||
_attachmentsToRemove.push_back(_attachmentModels[i]);
|
_attachmentsToRemove.push_back(_attachmentModels[i]);
|
||||||
_attachmentModels[i] = allocateAttachmentModel(attachmentData[i].isSoft, _skeletonModel->getRig());
|
_attachmentModels[i] = allocateAttachmentModel(attachmentData[i].isSoft, _skeletonModel->getRig(), isMyAvatar());
|
||||||
}
|
}
|
||||||
_attachmentModels[i]->setURL(attachmentData[i].modelURL);
|
_attachmentModels[i]->setURL(attachmentData[i].modelURL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue