summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsuippresentation_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-08-22 11:25:57 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-08-23 17:33:46 +0000
commit87a8a864327da7c64232ab44881310133107d29b (patch)
tree79184da6ecf9b15bd42cb8436bec5d92f1b4e1e9 /src/runtime/q3dsuippresentation_p.h
parent10b0cabebd9f07725191f463e807ea815d68ceb2 (diff)
Make ReferencedMaterial more dynamic
The ill-named ReferencedMaterial lacked quite some of the dynamic property handling, meaning it was not possible to change the referencedmaterial property to a different target material instance. This is now corrected. Therefore, the following console command sequence generates a green sphere, where the Model's child is a ReferencedMaterial that points to a DefaultMaterial living somewhere else, not associated (in the object tree at least) with any model. object(mm,mm,DefaultMaterial,Layer,Slide1) object(kk,kk,Model,Layer,Slide1) set(kk,sourcepath,#Sphere) object(rm,rm,ReferencedMaterial,kk,Slide1) set(rm,referencedmaterial,#mm) set(mm, diffuse, 0 1 0) Note that we continue with the assumption that a ReferencedMaterial cannot reference another ReferencedMaterial, meaning the target is always a default or custom material (or unset). Change-Id: I2cebb9689167f0ecb409d1bf73ee3df2364f3e04 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/runtime/q3dsuippresentation_p.h')
-rw-r--r--src/runtime/q3dsuippresentation_p.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime/q3dsuippresentation_p.h b/src/runtime/q3dsuippresentation_p.h
index adc8191..b6623e9 100644
--- a/src/runtime/q3dsuippresentation_p.h
+++ b/src/runtime/q3dsuippresentation_p.h
@@ -211,7 +211,8 @@ public:
CustomMaterialDirty = 0x1000,
EffectDirty = 0x2000,
AliasDirty = 0x4000,
- BehaviorDirty = 0x8000
+ BehaviorDirty = 0x8000,
+ ReferencedMaterialDirty = 0x10000
};
Q_DECLARE_FLAGS(FrameDirtyFlags, FrameDirtyFlag)
@@ -1763,6 +1764,7 @@ private:
Q3DSImage *m_lightProbe = nullptr;
};
+// this should have been named Q3DSReferencingMaterialInstance or something like that
class Q3DSV_PRIVATE_EXPORT Q3DSReferencedMaterial : public Q3DSGraphObject
{
Q3DS_OBJECT
@@ -1772,11 +1774,16 @@ class Q3DSV_PRIVATE_EXPORT Q3DSReferencedMaterial : public Q3DSGraphObject
Q_PROPERTY(Q3DSImage * lightmapshadow READ lightmapShadowMap WRITE setLightmapShadowMap)
Q_PROPERTY(Q3DSImage * iblprobe READ lightProbe WRITE setLightProbe)
public:
+ enum ReferencedMaterialPropertyChanges {
+ ReferenceChanges = 1 << 0
+ };
+
Q3DSReferencedMaterial();
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
Q3DSGraphObject *referencedMaterial() const { return m_referencedMaterial; }