Cleaned up the code a bit so that there is no need for a new class variable for properties to verify the change of url

This commit is contained in:
amantley 2018-01-18 12:09:28 -08:00
parent 9f484a7f57
commit 1c97272767
2 changed files with 7 additions and 12 deletions

View file

@ -1394,18 +1394,14 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
// That is where _currentFrame and _lastAnimated were updated.
if (_animating) {
DETAILED_PROFILE_RANGE(simulation_physics, "Animate");
// 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()) {
mapJoints(entity, model->getJointNames());
}
if (!jointsMapped() || _animation->getURL().toString() != entity->getAnimationURL()) {
qCDebug(entitiesrenderer) << "changed animation or started animation";
//else the joints have been mapped before but we have new animation to load
else if (_animation && (_animation->getURL().toString() != entity->getAnimationURL())) {
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURL());
_jointMappingCompleted = false;
mapJoints(entity, model->getJointNames());
}
if (!(entity->getAnimationFirstFrame() < 0) && !(entity->getAnimationFirstFrame() > entity->getAnimationLastFrame())) {

View file

@ -192,7 +192,6 @@ private:
bool _shouldHighlight { false };
bool _animating { false };
uint64_t _lastAnimated { 0 };
AnimationPropertyGroup _previousAnimationProperties;
render::ItemKey _itemKey { render::ItemKey::Builder().withTypeMeta() };
};