Component:MaterialSet: Difference between revisions

From Resonite Wiki
m ProbablePrime moved page MaterialSet (Component) to Component:MaterialSet: Creating component Namespace
add info
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
|Name=Material Set
|Name=Material Set
}}
}}
Material set allows for switching the list of materials being used on a mesh dynamically at any given moment. It also allows for lengthening or shortening the list in real time, which can be used to [[Things_to_Avoid#Material "Stacking"|material stack (things to avoid)]].


<!--T:2-->
<!--T:2-->
Line 10: Line 11:
{{Table ComponentFields
{{Table ComponentFields
|ActiveSetIndex|Int| The index into the Sets list of the materials to apply to the target renderer.
|ActiveSetIndex|Int| The index into the Sets list of the materials to apply to the target renderer.
|Target|SyncAssetList`1|TypeString1=SyncAssetList<Material>| The list of materials in a renderer to swap out.
|Target|{{RootFieldType|DriveRef`1|[[Type:SyncAssetList`1|SyncAssetList`1]]&lt;[[Type:Material|Material]]&gt;}}|TypeAdv1=true| The list of materials in a renderer to swap out.
|Sets|SyncList`1|TypeString2=SyncList<SyncAssetList<Material>>| The list of lists of materials in a renderer to swap out.
|Sets|{{RootFieldType|SyncList`1|[[Type:SyncAssetList`1|SyncAssetList`1]]&lt;[[Type:Material|Material]]&gt;}}|TypeAdv2=true| The list of lists of materials in a renderer to swap out.
}}
}}


<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
{{stub}}
Attach this component to the same slot as a [[Component:MeshRenderer|Mesh Renderer]] or a [[Component:SkinnedMeshRenderer|Skinned Mesh Renderer]] and hit the <code>Setup From Mesh Renderer()</code> [[Sync Delegate|sync delegate]] to attach it to the material list. Next add a list ([[Type:SyncAssetList`1|SyncAssetList`1]]&lt;[[Type:Material|Material]]&gt;) of each material list to <code>Sets</code> you want to switch between. Lastly use <code>ActiveSetIndex</code> to switch between each list in <code>Sets</code> for <code>Target</code>.


<!--T:4-->
<!--T:4-->
== Examples ==
== Examples ==
{{stub}}
Can be used to switch a material set on an avatar to make them change material types ([[Component:XiexeToonMaterial|toon]] to [[Component:PBS Metallic|pbs metallic]]) or from active camo to not active camo, etc.


[[Category:ComponentStubs]]
[[Category:Components:Rendering:Drivers{{#translation:}}|Material Set]]
[[Category:Components|Material Set]]
[[Category:Components{{#translation:}}|Material Set]]
[[Category:Components:Rendering:Drivers|Material Set]]

Latest revision as of 21:25, 28 October 2024


This article or section is a Stub. You can help the Resonite Wiki by expanding it.


Component image 
Material Set component as seen in the Scene Inspector

Material set allows for switching the list of materials being used on a mesh dynamically at any given moment. It also allows for lengthening or shortening the list in real time, which can be used to material stack (things to avoid).

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
ActiveSetIndex Int The index into the Sets list of the materials to apply to the target renderer.
Target direct DriveRef`1<SyncAssetList`1<Material>> The list of materials in a renderer to swap out.
Sets list of SyncAssetList`1<Material> The list of lists of materials in a renderer to swap out.

Usage

Attach this component to the same slot as a Mesh Renderer or a Skinned Mesh Renderer and hit the Setup From Mesh Renderer() sync delegate to attach it to the material list. Next add a list (SyncAssetList`1<Material>) of each material list to Sets you want to switch between. Lastly use ActiveSetIndex to switch between each list in Sets for Target.

Examples

Can be used to switch a material set on an avatar to make them change material types (toon to pbs metallic) or from active camo to not active camo, etc.