This is the programming guide to the Multilayer sticker projection system in Mutable, intended to complement the guide for artists and designers Multilayer projection on switchable parts, which should also be read by the programmers. It also contains an optimization section at the end.
The Multilayer system in Mutable introduces a new concept, ranged parameters (multi-value parameters). Whereas a normal parameter can only have one value, ranged parameters can have up to N values. You can think of them as an array of N values, all related to the same parameter, and you can access them with an index that goes from 0 to N - 1.
For the programmer's convenience, when using the "Group Projector Parameter" node Mutable manage nearly everything. It will automatically create several ranged parameters to control the stickers, and the programmer will only have to set their values to create the desired sticker design over the character.
Let's assume that the following "Group Projector Parameter" node is placed in the mutable graph:
The following controls for the "ShirtProjector" parameter will appear in the Mutable Editor preview viewport:
They let the developer add and remove layers of stickers, select them and move them around, choose which sticker appears in each layer, their opacity, etc. But all this only works in the editor, how to do it in-game from C++? What parameters have to be changed?
The Mutable compiler automatically creates a set of parameters that let the programmer have the same control with the Mutable C++ API. Here is the list of the parameters that are automatically created for a "ShirtProjector" node (assuming the Projector Parameter name is "ShirtProjector", change it to your own projector name) and that the programmer has to set: