mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using UnityEngine.Experimental.U2D.Animation;
|
|
|
|
namespace UnityEditor.Experimental.U2D.Animation
|
|
{
|
|
[CustomEditor(typeof(SpriteLibrary))]
|
|
[CanEditMultipleObjects]
|
|
internal class SpriteLibraryInspector : Editor
|
|
{
|
|
private SerializedProperty m_SpriteLib;
|
|
|
|
public void OnEnable()
|
|
{
|
|
m_SpriteLib = serializedObject.FindProperty("m_SpriteLibraryAsset");
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
serializedObject.Update();
|
|
|
|
EditorGUI.BeginChangeCheck();
|
|
EditorGUILayout.PropertyField(m_SpriteLib);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
serializedObject.ApplyModifiedProperties();
|
|
|
|
foreach (var t in targets)
|
|
{
|
|
var srs = (t as SpriteLibrary).GetComponentsInChildren<SpriteResolver>();
|
|
foreach (var sr in srs)
|
|
{
|
|
sr.ResolveSpriteToSpriteRenderer();
|
|
sr.spriteLibChanged = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|