diff --git a/Assets/Neuron/Scripts/Editor.meta b/Assets/Neuron/Scripts/Editor.meta deleted file mode 100644 index 221e170..0000000 --- a/Assets/Neuron/Scripts/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9a5a7cce706b92d4e8e43726edfeef11 -folderAsset: yes -timeCreated: 1466606696 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Neuron/Scripts/Editor/NeuronAnimatorEditor.cs b/Assets/Neuron/Scripts/Editor/NeuronAnimatorEditor.cs deleted file mode 100644 index 8ba596c..0000000 --- a/Assets/Neuron/Scripts/Editor/NeuronAnimatorEditor.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Custom editor for Neuron animator class -// -// Refactored by Keijiro Takahashi -// https://github.com/keijiro/NeuronRetargeting -// -// This is a derivative work of the Perception Neuron SDK. You can use this -// freely as one of "Perception Neuron SDK Derivatives". See LICENSE.pdf and -// their website for further details. -// - -using UnityEngine; -using UnityEditor; - -namespace Neuron -{ - [CanEditMultipleObjects, CustomEditor(typeof(NeuronAnimator))] - public class NeuronAnimatorEditor : Editor - { - SerializedProperty _address; - SerializedProperty _port; - SerializedProperty _socketType; - SerializedProperty _actorID; - - void OnEnable() - { - _address = serializedObject.FindProperty("_address"); - _port = serializedObject.FindProperty("_port"); - _socketType = serializedObject.FindProperty("_socketType"); - _actorID = serializedObject.FindProperty("_actorID"); - } - - public override void OnInspectorGUI() - { - if (EditorApplication.isPlaying) - { - EditorGUILayout.HelpBox( - "The settings in this component is not editable while " + - "playing. Exit the play mode to change the settings.", - MessageType.None, true - ); - return; - } - - serializedObject.Update(); - - EditorGUILayout.PropertyField(_address); - EditorGUILayout.PropertyField(_port); - EditorGUILayout.PropertyField(_socketType); - EditorGUILayout.PropertyField(_actorID); - - serializedObject.ApplyModifiedProperties(); - } - } -} diff --git a/Assets/Neuron/Scripts/Editor/NeuronAnimatorEditor.cs.meta b/Assets/Neuron/Scripts/Editor/NeuronAnimatorEditor.cs.meta deleted file mode 100644 index 57be6a9..0000000 --- a/Assets/Neuron/Scripts/Editor/NeuronAnimatorEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9aadf19b466c916498724aa2b77a885a -timeCreated: 1466606944 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Neuron/Scripts/NeuronAnimator.cs b/Assets/Neuron/Scripts/NeuronAnimator.cs index 53ffa2e..4284939 100644 --- a/Assets/Neuron/Scripts/NeuronAnimator.cs +++ b/Assets/Neuron/Scripts/NeuronAnimator.cs @@ -18,42 +18,35 @@ public class NeuronAnimator : MonoBehaviour { #region Editable variables - [SerializeField] - string _address = "127.0.0.1"; - - [SerializeField] - int _port = 7001; - - [SerializeField] - NeuronConnection.SocketType _socketType = NeuronConnection.SocketType.TCP; - - [SerializeField] - int _actorID = 0; + public string address = "127.0.0.1"; + public int port = 7001; + public NeuronConnection.SocketType socketType = NeuronConnection.SocketType.TCP; + public int actorID = 0; #endregion #region MonoBehavior functions - void Awake() + protected virtual void Awake() { _animator = GetComponent(); ScanBones(); } - void OnEnable() + protected virtual void OnEnable() { - _source = NeuronConnection.Connect(_address, _port, _socketType); - if (_source != null) _actor = _source.AcquireActor(_actorID); + _source = NeuronConnection.Connect(address, port, socketType); + if (_source != null) _actor = _source.AcquireActor(actorID); } - void OnDisable() + protected virtual void OnDisable() { if (_source != null) NeuronConnection.Disconnect(_source); _source = null; _actor = null; } - void Update() + protected virtual void Update() { if (_actor == null) return; @@ -124,7 +117,7 @@ void Update() FixUpWithFeetPosition(); } - void UpdateRoot() + protected void UpdateRoot() { var hips = _animator.GetBoneTransform(HumanBodyBones.Hips); @@ -139,7 +132,7 @@ void UpdateRoot() hips.localRotation = r_rot * Quaternion.Euler(rot) * r_rot_inv * d_rot; } - void UpdateBoneRotation( + protected void UpdateBoneRotation( HumanBodyBones humanBone, NeuronBones neuronBone0, NeuronBones neuronBone1 = NeuronBones.NumOfBones, @@ -164,7 +157,7 @@ void UpdateBoneRotation( bone.localRotation = r_rot * Quaternion.Euler(rot) * r_rot_inv * d_rot; } - void FixUpWithFeetPosition() + protected void FixUpWithFeetPosition() { var lfeet = _animator.GetBoneTransform(HumanBodyBones.LeftFoot); var rfeet = _animator.GetBoneTransform(HumanBodyBones.RightFoot); @@ -184,21 +177,21 @@ void FixUpWithFeetPosition() #region Private variables - const int kBoneCount = (int)HumanBodyBones.LastBone; + protected const int kBoneCount = (int)HumanBodyBones.LastBone; - Animator _animator; - NeuronSource _source; - NeuronActor _actor; + protected Animator _animator; + protected NeuronSource _source; + protected NeuronActor _actor; - float _scaleFactorForHips; - Quaternion[] _resetRotations = new Quaternion[kBoneCount]; - Quaternion[] _defaultRotations = new Quaternion[kBoneCount]; + protected float _scaleFactorForHips; + protected Quaternion[] _resetRotations = new Quaternion[kBoneCount]; + protected Quaternion[] _defaultRotations = new Quaternion[kBoneCount]; #endregion #region Private functions - void ScanBones() + protected void ScanBones() { // The height of the hips in the base model. const float kBaseHipsHeight = 1.113886f;