2016-01-07 08:17:16 -05:00
|
|
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-06-10 10:57:15 -04:00
|
|
|
#include "BoneControllers/AnimNode_ModifyBone.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "AnimationRuntime.h"
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// FAnimNode_ModifyBone
|
|
|
|
|
|
|
|
|
|
FAnimNode_ModifyBone::FAnimNode_ModifyBone()
|
|
|
|
|
: Translation(FVector::ZeroVector)
|
|
|
|
|
, Rotation(FRotator::ZeroRotator)
|
|
|
|
|
, Scale(FVector(1.0f))
|
|
|
|
|
, TranslationMode(BMM_Ignore)
|
|
|
|
|
, RotationMode(BMM_Ignore)
|
|
|
|
|
, ScaleMode(BMM_Ignore)
|
|
|
|
|
, TranslationSpace(BCS_ComponentSpace)
|
|
|
|
|
, RotationSpace(BCS_ComponentSpace)
|
|
|
|
|
, ScaleSpace(BCS_ComponentSpace)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-23 18:35:21 -04:00
|
|
|
void FAnimNode_ModifyBone::GatherDebugData(FNodeDebugData& DebugData)
|
|
|
|
|
{
|
|
|
|
|
FString DebugLine = DebugData.GetNodeName(this);
|
|
|
|
|
|
|
|
|
|
DebugLine += "(";
|
|
|
|
|
AddDebugNodeData(DebugLine);
|
|
|
|
|
DebugLine += FString::Printf(TEXT(" Target: %s)"), *BoneToModify.BoneName.ToString());
|
|
|
|
|
DebugData.AddDebugItem(DebugLine);
|
|
|
|
|
|
|
|
|
|
ComponentPose.GatherDebugData(DebugData);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-19 06:19:22 -04:00
|
|
|
void FAnimNode_ModifyBone::EvaluateBoneTransforms(USkeletalMeshComponent* SkelComp, FCSPose<FCompactPose>& MeshBases, TArray<FBoneTransform>& OutBoneTransforms)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
check(OutBoneTransforms.Num() == 0);
|
|
|
|
|
|
|
|
|
|
// the way we apply transform is same as FMatrix or FTransform
|
|
|
|
|
// we apply scale first, and rotation, and translation
|
2015-05-19 06:19:22 -04:00
|
|
|
// if you'd like to translate first, you'll need two nodes that first node does translate and second nodes to rotate.
|
Copying //UE4/Dev-Framework to //UE4/Dev-Main (Source: //UE4/Dev-Framework @ 2964666)
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2945310 on 2016/04/15 by Jon.Nabozny
Fix UI locking Angular Rotation Offset for PhysicsConstraintComponents when the motion is for axes is Free or Locked.
#JIRA UE-29368
Change 2945490 on 2016/04/15 by Jon.Nabozny
Remove extraneous changes introduced in CL-2945310.
Change 2946706 on 2016/04/18 by James.Golding
Checkin of slice test assets
Change 2947895 on 2016/04/19 by Benn.Gallagher
PR #2292: Use ref instead of copy in FAnimNode_ModifyBone::EvaluateBoneTransforms (Contributed by MiKom)
#jira UE-29567
Change 2947944 on 2016/04/19 by Benn.Gallagher
Fixed a few extra needless bone container copies
Change 2948279 on 2016/04/19 by Marc.Audy
Add well defined Map and Set Property names
Change 2948280 on 2016/04/19 by Marc.Audy
Properly name parameters
Change 2948792 on 2016/04/19 by Marc.Audy
Remove unused ini class name settings
Change 2948917 on 2016/04/19 by Aaron.McLeran
UE-29654 FadeIn invalidates Audio Components in 4.11
Change 2949567 on 2016/04/20 by James.Golding
- Add SliceProceduralMesh utility to UKismetProceduralMeshLibrary. It will slice the ProcMeshComp with a plan, including simple collision geom, and optionally create cap geometry, and create an addition ProceduralMeshComponent for the other half
- Add support for simple collision on ProceduralMeshComponent, and added bUseComplexAsSimpleCollision to allow it to be used
- Move GeomTools.h and .cpp from Editor to Engine module, so it can be used at runtime. Also move utils into an FGeomTools namespace.
- Add GetSectionFromStaticMesh and CopyProceduralMeshFromStaticMeshComponent utilities to UKismetProceduralMeshLibrary
- Expose UStaticMesh::GetNumLODs to BP, and add BP exposed UStaticMesh:: GetNumSections function
Change 2950482 on 2016/04/20 by Aaron.McLeran
FORT-22973 SoundMix Fade Time not fading audio properly
- Bug was due to bApplyToChildren case where the FSoundClassAdjuster wasn't getting the interpolated value before calling RecursiveApplyAdjuster in the case of non-overriden sound mixes.
Change 2951102 on 2016/04/21 by Thomas.Sarkanen
Un-deprecated blueprint functions for attachment/detachment
Renamed functions to <FuncName> (Deprecated).
Hid functions in the BP context menu so new ones cant be added.
#jira UE-23216 - "Snap to Target, Keep World Scale" when attaching doesn't work properly if parent is scaled.
Change 2951173 on 2016/04/21 by James.Golding
Fix cap geom generation when more than one polygon is generated
Fix CIS warning in KismetProceduralMeshLibrary.cpp
Change 2951334 on 2016/04/21 by Osman.Tsjardiwal
Add CapMaterial param to SliceProceduralMesh util
Change 2951528 on 2016/04/21 by Marc.Audy
Fix spelling errors in comments
Change 2952933 on 2016/04/22 by Lukasz.Furman
fixed behavior tree getting stuck on instantly finished gameplay tasks
copy of CL# 2952930
Change 2953948 on 2016/04/24 by James.Golding
Put #if WITH_EDITOR back into FPoly::Triangulate to fix non-editor builds (FPoly::Finalize not available in non-editor)
Change 2954558 on 2016/04/25 by Marc.Audy
Make USceneComponent::Attach* members private and remove deprecation messages and pragmas disabling/enabling deprecation throughout SceneComponent.h/cpp
#jira UE-29038
Change 2954865 on 2016/04/25 by Aaron.McLeran
UE-29763 Use HMD audio device only in VR preview mode, not for other PIE session types.
Change 2955009 on 2016/04/25 by Zak.Middleton
#ue4 - Wrap call from UCharacterMovementComponent::PostPhysicsTickComponent() to UpdateBasedMovement() in a FScopedMovementUpdate to accumulate moves with better perf.
Change 2955878 on 2016/04/26 by Benn.Gallagher
[Epic Friday] - Added spherical constraints to anim dynamics
Change 2956380 on 2016/04/26 by Lina.Halper
PR #2298: Step interpolation for UAnimSequence (Contributed by douglaslassance)
Change 2956383 on 2016/04/26 by Lina.Halper
Fixed to match coding standard
Change 2957866 on 2016/04/27 by Zak.Middleton
#ue4 - Add max depenetration distance settings for CharacterMovementComponent. Add controls to throttle logging when character is stuck in geometry so it doesn't spam the log.
- Depenetration settings are separated based on whether overlapping a Pawn versus other geometry, and furthermore by whether the Character is a proxy or not. Simulated proxies typically should not depenetrate a large amount because that effectively ignores the server authoritative location update.
- "Stuck" logging is controlled by the console var "p.CharacterStuckWarningPeriod". Set to number of seconds between logged events, or less than zero to disable logging.
#tests QA-Surfaces multiplayer, walking in to moving objects and pawns.
Change 2957953 on 2016/04/27 by Aaron.McLeran
UE-30018 Fixing up audio component ref-counting to prevent triggering notifications when an audio component is still active after a sound finishes playing.
Change 2958011 on 2016/04/27 by Jon.Nabozny
CalcAABB wasn't properly accounting for current transform on Convex elements, causing bad results.
#JIRA UE-29525
Change 2958321 on 2016/04/27 by Lukasz.Furman
path following update pass, added flags to request result, fixed AITask stacking vs scripted/BP move requests
Change 2959506 on 2016/04/28 by Aaron.McLeran
PR #2330: Fix for ambient sounds not stopping when active and told to play again (Contributed by hgamiel)
Change 2959686 on 2016/04/28 by Marc.Audy
Correctly handle multiple viewpoints when significance is being sorted descending
Change 2959773 on 2016/04/28 by Marc.Audy
Fix shadowing warning
Change 2959785 on 2016/04/28 by Aaron.McLeran
UE-30083 Sound concatenator node doesn't progress if child nodes don't produce wave instances
Change 2960852 on 2016/04/29 by Marc.Audy
Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 2960738
Change 2960946 on 2016/04/29 by Marc.Audy
Fix post merge compile error
Change 2962501 on 2016/05/02 by Marc.Audy
Remove interim GetMutableAttach accessors and use the variables directly now that they are private
Change 2962535 on 2016/05/02 by Marc.Audy
Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 2962478
Change 2962578 on 2016/05/02 by Marc.Audy
Switch ObjectGraphMove to using UserFlags instead of custom move data
Change 2962651 on 2016/05/02 by Marc.Audy
VS2015 shadow variable fixes
Change 2962662 on 2016/05/02 by Lukasz.Furman
deprecated old implementation of gameplay debugger
#jira UE-30011
Change 2962919 on 2016/05/02 by Marc.Audy
VS2015 shadow variable fixes
Change 2963475 on 2016/05/02 by Mieszko.Zielinski
Made SimpleMoveToLocation/Actor not reset velocity if agent not already at goal #UE4
#jira UE-30176
Change 2964098 on 2016/05/03 by Marc.Audy
Spelling fix
Change 2964099 on 2016/05/03 by Marc.Audy
VS2015 shadow variable fixes
Change 2964156 on 2016/05/03 by Marc.Audy
VS2015 shadow variable fixes
Change 2964272 on 2016/05/03 by Marc.Audy
VS2015 Shadow Variable fixes
Change 2964395 on 2016/05/03 by Marc.Audy
VS2015 Shadow Variable Fixes
Change 2964460 on 2016/05/03 by Marc.Audy
Reschedule coolingdown tick functions during pause frames.
#jira UE-30221
Change 2964666 on 2016/05/03 by Marc.Audy
Fix shipping compile error
[CL 2964775 by Marc Audy in Main branch]
2016-05-03 15:44:33 -04:00
|
|
|
const FBoneContainer& BoneContainer = MeshBases.GetPose().GetBoneContainer();
|
2015-05-19 06:19:22 -04:00
|
|
|
|
|
|
|
|
FCompactPoseBoneIndex CompactPoseBoneToModify = BoneToModify.GetCompactPoseIndex(BoneContainer);
|
|
|
|
|
FTransform NewBoneTM = MeshBases.GetComponentSpaceTransform(CompactPoseBoneToModify);
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
if (ScaleMode != BMM_Ignore)
|
|
|
|
|
{
|
|
|
|
|
// Convert to Bone Space.
|
2015-05-19 06:19:22 -04:00
|
|
|
FAnimationRuntime::ConvertCSTransformToBoneSpace(SkelComp, MeshBases, NewBoneTM, CompactPoseBoneToModify, ScaleSpace);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (ScaleMode == BMM_Additive)
|
|
|
|
|
{
|
|
|
|
|
NewBoneTM.SetScale3D(NewBoneTM.GetScale3D() * Scale);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NewBoneTM.SetScale3D(Scale);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert back to Component Space.
|
2015-05-19 06:19:22 -04:00
|
|
|
FAnimationRuntime::ConvertBoneSpaceTransformToCS(SkelComp, MeshBases, NewBoneTM, CompactPoseBoneToModify, ScaleSpace);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (RotationMode != BMM_Ignore)
|
|
|
|
|
{
|
|
|
|
|
// Convert to Bone Space.
|
2015-05-19 06:19:22 -04:00
|
|
|
FAnimationRuntime::ConvertCSTransformToBoneSpace(SkelComp, MeshBases, NewBoneTM, CompactPoseBoneToModify, RotationSpace);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
const FQuat BoneQuat(Rotation);
|
|
|
|
|
if (RotationMode == BMM_Additive)
|
|
|
|
|
{
|
|
|
|
|
NewBoneTM.SetRotation(BoneQuat * NewBoneTM.GetRotation());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NewBoneTM.SetRotation(BoneQuat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert back to Component Space.
|
2015-05-19 06:19:22 -04:00
|
|
|
FAnimationRuntime::ConvertBoneSpaceTransformToCS(SkelComp, MeshBases, NewBoneTM, CompactPoseBoneToModify, RotationSpace);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2015-05-19 06:19:22 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
if (TranslationMode != BMM_Ignore)
|
|
|
|
|
{
|
|
|
|
|
// Convert to Bone Space.
|
2015-05-19 06:19:22 -04:00
|
|
|
FAnimationRuntime::ConvertCSTransformToBoneSpace(SkelComp, MeshBases, NewBoneTM, CompactPoseBoneToModify, TranslationSpace);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (TranslationMode == BMM_Additive)
|
|
|
|
|
{
|
|
|
|
|
NewBoneTM.AddToTranslation(Translation);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NewBoneTM.SetTranslation(Translation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert back to Component Space.
|
2015-05-19 06:19:22 -04:00
|
|
|
FAnimationRuntime::ConvertBoneSpaceTransformToCS(SkelComp, MeshBases, NewBoneTM, CompactPoseBoneToModify, TranslationSpace);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2015-05-19 06:19:22 -04:00
|
|
|
|
|
|
|
|
OutBoneTransforms.Add( FBoneTransform(BoneToModify.GetCompactPoseIndex(BoneContainer), NewBoneTM) );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-10-01 14:45:04 -04:00
|
|
|
bool FAnimNode_ModifyBone::IsValidToEvaluate(const USkeleton* Skeleton, const FBoneContainer& RequiredBones)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// if both bones are valid
|
|
|
|
|
return (BoneToModify.IsValid(RequiredBones));
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-01 14:45:04 -04:00
|
|
|
void FAnimNode_ModifyBone::InitializeBoneReferences(const FBoneContainer& RequiredBones)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
BoneToModify.Initialize(RequiredBones);
|
Copying //UE4/Dev-Framework to //UE4/Dev-Main (Source: //UE4/Dev-Framework @ 2964666)
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2945310 on 2016/04/15 by Jon.Nabozny
Fix UI locking Angular Rotation Offset for PhysicsConstraintComponents when the motion is for axes is Free or Locked.
#JIRA UE-29368
Change 2945490 on 2016/04/15 by Jon.Nabozny
Remove extraneous changes introduced in CL-2945310.
Change 2946706 on 2016/04/18 by James.Golding
Checkin of slice test assets
Change 2947895 on 2016/04/19 by Benn.Gallagher
PR #2292: Use ref instead of copy in FAnimNode_ModifyBone::EvaluateBoneTransforms (Contributed by MiKom)
#jira UE-29567
Change 2947944 on 2016/04/19 by Benn.Gallagher
Fixed a few extra needless bone container copies
Change 2948279 on 2016/04/19 by Marc.Audy
Add well defined Map and Set Property names
Change 2948280 on 2016/04/19 by Marc.Audy
Properly name parameters
Change 2948792 on 2016/04/19 by Marc.Audy
Remove unused ini class name settings
Change 2948917 on 2016/04/19 by Aaron.McLeran
UE-29654 FadeIn invalidates Audio Components in 4.11
Change 2949567 on 2016/04/20 by James.Golding
- Add SliceProceduralMesh utility to UKismetProceduralMeshLibrary. It will slice the ProcMeshComp with a plan, including simple collision geom, and optionally create cap geometry, and create an addition ProceduralMeshComponent for the other half
- Add support for simple collision on ProceduralMeshComponent, and added bUseComplexAsSimpleCollision to allow it to be used
- Move GeomTools.h and .cpp from Editor to Engine module, so it can be used at runtime. Also move utils into an FGeomTools namespace.
- Add GetSectionFromStaticMesh and CopyProceduralMeshFromStaticMeshComponent utilities to UKismetProceduralMeshLibrary
- Expose UStaticMesh::GetNumLODs to BP, and add BP exposed UStaticMesh:: GetNumSections function
Change 2950482 on 2016/04/20 by Aaron.McLeran
FORT-22973 SoundMix Fade Time not fading audio properly
- Bug was due to bApplyToChildren case where the FSoundClassAdjuster wasn't getting the interpolated value before calling RecursiveApplyAdjuster in the case of non-overriden sound mixes.
Change 2951102 on 2016/04/21 by Thomas.Sarkanen
Un-deprecated blueprint functions for attachment/detachment
Renamed functions to <FuncName> (Deprecated).
Hid functions in the BP context menu so new ones cant be added.
#jira UE-23216 - "Snap to Target, Keep World Scale" when attaching doesn't work properly if parent is scaled.
Change 2951173 on 2016/04/21 by James.Golding
Fix cap geom generation when more than one polygon is generated
Fix CIS warning in KismetProceduralMeshLibrary.cpp
Change 2951334 on 2016/04/21 by Osman.Tsjardiwal
Add CapMaterial param to SliceProceduralMesh util
Change 2951528 on 2016/04/21 by Marc.Audy
Fix spelling errors in comments
Change 2952933 on 2016/04/22 by Lukasz.Furman
fixed behavior tree getting stuck on instantly finished gameplay tasks
copy of CL# 2952930
Change 2953948 on 2016/04/24 by James.Golding
Put #if WITH_EDITOR back into FPoly::Triangulate to fix non-editor builds (FPoly::Finalize not available in non-editor)
Change 2954558 on 2016/04/25 by Marc.Audy
Make USceneComponent::Attach* members private and remove deprecation messages and pragmas disabling/enabling deprecation throughout SceneComponent.h/cpp
#jira UE-29038
Change 2954865 on 2016/04/25 by Aaron.McLeran
UE-29763 Use HMD audio device only in VR preview mode, not for other PIE session types.
Change 2955009 on 2016/04/25 by Zak.Middleton
#ue4 - Wrap call from UCharacterMovementComponent::PostPhysicsTickComponent() to UpdateBasedMovement() in a FScopedMovementUpdate to accumulate moves with better perf.
Change 2955878 on 2016/04/26 by Benn.Gallagher
[Epic Friday] - Added spherical constraints to anim dynamics
Change 2956380 on 2016/04/26 by Lina.Halper
PR #2298: Step interpolation for UAnimSequence (Contributed by douglaslassance)
Change 2956383 on 2016/04/26 by Lina.Halper
Fixed to match coding standard
Change 2957866 on 2016/04/27 by Zak.Middleton
#ue4 - Add max depenetration distance settings for CharacterMovementComponent. Add controls to throttle logging when character is stuck in geometry so it doesn't spam the log.
- Depenetration settings are separated based on whether overlapping a Pawn versus other geometry, and furthermore by whether the Character is a proxy or not. Simulated proxies typically should not depenetrate a large amount because that effectively ignores the server authoritative location update.
- "Stuck" logging is controlled by the console var "p.CharacterStuckWarningPeriod". Set to number of seconds between logged events, or less than zero to disable logging.
#tests QA-Surfaces multiplayer, walking in to moving objects and pawns.
Change 2957953 on 2016/04/27 by Aaron.McLeran
UE-30018 Fixing up audio component ref-counting to prevent triggering notifications when an audio component is still active after a sound finishes playing.
Change 2958011 on 2016/04/27 by Jon.Nabozny
CalcAABB wasn't properly accounting for current transform on Convex elements, causing bad results.
#JIRA UE-29525
Change 2958321 on 2016/04/27 by Lukasz.Furman
path following update pass, added flags to request result, fixed AITask stacking vs scripted/BP move requests
Change 2959506 on 2016/04/28 by Aaron.McLeran
PR #2330: Fix for ambient sounds not stopping when active and told to play again (Contributed by hgamiel)
Change 2959686 on 2016/04/28 by Marc.Audy
Correctly handle multiple viewpoints when significance is being sorted descending
Change 2959773 on 2016/04/28 by Marc.Audy
Fix shadowing warning
Change 2959785 on 2016/04/28 by Aaron.McLeran
UE-30083 Sound concatenator node doesn't progress if child nodes don't produce wave instances
Change 2960852 on 2016/04/29 by Marc.Audy
Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 2960738
Change 2960946 on 2016/04/29 by Marc.Audy
Fix post merge compile error
Change 2962501 on 2016/05/02 by Marc.Audy
Remove interim GetMutableAttach accessors and use the variables directly now that they are private
Change 2962535 on 2016/05/02 by Marc.Audy
Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 2962478
Change 2962578 on 2016/05/02 by Marc.Audy
Switch ObjectGraphMove to using UserFlags instead of custom move data
Change 2962651 on 2016/05/02 by Marc.Audy
VS2015 shadow variable fixes
Change 2962662 on 2016/05/02 by Lukasz.Furman
deprecated old implementation of gameplay debugger
#jira UE-30011
Change 2962919 on 2016/05/02 by Marc.Audy
VS2015 shadow variable fixes
Change 2963475 on 2016/05/02 by Mieszko.Zielinski
Made SimpleMoveToLocation/Actor not reset velocity if agent not already at goal #UE4
#jira UE-30176
Change 2964098 on 2016/05/03 by Marc.Audy
Spelling fix
Change 2964099 on 2016/05/03 by Marc.Audy
VS2015 shadow variable fixes
Change 2964156 on 2016/05/03 by Marc.Audy
VS2015 shadow variable fixes
Change 2964272 on 2016/05/03 by Marc.Audy
VS2015 Shadow Variable fixes
Change 2964395 on 2016/05/03 by Marc.Audy
VS2015 Shadow Variable Fixes
Change 2964460 on 2016/05/03 by Marc.Audy
Reschedule coolingdown tick functions during pause frames.
#jira UE-30221
Change 2964666 on 2016/05/03 by Marc.Audy
Fix shipping compile error
[CL 2964775 by Marc Audy in Main branch]
2016-05-03 15:44:33 -04:00
|
|
|
}
|