mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 04:44:32 +02:00
Merge pull request #12366 from sethalves/fix-children-of-animated-entity-joints
fix -- get children of animated entity joints to follow along, again
This commit is contained in:
commit
63f752e76f
2 changed files with 13 additions and 4 deletions
|
@ -985,6 +985,7 @@ void RenderableModelEntityItem::copyAnimationJointDataToModel() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool changed { false };
|
||||||
// relay any inbound joint changes from scripts/animation/network to the model/rig
|
// relay any inbound joint changes from scripts/animation/network to the model/rig
|
||||||
_jointDataLock.withWriteLock([&] {
|
_jointDataLock.withWriteLock([&] {
|
||||||
for (int index = 0; index < _localJointData.size(); ++index) {
|
for (int index = 0; index < _localJointData.size(); ++index) {
|
||||||
|
@ -992,13 +993,21 @@ void RenderableModelEntityItem::copyAnimationJointDataToModel() {
|
||||||
if (jointData.rotationDirty) {
|
if (jointData.rotationDirty) {
|
||||||
model->setJointRotation(index, true, jointData.joint.rotation, 1.0f);
|
model->setJointRotation(index, true, jointData.joint.rotation, 1.0f);
|
||||||
jointData.rotationDirty = false;
|
jointData.rotationDirty = false;
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
if (jointData.translationDirty) {
|
if (jointData.translationDirty) {
|
||||||
model->setJointTranslation(index, true, jointData.joint.translation, 1.0f);
|
model->setJointTranslation(index, true, jointData.joint.translation, 1.0f);
|
||||||
jointData.translationDirty = false;
|
jointData.translationDirty = false;
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
forEachChild([&](SpatiallyNestablePointer object) {
|
||||||
|
object->locationChanged(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
|
@ -207,6 +207,10 @@ public:
|
||||||
|
|
||||||
void dump(const QString& prefix = "") const;
|
void dump(const QString& prefix = "") const;
|
||||||
|
|
||||||
|
virtual void locationChanged(bool tellPhysics = true); // called when a this object's location has changed
|
||||||
|
virtual void dimensionsChanged() { _queryAACubeSet = false; } // called when a this object's dimensions have changed
|
||||||
|
virtual void parentDeleted() { } // called on children of a deleted parent
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const NestableType _nestableType; // EntityItem or an AvatarData
|
const NestableType _nestableType; // EntityItem or an AvatarData
|
||||||
QUuid _id;
|
QUuid _id;
|
||||||
|
@ -218,10 +222,6 @@ protected:
|
||||||
mutable ReadWriteLockable _childrenLock;
|
mutable ReadWriteLockable _childrenLock;
|
||||||
mutable QHash<QUuid, SpatiallyNestableWeakPointer> _children;
|
mutable QHash<QUuid, SpatiallyNestableWeakPointer> _children;
|
||||||
|
|
||||||
virtual void locationChanged(bool tellPhysics = true); // called when a this object's location has changed
|
|
||||||
virtual void dimensionsChanged() { _queryAACubeSet = false; } // called when a this object's dimensions have changed
|
|
||||||
virtual void parentDeleted() { } // called on children of a deleted parent
|
|
||||||
|
|
||||||
// _queryAACube is used to decide where something lives in the octree
|
// _queryAACube is used to decide where something lives in the octree
|
||||||
mutable AACube _queryAACube;
|
mutable AACube _queryAACube;
|
||||||
mutable bool _queryAACubeSet { false };
|
mutable bool _queryAACubeSet { false };
|
||||||
|
|
Loading…
Reference in a new issue