Add Extrar Morph Support(WIP)
This commit is contained in:
@@ -19,9 +19,13 @@ public class UmaContainer : MonoBehaviour
|
||||
public AnimatorOverrideController OverrideController;
|
||||
public Animator UmaFaceAnimator;
|
||||
public AnimatorOverrideController FaceOverrideController;
|
||||
|
||||
public bool isAnimatorControl;
|
||||
|
||||
[Header("Body")]
|
||||
public GameObject UpBodyBone;
|
||||
public Vector3 UpBodyPosition;
|
||||
public Quaternion UpBodyRotation;
|
||||
|
||||
[Header("Face")]
|
||||
public FaceDrivenKeyTarget FaceDrivenKeyTarget;
|
||||
public FaceEmotionKeyTarget FaceEmotionKeyTarget;
|
||||
@@ -29,15 +33,20 @@ public class UmaContainer : MonoBehaviour
|
||||
public GameObject TrackTarget;
|
||||
public float EyeHeight;
|
||||
public bool EnableEyeTracking = true;
|
||||
|
||||
[Header("Body")]
|
||||
public GameObject UpBodyBone;
|
||||
public Vector3 UpBodyPosition;
|
||||
public Quaternion UpBodyRotation;
|
||||
public Material FaceMaterial;
|
||||
|
||||
[Header("Cheek")]
|
||||
public Texture CheekTex;
|
||||
public Material CheekMaterial;
|
||||
public Texture CheekTex_0;
|
||||
public Texture CheekTex_1;
|
||||
public Texture CheekTex_2;
|
||||
|
||||
[Header("Manga")]
|
||||
public List<GameObject> LeftMangaObject = new List<GameObject>();
|
||||
public List<GameObject> RightMangaObject = new List<GameObject>();
|
||||
|
||||
[Header("Tear")]
|
||||
public List<GameObject> TearObjects_0 = new List<GameObject>();
|
||||
public List<GameObject> TearObjects_1 = new List<GameObject>();
|
||||
|
||||
[Header("Generic")]
|
||||
public bool IsGeneric = false;
|
||||
@@ -52,15 +61,16 @@ public class UmaContainer : MonoBehaviour
|
||||
public bool EnablePhysics = true;
|
||||
public List<CySpringDataContainer> cySpringDataContainers;
|
||||
|
||||
[Header("Shader")]
|
||||
public Material FaceMaterial;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
EyeHeight = 0.1f;
|
||||
TrackTarget = Camera.main.gameObject;
|
||||
UpBodyPosition = UpBodyBone.transform.localPosition;
|
||||
UpBodyRotation = UpBodyBone.transform.localRotation;
|
||||
|
||||
//Models must be merged before handling extra morphs
|
||||
if (FaceDrivenKeyTarget)
|
||||
FaceDrivenKeyTarget.ChangeMorphWeight(FaceDrivenKeyTarget.MouthMorphs[3], 1);
|
||||
}
|
||||
|
||||
public void MergeModel()
|
||||
@@ -108,16 +118,16 @@ public class UmaContainer : MonoBehaviour
|
||||
child.SetParent(transform);
|
||||
}
|
||||
Tail.SetActive(false); //for debugging
|
||||
emptyBones.ForEach(a => { if (a) Destroy(a.gameObject); });
|
||||
}
|
||||
|
||||
|
||||
emptyBones.ForEach(a => { if (a) Destroy(a.gameObject); });
|
||||
|
||||
//MergeAvatar
|
||||
UmaAnimator = gameObject.AddComponent<Animator>();
|
||||
UmaAnimator.avatar = AvatarBuilder.BuildGenericAvatar(gameObject, gameObject.name);
|
||||
OverrideController = Instantiate(UmaViewerBuilder.Instance.OverrideController);
|
||||
UmaAnimator.runtimeAnimatorController = OverrideController;
|
||||
|
||||
FaceMaterial = transform.Find("M_Face").GetComponent<SkinnedMeshRenderer>().material;
|
||||
}
|
||||
|
||||
public void SetHeight(int scale)
|
||||
@@ -156,12 +166,17 @@ public class UmaContainer : MonoBehaviour
|
||||
|
||||
public void LoadPhysics()
|
||||
{
|
||||
cySpringDataContainers = new List<CySpringDataContainer>();
|
||||
var springs = PhysicsController.GetComponentsInChildren<CySpringDataContainer>();
|
||||
foreach (CySpringDataContainer spring in springs)
|
||||
cySpringDataContainers = new List<CySpringDataContainer>(PhysicsController.GetComponentsInChildren<CySpringDataContainer>());
|
||||
var bones = new List<Transform>(GetComponentsInChildren<Transform>());
|
||||
var colliders = new List<GameObject>();
|
||||
|
||||
foreach (CySpringDataContainer spring in cySpringDataContainers)
|
||||
{
|
||||
cySpringDataContainers.Add(spring);
|
||||
spring.InitializePhysics();
|
||||
colliders.AddRange(spring.InitiallizeCollider(bones));
|
||||
}
|
||||
foreach (CySpringDataContainer spring in cySpringDataContainers)
|
||||
{
|
||||
spring.InitializePhysics(bones, colliders);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user