mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 14:47:19 +02:00
Merge pull request #14739 from SamGondelman/animations
Case 20398: Fix animation URL change
This commit is contained in:
commit
78f0a3feaa
2 changed files with 14 additions and 30 deletions
|
@ -959,23 +959,6 @@ QStringList RenderableModelEntityItem::getJointNames() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
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() {
|
||||
auto model = resultWithReadLock<ModelPointer>([this]{ return _model; });
|
||||
|
||||
|
@ -1493,11 +1476,17 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
if (_animating) {
|
||||
DETAILED_PROFILE_RANGE(simulation_physics, "Animate");
|
||||
|
||||
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;
|
||||
auto animationURL = entity->getAnimationURL();
|
||||
bool animationChanged = _animationURL != animationURL;
|
||||
if (animationChanged) {
|
||||
_animationURL = animationURL;
|
||||
|
||||
if (_animation) {
|
||||
//(_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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_jointMappingCompleted) {
|
||||
|
@ -1562,7 +1551,7 @@ void ModelEntityRenderer::mapJoints(const TypedEntityPointer& entity, const Mode
|
|||
}
|
||||
|
||||
if (!_animation) {
|
||||
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURLAndReset());
|
||||
_animation = DependencyManager::get<AnimationCache>()->getAnimation(_animationURL);
|
||||
}
|
||||
|
||||
if (_animation && _animation->isLoaded()) {
|
||||
|
|
|
@ -113,10 +113,6 @@ public:
|
|||
virtual int getJointIndex(const QString& name) const override;
|
||||
virtual QStringList getJointNames() const override;
|
||||
|
||||
void setAnimationURL(const QString& url) override;
|
||||
bool needsAnimationReset() const;
|
||||
QString getAnimationURLAndReset();
|
||||
|
||||
private:
|
||||
bool needsUpdateModelBounds() const;
|
||||
void autoResizeJointArrays();
|
||||
|
@ -131,7 +127,6 @@ private:
|
|||
bool _originalTexturesRead { false };
|
||||
bool _dimensionsInitialized { true };
|
||||
bool _needsJointSimulation { false };
|
||||
bool _needsAnimationReset { false };
|
||||
};
|
||||
|
||||
namespace render { namespace entities {
|
||||
|
@ -190,12 +185,12 @@ private:
|
|||
|
||||
const void* _collisionMeshKey { nullptr };
|
||||
|
||||
// used on client side
|
||||
QUrl _parsedModelURL;
|
||||
bool _jointMappingCompleted { false };
|
||||
QVector<int> _jointMapping; // domain is index into model-joints, range is index into animation-joints
|
||||
AnimationPointer _animation;
|
||||
QUrl _parsedModelURL;
|
||||
bool _animating { false };
|
||||
QString _animationURL;
|
||||
uint64_t _lastAnimated { 0 };
|
||||
|
||||
render::ItemKey _itemKey { render::ItemKey::Builder().withTypeMeta() };
|
||||
|
|
Loading…
Reference in a new issue