mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:30:39 +02:00
Merge pull request #12827 from AndrewMeadows/lhf-needsToCallUpdate
Workload: low hanging fruit optimization: don't unneccessarily update() entities
This commit is contained in:
commit
476b75488c
6 changed files with 39 additions and 47 deletions
|
@ -110,6 +110,7 @@ bool SelectionScriptingInterface::enableListHighlight(const QString& listName, c
|
|||
}
|
||||
|
||||
if (!(*highlightStyle).isBoundToList()) {
|
||||
enableListToScene(listName);
|
||||
(*highlightStyle).setBoundToList(true);
|
||||
}
|
||||
|
||||
|
@ -133,6 +134,7 @@ bool SelectionScriptingInterface::disableListHighlight(const QString& listName)
|
|||
auto highlightStyle = _highlightStyleMap.find(listName);
|
||||
if (highlightStyle != _highlightStyleMap.end()) {
|
||||
if ((*highlightStyle).isBoundToList()) {
|
||||
disableListToScene(listName);
|
||||
}
|
||||
|
||||
_highlightStyleMap.erase(highlightStyle);
|
||||
|
|
|
@ -165,6 +165,8 @@ public:
|
|||
* @param listName {string} name of the selection
|
||||
* @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.
|
||||
*
|
||||
* Note: This function will implicitly call Selection.enableListToScene
|
||||
*/
|
||||
Q_INVOKABLE bool enableListHighlight(const QString& listName, const QVariantMap& highlightStyle);
|
||||
|
||||
|
@ -175,6 +177,8 @@ public:
|
|||
* @function Selection.disableListHighlight
|
||||
* @param listName {string} name of the selection
|
||||
* @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);
|
||||
/**jsdoc
|
||||
|
|
|
@ -69,7 +69,6 @@ private:
|
|||
graphics::SkyboxPointer editSkybox() { return editBackground()->getSkybox(); }
|
||||
graphics::HazePointer editHaze() { _needHazeUpdate = true; return _haze; }
|
||||
|
||||
bool _needsInitialSimulation{ true };
|
||||
glm::vec3 _lastPosition;
|
||||
glm::vec3 _lastDimensions;
|
||||
glm::quat _lastRotation;
|
||||
|
|
|
@ -195,10 +195,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
|
||||
|
@ -226,22 +223,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() {
|
||||
|
@ -714,7 +704,6 @@ float ModelEntityItem::getAnimationFPS() const {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
bool ModelEntityItem::isAnimatingSomething() const {
|
||||
return resultWithReadLock<bool>([&] {
|
||||
return !_animationProperties.getURL().isEmpty() &&
|
||||
|
|
|
@ -78,8 +78,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; }
|
||||
|
|
|
@ -157,7 +157,7 @@
|
|||
})
|
||||
|
||||
function cleanup() {
|
||||
Pointers.removePointer(ray);
|
||||
Pointers.removePointer(laser);
|
||||
Selection.disableListHighlight(HoveringList)
|
||||
Selection.removeListFromMap(HoveringList)
|
||||
|
||||
|
|
Loading…
Reference in a new issue