diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index b510f58b12..19e5ab4683 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -271,10 +271,10 @@ bool RenderableModelEntityItem::getAnimationFrame() { return false; } - if (!hasAnimation() || !_jointMappingCompleted) { + if (!hasRenderAnimation() || !_jointMappingCompleted) { return false; } - AnimationPointer myAnimation = getAnimation(_animationProperties.getURL()); // FIXME: this could be optimized + AnimationPointer myAnimation = getAnimation(getRenderAnimationURL()); // FIXME: this could be optimized if (myAnimation && myAnimation->isLoaded()) { const QVector& frames = myAnimation->getFramesReference(); // NOTE: getFrames() is too heavy @@ -384,7 +384,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) { } if (_model) { - if (hasAnimation()) { + if (hasRenderAnimation()) { if (!jointsMapped()) { QStringList modelJointNames = _model->getJointNames(); mapJoints(modelJointNames); @@ -528,6 +528,9 @@ void RenderableModelEntityItem::update(const quint64& now) { } } + // make a copy of the animation properites + _renderAnimationProperties = _animationProperties; + ModelEntityItem::update(now); } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.h b/libraries/entities-renderer/src/RenderableModelEntityItem.h index 6d40a80950..90aca41f34 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.h +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.h @@ -82,6 +82,11 @@ public: virtual int getJointIndex(const QString& name) const override; virtual QStringList getJointNames() const override; + // These operate on a copy of the renderAnimationProperties, so they can be accessed + // without having the entityTree lock. + bool hasRenderAnimation() const { return !_renderAnimationProperties.getURL().isEmpty(); } + const QString& getRenderAnimationURL() const { return _renderAnimationProperties.getURL(); } + private: QVariantMap parseTexturesToMap(QString textures); void remapTextures(); @@ -97,6 +102,8 @@ private: QVector> _points; bool _dimensionsInitialized = true; + AnimationPropertyGroup _renderAnimationProperties; + render::ItemID _myMetaItem{ render::Item::INVALID_ITEM_ID }; bool _showCollisionHull = false;