diff --git a/Assets/Editor.meta b/Assets/Editor.meta deleted file mode 100644 index 60a967c..0000000 --- a/Assets/Editor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 020a75ca2e43f90458872197fe59530d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Editor/SetPropertyDrawer.cs b/Assets/Editor/SetPropertyDrawer.cs deleted file mode 100644 index 526dd99..0000000 --- a/Assets/Editor/SetPropertyDrawer.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 Luminary LLC -// Licensed under The MIT License (See LICENSE for full text) -using UnityEngine; -using UnityEditor; -using System; -using System.Collections; -using System.Reflection; - -[CustomPropertyDrawer(typeof(SetPropertyAttribute))] -public class SetPropertyDrawer : PropertyDrawer -{ - public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) - { - // Rely on the default inspector GUI - EditorGUI.BeginChangeCheck (); - EditorGUI.PropertyField(position, property, label); - - // Update only when necessary - SetPropertyAttribute setProperty = attribute as SetPropertyAttribute; - if (EditorGUI.EndChangeCheck()) - { - // When a SerializedProperty is modified the actual field does not have the current value set (i.e. - // FieldInfo.GetValue() will return the prior value that was set) until after this OnGUI call has completed. - // Therefore, we need to mark this property as dirty, so that it can be updated with a subsequent OnGUI event - // (e.g. Repaint) - setProperty.IsDirty = true; - } - else if (setProperty.IsDirty) - { - // The propertyPath may reference something that is a child field of a field on this Object, so it is necessary - // to find which object is the actual parent before attempting to set the property with the current value. - object parent = GetParentObjectOfProperty(property.propertyPath, property.serializedObject.targetObject); - Type type = parent.GetType(); - PropertyInfo pi = type.GetProperty(setProperty.Name); - if (pi == null) - { - Debug.LogError("Invalid property name: " + setProperty.Name + "\nCheck your [SetProperty] attribute"); - } - else - { - // Use FieldInfo instead of the SerializedProperty accessors as we'd have to deal with every - // SerializedPropertyType and use the correct accessor - pi.SetValue(parent, fieldInfo.GetValue(parent), null); - } - setProperty.IsDirty = false; - } - } - - private object GetParentObjectOfProperty(string path, object obj) - { - string[] fields = path.Split('.'); - - // We've finally arrived at the final object that contains the property - if (fields.Length == 1) - { - return obj; - } - - // We may have to walk public or private fields along the chain to finding our container object, so we have to allow for both - FieldInfo fi = obj.GetType().GetField(fields[0], BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); - obj = fi.GetValue(obj); - - // Keep searching for our object that contains the property - return GetParentObjectOfProperty(string.Join(".", fields, 1, fields.Length - 1), obj); - } -} diff --git a/Assets/Editor/SetPropertyDrawer.cs.meta b/Assets/Editor/SetPropertyDrawer.cs.meta deleted file mode 100644 index 707a914..0000000 --- a/Assets/Editor/SetPropertyDrawer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f52efb0d2eca47e40ab251ae0e23e311 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/umamusume/FaceDrivenKeyTarget.cs b/Assets/Scripts/umamusume/FaceDrivenKeyTarget.cs index 7abef06..8bf8372 100644 --- a/Assets/Scripts/umamusume/FaceDrivenKeyTarget.cs +++ b/Assets/Scripts/umamusume/FaceDrivenKeyTarget.cs @@ -67,13 +67,15 @@ namespace Gallop } } - private void Update() + + private void FixedUpdate() { + bool changed = false; for (int i = 0; i < EyeBrowMorphs.Count; i++) { if(EyeBrowMorphs[i].LastWeight!= EyeBrowMorphs[i].Weight) { - ChangeMorph(); + changed = true; EyeBrowMorphs[i].LastWeight = EyeBrowMorphs[i].Weight; } } @@ -81,7 +83,7 @@ namespace Gallop { if (EyeMorphs[i].LastWeight != EyeMorphs[i].Weight) { - ChangeMorph(); + changed = true; EyeMorphs[i].LastWeight = EyeMorphs[i].Weight; } } @@ -89,10 +91,12 @@ namespace Gallop { if (MouthMorphs[i].LastWeight != MouthMorphs[i].Weight) { - ChangeMorph(); + changed = true; MouthMorphs[i].LastWeight = MouthMorphs[i].Weight; } } + + if (changed)ChangeMorph(); } public void ChangeMorph() @@ -105,17 +109,13 @@ namespace Gallop var bone = Objs.Find(ani => ani.name.Equals(trs._path)); if (bone) { - if (trs.IsOverrideTarget==1) + if (!trs.IsOverrideTarget) { - bone.localRotation = Quaternion.Euler(Vector3.Lerp(OriRots[Objs.IndexOf(bone)].eulerAngles, trs._rotation, morph.Weight)); - bone.localPosition = Vector3.Lerp(OriTrans[Objs.IndexOf(bone)],trs._position,morph.Weight); - bone.localScale = Vector3.Lerp(OriScal[Objs.IndexOf(bone)],trs._scale, morph.Weight); - } - else - { - bone.localRotation = Quaternion.Euler(bone.localRotation.eulerAngles+ (trs._rotation* morph.Weight)); - bone.localPosition += trs._position*morph.Weight; - bone.localScale += trs._scale* morph.Weight; + var tmp = bone.localRotation.eulerAngles; + tmp += (trs._rotation * morph.Weight); + bone.localRotation = Quaternion.Euler(bone.localRotation.eulerAngles + (trs._rotation * morph.Weight)); + bone.localPosition += trs._position * morph.Weight; + bone.localScale += trs._scale * morph.Weight; } }; } @@ -128,13 +128,7 @@ namespace Gallop var bone = Objs.Find(ani => ani.name.Equals(trs._path)); if (bone) { - if (trs.IsOverrideTarget == 1) - { - bone.localRotation = Quaternion.Euler(Vector3.Lerp(OriRots[Objs.IndexOf(bone)].eulerAngles, trs._rotation, morph.Weight)); - bone.localPosition = Vector3.Lerp(OriTrans[Objs.IndexOf(bone)], trs._position, morph.Weight); - bone.localScale = Vector3.Lerp(OriScal[Objs.IndexOf(bone)], trs._scale, morph.Weight); - } - else + if (!trs.IsOverrideTarget) { bone.localRotation = Quaternion.Euler(bone.localRotation.eulerAngles + (trs._rotation * morph.Weight)); bone.localPosition += trs._position * morph.Weight; @@ -151,13 +145,7 @@ namespace Gallop var bone = Objs.Find(ani => ani.name.Equals(trs._path)); if (bone) { - if (trs.IsOverrideTarget == 1) - { - bone.localRotation = Quaternion.Euler(Vector3.Lerp(OriRots[Objs.IndexOf(bone)].eulerAngles, trs._rotation, morph.Weight)); - bone.localPosition = Vector3.Lerp(OriTrans[Objs.IndexOf(bone)], trs._position, morph.Weight); - bone.localScale = Vector3.Lerp(OriScal[Objs.IndexOf(bone)], trs._scale, morph.Weight); - } - else + if (!trs.IsOverrideTarget) { bone.localRotation = Quaternion.Euler(bone.localRotation.eulerAngles + (trs._rotation * morph.Weight)); bone.localPosition += trs._position * morph.Weight; @@ -166,6 +154,58 @@ namespace Gallop }; } } + + + foreach (FacialMorph morph in EyeBrowMorphs)//´¦Àí¸²¸Ç±íÇé + { + foreach (TrsArray trs in morph.trsArray) + { + var bone = Objs.Find(ani => ani.name.Equals(trs._path)); + if (bone) + { + if (trs.IsOverrideTarget) + { + bone.localRotation = Quaternion.Euler(Vector3.Lerp(bone.localRotation.eulerAngles, trs._rotation, morph.Weight)); + bone.localPosition = Vector3.Lerp(bone.localPosition, trs._position, morph.Weight); + bone.localScale = Vector3.Lerp(bone.localScale, trs._scale, morph.Weight); + } + }; + } + } + + foreach (FacialMorph morph in EyeMorphs) + { + foreach (TrsArray trs in morph.trsArray) + { + var bone = Objs.Find(ani => ani.name.Equals(trs._path)); + if (bone) + { + if (trs.IsOverrideTarget) + { + bone.localRotation = Quaternion.Euler(Vector3.Lerp(bone.localRotation.eulerAngles, trs._rotation, morph.Weight)); + bone.localPosition = Vector3.Lerp(bone.localPosition, trs._position, morph.Weight); + bone.localScale = Vector3.Lerp(bone.localScale, trs._scale, morph.Weight); + } + }; + } + } + + foreach (FacialMorph morph in MouthMorphs) + { + foreach (TrsArray trs in morph.trsArray) + { + var bone = Objs.Find(ani => ani.name.Equals(trs._path)); + if (bone) + { + if (trs.IsOverrideTarget) + { + bone.localRotation = Quaternion.Euler(Vector3.Lerp(bone.localRotation.eulerAngles, trs._rotation, morph.Weight)); + bone.localPosition = Vector3.Lerp(bone.localPosition, trs._position, morph.Weight); + bone.localScale = Vector3.Lerp(bone.localScale, trs._scale, morph.Weight); + } + }; + } + } } public void FacialReset() diff --git a/Assets/Scripts/umamusume/GallopExtras.cs b/Assets/Scripts/umamusume/GallopExtras.cs index 939343a..fd522ef 100644 --- a/Assets/Scripts/umamusume/GallopExtras.cs +++ b/Assets/Scripts/umamusume/GallopExtras.cs @@ -34,11 +34,11 @@ public class StringValuePair public class TrsArray { public string _path; - public int _isValidScaleTransform; + public bool _isValidScaleTransform; public Vector3 _position; public Vector3 _scale; public Vector3 _rotation; - public int IsOverrideTarget; + public bool IsOverrideTarget; } [System.Serializable] diff --git a/Assets/Scripts/umamusume/SetPropertyAttribute.cs b/Assets/Scripts/umamusume/SetPropertyAttribute.cs deleted file mode 100644 index 0e12aea..0000000 --- a/Assets/Scripts/umamusume/SetPropertyAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2014 Luminary LLC -// Licensed under The MIT License (See LICENSE for full text) -using UnityEngine; -using System.Collections; - -public class SetPropertyAttribute : PropertyAttribute -{ - public string Name { get; private set; } - public bool IsDirty { get; set; } - - public SetPropertyAttribute(string name) - { - this.Name = name; - } -} diff --git a/Assets/Scripts/umamusume/SetPropertyAttribute.cs.meta b/Assets/Scripts/umamusume/SetPropertyAttribute.cs.meta deleted file mode 100644 index 7dcab2a..0000000 --- a/Assets/Scripts/umamusume/SetPropertyAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5d72052b442fcfe42b1433eeb25729bb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: