mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 16:14:01 +02:00
ModelEntityItem: fix for incorrect joint mapping
This could happen when switching the animation url between fbx files with different joint mappings. Only the first one would take effect. This should fix the issue in the demo domain, with the contorted doll model.
This commit is contained in:
parent
205bc1b790
commit
617fda7832
2 changed files with 4 additions and 2 deletions
|
@ -194,7 +194,7 @@ AnimationPointer ModelEntityItem::getAnimation(const QString& url) {
|
|||
|
||||
void ModelEntityItem::mapJoints(const QStringList& modelJointNames) {
|
||||
// if we don't have animation, or we're already joint mapped then bail early
|
||||
if (!hasAnimation() || _jointMappingCompleted) {
|
||||
if (!hasAnimation() || jointsMapped()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,7 @@ void ModelEntityItem::mapJoints(const QStringList& modelJointNames) {
|
|||
_jointMapping[i] = animationJointNames.indexOf(modelJointNames[i]);
|
||||
}
|
||||
_jointMappingCompleted = true;
|
||||
_jointMappingURL = _animationProperties.getURL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
|
||||
void mapJoints(const QStringList& modelJointNames);
|
||||
void getAnimationFrame(bool& newFrame, QVector<glm::quat>& rotationsResult, QVector<glm::vec3>& translationsResult);
|
||||
bool jointsMapped() const { return _jointMappingCompleted; }
|
||||
bool jointsMapped() const { return _jointMappingURL == getAnimationURL() && _jointMappingCompleted; }
|
||||
|
||||
bool getAnimationIsPlaying() const { return _animationLoop.getRunning(); }
|
||||
float getAnimationCurrentFrame() const { return _animationLoop.getCurrentFrame(); }
|
||||
|
@ -146,6 +146,7 @@ protected:
|
|||
// used on client side
|
||||
bool _jointMappingCompleted;
|
||||
QVector<int> _jointMapping;
|
||||
QString _jointMappingURL;
|
||||
|
||||
static AnimationPointer getAnimation(const QString& url);
|
||||
static QMap<QString, AnimationPointer> _loadedAnimations;
|
||||
|
|
Loading…
Reference in a new issue