132 lines
4.9 KiB
C++
132 lines
4.9 KiB
C++
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
|
|
|
#include "AnimGraphNode_VrmQuestHandBone.h"
|
|
#include "Misc/EngineVersionComparison.h"
|
|
#include "UnrealWidget.h"
|
|
#include "AnimNodeEditModes.h"
|
|
#include "Kismet2/CompilerResultsLog.h"
|
|
|
|
/////////////////////////////////////////////////////
|
|
// UAnimGraphNode_ModifyBone
|
|
|
|
#define LOCTEXT_NAMESPACE "A3Nodesaaaa"
|
|
|
|
UAnimGraphNode_VrmQuestHandBone::UAnimGraphNode_VrmQuestHandBone(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
#if UE_VERSION_OLDER_THAN(5,0,0)
|
|
CurWidgetMode = (int32)FWidget::WM_Rotate;
|
|
#else
|
|
CurWidgetMode = UE::Widget::EWidgetMode::WM_Rotate;
|
|
#endif
|
|
}
|
|
|
|
void UAnimGraphNode_VrmQuestHandBone::ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog)
|
|
{
|
|
// Temporary fix where skeleton is not fully loaded during AnimBP compilation and thus virtual bone name check is invalid UE-39499 (NEED FIX)
|
|
if (ForSkeleton && !ForSkeleton->HasAnyFlags(RF_NeedPostLoad))
|
|
{
|
|
/*
|
|
//if (ForSkeleton->GetReferenceSkeleton().FindBoneIndex(Node.BoneToModify.BoneName) == INDEX_NONE)
|
|
if (ForSkeleton->GetReferenceSkeleton().FindBoneIndex(Node.BoneNameToModify) == INDEX_NONE)
|
|
{
|
|
//if (Node.BoneToModify.BoneName == NAME_None)
|
|
if (Node.BoneNameToModify == NAME_None)
|
|
{
|
|
MessageLog.Warning(*LOCTEXT("NoBoneSelectedToModify", "@@ - You must pick a bone to modify").ToString(), this);
|
|
}
|
|
else
|
|
{
|
|
FFormatNamedArguments Args;
|
|
//Args.Add(TEXT("BoneName"), FText::FromName(Node.BoneToModify.BoneName));
|
|
Args.Add(TEXT("BoneName"), FText::FromName(Node.BoneNameToModify));
|
|
|
|
FText Msg = FText::Format(LOCTEXT("NoBoneFoundToModify", "@@ - 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_VrmQuestHandBone::GetControllerDescription() const
|
|
{
|
|
return LOCTEXT("VrmQuestHandBone", "VrmQuestHandBone");
|
|
}
|
|
|
|
FText UAnimGraphNode_VrmQuestHandBone::GetTooltipText() const
|
|
{
|
|
return LOCTEXT("AnimGraphNode_VrmQuestHandBone_Tooltip", "VrmQuestHandBone");
|
|
}
|
|
|
|
FText UAnimGraphNode_VrmQuestHandBone::GetNodeTitle(ENodeTitleType::Type TitleType) const
|
|
{
|
|
//if ((TitleType == ENodeTitleType::ListView || TitleType == ENodeTitleType::MenuTitle) && (Node.BoneToModify.BoneName == NAME_None))
|
|
//if ((TitleType == ENodeTitleType::ListView || TitleType == ENodeTitleType::MenuTitle) && (Node.BoneNameToModify == 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));
|
|
Args.Add(TEXT("BoneName"), FText::FromName(Node.BoneNameToModify));
|
|
|
|
// 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];
|
|
*/
|
|
}
|
|
|
|
void UAnimGraphNode_VrmQuestHandBone::CopyNodeDataToPreviewNode(FAnimNode_Base* InPreviewNode)
|
|
{
|
|
FAnimNode_VrmQuestHandBone* node = static_cast<FAnimNode_VrmQuestHandBone*>(InPreviewNode);
|
|
|
|
// no copy
|
|
}
|
|
|
|
//FEditorModeID UAnimGraphNode_VrmModifyBoneDynamic::GetEditorMode() const
|
|
//{
|
|
// return AnimNodeEditModes::ModifyBone;
|
|
//}
|
|
|
|
void UAnimGraphNode_VrmQuestHandBone::CopyPinDefaultsToNodeData(UEdGraphPin* InPin)
|
|
{
|
|
/*
|
|
if (InPin->GetName() == GET_MEMBER_NAME_STRING_CHECKED(FAnimNode_ModifyBone, Translation))
|
|
{
|
|
GetDefaultValue(GET_MEMBER_NAME_STRING_CHECKED(FAnimNode_ModifyBone, Translation), Node.Translation);
|
|
}
|
|
else if (InPin->GetName() == GET_MEMBER_NAME_STRING_CHECKED(FAnimNode_ModifyBone, Rotation))
|
|
{
|
|
GetDefaultValue(GET_MEMBER_NAME_STRING_CHECKED(FAnimNode_ModifyBone, Rotation), Node.Rotation);
|
|
}
|
|
else if (InPin->GetName() == GET_MEMBER_NAME_STRING_CHECKED(FAnimNode_ModifyBone, Scale))
|
|
{
|
|
GetDefaultValue(GET_MEMBER_NAME_STRING_CHECKED(FAnimNode_ModifyBone, Scale), Node.Scale);
|
|
}
|
|
*/
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|