avoid editor error if not playing

This commit is contained in:
ousttrue 2021-06-15 14:16:52 +09:00
parent 759204388f
commit ceed241abd
3 changed files with 6 additions and 11 deletions

View File

@ -35,6 +35,7 @@ namespace UniVRM10
if (!Application.isPlaying)
{
EditorGUILayout.HelpBox("Enable when playing", MessageType.Info);
return;
}
if (m_sliders != null)

View File

@ -43,23 +43,17 @@ namespace UniVRM10
int m_debugCount;
internal void Setup(Transform transform, ILookAtEyeDirectionProvider eyeDirectionProvider, ILookAtEyeDirectionApplicable eyeDirectionApplicable)
internal void Setup(VRM10Controller target, ILookAtEyeDirectionProvider eyeDirectionProvider, ILookAtEyeDirectionApplicable eyeDirectionApplicable)
{
m_expressionAvatar = transform.GetComponent<VRM10ExpressionAvatar>();
m_expressionAvatar = target.GetComponent<VRM10ExpressionAvatar>();
if (m_expressionAvatar == null)
{
#if VRM_DEVELOP
if (m_debugCount++ == 0)
{
Debug.LogWarning($"{nameof(VRM10ControllerExpression)}.{nameof(m_expressionAvatar)} is null.");
}
#endif
return;
throw new ArgumentNullException();
}
Restore();
_merger = new ExpressionMerger(m_expressionAvatar.Clips, transform);
_merger = new ExpressionMerger(m_expressionAvatar.Clips, target.transform);
_keys = m_expressionAvatar.Clips.Select(ExpressionKey.CreateFromClip).ToList();
var oldInputWeights = _inputWeights;
_inputWeights = _keys.ToDictionary(x => x, x => 0f);

View File

@ -22,7 +22,7 @@ namespace UniVRM10
}
m_head = animator.GetBoneTransform(HumanBodyBones.Head);
target.LookAt.Setup(animator, m_head);
target.Expression.Setup(target.transform, target.LookAt, target.LookAt.EyeDirectionApplicable);
target.Expression.Setup(target, target.LookAt, target.LookAt.EyeDirectionApplicable);
if (m_constraints == null)
{