standardize somethingChanged - CR feedback

This commit is contained in:
Brad Hefta-Gaub 2015-10-07 12:27:12 -07:00
parent ef054ffc6d
commit 57cc7adbfe
39 changed files with 93 additions and 103 deletions

View file

@ -46,10 +46,12 @@ bool RenderableModelEntityItem::setProperties(const EntityItemProperties& proper
int RenderableModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int RenderableModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
QString oldModelURL = getModelURL(); QString oldModelURL = getModelURL();
int bytesRead = ModelEntityItem::readEntitySubclassDataFromBuffer(data, bytesLeftToRead, int bytesRead = ModelEntityItem::readEntitySubclassDataFromBuffer(data, bytesLeftToRead,
args, propertyFlags, overwriteLocalData); args, propertyFlags,
overwriteLocalData, somethingChanged);
if (oldModelURL != getModelURL()) { if (oldModelURL != getModelURL()) {
_needsModelReload = true; _needsModelReload = true;
} }

View file

@ -39,7 +39,8 @@ public:
virtual bool setProperties(const EntityItemProperties& properties); virtual bool setProperties(const EntityItemProperties& properties);
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
virtual void somethingChangedNotification() { virtual void somethingChangedNotification() {
// FIX ME: this is overly aggressive. We only really need to simulate() if something about // FIX ME: this is overly aggressive. We only really need to simulate() if something about

View file

@ -61,11 +61,13 @@ bool RenderableZoneEntityItem::setProperties(const EntityItemProperties& propert
int RenderableZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int RenderableZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
changeProperties([&]() { changeProperties([&]() {
bytesRead = ZoneEntityItem::readEntitySubclassDataFromBuffer(data, bytesLeftToRead, bytesRead = ZoneEntityItem::readEntitySubclassDataFromBuffer(data, bytesLeftToRead,
args, propertyFlags, overwriteLocalData); args, propertyFlags,
overwriteLocalData, somethingChanged);
}); });
return bytesRead; return bytesRead;
} }

View file

@ -30,7 +30,8 @@ public:
virtual bool setProperties(const EntityItemProperties& properties); virtual bool setProperties(const EntityItemProperties& properties);
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
virtual void render(RenderArgs* args); virtual void render(RenderArgs* args);
virtual bool contains(const glm::vec3& point) const; virtual bool contains(const glm::vec3& point) const;

View file

@ -212,6 +212,7 @@ bool AnimationPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyF
int bytesRead = 0; int bytesRead = 0;
bool overwriteLocalData = true; bool overwriteLocalData = true;
bool somethingChanged = false;
READ_ENTITY_PROPERTY(PROP_ANIMATION_URL, QString, setURL); READ_ENTITY_PROPERTY(PROP_ANIMATION_URL, QString, setURL);
@ -320,8 +321,6 @@ bool AnimationPropertyGroup::setProperties(const EntityItemProperties& propertie
SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Animation, StartAutomatically, startAutomatically, setStartAutomatically); SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Animation, StartAutomatically, startAutomatically, setStartAutomatically);
} }
_somethingChanged = somethingChanged;
return somethingChanged; return somethingChanged;
} }
@ -375,15 +374,8 @@ void AnimationPropertyGroup::appendSubclassData(OctreePacketData* packetData, En
int AnimationPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int AnimationPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
float fps = _animationLoop ? _animationLoop->getFPS() : getFPS();
bool running = _animationLoop ? _animationLoop->getRunning() : getRunning();
float firstFrame = _animationLoop ? _animationLoop->getFirstFrame() : getFirstFrame();
float lastFrame = _animationLoop ? _animationLoop->getLastFrame() : getLastFrame();
bool loop = _animationLoop ? _animationLoop->getLoop() : getLoop();
bool hold = _animationLoop ? _animationLoop->getHold() : getHold();
bool startAutomatically = _animationLoop ? _animationLoop->getStartAutomatically() : getStartAutomatically();
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;
@ -411,24 +403,5 @@ int AnimationPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char
READ_ENTITY_PROPERTY(PROP_ANIMATION_START_AUTOMATICALLY, bool, setStartAutomatically); READ_ENTITY_PROPERTY(PROP_ANIMATION_START_AUTOMATICALLY, bool, setStartAutomatically);
} }
float newFPS = _animationLoop ? _animationLoop->getFPS() : getFPS();
bool newRunning = _animationLoop ? _animationLoop->getRunning() : getRunning();
float newFirstFrame = _animationLoop ? _animationLoop->getFirstFrame() : getFirstFrame();
float newLastFrame = _animationLoop ? _animationLoop->getLastFrame() : getLastFrame();
bool newLoop = _animationLoop ? _animationLoop->getLoop() : getLoop();
bool newHold = _animationLoop ? _animationLoop->getHold() : getHold();
bool newStartAutomatically = _animationLoop ? _animationLoop->getStartAutomatically() : getStartAutomatically();
// NOTE: we don't check frameIndex because that is assumed to always be changing.
_somethingChanged = newFPS != fps ||
newRunning != running ||
newFirstFrame != firstFrame ||
newLastFrame != lastFrame ||
newLoop != loop ||
newHold != hold ||
newStartAutomatically != startAutomatically;
return bytesRead; return bytesRead;
} }

View file

@ -10,24 +10,6 @@
// //
// FIXME - TODO
// DONE - 1) make EntityItemProperties support old versions of animation properties
// DONE - 2) rename the group animationSettings
// DONE - 3) make sure that setting properties and reading from stream actually set the animationLoop object properly
// 4) test it!
// DONE - a) toybox/windmill
// DONE - b) toybox "put me down" doll
// c) asana bugs about animations
// d) spray paint can (particles)
// e) grenade
//
// DONE - 5) update all scripts
// DONE - 6) remove all remnants of old member variables
// DONE - 7) research and remove animation settings from Particle Effect
// DONE - 8) make sure animations start properly when entering a domain... with previously running animations
// 9) debug running property
//
#ifndef hifi_AnimationPropertyGroup_h #ifndef hifi_AnimationPropertyGroup_h
#define hifi_AnimationPropertyGroup_h #define hifi_AnimationPropertyGroup_h
@ -88,7 +70,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
DEFINE_PROPERTY_REF(PROP_ANIMATION_URL, URL, url, QString); DEFINE_PROPERTY_REF(PROP_ANIMATION_URL, URL, url, QString);
DEFINE_PROPERTY(PROP_ANIMATION_FPS, FPS, fps, float); DEFINE_PROPERTY(PROP_ANIMATION_FPS, FPS, fps, float);

View file

@ -88,6 +88,7 @@ bool AtmospherePropertyGroup::decodeFromEditPacket(EntityPropertyFlags& property
int bytesRead = 0; int bytesRead = 0;
bool overwriteLocalData = true; bool overwriteLocalData = true;
bool somethingChanged = false;
READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_CENTER, glm::vec3, setCenter); READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_CENTER, glm::vec3, setCenter);
READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_INNER_RADIUS, float, setInnerRadius); READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_INNER_RADIUS, float, setInnerRadius);
@ -194,7 +195,8 @@ void AtmospherePropertyGroup::appendSubclassData(OctreePacketData* packetData, E
int AtmospherePropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int AtmospherePropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -87,7 +87,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
DEFINE_PROPERTY_REF(PROP_ATMOSPHERE_CENTER, Center, center, glm::vec3); DEFINE_PROPERTY_REF(PROP_ATMOSPHERE_CENTER, Center, center, glm::vec3);

View file

@ -65,7 +65,8 @@ bool BoxEntityItem::setProperties(const EntityItemProperties& properties) {
int BoxEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int BoxEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -39,7 +39,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
const rgbColor& getColor() const { return _color; } const rgbColor& getColor() const { return _color; }
xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; } xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }

View file

@ -403,6 +403,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
bool overwriteLocalData = true; // assume the new content overwrites our local data bool overwriteLocalData = true; // assume the new content overwrites our local data
quint64 now = usecTimestampNow(); quint64 now = usecTimestampNow();
bool somethingChanged = false;
// _created // _created
{ {
@ -715,7 +716,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
} }
bytesRead += readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, bytesRead += readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
propertyFlags, overwriteLocalData); propertyFlags, overwriteLocalData, somethingChanged);
//////////////////////////////////// ////////////////////////////////////
// WARNING: Do not add stream content here after the subclass. Always add it before the subclass // WARNING: Do not add stream content here after the subclass. Always add it before the subclass

View file

@ -179,8 +179,9 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
{ return 0; } bool& somethingChanged)
{ somethingChanged = false; return 0; }
virtual bool addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, virtual bool addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene,
render::PendingChanges& pendingChanges) { return false; } // by default entity items don't add to scene render::PendingChanges& pendingChanges) { return false; } // by default entity items don't add to scene

View file

@ -42,6 +42,7 @@
if (overwriteLocalData) { \ if (overwriteLocalData) { \
S(fromBuffer); \ S(fromBuffer); \
} \ } \
somethingChanged = true; \
} }
#define SKIP_ENTITY_PROPERTY(P,T) \ #define SKIP_ENTITY_PROPERTY(P,T) \

View file

@ -583,8 +583,6 @@ int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* edi
case PacketType::EntityAdd: case PacketType::EntityAdd:
case PacketType::EntityEdit: { case PacketType::EntityEdit: {
qCDebug(entities) << "EntityTree::processEditPacketData()... EntityAdd/EntityEdit";
quint64 startDecode = 0, endDecode = 0; quint64 startDecode = 0, endDecode = 0;
quint64 startLookup = 0, endLookup = 0; quint64 startLookup = 0, endLookup = 0;
quint64 startUpdate = 0, endUpdate = 0; quint64 startUpdate = 0, endUpdate = 0;

View file

@ -119,7 +119,8 @@ bool LightEntityItem::setProperties(const EntityItemProperties& properties) {
int LightEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int LightEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -41,7 +41,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
const rgbColor& getColor() const { return _color; } const rgbColor& getColor() const { return _color; }
xColor getXColor() const { xColor getXColor() const {

View file

@ -121,7 +121,8 @@ bool LineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
int LineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int LineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;
@ -130,7 +131,6 @@ int LineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
READ_ENTITY_PROPERTY(PROP_LINE_WIDTH, float, setLineWidth); READ_ENTITY_PROPERTY(PROP_LINE_WIDTH, float, setLineWidth);
READ_ENTITY_PROPERTY(PROP_LINE_POINTS, QVector<glm::vec3>, setLinePoints); READ_ENTITY_PROPERTY(PROP_LINE_POINTS, QVector<glm::vec3>, setLinePoints);
return bytesRead; return bytesRead;
} }

View file

@ -39,7 +39,8 @@ class LineEntityItem : public EntityItem {
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
const rgbColor& getColor() const { return _color; } const rgbColor& getColor() const { return _color; }
xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; } xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }

View file

@ -85,10 +85,12 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) {
int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;
bool animationPropertiesChanged = false;
READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor); READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor);
READ_ENTITY_PROPERTY(PROP_MODEL_URL, QString, setModelURL); READ_ENTITY_PROPERTY(PROP_MODEL_URL, QString, setModelURL);
@ -116,7 +118,7 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
// Note: since we've associated our _animationProperties with our _animationLoop, the readEntitySubclassDataFromBuffer() // Note: since we've associated our _animationProperties with our _animationLoop, the readEntitySubclassDataFromBuffer()
// will automatically read into the animation loop // will automatically read into the animation loop
int bytesFromAnimation = _animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, int bytesFromAnimation = _animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
propertyFlags, overwriteLocalData); propertyFlags, overwriteLocalData, animationPropertiesChanged);
bytesRead += bytesFromAnimation; bytesRead += bytesFromAnimation;
dataAt += bytesFromAnimation; dataAt += bytesFromAnimation;
@ -124,8 +126,9 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, updateShapeType); READ_ENTITY_PROPERTY(PROP_SHAPE_TYPE, ShapeType, updateShapeType);
if (_animationProperties.somethingChanged()) { if (animationPropertiesChanged) {
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE; _dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
somethingChanged = true;
} }
return bytesRead; return bytesRead;

View file

@ -42,7 +42,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
virtual void update(const quint64& now); virtual void update(const quint64& now);
virtual bool needsToCallUpdate() const; virtual bool needsToCallUpdate() const;

View file

@ -246,7 +246,8 @@ bool ParticleEffectEntityItem::setProperties(const EntityItemProperties& propert
int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int ParticleEffectEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -40,7 +40,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
virtual void update(const quint64& now); virtual void update(const quint64& now);
virtual bool needsToCallUpdate() const; virtual bool needsToCallUpdate() const;

View file

@ -184,7 +184,9 @@ bool PolyLineEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
int PolyLineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int PolyLineEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
QWriteLocker lock(&_quadReadWriteLock); QWriteLocker lock(&_quadReadWriteLock);
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -39,7 +39,8 @@ class PolyLineEntityItem : public EntityItem {
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
const rgbColor& getColor() const { return _color; } const rgbColor& getColor() const { return _color; }
xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; } xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }

View file

@ -152,7 +152,8 @@ bool PolyVoxEntityItem::setProperties(const EntityItemProperties& properties) {
int PolyVoxEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int PolyVoxEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -39,7 +39,8 @@ class PolyVoxEntityItem : public EntityItem {
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
// never have a ray intersection pick a PolyVoxEntityItem. // never have a ray intersection pick a PolyVoxEntityItem.
virtual bool supportsDetailedRayIntersection() const { return true; } virtual bool supportsDetailedRayIntersection() const { return true; }

View file

@ -81,10 +81,6 @@ public:
/// has changed. This will be called with properties change or when new data is loaded from a stream /// has changed. This will be called with properties change or when new data is loaded from a stream
virtual void somethingChangedNotification() { } virtual void somethingChangedNotification() { }
/// set to true or false after setProperties() and readEntitySubclassDataFromBuffer() if something in the state has changed.
bool somethingChanged() const { return _somethingChanged; }
virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const = 0; virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const = 0;
virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
@ -97,10 +93,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) = 0; EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) = 0;
protected:
bool _somethingChanged = false;
}; };
#endif // hifi_PropertyGroup_h #endif // hifi_PropertyGroup_h

View file

@ -56,6 +56,7 @@ bool SkyboxPropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyFlag
int bytesRead = 0; int bytesRead = 0;
bool overwriteLocalData = true; bool overwriteLocalData = true;
bool somethingChanged = false;
READ_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, xColor, setColor); READ_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, xColor, setColor);
READ_ENTITY_PROPERTY(PROP_SKYBOX_URL, QString, setURL); READ_ENTITY_PROPERTY(PROP_SKYBOX_URL, QString, setURL);
@ -121,7 +122,8 @@ void SkyboxPropertyGroup::appendSubclassData(OctreePacketData* packetData, Encod
int SkyboxPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int SkyboxPropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -67,7 +67,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
glm::vec3 getColorVec3() const { glm::vec3 getColorVec3() const {
const quint8 MAX_COLOR = 255; const quint8 MAX_COLOR = 255;

View file

@ -63,7 +63,8 @@ bool SphereEntityItem::setProperties(const EntityItemProperties& properties) {
int SphereEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int SphereEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -38,7 +38,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
const rgbColor& getColor() const { return _color; } const rgbColor& getColor() const { return _color; }
xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; } xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }

View file

@ -101,6 +101,7 @@ bool StagePropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyFlags
int bytesRead = 0; int bytesRead = 0;
bool overwriteLocalData = true; bool overwriteLocalData = true;
bool somethingChanged = false;
READ_ENTITY_PROPERTY(PROP_STAGE_SUN_MODEL_ENABLED, bool, setSunModelEnabled); READ_ENTITY_PROPERTY(PROP_STAGE_SUN_MODEL_ENABLED, bool, setSunModelEnabled);
READ_ENTITY_PROPERTY(PROP_STAGE_LATITUDE, float, setLatitude); READ_ENTITY_PROPERTY(PROP_STAGE_LATITUDE, float, setLatitude);
@ -206,7 +207,8 @@ void StagePropertyGroup::appendSubclassData(OctreePacketData* packetData, Encode
int StagePropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int StagePropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -67,7 +67,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
static const bool DEFAULT_STAGE_SUN_MODEL_ENABLED; static const bool DEFAULT_STAGE_SUN_MODEL_ENABLED;
static const float DEFAULT_STAGE_LATITUDE; static const float DEFAULT_STAGE_LATITUDE;

View file

@ -84,7 +84,8 @@ bool TextEntityItem::setProperties(const EntityItemProperties& properties) {
int TextEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int TextEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -43,7 +43,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
virtual bool supportsDetailedRayIntersection() const { return true; } virtual bool supportsDetailedRayIntersection() const { return true; }
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,

View file

@ -68,7 +68,8 @@ bool WebEntityItem::setProperties(const EntityItemProperties& properties) {
int WebEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int WebEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;

View file

@ -42,7 +42,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
virtual bool supportsDetailedRayIntersection() const { return true; } virtual bool supportsDetailedRayIntersection() const { return true; }
virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, virtual bool findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction,

View file

@ -129,7 +129,8 @@ bool ZoneEntityItem::setProperties(const EntityItemProperties& properties) {
int ZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, int ZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) { EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged) {
int bytesRead = 0; int bytesRead = 0;
const unsigned char* dataAt = data; const unsigned char* dataAt = data;
@ -139,7 +140,7 @@ int ZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
READ_ENTITY_PROPERTY(PROP_KEYLIGHT_DIRECTION, glm::vec3, setKeyLightDirection); READ_ENTITY_PROPERTY(PROP_KEYLIGHT_DIRECTION, glm::vec3, setKeyLightDirection);
int bytesFromStage = _stageProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, int bytesFromStage = _stageProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
propertyFlags, overwriteLocalData); propertyFlags, overwriteLocalData, somethingChanged);
bytesRead += bytesFromStage; bytesRead += bytesFromStage;
dataAt += bytesFromStage; dataAt += bytesFromStage;
@ -149,13 +150,13 @@ int ZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
READ_ENTITY_PROPERTY(PROP_BACKGROUND_MODE, BackgroundMode, setBackgroundMode); READ_ENTITY_PROPERTY(PROP_BACKGROUND_MODE, BackgroundMode, setBackgroundMode);
int bytesFromAtmosphere = _atmosphereProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, int bytesFromAtmosphere = _atmosphereProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
propertyFlags, overwriteLocalData); propertyFlags, overwriteLocalData, somethingChanged);
bytesRead += bytesFromAtmosphere; bytesRead += bytesFromAtmosphere;
dataAt += bytesFromAtmosphere; dataAt += bytesFromAtmosphere;
int bytesFromSkybox = _skyboxProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, int bytesFromSkybox = _skyboxProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
propertyFlags, overwriteLocalData); propertyFlags, overwriteLocalData, somethingChanged);
bytesRead += bytesFromSkybox; bytesRead += bytesFromSkybox;
dataAt += bytesFromSkybox; dataAt += bytesFromSkybox;

View file

@ -43,7 +43,8 @@ public:
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args, ReadBitstreamToTreeParams& args,
EntityPropertyFlags& propertyFlags, bool overwriteLocalData); EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
bool& somethingChanged);
xColor getKeyLightColor() const { xColor color = { _keyLightColor[RED_INDEX], _keyLightColor[GREEN_INDEX], _keyLightColor[BLUE_INDEX] }; return color; } xColor getKeyLightColor() const { xColor color = { _keyLightColor[RED_INDEX], _keyLightColor[GREEN_INDEX], _keyLightColor[BLUE_INDEX] }; return color; }
void setKeyLightColor(const xColor& value) { void setKeyLightColor(const xColor& value) {