summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsuippresentation_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-08-02 14:34:01 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-08-02 14:03:25 +0000
commit6830a0cf89b0b7b6c99f8a1ae36cf19075e1a28e (patch)
tree16d6c8c75d74a2a8fd33ef1fd4a166d577e080fb /src/runtime/q3dsuippresentation_p.h
parent7be61a7ae84d277019c2456c316efa8a35383c37 (diff)
Add support for changing the custom material source on the fly
Like with effects, the 'class' property can now be changed at run time, and can also refer to a file (in addition to a #id from the .uip's Classes section) Note that constructing materials on the fly needs to be done so that the active scene's tree is consistent at any time. For example, to replace a model's material, the model has to first be unparented from the scene's object tree (and so be disconnected from the scene) because having a model without the sufficient number of materials is not allowed. Once the child object (the material) is replaced (and, for custom materials, the class property was set), the model can be parented back to where it was. When just changing the class property on a CustomMaterial, this is not needed of course, the change is picked up right away. Change-Id: I086154023513d13a4a298aeac7e0e247951a6e09 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/runtime/q3dsuippresentation_p.h')
-rw-r--r--src/runtime/q3dsuippresentation_p.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/q3dsuippresentation_p.h b/src/runtime/q3dsuippresentation_p.h
index d931e17..448884b 100644
--- a/src/runtime/q3dsuippresentation_p.h
+++ b/src/runtime/q3dsuippresentation_p.h
@@ -1796,18 +1796,23 @@ private:
class Q3DSV_PRIVATE_EXPORT Q3DSCustomMaterialInstance : public Q3DSGraphObject
{
Q3DS_OBJECT
- Q_PROPERTY(QString class READ sourcePath)
+ Q_PROPERTY(QString class READ sourcePath WRITE setSourcePath)
Q_PROPERTY(Q3DSImage * lightmapindirect READ lightmapIndirectMap WRITE setLightmapIndirectMap)
Q_PROPERTY(Q3DSImage * lightmapradiosity READ lightmapRadiosityMap WRITE setLightmapRadiosityMap)
Q_PROPERTY(Q3DSImage * lightmapshadow READ lightmapShadowMap WRITE setLightmapShadowMap)
Q_PROPERTY(Q3DSImage * iblprobe READ lightProbe WRITE setLightProbe)
public:
+ enum CustomMaterialPropertyChanges {
+ SourceChanges = 1 << 0
+ };
+
Q3DSCustomMaterialInstance();
Q3DSCustomMaterialInstance(const Q3DSCustomMaterial &material);
void setProperties(const QXmlStreamAttributes &attrs, PropSetFlags flags) override;
void applyPropertyChanges(const Q3DSPropertyChangeList &changeList) override;
void resolveReferences(Q3DSUipPresentation &pres) override;
+ int mapChangeFlags(const Q3DSPropertyChangeList &changeList) override;
// Properties
QString sourcePath() const { return m_material_unresolved; }
@@ -1818,6 +1823,7 @@ public:
// IBL override
Q3DSImage *lightProbe() const { return m_lightProbe; }
+ Q3DSPropertyChange setSourcePath(const QString &v);
Q3DSPropertyChange setLightmapIndirectMap(Q3DSImage *v);
Q3DSPropertyChange setLightmapRadiosityMap(Q3DSImage *v);
Q3DSPropertyChange setLightmapShadowMap(Q3DSImage *v);