Skip to content
Draft
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
8 changes: 7 additions & 1 deletion Editor/UniEyeControllerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ public override void OnInspectorGUI()
break;
case EyeAssignMethod.Generic:
EditorExtensions.BeginErrorColor(_prefabForGenericAvatar.objectReferenceValue == null);
EditorGUILayout.PropertyField(_prefabForGenericAvatar, new GUIContent("基準となるPrefab"));
EditorGUI.BeginChangeCheck();
// Scene上のGameObjectを指定させないためにObjectFieldを使う
script.prefabForGenericAvatar = EditorGUILayout.ObjectField("基準となるPrefab", script.prefabForGenericAvatar, typeof(GameObject), false) as GameObject;
if (EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(script);
}
EditorExtensions.EndErrorColor();

GUILayout.BeginHorizontal();
Expand Down
2 changes: 2 additions & 0 deletions Runtime/Timeline/LookAt/UniEyeLookAtMixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public override void ProcessFrame(Playable playable, FrameData info, object play
{
var controller = playerData as UniEyeController;
if (controller == null) return;
if (!controller.gameObject.activeInHierarchy) return;
if (!controller.IsSettingValid) return;

_process = controller.lookAtProcess;
if (_process == null) return;
Expand Down
24 changes: 24 additions & 0 deletions Runtime/UniEyeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using UniEyeController.Core.Process.Blink;
using UniEyeController.Core.Process.LookAt;
using UniEyeController.Core.Process.MicroMove;
using UnityEditor;
using UnityEngine;

namespace UniEyeController
Expand Down Expand Up @@ -35,13 +36,36 @@ public partial class UniEyeController : MonoBehaviour
public MicroMoveProcess microMoveProcess = new MicroMoveProcess();
public BlinkProcess blinkProcess = new BlinkProcess();

public bool IsSettingValid
{
get
{
if (assignMethod == EyeAssignMethod.Generic && gameObject.scene == prefabForGenericAvatar.scene)
{
Debug.LogError("GenericAvatarの初期状態参照用のPrefabはScene上のものを使用しないでください");
return false;
}

return true;
}
}

private void OnEnable()
{
Init();
}

public void Init()
{
// TODO : 仮の対応
if (assignMethod == EyeAssignMethod.Generic && gameObject.scene == prefabForGenericAvatar.scene)
{
var prefab = PrefabUtility.GetCorrespondingObjectFromSource(gameObject);
prefabForGenericAvatar = prefab;
}

if (!IsSettingValid) enabled = false;

GetRequiredComponents();
ChangeEyeBones();
}
Expand Down