From 857698dbe391b2b4b8d85c4417bf07b22e0bd1a5 Mon Sep 17 00:00:00 2001 From: David-Vodhanel <39318287+David-Vodhanel@users.noreply.github.com> Date: Sun, 13 Jun 2021 23:24:20 -0700 Subject: [PATCH] Fix for Fixed Rotations with Separate Clothing Export When transferring an individual piece of clothing on a character and using Fixed Rotations, the rotations wouldn't be fixed. This allows the two to work together. --- .../DazToUnreal/Source/DazToUnreal/Private/DazToUnreal.cpp | 1 + .../Source/DazToUnreal/Private/DazToUnrealFbx.cpp | 7 +++++++ .../DazToUnreal/Source/DazToUnreal/Public/DazToUnrealFbx.h | 1 + 3 files changed, 9 insertions(+) diff --git a/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnreal.cpp b/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnreal.cpp index ab88afc..3fb4307 100644 --- a/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnreal.cpp +++ b/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnreal.cpp @@ -579,6 +579,7 @@ UObject* FDazToUnrealModule::ImportFromDaz(TSharedPtr JsonObject) // Daz Studio puts the base bone rotations in a different place than Unreal expects them. if (CachedSettings->FixBoneRotationsOnImport && AssetType == DazAssetType::SkeletalMesh && RootBone) { + FDazToUnrealFbx::RemoveBindPoses(Scene); FDazToUnrealFbx::FixClusterTranformLinks(Scene, RootBone); } diff --git a/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealFbx.cpp b/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealFbx.cpp index 1191804..4c3f4b2 100644 --- a/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealFbx.cpp +++ b/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealFbx.cpp @@ -70,6 +70,13 @@ void FDazToUnrealFbx::FixClusterTranformLinks(FbxScene* Scene, FbxNode* RootNode FixClusterTranformLinks(Scene, ChildNode); } } +void FDazToUnrealFbx::RemoveBindPoses(FbxScene* Scene) +{ + for (int32 PoseIndex = Scene->GetPoseCount() - 1; PoseIndex >= 0; --PoseIndex) + { + Scene->RemovePose(PoseIndex); + } +} void FDazToUnrealFbx::AddWeightsToAllNodes(FbxNode* Parent) { diff --git a/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealFbx.h b/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealFbx.h index 45d83af..433f1bb 100644 --- a/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealFbx.h +++ b/Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealFbx.h @@ -61,6 +61,7 @@ class FDazToUnrealFbx public: static void RenameDuplicateBones(FbxNode* RootNode); static void FixClusterTranformLinks(FbxScene* Scene, FbxNode* RootNode); + static void RemoveBindPoses(FbxScene* Scene); static void AddWeightsToAllNodes(FbxNode* Parent); private: static void RenameDuplicateBones(FbxNode* RootNode, TMap& ExistingBones);