summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2019-01-16 16:44:02 +0100
committerChristian Stromme <christian.stromme@qt.io>2019-01-16 16:08:26 +0000
commit8e8cbe86c045a68e7db457dfe2913e1c2d2668c4 (patch)
treeea6fb74e18261c7f54301de5d6d9b357d6a64f3a
parent4af66e46efed6630ccc202c1e47dec6f3926d38c (diff)
Don't reset the eyeball value when there's no need to change it
Resetting the eyeball value on a light, regardless if it needed to be changed or not, would cause unnecessary updates of the materials and severely impact the start-up time and/or slide changes. Change-Id: I33f3eb19764e784ccfb9e3104db45b0f5bdadd43 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/runtime/slideplayerng/q3dsslideplayerng.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/runtime/slideplayerng/q3dsslideplayerng.cpp b/src/runtime/slideplayerng/q3dsslideplayerng.cpp
index 293701d..5de56f2 100644
--- a/src/runtime/slideplayerng/q3dsslideplayerng.cpp
+++ b/src/runtime/slideplayerng/q3dsslideplayerng.cpp
@@ -769,7 +769,7 @@ void Q3DSSlidePlayerNg::processPropertyChanges(Q3DSSlide *currentSlide)
// 1. Eyeball set to true on master and false on slideX -> eyeball updated by prop change for slideX
// 2. Eyeball set to false on master and false on slideX -> eyeball update by prop change for slideX
// 3. Eyeball set to false on master and true on slideX -> eyeball was update by reset
- // 4. Eyeball set to true on master and true on slideX -> eyeball was update by reset
+ // 4. Eyeball set to true on master and true on slideX -> noop
if (currentSlide->parent()) {
Q3DSSlide *parent = static_cast<Q3DSSlide *>(currentSlide->parent());
const auto &objects = parent->objects();
@@ -780,8 +780,16 @@ void Q3DSSlidePlayerNg::processPropertyChanges(Q3DSSlide *currentSlide)
if (!object->isNode() && object->type() != Q3DSGraphObject::Effect)
return false;
- object->applyPropertyChanges(Q3DSPropertyChangeList{Q3DSPropertyChange::fromVariant(QString::fromLatin1("eyeball"), QVariant::fromValue(true))});
- object->notifyPropertyChanges(Q3DSPropertyChangeList{Q3DSPropertyChange::fromVariant(QString::fromLatin1("eyeball"), QVariant::fromValue(true))});
+ bool resetEyeball = false;
+ if (object->isNode() && !static_cast<Q3DSNode *>(object)->eyeballEnabled())
+ resetEyeball = true;
+ else if (object->type() == Q3DSGraphObject::Effect && !static_cast<Q3DSEffectInstance *>(object)->eyeballEnabled())
+ resetEyeball = true;
+
+ if (resetEyeball) {
+ object->applyPropertyChanges(Q3DSPropertyChangeList{Q3DSPropertyChange::fromVariant(QString::fromLatin1("eyeball"), QVariant::fromValue(true))});
+ object->notifyPropertyChanges(Q3DSPropertyChangeList{Q3DSPropertyChange::fromVariant(QString::fromLatin1("eyeball"), QVariant::fromValue(true))});
+ }
return false;
});