This article's documentation is for anything that uses the Source engine. Click here for more information.

$renamematerial: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Nesciuse moved page $renamematerial/en to $renamematerial without leaving a redirect: Move en subpage to basepage)
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LanguageBar|title = $renamematerial}}
{{LanguageBar|title = $renamematerial}}
{{this is a|QC command|name=$renamematerial}}
{{this is a|QC command|name=$renamematerial}} It allows a model to use a different [[material]] to the one specified in its [[Reference mesh|reference]] SMD.


It allows a model to use a different [[material]] to the one specified in its [[Reference mesh|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.
{{tip|This behavior can be exploited for potentially useful means, such as renaming eyeball_L and eyeball_R to a shared material, allowing the eyes to still function but requiring only a single material file rather than two copies.}}


== Syntax ==
== Syntax ==
Line 8: Line 9:
  $renamematerial <current material> <new material>
  $renamematerial <current material> <new material>


== Usage with texture groups ==
== Usage with $texturegroups ==
Renamed materials will be considered separate materials even if given the same name as an existing referenced material.
Renamed materials must be stated with their original material names when listed in a [[$texturegroup]], see below:
This can create an issue when listing texture groups, see below:
<syntaxhighlight lang=php>
$body "model_1.smd"  //Mesh using material "material_1"
$body "model_2.smd"  //Mesh using material "material_2"


<source lang=xml>
//Rename "material_2" on "model_2" to match the material name on "model_1"
$body "model_1.smd" //A mesh assigned the material "material_1"
$renamematerial "material_2" "material_1"
 
$body "model_2.smd" //A mesh assigned the material "material_2"
 
$renamematerial "material_2" "material_1" //Rename "material_2" on "model_2.smd" to match the material name on "model_1.smd"


$texturegroup skinfamilies
$texturegroup skinfamilies
Line 24: Line 23:
{ "material_3" }
{ "material_3" }
}
}
</syntaxhighlight>


</source>
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.
This would result in only the faces from model_1.smd being changed on the second skingroup, due to the compiler considering the renamed material to be seperate from the material named on the first mesh, even though they now share the same name.


In order for the skins to change correctly, you must list the original material name in the skin line, then perform the rename operation after.
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.


<source lang=xml>
<syntaxhighlight lang=php highlight=3>
$texturegroup skinfamilies
$texturegroup skinfamilies
{
{
Line 38: Line 37:


$renamematerial "material_2" "material_1"
$renamematerial "material_2" "material_1"
</source>
</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.}}


== See also ==
== See also ==
Line 45: Line 45:
*[[$texturegroup]] "skinfamilies"
*[[$texturegroup]] "skinfamilies"
*[[$lod]] "replacematerial"
*[[$lod]] "replacematerial"
[[Category:QC Commands|renamematerial]]

Latest revision as of 17:43, 3 August 2025

English (en)Русский (ru)Translate (Translate)

$renamematerial is a QC command available in all Source 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.

Tip.pngTip:This behavior can be exploited for potentially useful means, such as renaming eyeball_L and eyeball_R to a shared material, allowing the eyes to still function but requiring only a single material file rather than two copies.

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"
Tip.pngTip: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.

See also