$definebone
$definebone
is a QC command available in all Source games. It defines a bone outside of any .smd source. This is useful when building animation only mdl's that would otherwise optimize out all the bones since none of them are connected to any geometry or attachment points. You can get studiomdl to dump this out using the "-definebones"
command line option.
The (fixup) fields specify how the IK solver has rotated any of the bones to match the single X axis as the long axis requirement for all bones in an IK chain. All the source animations are resolved to match this new orientation.
$definebone
can also be used to change the bone order of a model (for example, bone merging purposes), by specifying it before any model references and changing around the $definebone
list order.
This command is run before any $hierarchy commands.
Syntax
$definebone (name) (parent) (X) (Y) (Z) (xr) (yr) (zr) (fixup X) (fixup Y) (fixup Z) (fixup X Rotation) (fixup Y Rotation) (fixup Z Rotation)
Generating definebone lines using Crowbar
The Crowbar Decompiling tool has a user interface for studiomdl, which also contains an automated process for writing $definebone lines.
- Remove all existing $definebone lines. Alternatively; comment out all definebone lines by adding a /* before the first definebone line and a */ after the last, to comment out multiple lines.
- In the "Compile" tab of Crowbar, select the "definebones" checkbox. You can decide to write everything into a qci file by checking the "Create qci file" checkbox underneath
- Click "Compile". This will not compile the model itself, it will only generate definebone lines. If you did not decide to write a qci file, you must copy the lines from crowbars compile-log text box and paste it into your qc file.
If you want to add definebone lines to your existing set of definebones you must first comment out all existing definebone lines from your QC file, compile the definebone list with crowbar and then copy just the new definebone lines into your qc file.