added a property check in renderableModelEntity for the animation url this fixes the bug stopping you from changing animations on an entity

This commit is contained in:
amantley 2018-01-17 19:25:20 -08:00
parent fda4cf10b9
commit 4eb2a5cf5e
2 changed files with 16 additions and 1 deletions

View file

@ -1394,7 +1394,19 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
// That is where _currentFrame and _lastAnimated were updated.
if (_animating) {
DETAILED_PROFILE_RANGE(simulation_physics, "Animate");
if (!jointsMapped()) {
// check animation url change
auto newprops = entity->getAnimationProperties();
if (newprops != _previousAnimationProperties) {
if (newprops.getURL() != _previousAnimationProperties.getURL()) {
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURL());
_jointMappingCompleted = false;
mapJoints(entity, model->getJointNames());
}
_previousAnimationProperties = newprops;
}
//
if (!jointsMapped() || _animation->getURL().toString() != entity->getAnimationURL()) {
qCDebug(entitiesrenderer) << "changed animation or started animation";
mapJoints(entity, model->getJointNames());
}
if (!(entity->getAnimationFirstFrame() < 0) && !(entity->getAnimationFirstFrame() > entity->getAnimationLastFrame())) {

View file

@ -193,6 +193,9 @@ private:
bool _animating { false };
uint64_t _lastAnimated { 0 };
//fix test
AnimationPropertyGroup _previousAnimationProperties;
render::ItemKey _itemKey { render::ItemKey::Builder().withTypeMeta() };
};