Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Editor/FaceEmoteProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected void Apply(BuildContext buildContext, Runtime.FaceEmoteInstaller insta
targetGameObject.transform.parent = buildContext.AvatarRootObject.transform;

ApplyMergeAnimator(installer, targetGameObject);
ApplyMAParameters(targetGameObject);
ApplyMAParameters(installer, targetGameObject);
ApplyMAMenuInstaller(installer, targetGameObject);
}

Expand Down Expand Up @@ -140,14 +140,14 @@ AnimatorState GenerateAnimatorState(string name, AnimationClip motion)
return layer;
}

protected void ApplyMAParameters(GameObject target)
protected void ApplyMAParameters(Runtime.FaceEmoteInstaller installer, GameObject target)
{
var parameter = target.AddComponent<ModularAvatarParameters>();
var conf = new ParameterConfig()
{
nameOrPrefix = ExpressionSetParameterName,
defaultValue = 0,
saved = true,
saved = installer.IsExpressionSetIndexSaved,
syncType = ParameterSyncType.Int
};
parameter.parameters.Add(conf);
Expand Down
3 changes: 3 additions & 0 deletions Runtime/FaceEmoteInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public sealed class FaceEmoteInstaller : MonoBehaviour, IEditorOnly
public AnimationClip IdleMotion;
[SerializeField]
public bool WriteDefaultsValues;
// 表情セットのインデックスを保存するかどうか
[SerializeField]
public bool IsExpressionSetIndexSaved;

[SerializeField]
public List<ExpressionSetDefinition> Definitions;
Expand Down
7 changes: 5 additions & 2 deletions Tests/FaceEmoteProcessorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,13 @@ void ValidateEmoteSetStateMachineSubSetEmote(AnimatorState node, int setIndex, i
}

[Test]
public void TestProcess_GeneratesMAParameters()
[TestCase(false)]
[TestCase(true)]
public void TestProcess_GeneratesMAParameters(bool isExpressionSetIndexSaved)
{
var gameObject = new GameObject("Test Target");
var installerComponent = gameObject.AddComponent<Runtime.FaceEmoteInstaller>();
installerComponent.IsExpressionSetIndexSaved = isExpressionSetIndexSaved;

var context = new BuildContext(gameObject, "Assets/_TestingResources");

Expand All @@ -282,7 +285,7 @@ public void TestProcess_GeneratesMAParameters()
{
nameOrPrefix = "ExpressionSet",
syncType = ParameterSyncType.Int,
saved = true,
saved = isExpressionSetIndexSaved,
defaultValue = 0,
},
};
Expand Down
Loading