You are almost right with that, but there is actually no need to edit the textures. The materials always have a $color2 parameter which defines the default color. However, I don't think that $blendtintbybasealpha is the right parameter, as that only controls if the applied color should be masked or go over the entire thing evenly.
Let's take a look at the material for the Texas Tin Gallon simply because I have a painted one.
Code:
"VertexLitGeneric"
{
"$basetexture" "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon_color"
"$bumpmap" "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon_normal"
"$lightwarptexture" "models/player/pyro/pyro_lightwarp"
"$phong" "1"
"$phongexponent" "5.000000"
"$phongboost" "2.000000"
"$phongfresnelranges" "[.25 .5 1]"
"$rimlight" "1"
"$rimlightexponent" "4.000000"
"$rimlightboost" "1.000000"
"$blendtintbybasealpha" "1"
"$blendtintcoloroverbase" "1.000000"
"$colortint_base" "{ 239 236 200 }"
"$color2" "{ 239 236 200 }"
"$colortint_tmp" "[0 0 0]"
"$bumpmapalphaphongmask" "1"
"$cloakPassEnabled" "1"
"$detail" "effects/tiledfire/fireLayeredSlowTiled512"
"$detailscale" "5"
"$detailblendfactor" "0"
"$detailblendmode" "6"
"$yellow" "0"
">=DX90"
{
"$selfillum" "0"
}
"Proxies"
{
"invis"
{
}
"AnimatedTexture"
{
"animatedtexturevar" "$detail"
"animatedtextureframenumvar" "$detailframe"
"animatedtextureframerate" 30
}
"BurnLevel"
{
"resultVar" "$detailblendfactor"
}
"ItemTintColor"
{
"resultVar" "$colortint_tmp"
}
"SelectFirstIfNonZero"
{
"srcVar1" "$colortint_tmp"
"srcVar2" "$colortint_base"
"resultVar" "$color2"
}
"YellowLevel"
{
"resultVar" "$yellow"
}
"Multiply"
{
"srcVar1" "$color2"
"srcVar2" "$yellow"
"resultVar" "$color2"
}
}
}
Now let's filter out all the stuff that is important to us right now:
Code:
"$blendtintbybasealpha" "1"
"$blendtintcoloroverbase" "1.000000"
"$colortint_base" "{ 239 236 200 }"
"$color2" "{ 239 236 200 }"
"$colortint_tmp" "[0 0 0]"
"Proxies"
{
"ItemTintColor"
{
"resultVar" "$colortint_tmp"
}
"SelectFirstIfNonZero"
{
"srcVar1" "$colortint_tmp"
"srcVar2" "$colortint_base"
"resultVar" "$color2"
}
}
My first assumptions for all these things:
$blendtintbybasealpha [boolean?]
As mentioned before, controlls if the color should be applied evenly or use a mask.
$blendtintcoloroverbase [float?]
Controlls how strong the color is applied
$colortint_base
A fake variable. This is the default color.
$color2 [RGB]
The applied color.
$colortint_tmp
A fake variable. We will get back to this in a moment.
And for the proxies:
ItemTintColor
This allows the material to know what the current paint is. It is then stored in the
$colortint_tmp variable.
SelectFirstIfNonZero
Selfexplanatory. If there is no paint applied, it uses the default color. The result is stored in
$color2.
From these assumptions I will make a simple mod where I copy the material and remove the
SelectFirstIfNonZero proxy entirely. At first i wanted to remove the
$colorint_tmp variable but I think I would have to remove everything that mentions it or else I might get errors. Anyways, this should visually remove the paint from my hat.
And it works!
However, removing a proxy from every material in the game would be annoying. So what if I simply remove the $colortint_tmp variable? Will I get errors or will it work? The answere:
Code:
No such variable "$colortint_tmp" for material "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon"
Error: Material "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon" : proxy "ItemTintColor" unable to initialize!
No such variable "$colortint_tmp" for material "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon"
Error: Material "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon" : proxy "SelectFirstIfNonZero" unable to initialize!
No such variable "$colortint_tmp" for material "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon"
Error: Material "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon" : proxy "ItemTintColor" unable to initialize!
No such variable "$colortint_tmp" for material "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon"
Error: Material "models/workshop/player/items/engineer/robo_engineer_texastingallon/robo_engineer_texastingallon" : proxy "SelectFirstIfNonZero" unable to initialize!
So, it works, but we get nasty console spam.