Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Private/AnimGraphNode_ModifyBone.cpp

336 lines
10 KiB
C++
Raw Normal View History

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "AnimGraphPrivatePCH.h"
#include "AnimGraphNode_ModifyBone.h"
#include "CompilerResultsLog.h"
/////////////////////////////////////////////////////
// UAnimGraphNode_ModifyBone
#define LOCTEXT_NAMESPACE "A3Nodes"
UAnimGraphNode_ModifyBone::UAnimGraphNode_ModifyBone(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
CurWidgetMode = (int32)FWidget::WM_Rotate;
}
void UAnimGraphNode_ModifyBone::ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog)
{
if (ForSkeleton->GetReferenceSkeleton().FindBoneIndex(Node.BoneToModify.BoneName) == INDEX_NONE)
{
Copying //UE4/Orion-Staging to //UE4/Main (Source: //Orion/Dev-General @ 3037465) #lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 3037044 on 2016/07/04 by Ben.Woodhouse (Content only change) Roll back WorldAlignedNormal material function to the previous version (which worked properly). The broken version was actually checked in back in 2014 (//depot/UE4-Fortnite/...@2342687), but it only hit //UE4/main very recently. #jira OR-24849 #rb me Change 3036463 on 2016/07/01 by Andrew.Grant Clarified BP compiler message #rb na #tests compiled AnimBP_Grux_Base Change 3036424 on 2016/07/01 by Andrew.Grant Integrated fix from //UE4/Main for state not being cleared when rebuidling HMSM. #rb na #tests verified warnings gone after resaving Agora_Terrain Change 3036317 on 2016/07/01 by Ben.Salem Allow FTests to be run in succession, and allow them to also be run in game instead of just editor. These are engine changes that have been tested extensively in fortnite, and have gone through a minor test pass here as well. #rb william.ewen, bob.tellez #tests Ran through all of Howitzer's new FTests in one run! Change 3036168 on 2016/07/01 by Frank.Fella MovieSceneRendering - Fix a crash when deserializing burn in options. Change from Andrew Rodham. #rb Me for Andrew. #tests Movie scene renders in a separate process no longer crash when the burn in options are missing. Change 3035632 on 2016/07/01 by Jason.Bestimt #ROBOMERGE-AUTHOR: jason.bestimt #ORION_MAIN - Merge 28.2 @ CL 3035536 #RB:none #Tests:none #ROBOMERGE-SOURCE: CL 3035630 in //Orion/Main/... #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3035237 on 2016/07/01 by Dmitry.Rekman Updated WebRTC libs to avoid SIGPIPE (OR-24857). - Should also remove debug output. - These fixes has been previously done for OR-13279 but apparently libs have been recompiled from earlier sources since that. - Current libs have been compiled by Lee Clark (CL 3034752). #rb Lee Clark #codereview Lee.Clark, Andrew.Grant, Sam.Zamani #tests Run PS4 client, made sure XMPP connection was established and got some traffic. Change 3035210 on 2016/07/01 by Andrew.Grant Fix for broken AI / abilities #rb none #tests Golden path with gadget, all abilities working, AI are happy and combatitive again Change 3034936 on 2016/06/30 by Josh.Markiewicz #UE4 - separated out basic features from update/patch/hotfix manager into generic engine class - left Orion specific overloads around #rb none #tests PS4/PC/Server hotfix and update checks (with and without update required) #codereview ian.fox, ben.zeigler, bob.tellez Change 3034935 on 2016/06/30 by Josh.Markiewicz #UE4 - make sure that mcp client keys, names, and ids can't have extraneous spaces in them from the ini file #codereview sam.zamani, shon.love, david.nikdel, eric.newman #tests paragon launch #rb none Change 3034933 on 2016/06/30 by Josh.Markiewicz #UE4 - moved OnlineHotfixManager out of deprecated classes directory #rb none #tests compiles Change 3034524 on 2016/06/30 by Andrew.Grant Fix for team assignment being broken in blueprints #rb Dan.OConnor #tests Golden Path with sparrow, verified arrow AOE color is correct and harvesters deliver XP Change 3034521 on 2016/06/30 by Andrew.Grant Setting replay version to 0 for v29 #rb none #tests none Change 3034483 on 2016/06/30 by Jason.Bestimt #ROBOMERGE-AUTHOR: jason.bestimt #ORION_MAIN - Repair main build integration #RB:none #Tests:none [CodeReviewed]: david.ratti #ROBOMERGE-SOURCE: CL 3034395 in //Orion/Main/... #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3034481 on 2016/06/30 by Jason.Bestimt #ROBOMERGE-AUTHOR: jason.bestimt #ORION_MAIN - Merge 28.2 @ CL 3034181 #RB:none #Tests:none #ROBOMERGE-SOURCE: CL 3034319 in //Orion/Main/... #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3034464 on 2016/06/30 by Martin.Wilson Fix for trying to load preview mesh for skeleton when the preview meshes skeleton doesn't match #rb Jurre.DeBaare #tests Asset loading in the editor Change 3034194 on 2016/06/30 by Martin.Wilson Fix for rendering crash #codereview Rolando.Caloca #rb Rolando.Caloca #test editor startup Change 3034192 on 2016/06/30 by Andrew.Grant Removing Fortnight madness #codereview Ben.Marsh #rb none #tests compiled Change 3034106 on 2016/06/30 by Martin.Wilson Fix retargetting of anim blueprints so that all animations referred to are collected and duplicated, not just direct bp variables #rb Thomas.Sarkanen #tests In editor retargeting of various blueprint setups Change 3034041 on 2016/06/30 by Jason.Bestimt #ROBOMERGE-AUTHOR: antony.carter Exposing some of the slate interfaces for upcoming Social Plugin usage #RB Jamie.Dale #TESTS NA #ROBOMERGE-SOURCE: CL 3034040 in //Orion/Main/... #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3033591 on 2016/06/29 by Andrew.Grant Merging //UE4/Main @ 3033257 through Orion-Staging #rb none #tests engine QA, golden path in PIE and out, BuildCookRun PS4 Change 3033545 on 2016/06/29 by Josh.Markiewicz #UE4 - fixed shadowed variable #rb none #tests compiles Change 3033462 on 2016/06/29 by Josh.Markiewicz #UE4 - notify game about net guid mismatch or net checksum failures #rb john.pollard #codereview john.pollard, dave.ratti, andrew.grant, matt.oelfke #tests triggered fake mismatches while networked Change 3033453 on 2016/06/29 by Josh.Markiewicz #UE4 - turned off extra logging feature now that the auth expiration issues have been solved - removes some bad log spam showing up in live (starting when already started, stopped when not started) #rb none #tests none #codereview ben.zeigler, sam.zamani Change 3033020 on 2016/06/29 by Jason.Bestimt #ROBOMERGE-AUTHOR: david.nikdel #OGF Merging //GamePlugins/Main/PluginTestGame/Plugins/OnlineGameplayFramework/... to //Orion/Main/OrionGame/Plugins/OnlineGameplayFramework/... --------- - Support for exclusive profile locking (by dedicated servers) - PostAdd event for IMcpItemAware - New McpItemDefinitionBase class - Support for converting to new colon-based template ids - Improvements to FJsonObjectWrapper (technically an engine change) - Ability to specify an explicit fulfillment class to instantiate - Ability to split catalog localization out from the main data. - Couple of Orion fix ups for the new code - Re-exported catalog (loc data now separated out) --------- #RB: none #TESTS: login, mcp, etc [CodeReviewed]: Jason.Bestimt #ROBOMERGE-SOURCE: CL 3033018 in //Orion/Main/... #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3032623 on 2016/06/29 by Jason.Bestimt #ROBOMERGE-AUTHOR: jason.bestimt #ORION_MAIN - Merge 28.2 @ CL 3032459 #RB:none #Tests:none #ROBOMERGE-SOURCE: CL 3032516 in //Orion/Main/... #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3032451 on 2016/06/29 by bruce.nesbit Added code in AutoPopulateInstanceProperties to populate vector and scalar parameter data. #rb SimonT #tests PIE Change 3031620 on 2016/06/28 by Aaron.McLeran Implementing CL 3029659 to Dev-General. Adding new minor feature to add new concurrency mode to allow not stopping old sounds if new sound is not lower priority (or is same priority) than any existing sounds in concurrency group #rb marc.audy #TESTS existing concurrency doesn't break. New concurrency rule results in not stopping sounds if new sound is not lower pri than existing sounds Change 3031616 on 2016/06/28 by Jason.Bestimt #ROBOMERGE-AUTHOR: bob.ferreira Fixed an additional cast issue (hopefully the last!) in SetupSkyIrradianceEnvironmentMapConstants where Scene objects were not being cast and/or null checked #rb Marcus.Wassmer #tests Compiled and verified clients connected to server #jira OR-24678 #ROBOMERGE-SOURCE: CL 3031610 in //Orion/Release-28/... via CL 3031611 via CL 3031613 via CL 3031614 #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3031607 on 2016/06/28 by Josh.Markiewicz #UE4 - pass the UniqueNetId along with client beacons so the server can tell who is making requests #rb sam.zamani #codereview paul.moore #tests draft lobby golden path Change 3031606 on 2016/06/28 by Josh.Markiewicz #UE4 - added code to stop logging out players from reservation beacon on timeouts if game doesn't request it #rb sam.zamani #codereview paul.moore #tests draft lobby golden path Change 3031598 on 2016/06/28 by Josh.Markiewicz #UE4 - FUniqueNetIdRepl is stored on the UNetConnection and passed into engine login functions rather than TSharedPtr<FUniqueNetId> - wrapped class is safer and simplifies some other code #rb sam.zamani #tests draft lobby golden path #codereview paul.moore Change 3031523 on 2016/06/28 by Josh.Markiewicz #UE4 - added ToDebugString to FUniqueNetIdRepl #rb none #tests draft lobby golden path Change 3031366 on 2016/06/28 by Jason.Bestimt #ROBOMERGE-AUTHOR: bob.ferreira Adding proper checks for Scene objects if it returns null #rb Marcus.Wassmer #tests Compiled and verified clients connected to server #jira OR-24678 #ROBOMERGE-SOURCE: CL 3031361 in //Orion/Release-28/... via CL 3031362 via CL 3031363 via CL 3031365 #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3030919 on 2016/06/28 by Jason.Bestimt #ROBOMERGE-AUTHOR: bob.ferreira Fixed issue that was causing client bots to crash when running with -nullrhi. Now use interface provided by the Scene object. #rb Marcus.Wassmer #tests Compiled and verified clients connected to server #jira OR-24678 #ROBOMERGE-SOURCE: CL 3030914 in //Orion/Release-28/... via CL 3030915 via CL 3030916 via CL 3030917 #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3030715 on 2016/06/28 by David.Ratti removing warning. It is valid to use the ability system with actors without an animinstance. #rb none #test compile Change 3030663 on 2016/06/28 by Jason.Bestimt #ROBOMERGE-AUTHOR: jason.bestimt #ORION_MAIN - Merge 28.2 @ CL 3030407 #RB:none #Tests:none #ROBOMERGE-SOURCE: CL 3030660 in //Orion/Main/... #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3030533 on 2016/06/28 by Marcus.Wassmer Fix incorrect warning #rb none #test none #codereview Daniel.Lamb Change 3030526 on 2016/06/28 by bruce.nesbit Re-added MaxRoughness changes in scalability config and added ECVF_Scalability to the CVar for same #rb none #codereview Marcus.Wassmer #tests PIE Change 3029022 on 2016/06/27 by Jason.Bestimt #ROBOMERGE-AUTHOR: jason.bestimt #ORION_MAIN - Merge 28.2 @ CL 3028879 #RB:none #tests:none #ROBOMERGE-SOURCE: CL 3029020 in //Orion/Main/... #ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3028712 on 2016/06/27 by David.Ratti AbilitySystem debug hud -Made this more accessible from the base engine system. No longer required to forward calls from the owning actor class'es DisplayDebug function PlayerController::DisplayDebug -Set DisplayDebugManager's Y pos to the out Y pos, so that subsequent debug huds don't overlap with this one #rb none #tests gameplay ability sample project [CL 3043787 by Andrew Grant in Main branch]
2016-07-08 22:29:24 -04:00
if (Node.BoneToModify.BoneName == NAME_None)
{
MessageLog.Warning(*LOCTEXT("NoBoneToModify", "@@ - You must pick a bone to modify").ToString(), this);
}
else
{
FFormatNamedArguments Args;
Args.Add(TEXT("BoneName"), FText::FromName(Node.BoneToModify.BoneName));
FText Msg = FText::Format(LOCTEXT("NoBoneToModify", "@@ - Bone {BoneName} not found in Skeleton"), Args);
MessageLog.Warning(*Msg.ToString(), this);
}
}
if ((Node.TranslationMode == BMM_Ignore) && (Node.RotationMode == BMM_Ignore) && (Node.ScaleMode == BMM_Ignore))
{
MessageLog.Warning(*LOCTEXT("NothingToModify", "@@ - No components to modify selected. Either Rotation, Translation, or Scale should be set to something other than Ignore").ToString(), this);
}
Super::ValidateAnimNodeDuringCompilation(ForSkeleton, MessageLog);
}
FText UAnimGraphNode_ModifyBone::GetControllerDescription() const
{
return LOCTEXT("TransformModifyBone", "Transform (Modify) Bone");
}
FText UAnimGraphNode_ModifyBone::GetTooltipText() const
{
return LOCTEXT("AnimGraphNode_ModifyBone_Tooltip", "The Transform Bone node alters the transform - i.e. Translation, Rotation, or Scale - of the bone");
}
FText UAnimGraphNode_ModifyBone::GetNodeTitle(ENodeTitleType::Type TitleType) const
{
if ((TitleType == ENodeTitleType::ListView || TitleType == ENodeTitleType::MenuTitle) && (Node.BoneToModify.BoneName == NAME_None))
{
return GetControllerDescription();
}
// @TODO: the bone can be altered in the property editor, so we have to
// choose to mark this dirty when that happens for this to properly work
else //if (!CachedNodeTitles.IsTitleCached(TitleType, this))
{
FFormatNamedArguments Args;
Args.Add(TEXT("ControllerDescription"), GetControllerDescription());
Args.Add(TEXT("BoneName"), FText::FromName(Node.BoneToModify.BoneName));
// FText::Format() is slow, so we cache this to save on performance
if (TitleType == ENodeTitleType::ListView || TitleType == ENodeTitleType::MenuTitle)
{
CachedNodeTitles.SetCachedTitle(TitleType, FText::Format(LOCTEXT("AnimGraphNode_ModifyBone_ListTitle", "{ControllerDescription} - Bone: {BoneName}"), Args), this);
}
else
{
CachedNodeTitles.SetCachedTitle(TitleType, FText::Format(LOCTEXT("AnimGraphNode_ModifyBone_Title", "{ControllerDescription}\nBone: {BoneName}"), Args), this);
}
}
return CachedNodeTitles[TitleType];
}
int32 UAnimGraphNode_ModifyBone::GetWidgetCoordinateSystem(const USkeletalMeshComponent* SkelComp)
{
EBoneControlSpace Space = BCS_BoneSpace;
switch (CurWidgetMode)
{
case FWidget::WM_Rotate:
Space = Node.RotationSpace;
break;
case FWidget::WM_Translate:
Space = Node.TranslationSpace;
break;
case FWidget::WM_Scale:
Space = Node.ScaleSpace;
break;
}
switch (Space)
{
default:
case BCS_ParentBoneSpace:
//@TODO: No good way of handling this one
return COORD_World;
case BCS_BoneSpace:
return COORD_Local;
case BCS_ComponentSpace:
case BCS_WorldSpace:
return COORD_World;
}
}
FVector UAnimGraphNode_ModifyBone::GetWidgetLocation(const USkeletalMeshComponent* SkelComp, FAnimNode_SkeletalControlBase* AnimNode)
{
USkeleton* Skeleton = SkelComp->SkeletalMesh->Skeleton;
FVector WidgetLoc = FVector::ZeroVector;
// if the current widget mode is translate, then shows the widget according to translation space
if (CurWidgetMode == FWidget::WM_Translate)
{
Copying //UE4/Dev-Framework to //UE4/Main @ 2830052 #lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2807479 on 2015/12/17 by Zak.Middleton #ue4 - Optimize allocations in FFinalPostProcessSettings. Fix bug skipping an element when updating the ContributingCubemaps array if one is removed during an iteration. #rb Aaron.Mcleran #codereview Martin.Mittring #jira UE-24485 Change 2807695 on 2015/12/17 by Aaron.McLeran Changing the VolumeScale sound concurrency implementation to be a volume scalar on older sounds in a concurrency group rather than scale new sounds. #rb zak.middleton Change 2808628 on 2015/12/18 by Thomas.Sarkanen Minor optimization: Dont call GetWorld() 3 times in a row in USceneComponent::ShouldRender() #rb Martin.Wilson Change 2810090 on 2015/12/21 by Ori.Cohen Allow collision and trail particles to run off the game thread. Clean up missing marshelled AsyncComponentToWorld Change 2814518 on 2016/01/04 by Marc.Audy Use Reset instead of Empty Change 2814530 on 2016/01/04 by James.Golding UE-2689 Hook up lots of new icons for component classes #rb thomas.sarkanen Change 2814665 on 2016/01/04 by Marc.Audy PR #1860:Fix ChildActorComponent linking issue when extended from game (Contributed by lion03) Change 2814686 on 2016/01/04 by Benn.Gallagher Fix for radial force components applying impulses multiple times to destructible components #rb Ori.Cohen Change 2815221 on 2016/01/04 by Aaron.McLeran UE-24528 Fixing focus-distance scaling and focus priority scaling working with concurrency settings. USoundAttenuation: - Added methods to SoundAttenuation to get focus, attenuation, and distance scale based on focus factor. - Added NonFocusDistanceScale parameter to attenuation settings customization so its setable by users USoundBase: - Added function on USoundBase which checks IsLooping, which checks the duration - Removed functions IsAudible and IsAudibleSimple from USoundBase since that functionality is accomplished differently and takes into account focus-distance scaling now. FActiveSound: - Caching values of FocusPriorityScale and FocusDistanceScale to Active sound so that can be used for audibility checks - Included FocusDistanceScale when computing bIsAudible in Active sound - Moved GetAttenuationListenerData and the accompanying private struct FAttenuationListenerData to FAudioDevice since the audio device and moved code which computes focus factor and geometry into FAudioDevice::GetFocusFactor since it needs to be computed before an active sound exist FAudioDevice: - Added SoundIsAudible function which queries a particular sound if its audible based on attenuation settings, focus factor, etc. Will optionally return computed MaxDistance to avoid recomputing it in certain cases. - Added a few helper functions: FindClosestListenerIndex, GetAttenuationListenerData - Added GetFocusFactor, which performs the vector math to determine focus factor (0.0 is in-focus, 1.0 is out of focus) for a given sound and listener and attenuation focus settings. - Updated CreateComponent and PlaySoundAtLocation functions to use the new SoundIsAudible function rather than the old IsAudibleSimple #rb zak.middleton Change 2815694 on 2016/01/05 by thomas.sarkanen Added test texture Change 2815695 on 2016/01/05 by thomas.sarkanen Modified test texture Change 2815709 on 2016/01/05 by James.Golding PR #1778 : New BP-callablle function AActor::WasRecentlyRendered, with optional tolerance in seconds https://github.com/EpicGames/UnrealEngine/pull/1778 #github 1778 #jira UE-23674 #rb jurre.debaare Change 2815711 on 2016/01/05 by James.Golding PR #1534 : Add missing default tolerance value for FVector2D::Equal https://github.com/EpicGames/UnrealEngine/pull/1534 #github 1534 #jira UE-20838 #rb jurre.debaare Change 2815714 on 2016/01/05 by James.Golding PR #1887 : Added 'Thickness' Parameter to all valid options in Draw Debug Helper https://github.com/EpicGames/UnrealEngine/pull/1887 #github 1887 #jira UE-24802 #rb jurre.debaare Change 2815725 on 2016/01/05 by James.Golding Added comment that USkeletalMeshComponent::bEnablePhysicsOnDedicatedServer cannot be changed at runtime #jira UE-20439 Change 2815813 on 2016/01/05 by Marc.Audy Move dispatch of transition functions to new OnMatchStateSet virtual which is called from SetMatchState allowing subclasses to insert their own handling between the set of the variable and dispatch to GameState and Blueprints rather than having to override the entire function. #codereview Peter.Knepley Change 2815884 on 2016/01/05 by James.Golding - Avoid PSC iterating over all particle emitters each tick to check for changes in DetailMode. Now remember global DetailMode when we last checked, and only iterate again if that has changed. - Add 'WarmupTime' and 'CPUCollision' to Asset Registry Tags for Particle Systems #rb simon.tovey #codereview gil.gribb Change 2816306 on 2016/01/05 by Marc.Audy (4.11) Pass boolean to OnComponentDestroyed that indicates if the entire Actor's hierarchy is being destroyed. If so we can avoid doing a lot of expensive tear down, particularly detaching each component one at a time from the hierarchy and causing massive position/bounds updates. #rb Zak.Middleton, James.Golding
2016-01-15 13:01:30 -05:00
FCSPose<FCompactHeapPose>& MeshBases = AnimNode->ForwardedPose;
WidgetLoc = ConvertWidgetLocation(SkelComp, MeshBases, Node.BoneToModify.BoneName, GetNodeValue(FString("Translation"), Node.Translation), Node.TranslationSpace);
Added FCompactPose, contains only the bone transforms needed by RequiredBones. Allows us to do animation evaluation without having to refer to required bones array all the time API Breaking Changes Removed Functions: FA2CSPose::SafeSetCSBoneTransforms FA2CSPose::LocalBlendCSBoneTransforms Member Type Changes: - int32 -> FCompactPoseBoneIndex --- FBoneTransform::BoneIndex --- FABRIKChainLink::BoneIndex - FA2CSPose -> FCSPose<FCompactPose> --- FAnimNode_SkeletalControlBase::ForwardedPose --- FComponentSpacePoseContext::Pose - FA2Pose -> FCompactPose --- FSlotEvaluationPose::Pose --- FAnimNode_TransitionPoseEvaluator::CachedPose --- FAnimNode_SaveCachedPose::CachedPose --- FPoseContext::Pose Paramater Changes: - FA2Pose& -> FCompactPose& --- UAnimSingleNodeInstance::InternalBlendSpaceEvaluatePose (FA2Pose& Pose -> FCompactPose&) --- UAnimInstance::SequenceEvaluatePose --- UAnimInstance::BlendSequences --- UAnimInstance::CopyPose --- UAnimInstance::ApplyAdditiveSequence --- UAnimInstance::BlendSpaceEvaluatePose --- UAnimInstance::BlendRotationOffset --- UAnimInstance::GetSlotWeight --- UAnimInstance::SlotEvaluatePose - FA2CSPose& -> FCSPose<FCompactPose>& --- FAnimNode_SkeletalControlBase::EvaluateBoneTransforms --- UAnimGraphNode_SkeletalControlBase::ConvertCSVectorToBoneSpace --- UAnimGraphNode_SkeletalControlBase::ConvertCSRotationToBoneSpace --- UAnimGraphNode_SkeletalControlBase::ConvertWidgetLocation --- UAnimPreviewInstance::ApplyBoneControllers - TArray<FTransform> -> FCompactPose --- UAnimPreviewInstance::SetKeyImplementation --- UAnimSequence::GetAnimationPose --- UAnimSequence::GetBonePose --- UAnimSequence::GetBonePose_Additive --- UAnimSequence::GetAdditiveBasePose --- UAnimSequence::GetBonePose_AdditiveMeshRotationOnly --- FAnimationRuntime::BlendPosesTogether ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesTogetherPerBone ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesTogetherPerBoneInMeshSpace ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesPerBoneFilter ( + Removed Skeleton and RequiredBones ) --- FAnimationRuntime::GetPoseFromSequence ( + Removed RequiredBones ) --- FAnimationRuntime::GetPoseFromAnimTrack ( + Removed RequiredBones ) --- FAnimationRuntime::FillWithRetargetBaseRefPose ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertPoseToAdditive ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertPoseToMeshRotation ( + Removed RequiredBones ) --- FAnimationRuntime::BlendPosesAccumulate ( + Removed RequiredBones ) --- FAnimationRuntime::BlendAdditivePose ( + Removed RequiredBones ) --- FAnimationRuntime::GetPoseFromBlendSpace ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertCSTransformToBoneSpace --- FAnimationRuntime::ConvertBoneSpaceTransformToCS --- FAnimationRuntime::BlendMeshPosesPerBoneWeights ( + Removed Skeleton and RequiredBones ) --- FAnimationRuntime::BlendLocalPosesPerBoneWeights ( + Removed Skeleton and RequiredBones ) - TArray<FTransform> -> FTransform --- UAnimSequence::ResetRootBoneForRootMotion - int32 -> FCompactPoseBoneIndex --- UAnimSequence::RetargetBoneTransform FAnimationRuntime: Many changes to animation operation functions, removal of NumPoses and RequiredBones, conversion of TArray<FTransform> to FCompactPose Removed USTRUCT markup from FBoneTransform Removed UPROPERTY markup from FAnimNode_TransitionPoseEvaluator::CachedPose [CL 2556671 by Martin Wilson in Main branch]
2015-05-19 06:19:22 -04:00
if (MeshBases.GetPose().IsValid() && Node.TranslationMode == BMM_Additive)
{
if(Node.TranslationSpace == EBoneControlSpace::BCS_WorldSpace ||
Node.TranslationSpace == EBoneControlSpace::BCS_ComponentSpace)
{
Added FCompactPose, contains only the bone transforms needed by RequiredBones. Allows us to do animation evaluation without having to refer to required bones array all the time API Breaking Changes Removed Functions: FA2CSPose::SafeSetCSBoneTransforms FA2CSPose::LocalBlendCSBoneTransforms Member Type Changes: - int32 -> FCompactPoseBoneIndex --- FBoneTransform::BoneIndex --- FABRIKChainLink::BoneIndex - FA2CSPose -> FCSPose<FCompactPose> --- FAnimNode_SkeletalControlBase::ForwardedPose --- FComponentSpacePoseContext::Pose - FA2Pose -> FCompactPose --- FSlotEvaluationPose::Pose --- FAnimNode_TransitionPoseEvaluator::CachedPose --- FAnimNode_SaveCachedPose::CachedPose --- FPoseContext::Pose Paramater Changes: - FA2Pose& -> FCompactPose& --- UAnimSingleNodeInstance::InternalBlendSpaceEvaluatePose (FA2Pose& Pose -> FCompactPose&) --- UAnimInstance::SequenceEvaluatePose --- UAnimInstance::BlendSequences --- UAnimInstance::CopyPose --- UAnimInstance::ApplyAdditiveSequence --- UAnimInstance::BlendSpaceEvaluatePose --- UAnimInstance::BlendRotationOffset --- UAnimInstance::GetSlotWeight --- UAnimInstance::SlotEvaluatePose - FA2CSPose& -> FCSPose<FCompactPose>& --- FAnimNode_SkeletalControlBase::EvaluateBoneTransforms --- UAnimGraphNode_SkeletalControlBase::ConvertCSVectorToBoneSpace --- UAnimGraphNode_SkeletalControlBase::ConvertCSRotationToBoneSpace --- UAnimGraphNode_SkeletalControlBase::ConvertWidgetLocation --- UAnimPreviewInstance::ApplyBoneControllers - TArray<FTransform> -> FCompactPose --- UAnimPreviewInstance::SetKeyImplementation --- UAnimSequence::GetAnimationPose --- UAnimSequence::GetBonePose --- UAnimSequence::GetBonePose_Additive --- UAnimSequence::GetAdditiveBasePose --- UAnimSequence::GetBonePose_AdditiveMeshRotationOnly --- FAnimationRuntime::BlendPosesTogether ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesTogetherPerBone ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesTogetherPerBoneInMeshSpace ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesPerBoneFilter ( + Removed Skeleton and RequiredBones ) --- FAnimationRuntime::GetPoseFromSequence ( + Removed RequiredBones ) --- FAnimationRuntime::GetPoseFromAnimTrack ( + Removed RequiredBones ) --- FAnimationRuntime::FillWithRetargetBaseRefPose ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertPoseToAdditive ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertPoseToMeshRotation ( + Removed RequiredBones ) --- FAnimationRuntime::BlendPosesAccumulate ( + Removed RequiredBones ) --- FAnimationRuntime::BlendAdditivePose ( + Removed RequiredBones ) --- FAnimationRuntime::GetPoseFromBlendSpace ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertCSTransformToBoneSpace --- FAnimationRuntime::ConvertBoneSpaceTransformToCS --- FAnimationRuntime::BlendMeshPosesPerBoneWeights ( + Removed Skeleton and RequiredBones ) --- FAnimationRuntime::BlendLocalPosesPerBoneWeights ( + Removed Skeleton and RequiredBones ) - TArray<FTransform> -> FTransform --- UAnimSequence::ResetRootBoneForRootMotion - int32 -> FCompactPoseBoneIndex --- UAnimSequence::RetargetBoneTransform FAnimationRuntime: Many changes to animation operation functions, removal of NumPoses and RequiredBones, conversion of TArray<FTransform> to FCompactPose Removed USTRUCT markup from FBoneTransform Removed UPROPERTY markup from FAnimNode_TransitionPoseEvaluator::CachedPose [CL 2556671 by Martin Wilson in Main branch]
2015-05-19 06:19:22 -04:00
const FMeshPoseBoneIndex MeshBoneIndex(SkelComp->GetBoneIndex(Node.BoneToModify.BoneName));
const FCompactPoseBoneIndex BoneIndex = MeshBases.GetPose().GetBoneContainer().MakeCompactPoseIndex(MeshBoneIndex);
if (BoneIndex != INDEX_NONE)
{
Added FCompactPose, contains only the bone transforms needed by RequiredBones. Allows us to do animation evaluation without having to refer to required bones array all the time API Breaking Changes Removed Functions: FA2CSPose::SafeSetCSBoneTransforms FA2CSPose::LocalBlendCSBoneTransforms Member Type Changes: - int32 -> FCompactPoseBoneIndex --- FBoneTransform::BoneIndex --- FABRIKChainLink::BoneIndex - FA2CSPose -> FCSPose<FCompactPose> --- FAnimNode_SkeletalControlBase::ForwardedPose --- FComponentSpacePoseContext::Pose - FA2Pose -> FCompactPose --- FSlotEvaluationPose::Pose --- FAnimNode_TransitionPoseEvaluator::CachedPose --- FAnimNode_SaveCachedPose::CachedPose --- FPoseContext::Pose Paramater Changes: - FA2Pose& -> FCompactPose& --- UAnimSingleNodeInstance::InternalBlendSpaceEvaluatePose (FA2Pose& Pose -> FCompactPose&) --- UAnimInstance::SequenceEvaluatePose --- UAnimInstance::BlendSequences --- UAnimInstance::CopyPose --- UAnimInstance::ApplyAdditiveSequence --- UAnimInstance::BlendSpaceEvaluatePose --- UAnimInstance::BlendRotationOffset --- UAnimInstance::GetSlotWeight --- UAnimInstance::SlotEvaluatePose - FA2CSPose& -> FCSPose<FCompactPose>& --- FAnimNode_SkeletalControlBase::EvaluateBoneTransforms --- UAnimGraphNode_SkeletalControlBase::ConvertCSVectorToBoneSpace --- UAnimGraphNode_SkeletalControlBase::ConvertCSRotationToBoneSpace --- UAnimGraphNode_SkeletalControlBase::ConvertWidgetLocation --- UAnimPreviewInstance::ApplyBoneControllers - TArray<FTransform> -> FCompactPose --- UAnimPreviewInstance::SetKeyImplementation --- UAnimSequence::GetAnimationPose --- UAnimSequence::GetBonePose --- UAnimSequence::GetBonePose_Additive --- UAnimSequence::GetAdditiveBasePose --- UAnimSequence::GetBonePose_AdditiveMeshRotationOnly --- FAnimationRuntime::BlendPosesTogether ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesTogetherPerBone ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesTogetherPerBoneInMeshSpace ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesPerBoneFilter ( + Removed Skeleton and RequiredBones ) --- FAnimationRuntime::GetPoseFromSequence ( + Removed RequiredBones ) --- FAnimationRuntime::GetPoseFromAnimTrack ( + Removed RequiredBones ) --- FAnimationRuntime::FillWithRetargetBaseRefPose ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertPoseToAdditive ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertPoseToMeshRotation ( + Removed RequiredBones ) --- FAnimationRuntime::BlendPosesAccumulate ( + Removed RequiredBones ) --- FAnimationRuntime::BlendAdditivePose ( + Removed RequiredBones ) --- FAnimationRuntime::GetPoseFromBlendSpace ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertCSTransformToBoneSpace --- FAnimationRuntime::ConvertBoneSpaceTransformToCS --- FAnimationRuntime::BlendMeshPosesPerBoneWeights ( + Removed Skeleton and RequiredBones ) --- FAnimationRuntime::BlendLocalPosesPerBoneWeights ( + Removed Skeleton and RequiredBones ) - TArray<FTransform> -> FTransform --- UAnimSequence::ResetRootBoneForRootMotion - int32 -> FCompactPoseBoneIndex --- UAnimSequence::RetargetBoneTransform FAnimationRuntime: Many changes to animation operation functions, removal of NumPoses and RequiredBones, conversion of TArray<FTransform> to FCompactPose Removed USTRUCT markup from FBoneTransform Removed UPROPERTY markup from FAnimNode_TransitionPoseEvaluator::CachedPose [CL 2556671 by Martin Wilson in Main branch]
2015-05-19 06:19:22 -04:00
const FTransform& BoneTM = MeshBases.GetComponentSpaceTransform(BoneIndex);
WidgetLoc += BoneTM.GetLocation();
}
}
}
}
else // if the current widget mode is not translate mode, then show the widget on the bone to modify
{
int32 MeshBoneIndex = SkelComp->GetBoneIndex(Node.BoneToModify.BoneName);
if (MeshBoneIndex != INDEX_NONE)
{
const FTransform BoneTM = SkelComp->GetBoneTransform(MeshBoneIndex);
WidgetLoc = BoneTM.GetLocation();
}
}
return WidgetLoc;
}
EBoneModificationMode UAnimGraphNode_ModifyBone::GetBoneModificationMode(int32 InWidgetMode)
{
FWidget::EWidgetMode InMode = (FWidget::EWidgetMode)InWidgetMode;
switch (InMode)
{
case FWidget::WM_Translate:
return Node.TranslationMode;
break;
case FWidget::WM_Rotate:
return Node.RotationMode;
break;
case FWidget::WM_Scale:
return Node.ScaleMode;
break;
case FWidget::WM_TranslateRotateZ:
case FWidget::WM_2D:
break;
}
return EBoneModificationMode::BMM_Ignore;
}
int32 UAnimGraphNode_ModifyBone::GetNextWidgetMode(int32 InWidgetMode)
{
FWidget::EWidgetMode InMode = (FWidget::EWidgetMode)InWidgetMode;
switch (InMode)
{
case FWidget::WM_Translate:
return FWidget::WM_Rotate;
case FWidget::WM_Rotate:
return FWidget::WM_Scale;
case FWidget::WM_Scale:
return FWidget::WM_Translate;
case FWidget::WM_TranslateRotateZ:
case FWidget::WM_2D:
break;
}
return (int32)FWidget::WM_None;
}
int32 UAnimGraphNode_ModifyBone::FindValidWidgetMode(int32 InWidgetMode)
{
FWidget::EWidgetMode InMode = (FWidget::EWidgetMode)InWidgetMode;
FWidget::EWidgetMode ValidMode = InMode;
if (InMode == FWidget::WM_None)
{ // starts from Rotate mode
ValidMode = FWidget::WM_Rotate;
}
// find from current widget mode and loop 1 cycle until finding a valid mode
for (int32 Index = 0; Index < 3; Index++)
{
if (GetBoneModificationMode(ValidMode) != BMM_Ignore)
{
return ValidMode;
}
ValidMode = (FWidget::EWidgetMode)GetNextWidgetMode(ValidMode);
}
// if couldn't find a valid mode, returns None
ValidMode = FWidget::WM_None;
return (int32)ValidMode;
}
int32 UAnimGraphNode_ModifyBone::GetWidgetMode(const USkeletalMeshComponent* SkelComp)
{
int32 BoneIndex = SkelComp->GetBoneIndex(Node.BoneToModify.BoneName);
if (BoneIndex != INDEX_NONE)
{
CurWidgetMode = FindValidWidgetMode(CurWidgetMode);
return CurWidgetMode;
}
return (int32)FWidget::WM_None;
}
int32 UAnimGraphNode_ModifyBone::ChangeToNextWidgetMode(const USkeletalMeshComponent* SkelComp, int32 InCurWidgetMode)
{
int32 NextWidgetMode = GetNextWidgetMode(InCurWidgetMode);
CurWidgetMode = FindValidWidgetMode(NextWidgetMode);
return CurWidgetMode;
}
bool UAnimGraphNode_ModifyBone::SetWidgetMode(const USkeletalMeshComponent* SkelComp, int32 InWidgetMode)
{
// if InWidgetMode is available
if (FindValidWidgetMode(InWidgetMode) == InWidgetMode)
{
CurWidgetMode = InWidgetMode;
return true;
}
return false;
}
FName UAnimGraphNode_ModifyBone::FindSelectedBone()
{
return Node.BoneToModify.BoneName;
}
void UAnimGraphNode_ModifyBone::DoTranslation(const USkeletalMeshComponent* SkelComp, FVector& Drag, FAnimNode_Base* InOutAnimNode)
{
FAnimNode_ModifyBone* ModifyBone = static_cast<FAnimNode_ModifyBone*>(InOutAnimNode);
if (ModifyBone->TranslationMode != EBoneModificationMode::BMM_Ignore)
{
FVector Offset = ConvertCSVectorToBoneSpace(SkelComp, Drag, ModifyBone->ForwardedPose, Node.BoneToModify.BoneName, Node.TranslationSpace);
ModifyBone->Translation += Offset;
Node.Translation = ModifyBone->Translation;
}
}
void UAnimGraphNode_ModifyBone::DoRotation(const USkeletalMeshComponent* SkelComp, FRotator& Rotation, FAnimNode_Base* InOutAnimNode)
{
FAnimNode_ModifyBone* ModifyBone = static_cast<FAnimNode_ModifyBone*>(InOutAnimNode);
if (Node.RotationMode != EBoneModificationMode::BMM_Ignore)
{
FQuat DeltaQuat = ConvertCSRotationToBoneSpace(SkelComp, Rotation, ModifyBone->ForwardedPose, Node.BoneToModify.BoneName, Node.RotationSpace);
FQuat PrevQuat(ModifyBone->Rotation);
FQuat NewQuat = DeltaQuat * PrevQuat;
ModifyBone->Rotation = NewQuat.Rotator();
Node.Rotation = ModifyBone->Rotation;
}
}
void UAnimGraphNode_ModifyBone::DoScale(const USkeletalMeshComponent* SkelComp, FVector& Scale, FAnimNode_Base* InOutAnimNode)
{
FAnimNode_ModifyBone* ModifyBone = static_cast<FAnimNode_ModifyBone*>(InOutAnimNode);
if (Node.ScaleMode != EBoneModificationMode::BMM_Ignore)
{
FVector Offset = Scale;
ModifyBone->Scale += Offset;
Node.Scale = ModifyBone->Scale;
}
}
void UAnimGraphNode_ModifyBone::CopyNodeDataTo(FAnimNode_Base* OutAnimNode)
{
FAnimNode_ModifyBone* ModifyBone = static_cast<FAnimNode_ModifyBone*>(OutAnimNode);
// copies Pin values from the internal node to get data which are not compiled yet
ModifyBone->Translation = GetNodeValue(FString("Translation"), Node.Translation);
ModifyBone->Rotation = GetNodeValue(FString("Rotation"), Node.Rotation);
ModifyBone->Scale = GetNodeValue(FString("Scale"), Node.Scale);
// copies Modes
ModifyBone->TranslationMode = Node.TranslationMode;
ModifyBone->RotationMode = Node.RotationMode;
ModifyBone->ScaleMode = Node.ScaleMode;
// copies Spaces
ModifyBone->TranslationSpace = Node.TranslationSpace;
ModifyBone->RotationSpace = Node.RotationSpace;
ModifyBone->ScaleSpace = Node.ScaleSpace;
}
void UAnimGraphNode_ModifyBone::CopyNodeDataFrom(const FAnimNode_Base* InNewAnimNode)
{
const FAnimNode_ModifyBone* ModifyBone = static_cast<const FAnimNode_ModifyBone*>(InNewAnimNode);
switch (CurWidgetMode)
{
case FWidget::WM_Translate:
SetNodeValue(FString("Translation"), Node.Translation, ModifyBone->Translation);
break;
case FWidget::WM_Rotate:
SetNodeValue(FString("Rotation"), Node.Rotation, ModifyBone->Rotation);
break;
case FWidget::WM_Scale:
SetNodeValue(FString("Scale"), Node.Scale, ModifyBone->Scale);
break;
}
}
#undef LOCTEXT_NAMESPACE