Skip to content

Commit 7685c6b

Browse files
committed
Added variable data with sortable list to AnimatorPlayback object
1 parent 54545a9 commit 7685c6b

17 files changed

+456
-0
lines changed

Assets/AdncAnimatorVariableStates/Editor.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/AdncAnimatorVariableStates/Editor/Scripts.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/AdncAnimatorVariableStates/Editor/Scripts/CustomEditors.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/AdncAnimatorVariableStates/Editor/Scripts/CustomEditors/AnimatorPlayback.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEditor;
4+
using UnityEngine;
5+
6+
namespace Adnc.AnimatorVariables.Editors.CustomEditors {
7+
[CustomEditor(typeof(AnimatorPlayback))]
8+
public class AnimatorPlaybackEditor : Editor {
9+
private SortableListAnimatorVariable _listBools;
10+
private SortableListAnimatorVariable _listFloats;
11+
private SortableListAnimatorVariable _listInts;
12+
private SortableListAnimatorVariable _listTriggers;
13+
14+
private void OnEnable () {
15+
_listBools = new SortableListAnimatorVariable(this, "bools", "Set Bools");
16+
_listFloats = new SortableListAnimatorVariable(this, "floats", "Set Floats");
17+
_listInts = new SortableListAnimatorVariable(this, "ints", "Set Ints");
18+
_listTriggers = new SortableListAnimatorVariable(this, "triggers", "Set Triggers");
19+
}
20+
21+
public override void OnInspectorGUI () {
22+
_listBools.Update();
23+
_listFloats.Update();
24+
_listInts.Update();
25+
_listTriggers.Update();
26+
27+
base.OnInspectorGUI();
28+
}
29+
}
30+
}
31+
32+

Assets/AdncAnimatorVariableStates/Editor/Scripts/CustomEditors/AnimatorPlayback/AnimatorPlaybackEditor.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using Adnc.Utility.Editors;
4+
using UnityEditor;
5+
using UnityEngine;
6+
7+
namespace Adnc.AnimatorVariables.Editors.CustomEditors {
8+
public class SortableListAnimatorVariable : SortableListBase {
9+
public SortableListAnimatorVariable (Editor editor, string property, string title) : base(editor, property, title) {
10+
_list.drawElementCallback = (rect, index, active, focused) => {
11+
var element = _serializedProp.GetArrayElementAtIndex(index);
12+
var propName = element.FindPropertyRelative("name");
13+
var propValue = element.FindPropertyRelative("value");
14+
15+
rect.height -= EditorGUIUtility.standardVerticalSpacing;
16+
17+
if (propValue != null) {
18+
var col1 = rect;
19+
col1.width /= 2;
20+
col1.width -= EditorGUIUtility.standardVerticalSpacing;
21+
EditorGUI.PropertyField(col1, propName, new GUIContent());
22+
23+
var col2 = col1;
24+
col2.x += col1.width + EditorGUIUtility.standardVerticalSpacing;
25+
EditorGUI.PropertyField(col2, propValue, new GUIContent());
26+
} else {
27+
EditorGUI.PropertyField(rect, propName, new GUIContent());
28+
}
29+
};
30+
}
31+
}
32+
}
33+

Assets/AdncAnimatorVariableStates/Editor/Scripts/CustomEditors/AnimatorPlayback/SortableListAnimatorVariable.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/AdncAnimatorVariableStates/Examples.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/AdncAnimatorVariableStates/Examples/Default.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)