Skip to content

Commit 3769a38

Browse files
committed
Fbx PostProcessing Fixes, Geograft Duplicate Removal defaults on
1 parent 29b5738 commit 3769a38

File tree

3 files changed

+41
-39
lines changed

3 files changed

+41
-39
lines changed

include/DzBridgeAction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ namespace DzBridgeNameSpace
141141
// post-process FBX
142142
bool m_bPostProcessFbx;
143143
bool m_bRemoveDuplicateGeografts;
144+
bool m_bExperimental_FbxPostProcessing;
144145
QStringList m_aGeografts;
145146

146147
// Morph Settings;

include/common_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
#define COMMON_MAJOR 2023
66
#define COMMON_MINOR 1
77
#define COMMON_REV 0
8-
#define COMMON_BUILD 42
8+
#define COMMON_BUILD 44
99

1010
#define COMMON_VERSION DZ_MAKE_VERSION( COMMON_MAJOR, COMMON_MINOR, COMMON_REV, COMMON_BUILD )

src/DzBridgeAction.cpp

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ DzBridgeAction::DzBridgeAction(const QString& text, const QString& desc) :
8383
m_bUndoNormalMaps = true;
8484
#endif
8585

86-
m_bPostProcessFbx = false;
87-
m_bRemoveDuplicateGeografts = false;
86+
m_bPostProcessFbx = true;
87+
m_bRemoveDuplicateGeografts = true;
88+
m_bExperimental_FbxPostProcessing = false;
8889
}
8990

9091
DzBridgeAction::~DzBridgeAction()
@@ -4099,9 +4100,6 @@ void FindAndProcessTwistBones(FbxNode* pNode)
40994100
// import process is started in target software
41004101
bool DzBridgeAction::postProcessFbx(QString fbxFilePath)
41014102
{
4102-
// DEBUG
4103-
m_bPostProcessFbx = true;
4104-
41054103
if (m_bPostProcessFbx == false)
41064104
return false;
41074105

@@ -4140,43 +4138,46 @@ bool DzBridgeAction::postProcessFbx(QString fbxFilePath)
41404138
}
41414139
}
41424140

4143-
// Find the root bone. There should only be one bone off the scene root
4144-
FbxNode* RootNode = pScene->GetRootNode();
4145-
FbxNode* RootBone = nullptr;
4146-
QString RootBoneName("");
4147-
for (int ChildIndex = 0; ChildIndex < RootNode->GetChildCount(); ++ChildIndex)
4141+
if (m_bExperimental_FbxPostProcessing)
41484142
{
4149-
FbxNode* ChildNode = RootNode->GetChild(ChildIndex);
4150-
FbxNodeAttribute* Attr = ChildNode->GetNodeAttribute();
4151-
if (Attr && Attr->GetAttributeType() == FbxNodeAttribute::eSkeleton)
4143+
// Find the root bone. There should only be one bone off the scene root
4144+
FbxNode* RootNode = pScene->GetRootNode();
4145+
FbxNode* RootBone = nullptr;
4146+
QString RootBoneName("");
4147+
for (int ChildIndex = 0; ChildIndex < RootNode->GetChildCount(); ++ChildIndex)
41524148
{
4153-
RootBone = ChildNode;
4154-
RootBoneName = RootBone->GetName();
4155-
RootBone->SetName("root");
4156-
Attr->SetName("root");
4157-
break;
4149+
FbxNode* ChildNode = RootNode->GetChild(ChildIndex);
4150+
FbxNodeAttribute* Attr = ChildNode->GetNodeAttribute();
4151+
if (Attr && Attr->GetAttributeType() == FbxNodeAttribute::eSkeleton)
4152+
{
4153+
RootBone = ChildNode;
4154+
RootBoneName = RootBone->GetName();
4155+
RootBone->SetName("root");
4156+
Attr->SetName("root");
4157+
break;
4158+
}
41584159
}
4159-
}
4160-
//// Daz characters sometimes have additional skeletons inside the character for accesories
4161-
//if (AssetType == DazAssetType::SkeletalMesh)
4162-
//{
4163-
// FDazToUnrealFbx::ParentAdditionalSkeletalMeshes(Scene);
4164-
//}
4165-
// Daz Studio puts the base bone rotations in a different place than Unreal expects them.
4166-
//if (CachedSettings->FixBoneRotationsOnImport && AssetType == DazAssetType::SkeletalMesh && RootBone)
4167-
//{
4168-
// FDazToUnrealFbx::RemoveBindPoses(Scene);
4169-
// FDazToUnrealFbx::FixClusterTranformLinks(Scene, RootBone);
4170-
//}
4171-
if (RootBone)
4172-
{
4173-
// remove pre and post rotations
4174-
RemovePrePostRotations(RootBone);
4175-
// FindAndProcessTwistBones(RootBone);
4176-
// RemoveBindPoses(pScene);
4177-
// FixClusterTranformLinks(pScene, RootBone);
4178-
}
41794160

4161+
//// Daz characters sometimes have additional skeletons inside the character for accesories
4162+
//if (AssetType == DazAssetType::SkeletalMesh)
4163+
//{
4164+
// FDazToUnrealFbx::ParentAdditionalSkeletalMeshes(Scene);
4165+
//}
4166+
// Daz Studio puts the base bone rotations in a different place than Unreal expects them.
4167+
//if (CachedSettings->FixBoneRotationsOnImport && AssetType == DazAssetType::SkeletalMesh && RootBone)
4168+
//{
4169+
// FDazToUnrealFbx::RemoveBindPoses(Scene);
4170+
// FDazToUnrealFbx::FixClusterTranformLinks(Scene, RootBone);
4171+
//}
4172+
if (RootBone)
4173+
{
4174+
// remove pre and post rotations
4175+
RemovePrePostRotations(RootBone);
4176+
// FindAndProcessTwistBones(RootBone);
4177+
// RemoveBindPoses(pScene);
4178+
// FixClusterTranformLinks(pScene, RootBone);
4179+
}
4180+
}
41804181

41814182
if (openFBX->SaveScene(pScene, fbxFilePath.toLocal8Bit().data()) == false)
41824183
{

0 commit comments

Comments
 (0)