โ Previous: 12. Bone Profiles ยท ๐ WC Animation Tools
WC Animation Tools comes with a library of editor functions for changing animation assets in bulk, from editor Python or an Editor Utility Blueprint. They cover jobs Epic's own scripting can't do (or can't do easily), like making a montage with a section per clip, or changing a notify's class while keeping its values.
<aside> โน๏ธ
This page is for people who write scripts. Everything else in this wiki works without any scripting. If you don't use Python or Editor Utility Blueprints, you can skip this page.
</aside>
The library is unreal.WCAnimAssetLibrary. Function names are the names below in lower case with underscores (for example CreateSectionedMontage becomes create_sectioned_montage).
<aside> ๐พ
Saving: some functions save for you, others leave the asset changed but unsaved so you can save in one go at the end. Each entry below says which. If something goes wrong, the function returns None, False or -1 and writes a line in the Output Log saying why.
</aside>
| Function | What it does |
|---|---|
| ReplaceNotifyClass (Sequence, Old Class, New Class, Tag Prefix) | Swaps every notify (or notify state) of one class for another class, copying each setting whose name matches (ignoring spaces and capitals). Gameplay tags get Tag Prefix added when they don't already start with it. Returns how many were replaced. Unsaved. |
| SetNotifyTriggerFlags (Sequence, Notify Class, On Dedicated Server, On Follower) | Sets whether every notify of a class triggers on a dedicated server and on sync-group followers. Returns how many were set. Unsaved. |
| Function | What it does |
|---|---|
| CreateSectionedMontage (Package Path, Skeleton, Sequences, Section Names, Slot Name) | Makes a montage with the clips one after another on one slot track, a named section at the start of each, and every section ending on its own. Unsaved. |
| MakeMirroredCopy (Source, Package Path, Table) | Copies a clip and mirrors the copy left to right (bones, paired curves, notify and sync marker names), the same as the Maker's Mirror step. The source is never changed. Saves. |
| CreateMirrorTable (Skeleton, Package Path) | Makes a Mirror Data Table from your project's mirror name rules. Saves. |
| AddDistanceCurve (Sequence, Curve Name) | Adds a distance curve (how far the root has travelled, for distance matching) with Epic's Distance Curve modifier, and turns root motion on. A clip that travels less than 1 cm is left alone and returns False. Saves. |
| SetAnimationSkeleton (Sequence, Skeleton) | Moves a clip onto another skeleton that has the same bones (it must be marked compatible), and clears anything pointing at the old skeleton's content. Saves. |
| RemoveAnimationModifiers (Sequence) | Removes every Animation Modifier from a clip. Their results stay baked in. |
| Function | What it does |
|---|---|
| GetSkeletonBones (Skeleton) | Gives you every bone of a skeleton (parents before children): its name, its parent's name and its reference pose. Editor Python can't read these otherwise. |
| CopyBlendProfile (From, To, Profile) | Copies a blend profile from one skeleton to another (made if missing), for every bone both share. Unsaved. |
| CreateBlendMask (Skeleton, Mask Name, Bone Weights, Recurse) | Adds a blend mask to a skeleton: each bone at its weight, and its children too when Recurse is on. Saves the skeleton. |
| Function | What it does |
|---|---|
| CreateAnimBlueprint (Package Path, Parent Class, Skeleton) | Makes a new Anim Blueprint. Unsaved. |
| ExportGraphText (Blueprint, Graph Name) | Copies every node of a graph as text, exactly like the editor's Copy. |
| ImportGraphText (Blueprint, Graph Name, Text) | Pastes that text into a graph, exactly like the editor's Paste. Returns how many nodes were pasted. |
| InsertLayeredSlot (Anim Blueprint, After Node Name, Slot Name, Branch Bones) | Adds a montage slot that plays over part of the body (a Slot plus a Layered Blend per Bone on the branch bones) after a node in the AnimGraph, and registers the slot on the skeleton. Compile and save afterwards. |
| CreateAnimLayerInterface (Skeleton, Package Path) | Makes an Animation Layer Interface. Saves. |
| AddAnimLayer (Blueprint, Layer Name, Input Pose Name, Blend Time) | Adds an animation layer with one input pose, like the editor's Add Animation Layer. |
| ImplementAnimLayerInterface (Blueprint, Interface Class, Blend Time) | Makes an Anim Blueprint implement a layer interface, with each layer passing its input straight through (so an unlinked layer changes nothing). |
| BuildMaskedClipLayer (...) | Builds a layer graph that lays a clip over the input pose through blend masks, each mask's weight read from a variable. |
| InsertDeadBlendingAfterClip (Blueprint, Layer Name) | Adds a Dead Blending node after a masked clip layer's player, so a change of clip blends only that clip. |
| InsertLinkedAnimLayer (...) | Puts a Linked Anim Layer node into the pose going into a node's pin. |
| CompileBlueprintChecked (Blueprint) | Compiles like the editor's Compile button and tells you whether it worked, with every error and warning. (Python's own compile call doesn't tell you.) |
| Function | What it does |
|---|---|
| CreateChooserTable | Makes an empty Chooser Table with the result type and parameters you give. |
| AddChooserColumn | Adds a column: filter columns Gameplay Tag, Bool, Enum; output columns Output Float, Output Bool, Output Object, Output Enum. |
| AddChooserRow | Adds a row with its result. |
| SetChooserTagCell, SetChooserBoolCell, SetChooserEnumCell, SetChooserFloatCell, SetChooserObjectCell | Set one cell. |
| GetChooserFloatCell, GetChooserColumnCount | Read a cell, count columns. |
| ClearChooserTable | Empties the rows and columns but keeps the asset, so everything that uses it still does. |
| FinishChooserTable | Compiles and saves the table. Call it when you're done. |
| RebindChooser | Re-points a Chooser Table (and every table inside it) to other struct or class types, renaming its bindings to match. |
| CopyChooserOutputValues | Copies every Output Struct column's values from one table into a re-pointed copy of it. |
import unreal
lib = unreal.WCAnimAssetLibrary
for path in unreal.EditorAssetLibrary.list_assets("/Game/Animations/Locomotion", recursive=True):
asset = unreal.load_asset(path)
if isinstance(asset, unreal.AnimSequence):
if lib.add_distance_curve(asset, "Distance"):
print("Added a distance curve to", asset.get_name())
import unreal
lib = unreal.WCAnimAssetLibrary
skeleton = unreal.load_asset("/Game/Characters/Mannequins/Meshes/SK_Mannequin")
clips = [
unreal.load_asset("/Game/Animations/Dodge_F"),
unreal.load_asset("/Game/Animations/Dodge_L"),
unreal.load_asset("/Game/Animations/Dodge_R"),
]
montage = lib.create_sectioned_montage(
"/Game/Animations/AM_Dodges", skeleton, clips,
["Forward", "Left", "Right"], "DefaultSlot")
if montage:
unreal.EditorAssetLibrary.save_loaded_asset(montage)
<aside> ๐ก
Change the paths to match your own project. Package Path is always the folder and the new asset's name together, for example /Game/Animations/AM_Dodges.
</aside>
โ Previous: 12. Bone Profiles ยท ๐ WC Animation Tools