mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 21:35:04 +02:00
Merge pull request #6653 from hyperlogic/tony/model-entity-animation-fix
ModelEntityItem: fix for incorrect joint mapping
This commit is contained in:
commit
5a355bd22f
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) {
|
void ModelEntityItem::mapJoints(const QStringList& modelJointNames) {
|
||||||
// if we don't have animation, or we're already joint mapped then bail early
|
// if we don't have animation, or we're already joint mapped then bail early
|
||||||
if (!hasAnimation() || _jointMappingCompleted) {
|
if (!hasAnimation() || jointsMapped()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +208,7 @@ void ModelEntityItem::mapJoints(const QStringList& modelJointNames) {
|
||||||
_jointMapping[i] = animationJointNames.indexOf(modelJointNames[i]);
|
_jointMapping[i] = animationJointNames.indexOf(modelJointNames[i]);
|
||||||
}
|
}
|
||||||
_jointMappingCompleted = true;
|
_jointMappingCompleted = true;
|
||||||
|
_jointMappingURL = _animationProperties.getURL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public:
|
||||||
|
|
||||||
void mapJoints(const QStringList& modelJointNames);
|
void mapJoints(const QStringList& modelJointNames);
|
||||||
void getAnimationFrame(bool& newFrame, QVector<glm::quat>& rotationsResult, QVector<glm::vec3>& translationsResult);
|
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(); }
|
bool getAnimationIsPlaying() const { return _animationLoop.getRunning(); }
|
||||||
float getAnimationCurrentFrame() const { return _animationLoop.getCurrentFrame(); }
|
float getAnimationCurrentFrame() const { return _animationLoop.getCurrentFrame(); }
|
||||||
|
@ -146,6 +146,7 @@ protected:
|
||||||
// used on client side
|
// used on client side
|
||||||
bool _jointMappingCompleted;
|
bool _jointMappingCompleted;
|
||||||
QVector<int> _jointMapping;
|
QVector<int> _jointMapping;
|
||||||
|
QString _jointMappingURL;
|
||||||
|
|
||||||
static AnimationPointer getAnimation(const QString& url);
|
static AnimationPointer getAnimation(const QString& url);
|
||||||
static QMap<QString, AnimationPointer> _loadedAnimations;
|
static QMap<QString, AnimationPointer> _loadedAnimations;
|
||||||
|
|
Loading…
Reference in a new issue