natiny.model.set_part_texture
natiny.model.set_part_texture(model, part [, texture])
Overrides the texture of one part of the model, in place of the one the mesh loaded for it.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
model |
number |
Model handle | |
part |
integer |
Zero-based part index; negative values are clamped to 0 |
|
texture |
number |
0 |
Texture handle, or 0 to inherit the mesh part texture |
Example
natiny.model.set_part_texture(crate, 0, label)
Notes
- A part's texture belongs to the mesh, because it is what the file said. This is the per-instance override of that, so two models can share one mesh and still look different.
- The texture reaches the built-in material directly, and fills any sampler slot a custom material left unassigned - the same rule the mesh part's own texture follows.
- Overrides are stored only for parts that have one;
0clears one. They are cleared by set_mesh.