private void TierSettingsGUI() { if (tierSettingsAnimator == null) { tierSettingsAnimator = new UnityEditor.AnimatedValues.AnimBool(showTierSettingsUI, Repaint); } bool enabled = GUI.enabled; GUI.enabled = true; // we don't want to disable the expand behavior EditorGUILayout.BeginVertical(GUI.skin.box); EditorGUILayout.BeginHorizontal(); Rect r = GUILayoutUtility.GetRect(20, 18); r.x += 3; r.width += 6; showTierSettingsUI = GUI.Toggle(r, showTierSettingsUI, Styles.tierSettings, EditorStyles.inspectorTitlebarText); HandleEditorWindowButton(); EditorGUILayout.EndHorizontal(); tierSettingsAnimator.target = showTierSettingsUI; GUI.enabled = enabled; if (EditorGUILayout.BeginFadeGroup(tierSettingsAnimator.faded) && TierSettingsWindow.GetInstance() == null) { tierSettingsEditor.OnInspectorGUI(); } EditorGUILayout.EndFadeGroup(); EditorGUILayout.EndVertical(); }
public virtual void OnOpenGUI(Material material, MaterialEditor materialEditor) { // Foldout states m_SurfaceOptionsFoldout = new UnityEditor.AnimatedValues.AnimBool(true); m_SurfaceInputsFoldout = new UnityEditor.AnimatedValues.AnimBool(true); m_AdvancedFoldout = new UnityEditor.AnimatedValues.AnimBool(true); m_OtherFoldout = new UnityEditor.AnimatedValues.AnimBool(true); foreach (var obj in materialEditor.targets) { MaterialChanged((Material)obj); } }
public AnimCollapseSection(GUIContent label, bool showOnlyInEditMode, bool isDefaultExpanded, System.Action action, UnityEditor.Editor editor, Color backgroundColor, List <AnimCollapseSection> groupItems = null) { Label = label; _name = Label.text; Label.text = " " + Label.text; // Add a space for aesthetics ShowOnlyInEditMode = showOnlyInEditMode; _action = action; isDefaultExpanded = EditorPrefs.GetBool(PrefName, isDefaultExpanded); BackgroundColor = backgroundColor; _groupItems = groupItems; _anim = new UnityEditor.AnimatedValues.AnimBool(isDefaultExpanded); _anim.speed = CollapseSpeed; _anim.valueChanged.AddListener(editor.Repaint); }
void OnEnable() { validateData(); // setup the reorderable list deselectAnimation(); _reorderableAnimationList = new ReorderableList(serializedObject, serializedObject.FindProperty("animations"), true, true, true, true); _reorderableAnimationList.drawElementCallback = drawAnimationListElement; _reorderableAnimationList.drawHeaderCallback = ( Rect rect ) => { EditorGUI.LabelField(rect, "Animations"); }; _reorderableAnimationList.onAddCallback = ( ReorderableList list ) => { list.serializedProperty.InsertArrayElementAtIndex(list.count); var prop = list.serializedProperty.GetArrayElementAtIndex(list.count - 1); prop.FindPropertyRelative("name").stringValue = "new-animation"; prop.FindPropertyRelative("frames").ClearArray(); prop.FindPropertyRelative("triggers").ClearArray(); selectAnimationAtIndex(list.count - 1); }; _reorderableAnimationList.onMouseUpCallback = ( ReorderableList list ) => { selectAnimationAtIndex(_selectedIndex); }; _reorderableAnimationList.onRemoveCallback = ( ReorderableList list ) => { list.serializedProperty.DeleteArrayElementAtIndex(list.index); deselectAnimation(); }; // hide/show helper _triggerListAnimBool = new UnityEditor.AnimatedValues.AnimBool(false); _triggerListAnimBool.valueChanged.AddListener(Repaint); _framesListAnimBool = new UnityEditor.AnimatedValues.AnimBool(true); _framesListAnimBool.valueChanged.AddListener(Repaint); // setup our PreviewGUI goodies _playButton = EditorGUIUtility.Load("icons/Animation.Play.png") as Texture; _pauseButton = EditorGUIUtility.Load("icons/PauseButton Anim.png") as Texture; _isPlaying = false; }
public FoldoutSet(EditorWindow editor, bool defaultIsShown) { animation = new UnityEditor.AnimatedValues.AnimBool(defaultIsShown, editor.Repaint); }
void OnEnable() { validateData(); // setup the reorderable list deselectAnimation(); _reorderableAnimationList = new ReorderableList( serializedObject, serializedObject.FindProperty( "animations" ), true, true, true, true ); _reorderableAnimationList.drawElementCallback = drawAnimationListElement; _reorderableAnimationList.drawHeaderCallback = ( Rect rect ) => { EditorGUI.LabelField( rect, "Animations" ); }; _reorderableAnimationList.onAddCallback = ( ReorderableList list ) => { list.serializedProperty.InsertArrayElementAtIndex( list.count ); var prop = list.serializedProperty.GetArrayElementAtIndex( list.count - 1 ); prop.FindPropertyRelative( "name" ).stringValue = "new-animation"; prop.FindPropertyRelative( "frames" ).ClearArray(); prop.FindPropertyRelative( "triggers" ).ClearArray(); selectAnimationAtIndex( list.count - 1 ); }; _reorderableAnimationList.onMouseUpCallback = ( ReorderableList list ) => { selectAnimationAtIndex( _selectedIndex ); }; _reorderableAnimationList.onRemoveCallback = ( ReorderableList list ) => { list.serializedProperty.DeleteArrayElementAtIndex( list.index ); deselectAnimation(); }; // hide/show helper _triggerListAnimBool = new UnityEditor.AnimatedValues.AnimBool( false ); _triggerListAnimBool.valueChanged.AddListener( Repaint ); _framesListAnimBool = new UnityEditor.AnimatedValues.AnimBool( true ); _framesListAnimBool.valueChanged.AddListener( Repaint ); // setup our PreviewGUI goodies _playButton = EditorGUIUtility.Load( "icons/Animation.Play.png" ) as Texture; _pauseButton = EditorGUIUtility.Load( "icons/PauseButton Anim.png" ) as Texture; _isPlaying = false; }