Source SDK

Source SDK

39 ratings
Workaround to Recompile Models that Have Jigglebone and Pose Parameter Problems Due to Delta Animations
By ZeqMacaw
Jigglebones and pose parameters mess up when recompiling a model that uses a delta or predelta option in a $sequence block. This tutorial describes a workaround so that recompiling will have working jigglebones and pose parameters.
   
Award
Favorite
Favorited
Unfavorite
Affected Models
  1. Any model compiled with at least one jigglebone and at least one $sequence that uses a predelta or delta option.
  2. Any model that uses the Proportion Trick and at least one jigglebone, because the trick uses a predelta option in a $sequence.
  3. Any model compiled that has a $sequence that refers to a $poseparameter and that uses a predelta or delta option.
What Goes Wrong?
Crowbar decompiles animation data as best it can, but for certain animations, not all of the original data is stored in the MDL. When a model uses subtract or presubtract options, there are two animations given to the model compiler, and a predelta or delta option given to the $sequence that uses the combined animation. The compiler combines the two animations and then stores only one of the original animations and the resulting combined animation. Thus, when Crowbar tries to decompile, it can not undo the combination because one of the original animations is not in the MDL; also, even though one of the animations stored in the MDL was used in the combination, there is no indication which animation was used.

So, Crowbar writes the QC such that a recompile is possible, but leaves out the presubtract and subtract options because the decompiled animations have already been combined. However, this somehow messes up the jigglebones.

This guide presents a workaround to allow you to recompile by making a few changes to the decompiled files. Eventually this workaround would be built into Crowbar directly, but I am not sure when that will happen.
The Workaround
I do not know exactly why this workaround works, but it seems like the jigglebones and pose parameters need to be re-combined back into the combined animations.

The workaround has 3 main steps, described in their own sections:
  • Step 1: Create a special SMD file for each $sequence block that use predelta or delta options.
  • Step 2: Change the $sequence blocks (or the $animation blocks that a $sequence uses) that use predelta or delta options.
  • Step 3: Add a new $animation block, for each special SMD file, to the QC file before any other $animation or $sequence blocks.
Step 1
Create a special SMD file for each $sequence block that use predelta or delta options.
  • In the QC file, find all $sequence blocks that have a predelta or delta option.
    For example: A model using Proportion Trick would have this:
    $sequence "proportions" { "a_proportions" autoplay predelta fadein 0.2 fadeout 0.2 }

  • For each found $sequence block, copy each SMD file used and name each something like "subtract_zero_01.smd" (where the number 01 is changed to make each copy unique).
    For example, for only one needed special SMD file: Copy "a_proportions.smd" file to "subtract_zero.smd" file.
    For example, for two needed special SMD files: Copy "walk.smd" file to "subtract_zero_01.smd" file. Copy "run.smd" file to "subtract_zero_02.smd" file.

  • In the new special SMD (e.g. "subtract_zero.smd"), for each bone in nodes section that does not have a -1 (which means it is not a root bone; usually there is only one root bone), remove that bone's line from the skeleton section.
    For example:
    Original nodes and skeleton sections (note that the first line in nodes section has -1 at the end of it):
    nodes 0 "ValveBiped.Bip01_Pelvis" -1 1 "ValveBiped.Bip01_Spine" 0 2 "ValveBiped.Bip01_Spine1" 1 // lines for bones/nodes 3 through 79 removed for easier reading 80 "Tail1" 0 81 "LTail" 80 82 "RTail" 80 end skeleton time 0 0 -0.000008 -5.062500 3.064453 0.000000 0.000000 -1.570796 1 0.000006 -3.861328 2.015625 0.000000 0.000000 0.000000 2 -3.814453 0.000000 0.000000 0.000000 0.000000 0.000000 // lines for bones/nodes 3 through 79 removed for easier reading 80 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 81 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 82 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 end
    The skeleton section after deleting the bone lines:
    skeleton time 0 0 -0.000008 -5.062500 3.064453 0.000000 0.000000 -1.570796 end

  • Zero-out the 2nd, 3rd, and 4th values (these are the position values) for each bone line in the skeleton section.
    For example:
    Change the skeleton section from:
    skeleton time 0 0 -0.000008 -5.062500 3.064453 0.000000 0.000000 -1.570796 end
    to:
    skeleton time 0 0 0 0 0 0.000000 0.000000 -1.570796 end
Step 2
Change each $sequence block (or each $animation block that a $sequence uses) that uses a delta or predelta option.
For each $sequence block (or each $animation block that a $sequence uses) that uses a delta or predelta option, add:
subtract subtract_zero 0
(where subtract_zero is the name given the special SMD file created for this $sequence in Step 1.)
Note that the same special SMD file is used for all $animation blocks that a $sequence uses.
For example:
$animation "a_proportions" "anims\a_proportions.smd" { fps 30 subtract subtract_zero 0 }
Step 3
Add a new $animation block, for each special SMD file, to the QC file before any other $animation or $sequence blocks.
For example: Corresponding to the examples shown in other steps, only one $animation block is needed:
$animation "subtract_zero" "anims\subtract_zero.smd" { }
For example: Multiple special SMD $animation blocks would look like this:
$animation "subtract_zero_01" "anims\subtract_zero_01.smd" { } $animation "subtract_zero_02" "anims\subtract_zero_02.smd" { } $animation "subtract_zero_03" "anims\subtract_zero_03.smd" { }
18 Comments
Yates 19 Apr @ 3:09pm 
worked for me, thanks for taking the time to write the guide! it's very well made and easy to understand
virgil 10 Feb @ 3:54pm 
What if I don't have any delta or predelta animations in any of $sequence blocks and don't have any $animation block but I still have this bug when recompiling the model?
Ashen_Chevalier 16 Apr, 2023 @ 5:25pm 
I still get duplication name error when recompiled again
TheDizcordumSeventh 14 Jan, 2020 @ 12:18pm 
Thank you ZeqMacaw
ZeqMacaw  [author] 9 Dec, 2019 @ 1:45pm 
Good to know that it worked for you.

I was hoping Crowbar 0.64 would have fixed all issues that this workaround fixes, but it seems some models still mess up whether using Crowbar 0.64 or using this workaround. I am still researching.
CNCTEPBNPT 9 Dec, 2019 @ 10:14am 
Never mind, I already fixed it. For anyone having the same issue, you mustn't delete any nodes from the "subtract" file you create, a mistake on my part for misreading the steps, and also no, there's no need to edit all the "times", deleting all of them and leaving only "time 0" should work, as it has worked perfectly for me. Thanks for the amazing tutorial :ianthumb:
CNCTEPBNPT 9 Dec, 2019 @ 10:03am 
If the model has multiple times, e.g. "time 0", "time 1"; am I supposed to edit their bones as well? I tried following this tutorial but ended up with a model stuck in the proportions pose. I could provide an image with both the .qc and "subtract_zero.smd" for you to take a look if you're willing to help.
picigu9 28 Nov, 2019 @ 3:10pm 
@ZeqMacaw it would be, if i had not forgotten to mention it's for gmod.
ZeqMacaw  [author] 28 Nov, 2019 @ 1:07pm 
Probably best to ask for help in Dead4Mods discord [discord.gg] #modding channel.
picigu9 28 Nov, 2019 @ 12:57pm 
my model t-poses, and works perfectly fine after following your tutorial, but any animation breaks it, causing its legs to twist, torso to shrink, and it's feet to clip beneath the ground. What should I do?