UpdateHumanPawnMeshMaterial
Tracking Issue: #169
Tags: customization, pawns
Adds a DLC hook to update a given material applied to a human pawn mesh component that can be used to set custom parameters on materials.
static function UpdateHumanPawnMeshMaterial(XComGameState_Unit UnitState, XComHumanPawn Pawn, MeshComponent MeshComp, name ParentMaterialName, MaterialInstanceConstant MIC);
This is called by UpdateHumanPawnMeshComponent
if not overridden.
UpdateHumanPawnMeshComponent
allows more control over the materials, like being able to use
MaterialInstanceTimeVarying
or outright replacing materials.
The following simplified example is taken from the Warhammer 40,000: Armours of the Imperium
mod. Its armor uses custom material names and requires that the eye color is passed to the material using
EmissiveColor
instead of EyeColor
:
static function UpdateHumanPawnMeshMaterial(XComGameState_Unit UnitState, XComHumanPawn Pawn, MeshComponent MeshComp, name ParentMaterialName, MaterialInstanceConstant MIC)
{
local XComLinearColorPalette Palette;
local LinearColor ParamColor;
if (MaterialInstanceConstant(MIC.Parent).Name == 'Mat_SpaceMarine_Eyes')
{
Palette = `CONTENT.GetColorPalette(ePalette_EyeColor);
ParamColor = Palette.Entries[Pawn.m_kAppearance.iEyeColor].Primary;
MIC.SetVectorParameterValue('EmissiveColor', ParamColor);
}
}
Note that a subset of this functionality (specifically if the material parameter names match) can
be implemented with config only (no code) using the TintMaterialConfigs
feature.