$weightlist: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(cleanup and more info)
No edit summary
Line 1: Line 1:
Creates a named list of boneweights that can be used by animations that are intended to be blended on top of other animations.
'''<code>$weighlist</code>''' defines the degree to which each bone in a model is affected by a [[$sequence]] or [[$animation]]. For example, you could set the weight of the leg bones to 0 to only animate the top half of the skeleton.


The weightlist is built assuming that the root bone has a weight of 0, and that all child bones inherit the weight of their closest specified parent bone. This means that you only have to specify weights when they change, not for each and every bone in the list.
A <code>$weightlist</code> can be reused as many times as is needed. It must come above anything that uses it in the QC.


All animations default to a weightlist that assumes all bones have a weight of 1.0.
== Usage ==


== Syntax ==
<source lang=php>
$weightlist my_weightlist
{
<bone> <weight>
<bone> <weight>
...
}


$weightlist <weightlist name> <bone name> <weight> [[<bone name> <weight>] ....]
$sequence my_weighted_anim "my_anim.smd" weightlist my_weightlist
</source>


== Example ==
Bones inherit weight from their parents, and all root bones start with a weight of 0.


Include all the bones, except the hands:
<source lang=php>
$weightlist no_hands "Bip01" 1.0 "Bip01 L Hand" 0.0 "Bip01 R Hand" 0.0
$weightlist no_hands
{
"Bip01_Pelvis" 1.0
"Bip01_LHand" 0.0
"Bip01_RHand" 0.0
}


Include all the bones starting at the top of the root bone to the clavicle and neck:
$weightlist head_and_arms "Bip01_Spine2" 1.0
$weightlist head_n_arms "Bip01 Spine 2" 1.0


Create a list that smoothly blends in the upper body, not becoming 100% until it reaches the arms:
$Weightlist UpperbodyBlend {
$Weightlist UpperbodyBlendPose {
"Bip01_Pelvis" 0.1  
"ValveBiped.Bip01_Pelvis" 0.1  
"Bip01_L_Thigh" 0.0  
"ValveBiped.Bip01_L_Thigh" 0.0  
"Bip01_R_Thigh" 0.0  
"ValveBiped.Bip01_R_Thigh" 0.0  
"Bip01_Spine" 0.2  
"ValveBiped.Bip01_Spine" 0.2  
"Bip01_Spine1" 0.4  
"ValveBiped.Bip01_Spine1" 0.4  
"Bip01_Spine2" 0.6  
"ValveBiped.Bip01_Spine2" 0.6  
"Bip01_Spine4" 0.4
"ValveBiped.Bip01_Spine4" 0.4
"Bip01_L_Clavicle" 0.8
"ValveBiped.Bip01_L_Clavicle" 0.8
"Bip01_L_Upperarm" 1.0
"ValveBiped.Bip01_L_Upperarm" 1.0
"Bip01_R_Clavicle" 0.8
"ValveBiped.Bip01_R_Clavicle" 0.8
"Bip01_R_Upperarm" 1.0
"ValveBiped.Bip01_R_Upperarm" 1.0
}</source>
}


Only the bones with a weight > 0 will have any influence over the animation.
== See also ==
 
* [[$animation#Blending|Subtracted animations]]


[[Category:QC Commands|weightlist]]
[[Category:QC Commands|weightlist]]

Revision as of 08:19, 30 July 2011

$weighlist defines the degree to which each bone in a model is affected by a $sequence or $animation. For example, you could set the weight of the leg bones to 0 to only animate the top half of the skeleton.

A $weightlist can be reused as many times as is needed. It must come above anything that uses it in the QC.

Usage

$weightlist my_weightlist
{
	<bone> <weight>
	<bone> <weight>
	...
}

$sequence my_weighted_anim "my_anim.smd" weightlist my_weightlist

Bones inherit weight from their parents, and all root bones start with a weight of 0.

$weightlist no_hands
{
	"Bip01_Pelvis" 1.0
	"Bip01_LHand" 0.0
	"Bip01_RHand" 0.0
}

$weightlist head_and_arms "Bip01_Spine2" 1.0

$Weightlist UpperbodyBlend {
	"Bip01_Pelvis" 0.1 
	"Bip01_L_Thigh" 0.0 
	"Bip01_R_Thigh" 0.0 
	"Bip01_Spine" 0.2 
	"Bip01_Spine1" 0.4 
	"Bip01_Spine2" 0.6 
	"Bip01_Spine4" 0.4
	"Bip01_L_Clavicle" 0.8
	"Bip01_L_Upperarm" 1.0
	"Bip01_R_Clavicle" 0.8
	"Bip01_R_Upperarm" 1.0
}

See also