mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
don't use string comparison when polling for changed animation URL
This commit is contained in:
parent
0c61779331
commit
da0d70af3f
2 changed files with 19 additions and 2 deletions
|
@ -976,7 +976,20 @@ QStringList RenderableModelEntityItem::getJointNames() const {
|
|||
}
|
||||
|
||||
void RenderableModelEntityItem::setAnimationURL(const QString& url) {
|
||||
QString oldURL = getAnimationURL();
|
||||
ModelEntityItem::setAnimationURL(url);
|
||||
if (oldURL != getAnimationURL()) {
|
||||
_needsAnimationReset = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool RenderableModelEntityItem::needsAnimationReset() const {
|
||||
return _needsAnimationReset;
|
||||
}
|
||||
|
||||
QString RenderableModelEntityItem::getAnimationURLAndReset() {
|
||||
_needsAnimationReset = false;
|
||||
return getAnimationURL();
|
||||
}
|
||||
|
||||
scriptable::ScriptableModelBase render::entities::ModelEntityRenderer::getScriptableModel() {
|
||||
|
@ -1477,7 +1490,8 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
if (_animating) {
|
||||
DETAILED_PROFILE_RANGE(simulation_physics, "Animate");
|
||||
|
||||
if (_animation && (_animation->getURL().toString() != entity->getAnimationURL())) { // bad check
|
||||
if (_animation && entity->needsAnimationReset()) {
|
||||
//(_animation->getURL().toString() != entity->getAnimationURL())) { // bad check
|
||||
// the joints have been mapped before but we have a new animation to load
|
||||
_animation.reset();
|
||||
_jointMappingCompleted = false;
|
||||
|
@ -1527,7 +1541,7 @@ void ModelEntityRenderer::mapJoints(const TypedEntityPointer& entity, const Mode
|
|||
}
|
||||
|
||||
if (!_animation) {
|
||||
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURL());
|
||||
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURLAndReset());
|
||||
}
|
||||
|
||||
if (_animation && _animation->isLoaded()) {
|
||||
|
|
|
@ -115,6 +115,8 @@ public:
|
|||
virtual QStringList getJointNames() const override;
|
||||
|
||||
void setAnimationURL(const QString& url) override;
|
||||
bool needsAnimationReset() const;
|
||||
QString getAnimationURLAndReset();
|
||||
|
||||
private:
|
||||
bool needsUpdateModelBounds() const;
|
||||
|
@ -130,6 +132,7 @@ private:
|
|||
bool _originalTexturesRead { false };
|
||||
bool _dimensionsInitialized { true };
|
||||
bool _needsJointSimulation { false };
|
||||
bool _needsAnimationReset { false };
|
||||
};
|
||||
|
||||
namespace render { namespace entities {
|
||||
|
|
Loading…
Reference in a new issue