$renamematerial: Difference between revisions
(added some tips and extra info) |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 10: | Line 10: | ||
== Usage with $texturegroups == | == Usage with $texturegroups == | ||
Renamed materials | Renamed materials must be stated with their original material names when listed in a [[$texturegroup]], see below: | ||
<syntaxhighlight lang=php> | |||
$body "model_1.smd" //Mesh using material "material_1" | |||
$body "model_2.smd" //Mesh using material "material_2" | |||
//Rename "material_2" on "model_2" to match the material name on "model_1" | |||
$renamematerial "material_2" "material_1" | |||
$renamematerial "material_2" "material_1 | |||
$texturegroup skinfamilies | $texturegroup skinfamilies | ||
Line 25: | Line 23: | ||
{ "material_3" } | { "material_3" } | ||
} | } | ||
</syntaxhighlight> | |||
The above example would result in only the faces from "model_1" being changed to "material_3" because the compiler still identifies the faces on "model_2" as being assigned to "material_2" even though it was renamed to match. | |||
In order for the | In order for the materials to change correctly, you must list the original material name in the first texture group and state the rename command after. | ||
< | <syntaxhighlight lang=php highlight=3> | ||
$texturegroup skinfamilies | $texturegroup skinfamilies | ||
{ | { | ||
Line 39: | Line 37: | ||
$renamematerial "material_2" "material_1" | $renamematerial "material_2" "material_1" | ||
</ | </syntaxhighlight> | ||
{{tip|You can temporarily rename the default materials to your alternate skin's materials if you want to display them as the default skin while working on them.}} | {{tip|You can temporarily rename the default materials to your alternate skin's materials if you want to display them as the default skin while working on them.}} | ||
Line 47: | Line 45: | ||
*[[$texturegroup]] "skinfamilies" | *[[$texturegroup]] "skinfamilies" | ||
*[[$lod]] "replacematerial" | *[[$lod]] "replacematerial" | ||
Latest revision as of 17:43, 3 August 2025
$renamematerial
is a QC command available in all Source games. It allows a model to use a different material to the one specified in its reference SMD.
Renamed materials remain independent from each other for identification purposes, even if they share a new material name. As a result, this command cannot be used to lower the original material count.

Syntax
$renamematerial <current material> <new material>
Usage with $texturegroups
Renamed materials must be stated with their original material names when listed in a $texturegroup, see below:
$body "model_1.smd" //Mesh using material "material_1"
$body "model_2.smd" //Mesh using material "material_2"
//Rename "material_2" on "model_2" to match the material name on "model_1"
$renamematerial "material_2" "material_1"
$texturegroup skinfamilies
{
{ "material_1" }
{ "material_3" }
}
The above example would result in only the faces from "model_1" being changed to "material_3" because the compiler still identifies the faces on "model_2" as being assigned to "material_2" even though it was renamed to match.
In order for the materials to change correctly, you must list the original material name in the first texture group and state the rename command after.
$texturegroup skinfamilies
{
{ "material_1" "material_2 }
{ "material_3" "material_3" }
}
$renamematerial "material_2" "material_1"

See also
- $cdmaterials
- $texturegroup "skinfamilies"
- $lod "replacematerial"