void OnGUI() { this.title = "Ease: " + (oData.time_numbering ? AMTimeline.frameToTime(key.frame, (float)aData.getCurrentTake().frameRate) + " s" : key.frame.ToString()); AMTimeline.loadSkin(oData, ref skin, ref cachedSkinName, position); bool updateEasingCurve = false; GUIStyle styleBox = new GUIStyle(GUI.skin.button); styleBox.normal = GUI.skin.button.active; styleBox.hover = styleBox.normal; styleBox.border = GUI.skin.button.border; GUILayout.BeginArea(new Rect(5f, 5f, position.width - 10f, position.height - 10f)); GUILayout.BeginHorizontal(); if (GUILayout.Button("", styleBox, GUILayout.Width(500f), GUILayout.Height(100f))) { selectedSpeedIndex = (selectedSpeedIndex + 1) % speedValues.Length; percent = waitPercent * -1f; } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); int prevCategory = category; bool updatedSelectedIndex = false; if (setCategory(GUILayout.SelectionGrid(category, categories, (position.width >= 715f ? 12 : 6), GUILayout.Width(position.width - 16f)))) { selectedIndex = getSelectedEaseIndex(prevCategory, selectedIndex); selectedIndex = getCategoryIndexForEase(selectedIndex); if (selectedIndex < 0) { selectedIndex = 0; percent = waitPercent * -1f; updatedSelectedIndex = true; } } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginVertical(GUILayout.Height(233f)); if (updatedSelectedIndex || setSelectedIndex(GUILayout.SelectionGrid(selectedIndex, easeTypesFiltered[category].ToArray(), 3))) { percent = waitPercent * -1f; updateEasingCurve = true; if (getSelectedEaseName(category, selectedIndex) == "Custom") { isCustomEase = true; if (key.customEase.Count > 0) { curve = key.getCustomEaseCurve(); } else { setEasingCurve(); } } else { isCustomEase = false; } } GUILayout.EndVertical(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); if (GUILayout.Button("Apply")) { bool shouldUpdateCache = false; if (isCustomEase) { key.setCustomEase(curve); shouldUpdateCache = true; } if (key.setEaseType(getSelectedEaseIndex(category, selectedIndex))) { shouldUpdateCache = true; } if (shouldUpdateCache) { // update cache when modifying varaibles track.updateCache(); AMCodeView.refresh(); // preview new position aData.getCurrentTake().previewFrame(aData.getCurrentTake().selectedFrame); // save data EditorUtility.SetDirty(aData); } this.Close(); } if (GUILayout.Button("Cancel")) { this.Close(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); // orb texture GUI.DrawTexture(new Rect(x_pos, 15f, 80f, 80f), tex_orb); // speed label GUIStyle styleLabelRight = new GUIStyle(GUI.skin.label); styleLabelRight.alignment = TextAnchor.MiddleRight; styleLabelRight.normal.textColor = Color.white; EditorGUI.DropShadowLabel(new Rect(475f, 5f, 25f, 25f), speedNames[selectedSpeedIndex], styleLabelRight); // draw border GUI.color = GUI.skin.window.normal.textColor; GUI.DrawTexture(new Rect(0f, 0f, 7f, 110f), EditorGUIUtility.whiteTexture); GUI.DrawTexture(new Rect(position.width - 209f, 0f, 208f, 110f), EditorGUIUtility.whiteTexture); GUI.color = Color.white; // curve field if (updateEasingCurve) { setEasingCurve(); } else if (!isCustomEase && didChangeCurve()) { isCustomEase = true; selectedIndex = getCategoryIndexForEaseName("Custom"); if (selectedIndex < 0) { category = 0; selectedIndex = getCategoryIndexForEaseName("Custom"); } } curve = EditorGUI.CurveField(new Rect(500f, 5f, 208f, 100f), curve, Color.blue, new Rect(0f, -0.5f, 1f, 2.0f)); }