From 865ff176a96f4ecee0db6eaf9d744604ada94671 Mon Sep 17 00:00:00 2001 From: Roman <69218254+amzn-rhhong@users.noreply.github.com> Date: Thu, 24 Jun 2021 09:18:33 -0700 Subject: [PATCH] [bugfix] Any FBX create both a model and actor by default * [bugfix] Any FBX create both a model and actor by default --- .../Behaviors/ActorGroupBehavior.cpp | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Behaviors/ActorGroupBehavior.cpp b/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Behaviors/ActorGroupBehavior.cpp index 4be17d78aa..6be086a31b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Behaviors/ActorGroupBehavior.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Behaviors/ActorGroupBehavior.cpp @@ -168,13 +168,25 @@ namespace EMotionFX AZ::SceneAPI::Events::ProcessingResult ActorGroupBehavior::BuildDefault(AZ::SceneAPI::Containers::Scene& scene) const { + // Skip adding the actor group if it's already exist. + if (SceneHasActorGroup(scene)) + { + return AZ::SceneAPI::Events::ProcessingResult::Ignored; + } + const bool hasBoneData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike(scene, true); const bool hasSkinData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike(scene, true); - const bool hasBlendShapeData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike(scene, true); - // Skip building the default actor in case a valid actor group with overwritten settings exists, or - // in the most common case for animation files, that do contain an animated skeleton while not containing a skin or blend shapes. - if (SceneHasActorGroup(scene) || - (hasBoneData && (!hasSkinData && !hasBlendShapeData))) + const bool hasBlendShapeData = + AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike(scene, true); + // Skip adding the actor group if it doesn't contain any bone, skin and blendshape data. + if (!hasBoneData && !hasSkinData && !hasBlendShapeData) + { + return AZ::SceneAPI::Events::ProcessingResult::Ignored; + } + + const bool hasAnimationData = AZ::SceneAPI::Utilities::DoesSceneGraphContainDataLike(scene, true); + // Skip adding the actor group if it's contain animation data but don't contain any skindata or blendshapedata. + if (hasAnimationData && !hasSkinData && !hasBlendShapeData) { return AZ::SceneAPI::Events::ProcessingResult::Ignored; }