Quellcode durchsuchen

Added more info about component and material properties

Björn Ritzl vor 5 Jahren
Ursprung
Commit
c31e8763c7

+ 52 - 1
docs/en/manuals/model.md

@@ -9,7 +9,7 @@ Defold is at its core a 3D engine. Even when you work with 2D material only all
 
 ## Creating a model
 
-Let's look at an example. We have created a simple model with an armature (skeleton) and a simple animation in _Blender_. 
+Let's look at an example. We have created a simple model with an armature (skeleton) and a simple animation in _Blender_.
 
 Blender is a powerful and popular 3D modeling, animation and rendering program. It runs on Windows, Mac OS X and Linux and is freely available for download at http://www.blender.org
 
@@ -36,6 +36,10 @@ Model components are created just like any other game object component. You can
 
 With the model created you need to specify a number of properties:
 
+### Model properties
+
+Apart from the properties *Id*, *Position* and *Rotation* the following component specific properties exist:
+
 *Mesh*
 : This property should refer to the Collada *.dae* file that contains the mesh to use. If the file contains multiple meshes, only the first one is read.
 
@@ -54,9 +58,56 @@ With the model created you need to specify a number of properties:
 *Default Animation*
 : This is the animation (from the animation set) that will be automatically played on the model.
 
+## Editor manipulation
 
 With the model component in place you are free to edit and manipulate the component and/or the encapsulating game object with the regular *Scene Editor* tools to move, rotate and scale the model to your liking.
 
 ![Wiggler ingame](images/model/ingame.png){srcset="images/model/[email protected] 2x"}
 
+## Runtime manipulation
+
+You can manipulate models in runtime through a number of different functions and properties (refer to the [API docs for usage](/ref/model/)).
+
+### Runtime animation
+
+Defold provides powerful support for controlling animation in runtime:
+
+```lua
+local play_properties = { blend_duration = 0.1 }
+spine.play_anim("#model", "jump", go.PLAYBACK_ONCE_FORWARD, play_properties)
+```
+
+The animation playback cursor can be animated either by hand or through the property animation system:
+
+```lua
+-- set the run animation
+model.play_anim("#model", "run", go.PLAYBACK_NONE)
+-- animate the cursor
+go.animate("#model", "cursor", go.PLAYBACK_LOOP_PINGPONG, 1, go.EASING_LINEAR, 10)
+```
+
+### Changing properties
+
+A model also has a number of different properties that can be manipulated using `go.get()` and `go.set()`:
+
+`animation`
+: The current model animation (`hash`) (READ ONLY). You change animation using `model.play_anim()` (see above).
+
+`cursor`
+: The normalized animation cursor (`number`).
+
+`material`
+: The model material (`hash`). You can change this using a material resource property and `go.set()`. Refer to the [API reference for an example](/ref/model/#material).
+
+`playback_rate`
+: The animation playback rate (`number`).
+
+`textureN`
+: The model textures where N is 0-7 (`hash`). You can change this using a texture resource property and `go.set()`. Refer to the [API reference for an example](/ref/model/#textureN).
+
+## Material constants
+
+The default model material has the following constants that can be changed using `model.set_constant()` and reset using `model.reset_constant()` (refer to the [Material manual for more details](/manuals/material/#vertex-and-fragment-constants)):
 
+`tint`
+: The color tint of the model (`vector4`). The vector4 is used to represent the tint with x, y, z, and w corresponding to the red, green, blue and alpha tint. Refer to the [API reference for an example](/ref/model/#model.set_constant:url-constant-value).

+ 7 - 0
docs/en/manuals/particlefx.md

@@ -227,3 +227,10 @@ particlefx.stop("#particles")
 A particle effect will continue to emit particles even if the game object the particle effect component belonged to is deleted.
 :::
 See the [Particle FX reference documentation](/ref/particlefx) for more information.
+
+## Material constants
+
+The default particle effect material has the following constants that can be changed using `particlefx.set_constant()` and reset using `particlefx.reset_constant()` (refer to the [Material manual for more details](/manuals/material/#vertex-and-fragment-constants)):
+
+`tint`
+: The color tint of the particle effect (`vector4`). The vector4 is used to represent the tint with x, y, z, and w corresponding to the red, green, blue and alpha tint. Refer to the [API reference for an example](/ref/particlefx/#particlefx.set_constant:url-constant-value).

+ 39 - 8
docs/en/manuals/spinemodel.md

@@ -15,28 +15,34 @@ Either create the component in-place (<kbd>right click</kbd> the game object and
 
 Or create it on file first (<kbd>right click</kbd> a location in the *Assets* browser, then select <kbd>New... ▸ Spine Model</kbd> from the context menu), then add the file to the game object by <kbd>right clicking</kbd> the game object and selecting <kbd>Add Component File</kbd>).
 
-Set the *Properties* on the component:
+## Spine model properties
 
-Spine scene
+Apart from the properties *Id*, *Position* and *Rotation* the following component specific properties exist:
+
+*Spine scene*
 : Set this to the Spine scene file you created earlier.
 
-Blend Mode
+*Blend Mode*
 : If you want a blend mode other than the default `Alpha`, change this property.
 
-Material
+*Material*
 : If you need to render the model with a custom material, change this property.
 
-Default animation
+*Default animation*
 : Set this to the animation you want the model to start with.
 
-Skin
+*Skin*
 : If your model has skins, select the one you want it to start with.
 
 You should now be able to view your Spine model in the editor:
 
 ![Spine model in editor](images/spinemodel/spinemodel.png){srcset="images/spinemodel/[email protected] 2x"}
 
-## Runtime animation
+## Runtime manipulation
+
+You can manipulate spine models in runtime through a number of different functions and properties (refer to the [API docs for usage](/ref/spine/)).
+
+### Runtime animation
 
 Defold provides powerful support for controlling animation in runtime:
 
@@ -45,7 +51,7 @@ local play_properties = { blend_duration = 0.1 }
 spine.play_anim("#spinemodel", "jump", go.PLAYBACK_ONCE_FORWARD, play_properties)
 ```
 
-The animation playback cursor can be animated either by hand or throught the property animation system:
+The animation playback cursor can be animated either by hand or through the property animation system:
 
 ```lua
 -- set the run animation
@@ -54,3 +60,28 @@ spine.play_anim("#spinemodel", "run", go.PLAYBACK_NONE)
 go.animate("#spinemodel", "cursor", go.PLAYBACK_LOOP_PINGPONG, 1, go.EASING_LINEAR, 10)
 ```
 
+### Changing properties
+
+A spine model also has a number of different properties that can be manipulated using `go.get()` and `go.set()`:
+
+`animation`
+: The current model animation (`hash`) (READ ONLY). You change animation using `spine.play_anim()` (see above).
+
+`cursor`
+: The normalized animation cursor (`number`).
+
+`material`
+: The spine model material (`hash`). You can change this using a material resource property and `go.set()`. Refer to the [API reference for an example](/ref/spine/#material).
+
+`playback_rate`
+: The animation playback rate (`number`).
+
+`skin`
+: The current skin on the component (`hash`).
+
+## Material constants
+
+The default spine material has the following constants that can be changed using `spine.set_constant()` and reset using `spine.reset_constant()` (refer to the [Material manual for more details](/manuals/material/#vertex-and-fragment-constants)):
+
+`tint`
+: The color tint of the spine model (`vector4`). The vector4 is used to represent the tint with x, y, z, and w corresponding to the red, green, blue and alpha tint. Refer to the [API reference for an example](/ref/spine/#spine.set_constant:url-constant-value).

+ 2 - 3
docs/en/manuals/sprite.md

@@ -40,7 +40,7 @@ A sprite also has a number of different properties that can be manipulated using
 : The normalized animation cursor (`number`).
 
 `image`
-: The sprite image (`hash`). You can change this using an atlas or tilesource resource property and `go.set()`. Refer to the [API reference for an example](/ref/sprite/#image).
+: The sprite image (`hash`). You can change this using an atlas or tile source resource property and `go.set()`. Refer to the [API reference for an example](/ref/sprite/#image).
 
 `material`
 : The sprite material (`hash`). You can change this using a material resource property and `go.set()`. Refer to the [API reference for an example](/ref/sprite/#material).
@@ -54,8 +54,7 @@ A sprite also has a number of different properties that can be manipulated using
 `size`
 : The size of the sprite (`vector3`) (READ ONLY).
 
-
-## Sprite material constants
+## Material constants
 
 The default sprite material has the following constants that can be changed using `sprite.set_constant()` and reset using `sprite.reset_constant()` (refer to the [Material manual for more details](/manuals/material/#vertex-and-fragment-constants)):
 

+ 22 - 1
docs/en/manuals/tilemap.md

@@ -46,7 +46,11 @@ To add a tile map to your game:
 
 ![Use tile map](images/tilemap/use_tilemap.png){srcset="images/tilemap/[email protected] 2x"}
 
-## Changing tiles from script
+## Runtime manipulation
+
+You can manipulate tilemaps in runtime through a number of different functions and properties (refer to the [API docs for usage](/ref/tilemap/)).
+
+### Changing tiles from script
 
 You can read and write the content of a tile map dynamically while your game is running. To do so, use the [`tilemap.get_tile()`](/ref/tilemap/#tilemap.get_tile) and [`tilemap.set_tile()`](/ref/tilemap/#tilemap.set_tile) functions:
 
@@ -58,3 +62,20 @@ if tile == 2 then
     tilemap.set_tile("/level#map", "ground", x, y, 4)
 end
 ```
+
+### Changing properties
+
+A tilemap has a number of different properties that can be manipulated using `go.get()` and `go.set()`:
+
+`tile_source`
+: The tile map tile source (`hash`). You can change this using a tile source resource property and `go.set()`. Refer to the [API reference for an example](/ref/tilemap/#tile_source).
+
+`material`
+: The tile map material (`hash`). You can change this using a material resource property and `go.set()`. Refer to the [API reference for an example](/ref/tilemap/#material).
+
+### Material constants
+
+The default tile map material has the following constants that can be changed using `tilemap.set_constant()` and reset using `tilemap.reset_constant()` (refer to the [Material manual for more details](/manuals/material/#vertex-and-fragment-constants)):
+
+`tint`
+: The color tint of the tile map (`vector4`). The vector4 is used to represent the tint with x, y, z, and w corresponding to the red, green, blue and alpha tint. Refer to the [API reference for an example](/ref/tilemap/#tilemap.set_constant:url-constant-value).