Difference between revisions of "$renamematerial"

From Valve Developer Community
Jump to: navigation, search
m (Usage: typo ;-))
 
Line 4: Line 4:
  
 
  $renamematerial <current material> <new material>
 
  $renamematerial <current material> <new material>
 +
 +
== Usage with texture groups ==
 +
Renamed materials will be considered separate materials even if given the same name as an existing referenced material.
 +
This can create an issue when listing texture groups, see below:
 +
 +
<source lang=xml>
 +
$body "model_1.smd" //A mesh assigned the material "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
 +
{
 +
{ "material_1" }
 +
{ "material_3" }
 +
}
 +
 +
</source>
 +
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.
 +
 +
<source lang=xml>
 +
$texturegroup skinfamilies
 +
{
 +
{ "material_1" "material_2 }
 +
{ "material_3" "material_3" }
 +
}
 +
 +
$renamematerial "material_2" "material_1"
 +
</source>
  
 
== See also ==
 
== See also ==

Latest revision as of 21:37, 21 February 2016

The QC command $renamematerial allows a model to used a different material to the one specified in its reference SMD.

Syntax

$renamematerial	<current material>	<new material>

Usage with texture groups

Renamed materials will be considered separate materials even if given the same name as an existing referenced material. This can create an issue when listing texture groups, see below:

$body "model_1.smd" //A mesh assigned the material "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
{
	{ "material_1" }
	{ "material_3" }
}

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.

$texturegroup skinfamilies
{
	{ "material_1" "material_2 }
	{ "material_3" "material_3" }
}

$renamematerial "material_2" "material_1"

See also