UE4 Custom Animation Blueprint node 自定义动画蓝图节点

Posted lynnvon

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UE4 Custom Animation Blueprint node 自定义动画蓝图节点相关的知识,希望对你有一定的参考价值。

  部分内容参考:https://www.cnblogs.com/corgi/p/5405453.html

  本文章地址:https://www.cnblogs.com/LynnVon/p/13334523.html

  当我按照文章做完之后,editor模式下完全没问题,Standalone模式下也没问题,就是shipping、Development打包时,报以下错误:Non-editor build cannot depend on non-redistributable modules。

  这是由于AnimGraphNode_SkeletalControlBase.h或者说AnimGraphNode所在的AnimGraph Module是Editor Module,Editor Module是不能shipping打包的,只有Runtime Module才可以shipping打包。

  解决思路是将所有自定义AnimGraphNode全部放到Editor Module,而我们的项目默认只有Runtime Module,所以得新建一个Editor Module。

  1.修改.uproject文件,添加Editor Module

 "Modules": [
    {
      "Name": "FlightSim",
      "Type": "Runtime",
      "LoadingPhase": "Default",
      "AdditionalDependencies": [
        "Engine",
        "UMG",
        "CoreUObject"
      ]
    },
    {
      "Name": "FlightSimEditor",
      "Type": "Editor",
      "LoadingPhase": "Default",
      "AdditionalDependencies": [
        "Engine",
        "CoreUObject"
      ]
    }
  ]

  2.在source文件夹新建FlightSimEditor文件夹

  技术图片

  3.在FlightSimEditor文件夹新建FlightSimEditor.Build.cs、FlightSimEditor.h、FlightSimEditor.cpp文件

  技术图片

  FlightSimEditor.Build.cs  

using UnrealBuildTool;

public class FlightSimEditor : ModuleRules
{
    public FlightSimEditor(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
        
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject",
            "Engine","AnimGraph","BlueprintGraph","FlightSim"});  //添加AnimGraph BlueprintGraph模块,还有本项目的runtime module FlightSim
     
    }
}

  FlightSimEditor.h

#pragma once

#include "Engine.h"
#include "ModuleManager.h"
#include "UnrealEd.h"

class FFlightSimEditorModule:public IModuleInterface
{

};

  FlightSimEditor.cpp

#include "FlightSimEditor.h"

IMPLEMENT_GAME_MODULE(FFlightSimEditorModule,FlightSimEditor)

  

  4.在原FlightSim文件夹中新建FlightSimEditor.Target.cs文件

  技术图片

 

  FlightSimEditor.Target.cs

using UnrealBuildTool;
using System.Collections.Generic;

public class FlightSimEditorTarget : TargetRules
{
	public FlightSimEditorTarget(TargetInfo Target) : base(Target)
	{
		Type = TargetType.Editor;

		ExtraModuleNames.AddRange( new string[] { "FlightSim" ,"FlightSimEditor"} );
	}
}

  

  5.在FlightSim.Build.cs添加AnimGraphRuntime Module

  FlightSim.Build.cs 

using UnrealBuildTool;

public class FlightSim : ModuleRules
{
    public FlightSim(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
        bEnableExceptions = true;
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject",
            "Engine", "InputCore", "Http", "Json", "JsonUtilities",
            "CryptoPP","OnlineSubsystemUtils", "EasyFM" ,
            "HeadMountedDisplay","Landscape" ,"RenderCore",
            "AnimGraphRuntime"});//添加AnimGraphRuntime
PrivateDependencyModuleNames.AddRange(new string[] { "ImageWrapper", }); // Uncomment if you are using Slate UI PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

  6.将自定义的AnimGraphNode置于FlightSimEditor Module下,在Editor时加载,Runtime时不加载(打包)

  7.完成,shipping打包,ok

 

以上是关于UE4 Custom Animation Blueprint node 自定义动画蓝图节点的主要内容,如果未能解决你的问题,请参考以下文章

u3d里animator,animation有啥区别 吗

如何在UE4材质中判断物体是否开启了渲染Custom Depth Pass?

Ue4_UEnum枚举类型

[cocos2d-x]-会动的精灵

2D Procedural Animation小试:尾巴,翅膀,触手等等

2D Procedural Animation小试:尾巴,翅膀,触手等等