2019-12-26 15:33:43 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
# include "AnimGraphNode_LayeredBoneBlend.h"
2019-09-10 11:35:20 -04:00
# include "ToolMenus.h"
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
# include "Kismet2/BlueprintEditorUtils.h"
2014-03-14 14:13:41 -04:00
2021-01-25 08:43:19 -04:00
# include "AnimGraphCommands.h"
2014-03-14 14:13:41 -04:00
# include "ScopedTransaction.h"
2020-11-20 15:02:56 -04:00
# include "DetailLayoutBuilder.h"
# include "Kismet2/CompilerResultsLog.h"
2022-09-14 05:55:52 -04:00
# include "UObject/UE5ReleaseStreamObjectVersion.h"
2014-03-14 14:13:41 -04:00
/////////////////////////////////////////////////////
// UAnimGraphNode_LayeredBoneBlend
2014-04-23 18:30:37 -04:00
# define LOCTEXT_NAMESPACE "A3Nodes"
2014-10-14 10:29:11 -04:00
UAnimGraphNode_LayeredBoneBlend : : UAnimGraphNode_LayeredBoneBlend ( const FObjectInitializer & ObjectInitializer )
: Super ( ObjectInitializer )
2014-03-14 14:13:41 -04:00
{
2014-11-06 15:00:42 -05:00
Node . AddPose ( ) ;
2014-03-14 14:13:41 -04:00
}
FLinearColor UAnimGraphNode_LayeredBoneBlend : : GetNodeTitleColor ( ) const
{
return FLinearColor ( 0.2f , 0.8f , 0.2f ) ;
}
2014-09-03 18:14:09 -04:00
FText UAnimGraphNode_LayeredBoneBlend : : GetTooltipText ( ) const
2014-03-14 14:13:41 -04:00
{
2014-09-03 18:14:09 -04:00
return LOCTEXT ( " AnimGraphNode_LayeredBoneBlend_Tooltip " , " Layered blend per bone " ) ;
2014-03-14 14:13:41 -04:00
}
2014-04-23 18:30:37 -04:00
FText UAnimGraphNode_LayeredBoneBlend : : GetNodeTitle ( ENodeTitleType : : Type TitleType ) const
2014-03-14 14:13:41 -04:00
{
2014-04-23 18:30:37 -04:00
return LOCTEXT ( " AnimGraphNode_LayeredBoneBlend_Title " , " Layered blend per bone " ) ;
2014-03-14 14:13:41 -04:00
}
2020-11-20 15:02:56 -04:00
void UAnimGraphNode_LayeredBoneBlend : : PostEditChangeProperty ( struct FPropertyChangedEvent & PropertyChangedEvent )
{
const FName PropertyName = ( PropertyChangedEvent . Property ? PropertyChangedEvent . Property - > GetFName ( ) : NAME_None ) ;
// Reconstruct node to show updates to PinFriendlyNames.
if ( PropertyName = = GET_MEMBER_NAME_STRING_CHECKED ( FAnimNode_LayeredBoneBlend , BlendMode ) )
{
// If we change blend modes, we need to resize our containers
2021-11-30 12:15:54 -05:00
FScopedTransaction Transaction ( LOCTEXT ( " ChangeBlendMode " , " Change Blend Mode " ) ) ;
Modify ( ) ;
const int32 NumPoses = Node . BlendPoses . Num ( ) ;
if ( Node . BlendMode = = ELayeredBoneBlendMode : : BlendMask )
{
Node . LayerSetup . Reset ( ) ;
Node . BlendMasks . SetNum ( NumPoses ) ;
}
else
{
Node . BlendMasks . Reset ( ) ;
Node . LayerSetup . SetNum ( NumPoses ) ;
}
2020-11-20 15:02:56 -04:00
FBlueprintEditorUtils : : MarkBlueprintAsStructurallyModified ( GetBlueprint ( ) ) ;
}
Super : : PostEditChangeProperty ( PropertyChangedEvent ) ;
}
2014-03-14 14:13:41 -04:00
FString UAnimGraphNode_LayeredBoneBlend : : GetNodeCategory ( ) const
{
2022-06-15 10:37:36 -04:00
return TEXT ( " Animation|Blends " ) ;
2014-03-14 14:13:41 -04:00
}
2020-11-20 15:02:56 -04:00
void UAnimGraphNode_LayeredBoneBlend : : CustomizeDetails ( IDetailLayoutBuilder & DetailBuilder )
{
TSharedRef < IPropertyHandle > NodeHandle = DetailBuilder . GetProperty ( FName ( TEXT ( " Node " ) ) , GetClass ( ) ) ;
if ( Node . BlendMode ! = ELayeredBoneBlendMode : : BranchFilter )
{
DetailBuilder . HideProperty ( NodeHandle - > GetChildHandle ( GET_MEMBER_NAME_CHECKED ( FAnimNode_LayeredBoneBlend , LayerSetup ) ) ) ;
}
if ( Node . BlendMode ! = ELayeredBoneBlendMode : : BlendMask )
{
DetailBuilder . HideProperty ( NodeHandle - > GetChildHandle ( GET_MEMBER_NAME_CHECKED ( FAnimNode_LayeredBoneBlend , BlendMasks ) ) ) ;
}
Super : : CustomizeDetails ( DetailBuilder ) ;
}
void UAnimGraphNode_LayeredBoneBlend : : PreloadRequiredAssets ( )
{
// Preload our blend profiles in case they haven't been loaded by the skeleton yet.
if ( Node . BlendMode = = ELayeredBoneBlendMode : : BlendMask )
{
int32 NumBlendMasks = Node . BlendMasks . Num ( ) ;
for ( int32 MaskIndex = 0 ; MaskIndex < NumBlendMasks ; + + MaskIndex )
{
UBlendProfile * BlendMask = Node . BlendMasks [ MaskIndex ] ;
PreloadObject ( BlendMask ) ;
}
}
Super : : PreloadRequiredAssets ( ) ;
}
2014-03-14 14:13:41 -04:00
void UAnimGraphNode_LayeredBoneBlend : : AddPinToBlendByFilter ( )
{
2014-04-23 18:30:37 -04:00
FScopedTransaction Transaction ( LOCTEXT ( " AddPinToBlend " , " AddPinToBlendByFilter " ) ) ;
2014-03-14 14:13:41 -04:00
Modify ( ) ;
Node . AddPose ( ) ;
ReconstructNode ( ) ;
FBlueprintEditorUtils : : MarkBlueprintAsStructurallyModified ( GetBlueprint ( ) ) ;
}
void UAnimGraphNode_LayeredBoneBlend : : RemovePinFromBlendByFilter ( UEdGraphPin * Pin )
{
2014-04-23 18:30:37 -04:00
FScopedTransaction Transaction ( LOCTEXT ( " RemovePinFromBlend " , " RemovePinFromBlendByFilter " ) ) ;
2014-03-14 14:13:41 -04:00
Modify ( ) ;
2019-12-13 11:07:03 -05:00
FProperty * AssociatedProperty ;
2014-03-14 14:13:41 -04:00
int32 ArrayIndex ;
GetPinAssociatedProperty ( GetFNodeType ( ) , Pin , /*out*/ AssociatedProperty , /*out*/ ArrayIndex ) ;
if ( ArrayIndex ! = INDEX_NONE )
{
//@TODO: ANIMREFACTOR: Need to handle moving pins below up correctly
// setting up removed pins info
RemovedPinArrayIndex = ArrayIndex ;
Node . RemovePose ( ArrayIndex ) ;
ReconstructNode ( ) ;
FBlueprintEditorUtils : : MarkBlueprintAsStructurallyModified ( GetBlueprint ( ) ) ;
}
}
2019-09-10 11:35:20 -04:00
void UAnimGraphNode_LayeredBoneBlend : : GetNodeContextMenuActions ( UToolMenu * Menu , UGraphNodeContextMenuContext * Context ) const
2014-03-14 14:13:41 -04:00
{
2019-09-10 11:35:20 -04:00
if ( ! Context - > bIsDebugging )
2014-03-14 14:13:41 -04:00
{
{
2019-09-10 11:35:20 -04:00
FToolMenuSection & Section = Menu - > AddSection ( " AnimGraphNodeLayeredBoneblend " , LOCTEXT ( " LayeredBoneBlend " , " Layered Bone Blend " ) ) ;
if ( Context - > Pin ! = NULL )
2014-03-14 14:13:41 -04:00
{
// we only do this for normal BlendList/BlendList by enum, BlendList by Bool doesn't support add/remove pins
2019-09-10 11:35:20 -04:00
if ( Context - > Pin - > Direction = = EGPD_Input )
2014-03-14 14:13:41 -04:00
{
//@TODO: Only offer this option on arrayed pins
2021-01-25 08:43:19 -04:00
Section . AddMenuEntry ( FAnimGraphCommands : : Get ( ) . RemoveBlendListPin ) ;
2014-03-14 14:13:41 -04:00
}
}
else
{
2021-01-25 08:43:19 -04:00
Section . AddMenuEntry ( FAnimGraphCommands : : Get ( ) . AddBlendListPin ) ;
2014-03-14 14:13:41 -04:00
}
}
}
}
2014-04-23 18:30:37 -04:00
2019-04-05 19:59:44 -04:00
void UAnimGraphNode_LayeredBoneBlend : : ValidateAnimNodeDuringCompilation ( class USkeleton * ForSkeleton , class FCompilerResultsLog & MessageLog )
{
UAnimGraphNode_Base : : ValidateAnimNodeDuringCompilation ( ForSkeleton , MessageLog ) ;
2020-11-20 15:02:56 -04:00
bool bCompilationError = false ;
// Validate blend masks
if ( Node . BlendMode = = ELayeredBoneBlendMode : : BlendMask )
{
int32 NumBlendMasks = Node . BlendMasks . Num ( ) ;
for ( int32 MaskIndex = 0 ; MaskIndex < NumBlendMasks ; + + MaskIndex )
{
const UBlendProfile * BlendMask = Node . BlendMasks [ MaskIndex ] ;
2022-09-22 17:40:51 -04:00
if ( BlendMask = = nullptr & & ! GetAnimBlueprint ( ) - > bIsTemplate )
2020-11-20 15:02:56 -04:00
{
MessageLog . Error ( * FText : : Format ( LOCTEXT ( " LayeredBlendNullMask " , " @@ has null BlendMask for Blend Pose {0}. " ) , FText : : AsNumber ( MaskIndex ) ) . ToString ( ) , this , BlendMask ) ;
bCompilationError = true ;
}
2022-09-22 17:40:51 -04:00
if ( BlendMask & & BlendMask - > Mode ! = EBlendProfileMode : : BlendMask )
2020-11-20 15:02:56 -04:00
{
MessageLog . Error ( * FText : : Format ( LOCTEXT ( " LayeredBlendProfileModeError " , " @@ is using a BlendProfile(@@) without a BlendMask mode for Blend Pose {0}. " ) , FText : : AsNumber ( MaskIndex ) ) . ToString ( ) , this , BlendMask ) ;
bCompilationError = true ;
}
}
}
// Don't rebuild the node's data if compilation failed. We may be attempting to do so with invalid data.
if ( bCompilationError )
{
return ;
}
2021-05-26 07:55:41 -04:00
// ensure to cache the per-bone blend weights
if ( ! Node . ArePerBoneBlendWeightsValid ( ForSkeleton ) )
2019-04-05 19:59:44 -04:00
{
2021-05-26 07:55:41 -04:00
Node . RebuildPerBoneBlendWeights ( ForSkeleton ) ;
2019-04-05 19:59:44 -04:00
}
}
2022-09-14 05:55:52 -04:00
void UAnimGraphNode_LayeredBoneBlend : : Serialize ( FArchive & Ar )
{
Super : : Serialize ( Ar ) ;
Ar . UsingCustomVersion ( FUE5ReleaseStreamObjectVersion : : GUID ) ;
if ( Ar . IsLoading ( ) & & Ar . CustomVer ( FUE5ReleaseStreamObjectVersion : : GUID ) < FUE5ReleaseStreamObjectVersion : : AnimLayeredBoneBlendMasks )
{
if ( Node . BlendMode = = ELayeredBoneBlendMode : : BlendMask & & Node . BlendMasks . Num ( ) ! = Node . BlendPoses . Num ( ) )
{
Node . BlendMasks . SetNum ( Node . BlendPoses . Num ( ) ) ;
}
}
}
2022-09-26 15:20:12 -04:00
void UAnimGraphNode_LayeredBoneBlend : : PostLoad ( )
{
Super : : PostLoad ( ) ;
// Post-load our blend masks, in case they've been pre-loaded, but haven't had their bone references initialized yet.
if ( Node . BlendMode = = ELayeredBoneBlendMode : : BlendMask )
{
int32 NumBlendMasks = Node . BlendMasks . Num ( ) ;
for ( int32 MaskIndex = 0 ; MaskIndex < NumBlendMasks ; + + MaskIndex )
{
2022-10-11 11:17:52 -04:00
if ( UBlendProfile * BlendMask = Node . BlendMasks [ MaskIndex ] )
{
BlendMask - > ConditionalPostLoad ( ) ;
}
2022-09-26 15:20:12 -04:00
}
}
}
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
# undef LOCTEXT_NAMESPACE