Create animation graph nodes?

I am trying to set up custom anim graph nodes, and am struggling. The docs and every tutorial I can find:

Are outdated. In 4.12, the FAnimNode_Base class seems to have been replaced with: FAnimInstanceProxy, and neither of these are in the ‘create new c++ class’ list…

And this, I think, voids all the docs. What do I need to change in the above guides, to get custom anim nodes?

Ah, I was missing the #include myGraphNode.h. It seems with this, the FAnimNode_Base can still be used.

Any chance you could share how you were able to achieve this? I’m running through the links you posted trying to create an anim graph node and I’m running into lots of problems. Currently FBoneReference is not a blueprint type so I’m not sure how to expose that parameter.

Sure! These are the files I use:

AnimGraphNode_NAME.cpp:

// Fill out your copyright notice in the Description page of Project Settings.

#include "YOUR_PLUGIN.h"
#include "AnimGraphNode_DataStream.h"



UAnimGraphNode_DataStream::UAnimGraphNode_DataStream(const class FObjectInitializer& PCIP)
	: Super(PCIP)
{
}

FText UAnimGraphNode_DataStream::GetNodeTitle(ENodeTitleType::Type TitleType) const
{
	return FText::FromString(FString::Printf(TEXT("NodeTitle.")));
}

FLinearColor UAnimGraphNode_DataStream::GetNodeTitleColor() const
{
	return FLinearColor(0.75f, 0.75f, 0.75f);
}

FText UAnimGraphNode_DataStream::GetTooltipText() const
{
	return FText::FromString(TEXT("ToolTipHere"));
}

FString UAnimGraphNode_DataStream::GetNodeCategory() const
{
	return FString("Category");
}

AnimNode_NAME.cpp

#include "YOUR_PLUGIN.h"
#include "Runtime/Engine/Public/Animation/AnimInstanceProxy.h"
#include "AnimNode_DataStream.h"


FAnimNode_NAME::FAnimNode_NAME()
{
}

FAnimNode_NAME::~FAnimNode_NAME()
{
	
}

void FAnimNode_NAME::Initialize(const FAnimationInitializeContext& Context)
{
	// Forward to the incoming pose link.
	check(Context.AnimInstanceProxy != nullptr);

	//init the datastream
	

    InPose.Initialize(Context);
  
}
TArray<FTransform> inPoses;
void FAnimNode_NAME::Update(const FAnimationUpdateContext& Context)
{
	//this function should grab the data that you want on the skeleton and bind it.
	
	
	//get input skelton Transforms and store
	inPoses.Empty();
	inPoses = Context.AnimInstanceProxy->GetSkelMeshComponent()->BoneSpaceTransforms;

	InPose.Update(Context);
	EvaluateGraphExposedInputs.Execute(Context);
}

void FAnimNode_NAME::Evaluate(FPoseContext& Output)
{
	check(Output.AnimInstanceProxy->GetSkeleton() != nullptr);
	InPose.Evaluate(Output);
	
	
	//TempBones here is the output pose. 
	
	TArray<FTransform> TempBones = Output.Pose.GetBoneContainer().GetRefPoseArray();
	
	TempBones[i].SetLocation(tmpV);
	
		

  Output.Pose.CopyBonesFrom( TempBones );
 
	return;
}

void FAnimNode_NAME::CacheBones(const FAnimationCacheBonesContext & Context)
{
	InPose.CacheBones(Context);
}

AnimGraphNode_NAME.h

    #include "AnimNode_NAME.h"
    #include "AnimGraphNode_Base.h"
    #include "AnimGraphNode_NAME.generated.h"
    
    /**
     * 
     */
    UCLASS(MinimalAPI)
    class AnimGraphNode_NAME : public UAnimGraphNode_Base
    {
    	GENERATED_UCLASS_BODY()


//THIS IS CRUCIAL, 

    		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Settings)
    		FAnimNode_NAME Node;
    
    #if WITH_EDITOR
    	// UEdGraphNode interface
    	virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
    	virtual FLinearColor GetNodeTitleColor() const override;
    	virtual FText GetTooltipText() const override;
    	virtual FString GetNodeCategory() const override;
    	// End of UEdGraphNode interface
    #endif
    	
    };

AnimNode_NAME.h

   #pragma once
    
    #include "Animation/AnimNodeBase.h"
    //#include "AnimGraphNode_NAME.h"
    #include "SkeletonBinding.h"
    #include "AnimNode_NAME.generated.h"
    
    USTRUCT()
    struct FAnimNode_NAME : public FAnimNode_Base
    {
    	GENERATED_USTRUCT_BODY()
    
    public:
    	// The input pose is segmented into two:
    	// - The FK input pose that serves as a bias for the solver.
    	// - The task targets appended at the end.
    	//UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Links)
    	UPROPERTY(Transient)
    	FPoseLink InPose;
    
//these are boxes that show on the graph node

    	UPROPERTY(EditAnywhere, Category=Server, meta=(PinShownByDefault))
    	FString ServerName;
    
    	UPROPERTY(EditAnywhere, Category=Server,meta=(PinShownByDefault))
    	FString PortNumber;
    
    
    
    public:	
    
    	FAnimNode_DataStream();
    	~FAnimNode_DataStream();
    	
    
    	
    	// FAnimNode_Base interface
    	virtual void Initialize(const FAnimationInitializeContext& Context) override;
    	virtual void Update(const FAnimationUpdateContext& Context) override;
    	virtual void Evaluate(FPoseContext& Output) override;
    	virtual void CacheBones(const FAnimationCacheBonesContext & Context) override;
    	// End of FAnimNode_Base interface
    
    private:
    	bool DoReconnect;
    };

Hope that helps! :slight_smile:

I am also trying to use those tutorials in 4.18 or 4.19 and cant get them to work. I tried your code here and UE4 cant find “AnimNode_DataStream” Has this been replaced in newer versions with something else?

Heya, that is the name of my class. In the above example, that should be: #include "AnimNode_NAME.h"

Hi,
I’m still interested in this topic

I want to create a simple Anim Graph in C++, it can be as simple as an IDLE animation node connected to FINAL ANIMATION POSE via DEFAULTSLOT node