private void Initialize(SerializedProperty property) { if (curve != null) { return; } string path = JuicyEditorUtils.GetPluginRootPath() + "Editor/EasingCurves.curves"; CacheProperty(ref curve, property, nameof(curve)); Object presetObject = AssetDatabase .LoadAssetAtPath <Object>(path); presets = new SerializedObject(presetObject) .FindProperty("m_Presets"); curves = new AnimationCurve[presets.arraySize]; names = new string[presets.arraySize]; for (int i = 0; i < presets.arraySize; i++) { SerializedProperty present = presets.GetArrayElementAtIndex(i); names[i] = BuildEaseMenu(present .FindPropertyRelative("m_Name").stringValue); curves[i] = new AnimationCurve(present .FindPropertyRelative("m_Curve").animationCurveValue.keys); } }
static JuicyStyles() { IconButtonStyle = new GUIStyle(GUI.skin.FindStyle("IconButton") ?? EditorGUIUtility .GetBuiltinSkin(EditorSkin.Inspector) .FindStyle("IconButton")) { margin = new RectOffset(0, 0, 2, 0) }; FeedbackEditorStyle = new GUIStyle { margin = new RectOffset(0, 17, 5, 5) }; BoxStyle = new GUIStyle(EditorStyles.toolbar) { padding = new RectOffset(3, 3, 4, 4), margin = new RectOffset(0, 3, 0, 0), stretchHeight = true, stretchWidth = true, fixedHeight = 0.0f }; FeedbackItemBoxStyle = new GUIStyle(EditorStyles.toolbar) { padding = new RectOffset(3, 3, 4, 4), margin = new RectOffset(0, 0, 0, 0), stretchHeight = true, stretchWidth = true, fixedHeight = 0.0f, }; IconJuicyStyle = new GUIStyle { margin = new RectOffset(10, 0, 0, 0), fixedWidth = EditorGUIUtility.singleLineHeight + 10, fixedHeight = EditorGUIUtility.singleLineHeight }; FeedbackIconStyle = new GUIStyle { margin = new RectOffset(0, 0, 4, 0), fixedWidth = EditorGUIUtility.singleLineHeight - 5, fixedHeight = EditorGUIUtility.singleLineHeight - 5, }; FoldoutStyle = new GUIStyle(EditorStyles.foldout) { //alignment = TextAnchor.MiddleLeft, wordWrap = true, //fontStyle = FontStyle.Bold, fontSize = 12 }; SmallToggle = new GUIStyle("ShurikenToggle") { fixedWidth = EditorGUIUtility.singleLineHeight, fixedHeight = EditorGUIUtility.singleLineHeight }; HeaderStyle = new GUIStyle(EditorStyles.boldLabel); HeaderToggleStyle = new GUIStyle(EditorStyles.toggle) { fontStyle = FontStyle.Bold }; HeaderFoldout = new GUIStyle(EditorStyles.foldoutHeader) { margin = new RectOffset(16, 7, 0, 0), fixedHeight = 25, fontSize = 11, fontStyle = FontStyle.Bold }; ToggleGroupStyle = new GUIStyle(EditorStyles.foldoutHeader) { fontSize = 10, fontStyle = FontStyle.Normal, }; ToggleGroupLabelStyle = new GUIStyle(EditorStyles.boldLabel) { padding = new RectOffset(-10, 0, 0, 0), fontSize = 10 }; ToggleGroupLabelSelectedStyle = new GUIStyle(ToggleGroupLabelStyle) { normal = { textColor = EditorStyles.linkLabel.normal.textColor }, }; IconJuicy = AssetDatabase .LoadAssetAtPath <Texture>(JuicyEditorUtils.GetPluginRootPath() + "Images/img_juicy.png"); DefaultFeedbackIcon = AssetDatabase .LoadAssetAtPath <Texture>(JuicyEditorUtils.GetPluginRootPath() + $"Images/img_feedback_default.png"); InvalidIcon = EditorGUIUtility.IconContent("console.erroricon.sml").image; ValidIcon = EditorGUIUtility.IconContent("Collab").image; }