$bonemerge
$bonemerge
is a QC command available in all Source games. It sets the bonemerge flag on the specified bone, which serves as a hint to the game code that the named bone will be used for bone merges (see Attachments) during the game. If this flag is not present, the bone can still be used for bone merging, but you'll get performance warnings.
Warning:For models with no meshes (i.e. animations-only), this flag is mandatory for any bones intended to be bonemerged against, otherwise it will not merge and become distorted. However, this issue does not apply in the case where an external model includes the animations.
$bonemerge
also has several alternate uses:
- Prevents studiomdl from collapsing bones during model compilation. As part of the optimization process, studiomdl will attempt to cull bones from the output MDL that are not strictly necessary. The prime candidates are 1) bones that have 0 vertices weighted to them and 2) any bone which is the only bone that its skinned vertices are weighted to. Unused bones are removed without issue, and, in the latter case, the bone is deleted and its vertex skinning weights are moved to its parent bone. Set
$bonemerge
on these types of bones to force studiomdl to keep them in the output MDL file. Set$bonemerge
on every bone in a model's skeleton to guarantee that the entire skeleton will be available in engine. - The bonemerge flag is a critical component of procedurally-driven flexes. Procedural bones must have
$bonemerge
set on them in order for the technique to work. - SFM typically hides $proceduralbones in the outliner and the viewport. Setting
$bonemerge
on the procedural bones forces SFM to always display them.
Syntax
$bonemerge <bone name>
Writing Bonemerge in Notepad++
There is no automated function for this yet, but you can do it manually using Regex in Notepad++. This process takes about two minutes.
Tip:You can record the following Find & Replace process as a macro in Notepad++ to avoid copypasting the string of text for the next uses.
- Open your mesh.smd in Notepad++.
- Copy the bone names from the very top into a new, empty file.
- Press Ctrl&H to enter "Replace" mode.
- In the "Find What" field, enter:
^\s*\d+\s*"(.+)"\s*-?\d+\s*$
- In the "Replace with" field enter:
$bonemerge "\1"
- Make sure that ". Matches newline" is disabled.
- Click "Replace all"
Now you can paste those lines in your qc file, or use as a qci file.