SkinningCopyUtility.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. namespace UnityEditor.U2D.Animation
  2. {
  3. internal static class SkinningCopyUtility
  4. {
  5. private static ISkinningSerializer s_SkinningSerializer = new SkinningSerializerJSON();
  6. public static ISkinningSerializer Serializer
  7. {
  8. get { return s_SkinningSerializer; }
  9. set { s_SkinningSerializer = value; }
  10. }
  11. public static string SerializeSkinningCopyDataToString(SkinningCopyData skinningData)
  12. {
  13. return s_SkinningSerializer.Serialize(skinningData);
  14. }
  15. public static bool CanDeserializeSystemCopyBufferToSkinningCopyData()
  16. {
  17. if (!string.IsNullOrEmpty(EditorGUIUtility.systemCopyBuffer))
  18. return CanDeserializeStringToSkinningCopyData(EditorGUIUtility.systemCopyBuffer);
  19. return false;
  20. }
  21. public static bool CanDeserializeStringToSkinningCopyData(string data)
  22. {
  23. return s_SkinningSerializer.CanDeserialize(data);
  24. }
  25. public static SkinningCopyData DeserializeStringToSkinningCopyData(string data)
  26. {
  27. return s_SkinningSerializer.Deserialize(data);
  28. }
  29. }
  30. }