Proportion Trick
Purpose (i.e. why a modder would use this trick)
Use an existing set of animations built for a different-shaped skeleton (such as for a smaller or taller human than what will be using the animations) without having to change the existing animations. The trick forces the animations to conform to the custom model's skeleton rather than the other way around. For example, by using the trick, a modder can replace L4D2 Zoey survivor model with a custom woman model that has longer legs and is shorter from head to torso than Zoey and still uses Zoey's existing animations without having to change any of Zoey's animations.
Information that the tutorial is based on
QC files (Forum topic by CaptainBigButt with explanations and link to example files that use the Proportion Trick.)
Other tutorials on the subject:
Applying the Size Proportion Trick - L4D2 (YouTube video by MSF.)
I'm trying to make a small playermodel, but its body is stretched-out to fit the human-body-form. (Forum topic where there are a few posts by Lukis that are full tutorial posts.)
Convert GMod ragdoll to player model & NPC + proportion trick (Video by Name.)
Quick proportion Idle Pose Method (Video by Splinks.)
Custom Playermodels (Proportiontrick & Face Flex) (Guide by Funreal.)
Adjusting Proportions on Playermodels (Guide by CaptainBigButt.)
Proportion trick script for GMod player model (Blender 2.79) (Video)
Proportion trick script for GMod player model (Blender 2.8/2.9) (Video)
Import the skeleton of the model being replaced. The model or mesh being replaced is the "reference".
Import the custom mesh.
Adjust the skeleton to fit the custom mesh. Note that sometimes some bones need rotating about the axis along the length of the bone because different games expect different orientation of the axes.
Rig/weight the custom mesh to the skeleton.
Pose the weighted mesh + skeleton to match the pose of the replaced model's idle/reference sequence. For example, if the replaced model's idle/reference sequence is the "T-pose", then pose the weighted mesh + skeleton into the "T-pose".
Export the weighted mesh + skeleton to "rigged_mesh.smd" file. This file name will be used in two places in the QC file.
Change the file name of the reference mesh used in $model or $body or $bodygroup line in the QC. Example of a $model line:
$model "rigged_mesh.smd"
Add these two lines in the QC after all $animation, $sequence, and $includemodel lines. The important thing is to have the $sequence be the final sequence, so it does not interfere with existing animations, particularly in multiplayer. The "a_proportions" is simply the name of the $animation that is then used in the $sequence. The "rigged_mesh.smd" is the file name from earlier steps, which contains the custom weighted mesh. The "reference" is the name of the idle/reference $sequence name, usually the first $sequence in the QC; it should be from the $sequence to which you matched the custom mesh in the earlier steps. The "proportions" is the name of the special $sequence that (in my own words) "tells the game to use the proportion trick"; it can be any name you want as long as it is not the same name as any other $sequence in the model.
$animation "a_proportions" "rigged_mesh.smd" subtract "reference" 0 $sequence "proportions" "a_proportions" predelta autoplay
NOTE: If the custom mesh is significantly different, $attachment lines in the QC file might need changing to avoid attached models from clipping.
[This is helpful step for survivor models and common infected models in L4D2.] Add this line AFTER any $sequence lines and BEFORE $sequence "proportions" and $includemodel lines in the QC file (where "modelname_$DeclareSequence.qci" has a $DeclareSequence sequence_name line for every sequence):
$include "modelname_$DeclareSequence.qci"
QCI file downloads:
[This is helpful step for survivor models and common infected models in L4D2.] Delete or comment-out the lines in the QCI file that refer to the same names as the $sequence blocks in the QC file. Example: QC file has these two $sequence blocks:
$sequence "TeenAngst" "survivor_teenangst_anims\TeenAngst.smd" { fps 30 }Â $sequence "ragdoll" "survivor_teenangst_anims\ragdoll.smd" { fps 30 "ACT_DIERAGDOLL" 1 }
The "Zoey_$DeclareSequence.qci" has these two lines at the top that need deleting:
$declaresequence TeenAngst $declaresequence ragdoll
How to Workaround Some Problems with Decompiled Models that Use Proportion Trick
Workaround to Recompile Models that Have Problems Due to Delta Animations (by ZeqMacaw)
Possible trouble areas
Hands might need more adjustments.