Skip to content

Commit

Permalink
Fbx PostProcessing Fixes, Geograft Duplicate Removal defaults on
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbui78 committed Jun 27, 2023
1 parent 29b5738 commit 3769a38
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 39 deletions.
1 change: 1 addition & 0 deletions include/DzBridgeAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ namespace DzBridgeNameSpace
// post-process FBX
bool m_bPostProcessFbx;
bool m_bRemoveDuplicateGeografts;
bool m_bExperimental_FbxPostProcessing;
QStringList m_aGeografts;

// Morph Settings;
Expand Down
2 changes: 1 addition & 1 deletion include/common_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#define COMMON_MAJOR 2023
#define COMMON_MINOR 1
#define COMMON_REV 0
#define COMMON_BUILD 42
#define COMMON_BUILD 44

#define COMMON_VERSION DZ_MAKE_VERSION( COMMON_MAJOR, COMMON_MINOR, COMMON_REV, COMMON_BUILD )
77 changes: 39 additions & 38 deletions src/DzBridgeAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ DzBridgeAction::DzBridgeAction(const QString& text, const QString& desc) :
m_bUndoNormalMaps = true;
#endif

m_bPostProcessFbx = false;
m_bRemoveDuplicateGeografts = false;
m_bPostProcessFbx = true;
m_bRemoveDuplicateGeografts = true;
m_bExperimental_FbxPostProcessing = false;
}

DzBridgeAction::~DzBridgeAction()
Expand Down Expand Up @@ -4099,9 +4100,6 @@ void FindAndProcessTwistBones(FbxNode* pNode)
// import process is started in target software
bool DzBridgeAction::postProcessFbx(QString fbxFilePath)
{
// DEBUG
m_bPostProcessFbx = true;

if (m_bPostProcessFbx == false)
return false;

Expand Down Expand Up @@ -4140,43 +4138,46 @@ bool DzBridgeAction::postProcessFbx(QString fbxFilePath)
}
}

// Find the root bone. There should only be one bone off the scene root
FbxNode* RootNode = pScene->GetRootNode();
FbxNode* RootBone = nullptr;
QString RootBoneName("");
for (int ChildIndex = 0; ChildIndex < RootNode->GetChildCount(); ++ChildIndex)
if (m_bExperimental_FbxPostProcessing)
{
FbxNode* ChildNode = RootNode->GetChild(ChildIndex);
FbxNodeAttribute* Attr = ChildNode->GetNodeAttribute();
if (Attr && Attr->GetAttributeType() == FbxNodeAttribute::eSkeleton)
// Find the root bone. There should only be one bone off the scene root
FbxNode* RootNode = pScene->GetRootNode();
FbxNode* RootBone = nullptr;
QString RootBoneName("");
for (int ChildIndex = 0; ChildIndex < RootNode->GetChildCount(); ++ChildIndex)
{
RootBone = ChildNode;
RootBoneName = RootBone->GetName();
RootBone->SetName("root");
Attr->SetName("root");
break;
FbxNode* ChildNode = RootNode->GetChild(ChildIndex);
FbxNodeAttribute* Attr = ChildNode->GetNodeAttribute();
if (Attr && Attr->GetAttributeType() == FbxNodeAttribute::eSkeleton)
{
RootBone = ChildNode;
RootBoneName = RootBone->GetName();
RootBone->SetName("root");
Attr->SetName("root");
break;
}
}
}
//// Daz characters sometimes have additional skeletons inside the character for accesories
//if (AssetType == DazAssetType::SkeletalMesh)
//{
// FDazToUnrealFbx::ParentAdditionalSkeletalMeshes(Scene);
//}
// 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);
//}
if (RootBone)
{
// remove pre and post rotations
RemovePrePostRotations(RootBone);
// FindAndProcessTwistBones(RootBone);
// RemoveBindPoses(pScene);
// FixClusterTranformLinks(pScene, RootBone);
}

//// Daz characters sometimes have additional skeletons inside the character for accesories
//if (AssetType == DazAssetType::SkeletalMesh)
//{
// FDazToUnrealFbx::ParentAdditionalSkeletalMeshes(Scene);
//}
// 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);
//}
if (RootBone)
{
// remove pre and post rotations
RemovePrePostRotations(RootBone);
// FindAndProcessTwistBones(RootBone);
// RemoveBindPoses(pScene);
// FixClusterTranformLinks(pScene, RootBone);
}
}

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

0 comments on commit 3769a38

Please sign in to comment.