C++
UTakeForgeLibrary is exported from the TakeForgeEditor module (public
header, TAKEFORGEEDITOR_API), so editor C++ code can call it directly -
useful when TakeForge is one step in a bigger asset pipeline.
Setup
Your calling module must itself be editor-only (module Type of Editor
in the .uplugin, or an editor target) - TakeForgeEditor never exists in
packaged builds.
// MyEditorTools.Build.cs
PrivateDependencyModuleNames.Add("TakeForgeEditor");
Add the plugin to your project's .uproject/.uplugin dependencies so it
loads before your module:
"Plugins": [ { "Name": "TakeForge", "Enabled": true } ]
Calling
#include "TakeForgeLibrary.h"
void FMyPipeline::ProcessTake(UAnimSequence* Sequence)
{
bool bOk = false;
FString Error;
UTakeForgeLibrary::ApplyRootMotion(Sequence, ETakeForgeMode::SmoothedRootMotion, bOk, Error);
if (!bOk)
{
UE_LOG(LogMyPipeline, Warning, TEXT("%s: %s"), *Sequence->GetName(), *Error);
return;
}
UTakeForgeLibrary::MakeLoopable(Sequence, bOk, Error);
}
All functions are static; the bone-based actions take TArray<FName> and
Smooth Bones takes TArray<FIntPoint> frame windows:
bool bOk = false;
FString Error;
UTakeForgeLibrary::IsolateBones(Sequence, { TEXT("clavicle_l"), TEXT("clavicle_r") },
/*bOthersHoldFirstFrame*/ false, bOk, Error);
UTakeForgeLibrary::SmoothBones(Sequence, { TEXT("hand_r") },
{ FIntPoint(120, 180) }, /*SmoothingFrames*/ 4.0f, /*BlendFrames*/ 5.0f, bOk, Error);
Notes
- Functions modify the given asset in place and open an editor transaction -
wrap your own multi-step pipelines in an outer
FScopedTransactionif you want them to undo as one step. - Settings (pelvis bone, smoothing, markers, forward axis) are read from
UTakeForgeSettings(Editor Preferences) at call time. - Success is a
bool&out parameter rather than the return value, so Unreal's Python binding can hand the error message back on failure instead of discarding it. Aboolreturn is consumed as a success flag by the binding, which returnsNoneand drops every out parameter with it.