Importing and Animating (source1) models using blender

edited October 2016 in Tutorials

please check this thread for links to crowbar 0.24 and most of the source 1 dota models.

Things to know before we begin.

-I'm going to assume you know how to use blender.

-You should have some custom abilities in your mod ready to test animations.

-I'll only be showing you how to modify heroes that are already in dota, not custom models. Though some aspects may apply.

-This is my first tutorial ever so bear with me.

Step 1

-Download Blender Source Tools if you dont have it already, this lets you import and export source files like SMD,VTA,DMX

-make a new folder for yourself where you will be placing heroes decompiled files and anims

-run CROWBAR 0.24

-MDL file : select the main .MDL file for the model that you downloaded, in my case thats going to be "sven.mdl"

-Subfolder(of MDL file): i like to use the new folder i made as the path C:\Users\Me\Desktop\temporary, please use whatever location is appropriate for you.

-using the image above please make sure the only checked boxes are "Reference mesh SMD file" "Bone animation SMD files" and "Procedural bones VRD file"

-if you come accross any issue make sure that you are indeed using CROWBAR 0.24 as newer versions will not work

-great! now that you have successfully decompiled the main body mesh of the hero go ahead and change the checked boxes inside crowbar to only "Reference mesh SMD file" as we wont need to generate all those extra junk files for his other assets.

-go ahead and decompile the other .mdl files, some files wont behave normally in blender and will stay stuck in the ground or something else so make sure you only have the necessary ones that will help us visually while animating.

note you only really need the main.mdl file to animate, but having all the pieces in place helps A LOT

-once everything is done decompiling go ahead and delete some empty folders and stuff generated by crowbar.

Step 3

-open up blender and make a new file. delete the camera/cube/lamp as we wont be needed that

a - click file again and select "Import" and "Source Engine" (see top if you dont have this option)

b - now you will see your model inside blender without any items, before you add those...

c - import again and open up the anims folder and select "idle.smd" so that when we add the items, if they dont attach to sven we will know that those arent the ones we need.

Step 4

-so now lets go over creating an animation and export the animation file BRIEFLY because that is a whole number of tutorials about animation and other stuff that i dont have the time to explain unfortunately.

  • i will say that if you are very inexperienced and dont feel like learning how to animate its fairly simple to modify animations already in the game by importing them and changing them slightly for whatever your needs may be

-here I have taken the idle animation we imported and dleted all of the keyframes between the first and last and added a keyframe with this new pose, make sure you are set to animate at 30fps

a -when you are finished animating your pose, click the scene tab inside of the property viewer

c - i dont know why i labeled this one "c" just make sure that the Export format is set to "SMD" and not "DMX"

b - hit export and select only the current action, we wont need the whole scene.

-make a new folder next to "sven_anims" or whichever your hero is and name it something like "new_sven_anims" and put your new anims in there so we know which ones are separate which. go ahead and give them cool names like "meme_storm_hammer"

Step 5

-navigate to your /content/ addon folder and make a "models" folder if there isnt one already. i also HIGHLY recommend adding a folder for each hero. move your decompiled files and new anims to this folder ( i made a copy of the folder but it doesnt really matter )

  • run dota 2 tools and pick your favorite addon, in your Asset Browser select the model editor and click on New VMDL from mesh file at the bottom.

-select your main mesh and you should hopefully see it load into the model viewer.

  • very important click file : SAVE right away. close it, open it again. if everything looks good then we can proceed, its important not to do too much at once with the model viewer or youll get an error and have to start all over.

-if your model isnt in the recent models in the model viewer. then try to do the first option "browse and open" then in the file viewer set file type to all & select the newly created .vmdl file

-click on Model > Hitboxes > Auto-Generate Hitboxes > confirm > close sub-window. -if youre unsure if you have generated the hitboxes you can click on Display > Hitboxes, to display them.

-next im going to add only a few of the animations for this example

-click on Animation > Add Animation

-if you like you can go crazy and view them all (note you shouldnt load more than 10 at a time).

-i added "idle,run,death" and two custom anims that i created for this tutorial.

-now what you should do is append "Activities" to your animations so your DATA DRIVEN abilities and items know which animations to use. check out the ability tutorial to find out more about "Activities" such as ACT_DOTA_IDLE and ACT_DOTA_RUN

-now click file save and hopefully you didnt get an error, if you did you will have to start over whatever changes did not save, if you did get the error it means you tried adding too much data to the file.

Step 6

-alright so go into your \game\dota_addons\xxxxxxx\scripts\npc\npc_heroes_custom.txt and add the "Model" line to your list of data and the appropriate "ACT_DOTA_..." functions to your data driven abilities.

        "override_hero"     "npc_dota_hero_sven"
        "Model"             "models\temporary\notevensven.vmdl"

-i would like to add that if you are not going to edit the models themselves or have custom models in your addon i would skip this step and just let the game use the appropriate model because they are a little harder to work with sometimes, im currently having issues with spells without "ignore backswing" causing animations to play again instead of going back to idle. (but you may never experience this issue), also you will have to add your own attachments if you plan to use the edited model aswell for stuff like particles coming off the heroes.

-its still unclear how the source 2 models are using data from the source 1 models anims, if you follow this tutorial and remove this line from your npc_custom_heroes.txt

"Model"             "models\temporary\notevensven.vmdl"

then you will be using S2 models with the anims you created

alright hopefully i didnt forget anything important, happy modding!