From 7246135a0a49fed21971388950a29ccc4d6573c0 Mon Sep 17 00:00:00 2001
From: akizuki7950 <a3250766@gmail.com>
Date: Tue, 17 Jun 2025 20:59:52 +0200
Subject: [PATCH] Move face montage slot from body to face ABP / added bodyType
 check in PlayFacialAnimation so it only works for metahuman

---
 .../MetaHuman/Face_Archetype53_Skeleton.uasset |  4 ++--
 .../MetaHuman/metahuman_base_skel.uasset       |  4 ++--
 Content/Meta_AnimBP.uasset                     |  4 ++--
 Content/Meta_Face_AnimBP.uasset                |  4 ++--
 .../CharacterPlugin/Private/VirtualHuman.cpp   | 18 ++++++++++--------
 Source/CharacterPlugin/Public/VirtualHuman.h   |  2 +-
 6 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/Content/Characters/MetaHuman/Face_Archetype53_Skeleton.uasset b/Content/Characters/MetaHuman/Face_Archetype53_Skeleton.uasset
index 71b70af7..e8dad022 100644
--- a/Content/Characters/MetaHuman/Face_Archetype53_Skeleton.uasset
+++ b/Content/Characters/MetaHuman/Face_Archetype53_Skeleton.uasset
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:3e52769cc1a113747b05e443b82fc9b3647b8ffe7f52931d2413a7b37060251f
-size 890837
+oid sha256:8fb075eca9fdfb30900d188db69b2e7987124e4eac4e3019301decb08afcacbc
+size 843168
diff --git a/Content/Characters/MetaHuman/metahuman_base_skel.uasset b/Content/Characters/MetaHuman/metahuman_base_skel.uasset
index b2d5f438..64211672 100644
--- a/Content/Characters/MetaHuman/metahuman_base_skel.uasset
+++ b/Content/Characters/MetaHuman/metahuman_base_skel.uasset
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:5d7d329aa1cff9de60f7785e84e6416045703200fc2a9ed17706355ff6f3ca3e
-size 4101013
+oid sha256:3a3fef3b2c28447a3d45f7ae096fb0cb7704c1953aa072d12f5fc2263f4cf0be
+size 4100880
diff --git a/Content/Meta_AnimBP.uasset b/Content/Meta_AnimBP.uasset
index f0ac1f2e..c1534666 100644
--- a/Content/Meta_AnimBP.uasset
+++ b/Content/Meta_AnimBP.uasset
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:4fbd9915cf59a4dbaa0f089d1560a00f74edd1003de66e05c004619d6d8c59e9
-size 634068
+oid sha256:5e68ec4bbd9ca415e1dae13bd37f701f4362655d5235006c86b9267d07e5f048
+size 587163
diff --git a/Content/Meta_Face_AnimBP.uasset b/Content/Meta_Face_AnimBP.uasset
index d79a26ed..789c6536 100644
--- a/Content/Meta_Face_AnimBP.uasset
+++ b/Content/Meta_Face_AnimBP.uasset
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:ac43c45cbb05665fa7461ecc292edc4fb6a6d27ba369740b4eb5273d4dddfb9b
-size 513563
+oid sha256:16e113c60f2fae63032959caec74a8dab4a9dc7b865c997c45ee0573421a9e1c
+size 513341
diff --git a/Source/CharacterPlugin/Private/VirtualHuman.cpp b/Source/CharacterPlugin/Private/VirtualHuman.cpp
index f8965a14..d202cfef 100644
--- a/Source/CharacterPlugin/Private/VirtualHuman.cpp
+++ b/Source/CharacterPlugin/Private/VirtualHuman.cpp
@@ -182,16 +182,18 @@ bool AVirtualHuman::SupportsMorphs()
 
 void AVirtualHuman::PlayFacialAnimationMontage(UAnimMontage* InMontage, float InPlayRate, FName StartSectionName)
 {
-	UVHAnimInstance* BodyAnimInstance = GetBodyAnimInstance();
-	if (BodyAnimInstance)
-	{
-		float const Duration = BodyAnimInstance->Montage_Play(InMontage, InPlayRate);
-		if (Duration > 0.f)
+	if (BodyType != EBodyType::MetaHuman) {
+		UVHAnimInstance* BodyAnimInstance = GetBodyAnimInstance();
+		if (BodyAnimInstance)
 		{
-			// Start at a given Section.
-			if (StartSectionName != NAME_None)
+			float const Duration = BodyAnimInstance->Montage_Play(InMontage, InPlayRate);
+			if (Duration > 0.f)
 			{
-				BodyAnimInstance->Montage_JumpToSection(StartSectionName, InMontage);
+				// Start at a given Section.
+				if (StartSectionName != NAME_None)
+				{
+					BodyAnimInstance->Montage_JumpToSection(StartSectionName, InMontage);
+				}
 			}
 		}
 	}
diff --git a/Source/CharacterPlugin/Public/VirtualHuman.h b/Source/CharacterPlugin/Public/VirtualHuman.h
index b24c5454..21dad681 100644
--- a/Source/CharacterPlugin/Public/VirtualHuman.h
+++ b/Source/CharacterPlugin/Public/VirtualHuman.h
@@ -100,7 +100,7 @@ public:
 
 
 	/**
-	 * Facial animation play entry
+	 * Play a facial animation montage on face mesh. (Only for MetaHuman)
 	 */
 	UFUNCTION(BlueprintCallable)
 	virtual void PlayFacialAnimationMontage(UAnimMontage* InMontage, float InPlayRate = 1.0f, FName StartSectionName = NAME_None);
-- 
GitLab