/// <summary> /// /// </summary> public static bool DrawHandGUI(string i_flag, HandGesture i_gesture) { bool ret = false, foldout = EditorGUILayout.Foldout(EditorPrefs.GetBool(i_flag + " Hand", false), i_flag + " Hand"); EditorPrefs.SetBool(i_flag + " Hand", foldout); if (foldout) { if (i_gesture == null) { EditorGUILayout.HelpBox( "Please link a HandGesture asset to " + i_flag + " Gesture", MessageType.Warning ); } else { HandGesture.Entry[] entries = i_gesture.entriesForEditor; float value; for (int i = 0, imax = entries.Length; i < imax; ++i) { GUI.changed = false; value = EditorGUILayout.Slider(entries[i].id.ToString(), entries[i].value, -1.0f, 1.0f); if (GUI.changed) { //Log.i("",""); Undo.RecordObject(i_gesture, "Modify HandGesture"); entries[i].value = value; EditorUtility.SetDirty(i_gesture); ret = true; } } } } return(ret); }
/// <summary> /// /// </summary> public virtual void SetGesture(HandGesture i_gesture) { for (int i = 0, imax = 5; i < imax; ++i) { fingers[i].Stretch( i_gesture.GetStretch(i) ); } }
/// <summary> /// /// </summary> public static void LerpStretch(HandControllerBase o_ctrl, HandGesture i_from, HandGesture i_to, float i_t) { float from, to; for (int i = 0, imax = 5; i < imax; ++i) { from = i_from.GetStretch(i); to = i_to.GetStretch(i); o_ctrl.fingers[i].Stretch( from * (1.0f - i_t) + to * i_t ); } }