Add Games File
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#include "AnimGraphNode_VrmVMC.h"
|
||||
#include "Misc/EngineVersionComparison.h"
|
||||
#include "UnrealWidget.h"
|
||||
#include "AnimNodeEditModes.h"
|
||||
#include "AnimationRuntime.h"
|
||||
#include "Animation/AnimInstance.h"
|
||||
#include "Kismet2/CompilerResultsLog.h"
|
||||
#include "Components/SkeletalMeshComponent.h"
|
||||
#include "VrmMetaObject.h"
|
||||
#include "VrmUtil.h"
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
// UAnimGraphNode_ModifyBone
|
||||
|
||||
#define LOCTEXT_NAMESPACE "A3Nodesaaaa"
|
||||
////////////////////
|
||||
|
||||
|
||||
UAnimGraphNode_VrmVMC::UAnimGraphNode_VrmVMC(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_VrmVMC::ValidateAnimNodePostCompile(FCompilerResultsLog& MessageLog, UAnimBlueprintGeneratedClass* CompiledClass, int32 CompiledNodeIndex) {
|
||||
|
||||
if (Node.VrmMetaObject == nullptr) {
|
||||
//MessageLog.Warning(*LOCTEXT("VrmNoMetaObject", "@@ - You must set VrmMetaObject").ToString(), this);
|
||||
} else {
|
||||
if (Node.VrmMetaObject->SkeletalMesh) {
|
||||
if (VRMGetSkeleton(Node.VrmMetaObject->SkeletalMesh) != CompiledClass->GetTargetSkeleton()) {
|
||||
MessageLog.Warning(*LOCTEXT("VrmDifferentSkeleton", "@@ - You must set VrmMetaObject has same skeleton").ToString(), this);
|
||||
}
|
||||
}
|
||||
if (CompiledClass->GetTargetSkeleton()->GetReferenceSkeleton().GetRawBoneNum() <= 0) {
|
||||
MessageLog.Warning(*LOCTEXT("VrmNoBone", "@@ - Skeleton bad data").ToString(), this);
|
||||
}
|
||||
}
|
||||
|
||||
Super::ValidateAnimNodePostCompile(MessageLog, CompiledClass, CompiledNodeIndex);
|
||||
}
|
||||
|
||||
void UAnimGraphNode_VrmVMC::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 (Node.VrmMetaObject == nullptr) {
|
||||
//MessageLog.Warning(*LOCTEXT("VrmNoMetaObject", "@@ - You must set VrmMetaObject").ToString(), this);
|
||||
} else {
|
||||
if (Node.VrmMetaObject->SkeletalMesh){
|
||||
if (VRMGetSkeleton(Node.VrmMetaObject->SkeletalMesh) != ForSkeleton) {
|
||||
// MessageLog.Warning(*LOCTEXT("VrmDifferentSkeleton", "@@ - You must set VrmMetaObject has same skeleton").ToString(), this);
|
||||
}
|
||||
}
|
||||
if (ForSkeleton->GetReferenceSkeleton().GetRawBoneNum() <= 0) {
|
||||
// MessageLog.Warning(*LOCTEXT("VrmNoBone", "@@ - Skeleton bad data").ToString(), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//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_VrmVMC::GetControllerDescription() const
|
||||
{
|
||||
return LOCTEXT("VrmVMC", "VrmVMC");
|
||||
}
|
||||
|
||||
FText UAnimGraphNode_VrmVMC::GetTooltipText() const
|
||||
{
|
||||
return LOCTEXT("AnimGraphNode_VrmVMC_Tooltip", "VrmVMC");
|
||||
}
|
||||
|
||||
FText UAnimGraphNode_VrmVMC::GetNodeTitle(ENodeTitleType::Type TitleType) const
|
||||
{
|
||||
return GetControllerDescription();
|
||||
//if ((TitleType == ENodeTitleType::ListView || TitleType == ENodeTitleType::MenuTitle) && (Node.SpringBone.BoneName == NAME_None))
|
||||
//{
|
||||
// return GetControllerDescription();
|
||||
//}
|
||||
|
||||
/*
|
||||
FFormatNamedArguments Args;
|
||||
Args.Add(TEXT("ControllerDescription"), GetControllerDescription());
|
||||
Args.Add(TEXT("Server"), FText::FromString(Node.ServerAddress));
|
||||
Args.Add(TEXT("Port"), FText::FromString(FString::FromInt(Node.Port)));
|
||||
|
||||
if (TitleType == ENodeTitleType::ListView || TitleType == ENodeTitleType::MenuTitle)
|
||||
{
|
||||
CachedNodeTitles.SetCachedTitle(TitleType, FText::Format(LOCTEXT("AnimGraphNode_VrmVMC_ListTitle", "{ControllerDescription} - {Server}:{Port}"), Args), this);
|
||||
}
|
||||
else
|
||||
{
|
||||
CachedNodeTitles.SetCachedTitle(TitleType, FText::Format(LOCTEXT("AnimGraphNode_VrmVMC_ListTitle", "{ControllerDescription}\n{Server}:{Port}"), Args), this);
|
||||
}
|
||||
|
||||
return CachedNodeTitles[TitleType];
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
//void UAnimGraphNode_VrmVMC::CopyNodeDataToPreviewNode(FAnimNode_Base* InPreviewNode)
|
||||
//{
|
||||
//}
|
||||
|
||||
FEditorModeID UAnimGraphNode_VrmVMC::GetEditorMode() const
|
||||
{
|
||||
return Super::GetEditorMode();
|
||||
}
|
||||
|
||||
void UAnimGraphNode_VrmVMC::Draw(FPrimitiveDrawInterface* PDI, USkeletalMeshComponent * PreviewSkelMeshComp) const
|
||||
{
|
||||
if (PreviewSkelMeshComp)
|
||||
{
|
||||
if (FAnimNode_VrmVMC* ActiveNode = GetActiveInstanceNode<FAnimNode_VrmVMC>(PreviewSkelMeshComp->GetAnimInstance()))
|
||||
{
|
||||
if (bPreviewLive) {
|
||||
//ActiveNode->ConditionalDebugDraw(PDI, PreviewSkelMeshComp, bPreviewForeground);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
@@ -0,0 +1,65 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/ObjectMacros.h"
|
||||
//#include "BoneControllers/AnimNode_ModifyBone.h"
|
||||
#include "AnimNode_VrmVMC.h"
|
||||
#include "EdGraph/EdGraphNodeUtils.h"
|
||||
#include "AnimGraphNode_SkeletalControlBase.h"
|
||||
|
||||
#include "UnrealWidget.h"
|
||||
#include "AnimNodeEditMode.h"
|
||||
|
||||
#include "AnimGraphNode_VrmVMC.generated.h"
|
||||
|
||||
class FCompilerResultsLog;
|
||||
class FPrimitiveDrawInterface;
|
||||
class USkeletalMeshComponent;
|
||||
|
||||
UCLASS(meta=(Keywords = "VRM4U"))
|
||||
class UAnimGraphNode_VrmVMC : public UAnimGraphNode_SkeletalControlBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = Settings)
|
||||
FAnimNode_VrmVMC Node;
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, Category = Preview)
|
||||
bool bPreviewLive = true;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = Preview)
|
||||
bool bPreviewForeground = false;
|
||||
|
||||
// UEdGraphNode interface
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
virtual FText GetTooltipText() const override;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
protected:
|
||||
// UAnimGraphNode_Base interface
|
||||
virtual void ValidateAnimNodeDuringCompilation(USkeleton* ForSkeleton, FCompilerResultsLog& MessageLog) override;
|
||||
virtual void ValidateAnimNodePostCompile(FCompilerResultsLog& MessageLog, UAnimBlueprintGeneratedClass* CompiledClass, int32 CompiledNodeIndex) override;
|
||||
// virtual FEditorModeID GetEditorMode() const override;
|
||||
//virtual void CopyNodeDataToPreviewNode(FAnimNode_Base* InPreviewNode) override;
|
||||
//virtual void CopyPinDefaultsToNodeData(UEdGraphPin* InPin) override;
|
||||
|
||||
virtual FEditorModeID GetEditorMode() const override;
|
||||
virtual void Draw(FPrimitiveDrawInterface* PDI, USkeletalMeshComponent * PreviewSkelMeshComp) const override;
|
||||
// End of UAnimGraphNode_Base interface
|
||||
|
||||
// UAnimGraphNode_SkeletalControlBase interface
|
||||
virtual FText GetControllerDescription() const override;
|
||||
virtual const FAnimNode_SkeletalControlBase* GetNode() const override { return &Node; }
|
||||
// End of UAnimGraphNode_SkeletalControlBase interface
|
||||
|
||||
private:
|
||||
/** Constructing FText strings can be costly, so we cache the node's title */
|
||||
FNodeTitleTextTable CachedNodeTitles;
|
||||
|
||||
// storing current widget mode
|
||||
int32 CurWidgetMode;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#include "VRM4UCaptureEditor.h"
|
||||
#include "CoreMinimal.h"
|
||||
#include "VRM4UCaptureEditorLog.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "Internationalization/Internationalization.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "VRM4UMisc"
|
||||
|
||||
DEFINE_LOG_CATEGORY(LogVRM4UCaptureEditor);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// FSpriterImporterModule
|
||||
|
||||
class FVRM4UCaptureEditorModule : public FDefaultModuleImpl
|
||||
{
|
||||
public:
|
||||
virtual void StartupModule() override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ShutdownModule() override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IMPLEMENT_MODULE(FVRM4UCaptureEditorModule, VRM4UCaptureEditor);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
@@ -0,0 +1,8 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
//#include "VRMImporterModule.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
//#include "VRMImporterModule.h"
|
||||
|
||||
DECLARE_LOG_CATEGORY_EXTERN(LogVRM4UCaptureEditor, Verbose, All);
|
||||
|
||||
//#define SPRITER_IMPORT_ERROR(FormatString, ...) \
|
||||
// if (!bSilent) { UE_LOG(LogVRM4UMIsc, Warning, FormatString, __VA_ARGS__); }
|
||||
//#define SPRITER_IMPORT_WARNING(FormatString, ...) \
|
||||
// if (!bSilent) { UE_LOG(LogVRM4UMIsc, Warning, FormatString, __VA_ARGS__); }
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// VRM4U Copyright (c) 2021-2024 Haruyoshi Yamamoto. This software is released under the MIT License.
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class VRM4UCaptureEditor : ModuleRules
|
||||
{
|
||||
public VRM4UCaptureEditor(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[] {
|
||||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
|
||||
"AnimGraphRuntime",
|
||||
"AnimGraph",
|
||||
"BlueprintGraph",
|
||||
|
||||
"UnrealEd",
|
||||
"AnimationEditMode",
|
||||
"Persona",
|
||||
|
||||
"VRM4U",
|
||||
"VRM4UCapture",
|
||||
});
|
||||
|
||||
PrivateIncludePathModuleNames.AddRange(
|
||||
new string[] {
|
||||
});
|
||||
|
||||
DynamicallyLoadedModuleNames.AddRange(
|
||||
new string[] {
|
||||
});
|
||||
|
||||
PrivateIncludePaths.AddRange(
|
||||
new string[] {
|
||||
//"../Runtime/Renderer/Private",
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user