diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2020-05-20 13:25:46 +0300 |
---|---|---|
committer | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2020-05-25 10:26:00 +0300 |
commit | 01b2fc83188b63c7696bd391055eb2d0517d0019 (patch) | |
tree | 0de389ce801b5893026c51b929e379e3769f2ca1 /doc | |
parent | 90e7a3160e5144b56a5ab04641b78e7985a7e641 (diff) |
Add documentation for controlling custom material properties
Fixes: QT3DS-4111
Change-Id: I880282c44c13f71c2861fe2aa932d0d921fd8a36
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/07-file-formats/custom-materials-effects.qdoc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/src/07-file-formats/custom-materials-effects.qdoc b/doc/src/07-file-formats/custom-materials-effects.qdoc index 6f333580..66f5d8e7 100644 --- a/doc/src/07-file-formats/custom-materials-effects.qdoc +++ b/doc/src/07-file-formats/custom-materials-effects.qdoc @@ -382,4 +382,36 @@ The first option results in \image materials-category-dummy.png and the seconds one results in \image materials-category-several.png + +\section2 Controlling Custom Properties +When some of the properties in custom materials or effects need to be adjusted during run-time, +the \c setAttribute API is required. The usage may differ slightly from normal usage, depending on +the property being controlled, as all of the properties in custom materials and effects are handled +as dynamic properties. +For example, a texture is not handled as an image like it is when controlling it in standard +material. +\section3 Controlling a texture in standard material +\badcode +<presentation id>.setAttribute("<element path to texture>", "sourcepath", "<path to image>"); +\endcode +For example: +\badcode +myPresentation.setAttribute("Scene.Layer.Sphere.Default_animatable.diffusemap", "sourcepath", "../maps/myTexture.png"); +\endcode +\section3 Controlling a texture in a custom material +\badcode +<presentation id>.setAttribute("<element path to material>", "<texture property name>", "<path to image>"); +\endcode +With a material that has a metadata entry as follows: +\badcode +<MetaData > + ... + <Property name="diffuseTexture" type="Texture" category="Material" formalName="Diffuse texture"/> + ... +</MetaData> +\endcode +This is the way to control it: +\badcode +myPresentation.setAttribute("Scene.Layer.Sphere.MyMaterial_animatable", "diffuseTexture", "../maps/myTexture.png"); +\endcode */ |