more correct needsToCallUpdate() implementations

This commit is contained in:
Andrew Meadows 2018-04-06 16:53:08 -07:00
parent e36dbab838
commit 75508385cf
3 changed files with 29 additions and 42 deletions

View file

@ -26,7 +26,7 @@ public:
ALLOW_INSTANTIATION // This class can be instantiated
void update(const quint64& now) override;
bool needsToCallUpdate() const override { return true; }
bool needsToCallUpdate() const override { return _retryApply; }
// methods for getting/setting all properties of an entity
virtual EntityItemProperties getProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()) const override;

View file

@ -194,10 +194,7 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
// added update function back for property fix
void ModelEntityItem::update(const quint64& now) {
{
auto currentAnimationProperties = this->getAnimationProperties();
if (_previousAnimationProperties != currentAnimationProperties) {
withWriteLock([&] {
// if we hit start animation or change the first or last frame then restart the animation
@ -225,22 +222,15 @@ void ModelEntityItem::update(const quint64& now) {
});
_previousAnimationProperties = this->getAnimationProperties();
}
if (isAnimatingSomething()) {
if (!(getAnimationFirstFrame() < 0) && !(getAnimationFirstFrame() > getAnimationLastFrame())) {
updateFrameCount();
}
}
}
EntityItem::update(now);
}
bool ModelEntityItem::needsToCallUpdate() const {
return true;
return isAnimatingSomething();
}
void ModelEntityItem::updateFrameCount() {
@ -713,7 +703,6 @@ float ModelEntityItem::getAnimationFPS() const {
});
}
bool ModelEntityItem::isAnimatingSomething() const {
return resultWithReadLock<bool>([&] {
return !_animationProperties.getURL().isEmpty() &&

View file

@ -77,8 +77,6 @@ class PolyLineEntityItem : public EntityItem {
QString getTextures() const;
void setTextures(const QString& textures);
virtual bool needsToCallUpdate() const override { return true; }
virtual ShapeType getShapeType() const override { return SHAPE_TYPE_NONE; }
bool pointsChanged() const { return _pointsChanged; }