Merge branch 'workload' of https://github.com/highfidelity/hifi into workload

This commit is contained in:
samcake 2018-04-06 17:42:45 -07:00
commit 49977d7fc3
6 changed files with 39 additions and 47 deletions

View file

@ -110,6 +110,7 @@ bool SelectionScriptingInterface::enableListHighlight(const QString& listName, c
} }
if (!(*highlightStyle).isBoundToList()) { if (!(*highlightStyle).isBoundToList()) {
enableListToScene(listName);
(*highlightStyle).setBoundToList(true); (*highlightStyle).setBoundToList(true);
} }
@ -133,6 +134,7 @@ bool SelectionScriptingInterface::disableListHighlight(const QString& listName)
auto highlightStyle = _highlightStyleMap.find(listName); auto highlightStyle = _highlightStyleMap.find(listName);
if (highlightStyle != _highlightStyleMap.end()) { if (highlightStyle != _highlightStyleMap.end()) {
if ((*highlightStyle).isBoundToList()) { if ((*highlightStyle).isBoundToList()) {
disableListToScene(listName);
} }
_highlightStyleMap.erase(highlightStyle); _highlightStyleMap.erase(highlightStyle);
@ -476,4 +478,4 @@ QVariantMap SelectionHighlightStyle::toVariantMap() const {
properties["isOutlineSmooth"] = _style._isOutlineSmooth; properties["isOutlineSmooth"] = _style._isOutlineSmooth;
return properties; return properties;
} }

View file

@ -165,6 +165,8 @@ public:
* @param listName {string} name of the selection * @param listName {string} name of the selection
* @param highlightStyle {jsObject} highlight style fields (see Selection.getListHighlightStyle for a detailed description of the highlightStyle). * @param highlightStyle {jsObject} highlight style fields (see Selection.getListHighlightStyle for a detailed description of the highlightStyle).
* @returns {bool} true if the selection was successfully enabled for highlight. * @returns {bool} true if the selection was successfully enabled for highlight.
*
* Note: This function will implicitly call Selection.enableListToScene
*/ */
Q_INVOKABLE bool enableListHighlight(const QString& listName, const QVariantMap& highlightStyle); Q_INVOKABLE bool enableListHighlight(const QString& listName, const QVariantMap& highlightStyle);
@ -175,8 +177,10 @@ public:
* @function Selection.disableListHighlight * @function Selection.disableListHighlight
* @param listName {string} name of the selection * @param listName {string} name of the selection
* @returns {bool} true if the selection was successfully disabled for highlight, false otherwise. * @returns {bool} true if the selection was successfully disabled for highlight, false otherwise.
*
* Note: This function will implicitly call Selection.disableListToScene
*/ */
Q_INVOKABLE bool disableListHighlight(const QString& listName); Q_INVOKABLE bool disableListHighlight(const QString& listName);
/**jsdoc /**jsdoc
* Enable scene selection for the named selection. * Enable scene selection for the named selection.
* If the Selection doesn't exist, it will be created. * If the Selection doesn't exist, it will be created.
@ -246,7 +250,7 @@ private:
void setupHandler(const QString& selectionName); void setupHandler(const QString& selectionName);
void removeHandler(const QString& selectionName); void removeHandler(const QString& selectionName);
}; };
#endif // hifi_SelectionScriptingInterface_h #endif // hifi_SelectionScriptingInterface_h

View file

@ -69,7 +69,6 @@ private:
graphics::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); } graphics::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); }
graphics::HazePointer editHaze() { _needHazeUpdate = true; return _haze; } graphics::HazePointer editHaze() { _needHazeUpdate = true; return _haze; }
bool _needsInitialSimulation{ true };
glm::vec3 _lastPosition; glm::vec3 _lastPosition;
glm::vec3 _lastDimensions; glm::vec3 _lastDimensions;
glm::quat _lastRotation; glm::quat _lastRotation;

View file

@ -195,53 +195,43 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
// added update function back for property fix // added update function back for property fix
void ModelEntityItem::update(const quint64& now) { 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
if ((currentAnimationProperties.getFirstFrame() != _previousAnimationProperties.getFirstFrame()) ||
(currentAnimationProperties.getLastFrame() != _previousAnimationProperties.getLastFrame()) ||
(currentAnimationProperties.getRunning() && !_previousAnimationProperties.getRunning())) {
{ // when we start interface and the property is are set then the current frame is initialized to -1
auto currentAnimationProperties = this->getAnimationProperties(); if (_currentFrame < 0) {
// don't reset _lastAnimated here because we need the timestamp from the ModelEntityItem constructor for when the properties were set
if (_previousAnimationProperties != currentAnimationProperties) {
withWriteLock([&] {
// if we hit start animation or change the first or last frame then restart the animation
if ((currentAnimationProperties.getFirstFrame() != _previousAnimationProperties.getFirstFrame()) ||
(currentAnimationProperties.getLastFrame() != _previousAnimationProperties.getLastFrame()) ||
(currentAnimationProperties.getRunning() && !_previousAnimationProperties.getRunning())) {
// when we start interface and the property is are set then the current frame is initialized to -1
if (_currentFrame < 0) {
// don't reset _lastAnimated here because we need the timestamp from the ModelEntityItem constructor for when the properties were set
_currentFrame = currentAnimationProperties.getCurrentFrame();
setAnimationCurrentFrame(_currentFrame);
} else {
_lastAnimated = usecTimestampNow();
_currentFrame = currentAnimationProperties.getFirstFrame();
setAnimationCurrentFrame(currentAnimationProperties.getFirstFrame());
}
} else if (!currentAnimationProperties.getRunning() && _previousAnimationProperties.getRunning()) {
_currentFrame = currentAnimationProperties.getFirstFrame();
setAnimationCurrentFrame(_currentFrame);
} else if (currentAnimationProperties.getCurrentFrame() != _previousAnimationProperties.getCurrentFrame()) {
// don't reset _lastAnimated here because the currentFrame was set with the previous setting of _lastAnimated
_currentFrame = currentAnimationProperties.getCurrentFrame(); _currentFrame = currentAnimationProperties.getCurrentFrame();
setAnimationCurrentFrame(_currentFrame);
} else {
_lastAnimated = usecTimestampNow();
_currentFrame = currentAnimationProperties.getFirstFrame();
setAnimationCurrentFrame(currentAnimationProperties.getFirstFrame());
} }
} else if (!currentAnimationProperties.getRunning() && _previousAnimationProperties.getRunning()) {
}); _currentFrame = currentAnimationProperties.getFirstFrame();
_previousAnimationProperties = this->getAnimationProperties(); setAnimationCurrentFrame(_currentFrame);
} else if (currentAnimationProperties.getCurrentFrame() != _previousAnimationProperties.getCurrentFrame()) {
} // don't reset _lastAnimated here because the currentFrame was set with the previous setting of _lastAnimated
_currentFrame = currentAnimationProperties.getCurrentFrame();
if (isAnimatingSomething()) {
if (!(getAnimationFirstFrame() < 0) && !(getAnimationFirstFrame() > getAnimationLastFrame())) {
updateFrameCount();
} }
}
}
});
_previousAnimationProperties = this->getAnimationProperties();
}
if (!(getAnimationFirstFrame() < 0) && !(getAnimationFirstFrame() > getAnimationLastFrame())) {
updateFrameCount();
}
EntityItem::update(now); EntityItem::update(now);
} }
bool ModelEntityItem::needsToCallUpdate() const { bool ModelEntityItem::needsToCallUpdate() const {
return isAnimatingSomething();
return true;
} }
void ModelEntityItem::updateFrameCount() { void ModelEntityItem::updateFrameCount() {
@ -714,11 +704,10 @@ float ModelEntityItem::getAnimationFPS() const {
}); });
} }
bool ModelEntityItem::isAnimatingSomething() const { bool ModelEntityItem::isAnimatingSomething() const {
return resultWithReadLock<bool>([&] { return resultWithReadLock<bool>([&] {
return !_animationProperties.getURL().isEmpty() && return !_animationProperties.getURL().isEmpty() &&
_animationProperties.getRunning() && _animationProperties.getRunning() &&
(_animationProperties.getFPS() != 0.0f); (_animationProperties.getFPS() != 0.0f);
}); });
} }

View file

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

View file

@ -157,7 +157,7 @@
}) })
function cleanup() { function cleanup() {
Pointers.removePointer(ray); Pointers.removePointer(laser);
Selection.disableListHighlight(HoveringList) Selection.disableListHighlight(HoveringList)
Selection.removeListFromMap(HoveringList) Selection.removeListFromMap(HoveringList)