diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-02-19 09:26:13 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2018-02-20 19:15:53 +0000 |
commit | 06df3679cd1acfc7b08068a524353ab8d2c2af6b (patch) | |
tree | cee5cdeee707c1da10f2fac49b89debe198752d4 /tools | |
parent | 638000bc8e52205f475798fbdab3f9a5ca4b4e9d (diff) |
Revise how properties can be set on graph objects
1. Introduce proper setters
The pattern would be
Q3DSPropertyChange setSomething(TYPE newSomethingValue);
which would then allow writing the following, using starttime and
endtime as an example
obj->notifyPropertyChanges({ obj->setStartTime(5000), obj->setEndTime(6000) });
to both set and notify about the change. Pretty convenient.
2. Move the anim setters out of the way
The static, variant-based setters and getters used by the animation
system are moved to their own classes. (Q3DSnnnn -> Q3DSnnnnAnimator)
This makes the Q3DSnnnn classes a lot cleaner and the static stuff can also
be hidden later on, if needed (since they do not need to be public as long
as the friend declaration is there).
3. Custom property getters/setters for CustomMaterialInstance and EffectInstance
This should be self-explanatory:
QVariantMap customProperties() const
QVariant customProperty(const QString &name) const
Q3DSPropertyChange setCustomProperty(const QString &name, const QVariant &value)
Additionally they both get a ctor that takes a Q3DSEffect or Q3DSCustomMaterial.
4. Make a bunch of functions on Q3DSUipPresentation and Q3DSSlide
public. This will not suffice for creating a full scene programatically
with animations and everything, but is a good start, as shown in the new
autotest.
Task-number: QT3DS-1123
Change-Id: I3a96fc8a38e7d483ab802bddf94999c68525b33f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/q3dsviewer/q3dsmainwindow.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/q3dsviewer/q3dsmainwindow.cpp b/tools/q3dsviewer/q3dsmainwindow.cpp index d540071..e4aeddf 100644 --- a/tools/q3dsviewer/q3dsmainwindow.cpp +++ b/tools/q3dsviewer/q3dsmainwindow.cpp @@ -148,8 +148,8 @@ Q3DStudioMainWindow::Q3DStudioMainWindow(Q3DSWindow *view, QWidget *parent) Q3DSPropertyChangeList changeList; const QString value = ssaoAction->isChecked() ? QLatin1String("50") : QLatin1String("0"); changeList.append(Q3DSPropertyChange(QLatin1String("aostrength"), value)); - layer3DS->applyPropertyChanges(&changeList); - layer3DS->notifyPropertyChanges(&changeList); + layer3DS->applyPropertyChanges(changeList); + layer3DS->notifyPropertyChanges(changeList); }); }); QAction *rebuildMatAction = debugMenu->addAction(tr("&Rebuild model materials")); @@ -169,8 +169,8 @@ Q3DStudioMainWindow::Q3DStudioMainWindow(Q3DSWindow *view, QWidget *parent) Q3DSPropertyChangeList changeList; const QString value = light3DS->castShadow() ? QLatin1String("false") : QLatin1String("true"); changeList.append(Q3DSPropertyChange(QLatin1String("castshadow"), value)); - light3DS->applyPropertyChanges(&changeList); - light3DS->notifyPropertyChanges(&changeList); + light3DS->applyPropertyChanges(changeList); + light3DS->notifyPropertyChanges(changeList); } }); }); @@ -183,8 +183,8 @@ Q3DStudioMainWindow::Q3DStudioMainWindow(Q3DSWindow *view, QWidget *parent) Q3DSPropertyChangeList changeList; const QString value = QLatin1String("11"); // 8..11 changeList.append(Q3DSPropertyChange(QLatin1String("shdwmapres"), value)); - light3DS->applyPropertyChanges(&changeList); - light3DS->notifyPropertyChanges(&changeList); + light3DS->applyPropertyChanges(changeList); + light3DS->notifyPropertyChanges(changeList); } }); }); |