mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
Bug fix & rename isRelative to relativeFlag
This commit is contained in:
parent
001e4bc952
commit
f1afc9e873
3 changed files with 9 additions and 8 deletions
|
@ -197,7 +197,7 @@ static std::vector<AnimPoseVec> copyAndRetargetFromNetworkAnim(AnimationPointer
|
|||
}
|
||||
|
||||
AnimClip::AnimClip(const QString& id, const QString& url, float startFrame, float endFrame, float timeScale, bool loopFlag, bool mirrorFlag,
|
||||
bool isRelative, const QString& baseURL, float baseFrame) :
|
||||
bool relativeFlag, const QString& baseURL, float baseFrame) :
|
||||
AnimNode(AnimNode::Type::Clip, id),
|
||||
_startFrame(startFrame),
|
||||
_endFrame(endFrame),
|
||||
|
@ -205,12 +205,12 @@ AnimClip::AnimClip(const QString& id, const QString& url, float startFrame, floa
|
|||
_loopFlag(loopFlag),
|
||||
_mirrorFlag(mirrorFlag),
|
||||
_frame(startFrame),
|
||||
_isRelative(isRelative),
|
||||
_relativeFlag(relativeFlag),
|
||||
_baseFrame(baseFrame)
|
||||
{
|
||||
loadURL(url);
|
||||
|
||||
if (isRelative) {
|
||||
if (relativeFlag) {
|
||||
auto animCache = DependencyManager::get<AnimationCache>();
|
||||
_baseNetworkAnim = animCache->getAnimation(baseURL);
|
||||
_baseURL = baseURL;
|
||||
|
@ -234,7 +234,7 @@ const AnimPoseVec& AnimClip::evaluate(const AnimVariantMap& animVars, const Anim
|
|||
_frame = ::accumulateTime(_startFrame, _endFrame, _timeScale, frame, dt, _loopFlag, _id, triggersOut);
|
||||
|
||||
// poll network anim to see if it's finished loading yet.
|
||||
if (_isRelative) {
|
||||
if (!_relativeFlag) {
|
||||
if (_networkAnim && _networkAnim->isLoaded() && _skeleton) {
|
||||
// loading is complete, copy & retarget animation.
|
||||
_anim = copyAndRetargetFromNetworkAnim(_networkAnim, _skeleton);
|
||||
|
@ -256,6 +256,7 @@ const AnimPoseVec& AnimClip::evaluate(const AnimVariantMap& animVars, const Anim
|
|||
_networkAnim.reset();
|
||||
|
||||
// mirrorAnim will be re-built on demand, if needed.
|
||||
// TODO: handle mirrored relative animations.
|
||||
_mirrorAnim.clear();
|
||||
|
||||
_poses.resize(_skeleton->getNumJoints());
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
friend class AnimTests;
|
||||
|
||||
AnimClip(const QString& id, const QString& url, float startFrame, float endFrame, float timeScale, bool loopFlag, bool mirrorFlag,
|
||||
bool isRelative, const QString& baseURL, float baseFrame);
|
||||
bool relativeFlag, const QString& baseURL, float baseFrame);
|
||||
virtual ~AnimClip() override;
|
||||
|
||||
virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) override;
|
||||
|
@ -80,7 +80,7 @@ protected:
|
|||
bool _loopFlag;
|
||||
bool _mirrorFlag;
|
||||
float _frame;
|
||||
bool _isRelative;
|
||||
bool _relativeFlag;
|
||||
QString _baseURL;
|
||||
float _baseFrame;
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ static AnimNode::Pointer loadClipNode(const QJsonObject& jsonObj, const QString&
|
|||
READ_FLOAT(timeScale, jsonObj, id, jsonUrl, nullptr);
|
||||
READ_BOOL(loopFlag, jsonObj, id, jsonUrl, nullptr);
|
||||
READ_OPTIONAL_BOOL(mirrorFlag, jsonObj, false);
|
||||
READ_OPTIONAL_BOOL(isRelative, jsonObj, false);
|
||||
READ_OPTIONAL_BOOL(relativeFlag, jsonObj, false);
|
||||
READ_OPTIONAL_STRING(baseURL, jsonObj);
|
||||
READ_OPTIONAL_FLOAT(baseFrame, jsonObj, 0.0f);
|
||||
|
||||
|
@ -389,7 +389,7 @@ static AnimNode::Pointer loadClipNode(const QJsonObject& jsonObj, const QString&
|
|||
auto tempUrl = QUrl(url);
|
||||
tempUrl = jsonUrl.resolved(tempUrl);
|
||||
|
||||
auto node = std::make_shared<AnimClip>(id, tempUrl.toString(), startFrame, endFrame, timeScale, loopFlag, mirrorFlag, isRelative, baseURL, baseFrame);
|
||||
auto node = std::make_shared<AnimClip>(id, tempUrl.toString(), startFrame, endFrame, timeScale, loopFlag, mirrorFlag, relativeFlag, baseURL, baseFrame);
|
||||
|
||||
if (!startFrameVar.isEmpty()) {
|
||||
node->setStartFrameVar(startFrameVar);
|
||||
|
|
Loading…
Reference in a new issue