MB2_Core.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DigitalOpus.MB.Core{
  5. public delegate void ProgressUpdateDelegate(string msg, float progress);
  6. public delegate bool ProgressUpdateCancelableDelegate(string msg, float progress);
  7. public enum MB_ObjsToCombineTypes{
  8. prefabOnly,
  9. sceneObjOnly,
  10. dontCare
  11. }
  12. public enum MB_OutputOptions{
  13. bakeIntoPrefab,
  14. bakeMeshsInPlace,
  15. bakeTextureAtlasesOnly,
  16. bakeIntoSceneObject
  17. }
  18. public enum MB_RenderType{
  19. meshRenderer,
  20. skinnedMeshRenderer
  21. }
  22. public enum MB2_OutputOptions{
  23. bakeIntoSceneObject,
  24. bakeMeshAssetsInPlace,
  25. bakeIntoPrefab
  26. }
  27. public enum MB2_LightmapOptions{
  28. preserve_current_lightmapping,
  29. ignore_UV2,
  30. copy_UV2_unchanged,
  31. generate_new_UV2_layout,
  32. copy_UV2_unchanged_to_separate_rects,
  33. }
  34. public enum MB2_PackingAlgorithmEnum{
  35. UnitysPackTextures,
  36. MeshBakerTexturePacker,
  37. MeshBakerTexturePacker_Fast,
  38. MeshBakerTexturePacker_Horizontal, //special packing packs all horizontal. makes it possible to use an atlas with tiling textures
  39. MeshBakerTexturePacker_Vertical, //special packing packs all Vertical. makes it possible to use an atlas with tiling textures
  40. }
  41. public enum MB_TextureTilingTreatment{
  42. none,
  43. considerUVs,
  44. edgeToEdgeX,
  45. edgeToEdgeY,
  46. edgeToEdgeXY, // One image in atlas.
  47. unknown,
  48. }
  49. public enum MB2_ValidationLevel{
  50. none,
  51. quick,
  52. robust
  53. }
  54. /// <summary>
  55. /// M b2_ texture combiner editor methods.
  56. /// Contains functionality such as changeing texture formats
  57. /// Which is only available in the editor. These methods have all been put in a
  58. /// class so that the UnityEditor namespace does not need to be included in any of the
  59. /// the runtime classes.
  60. /// </summary>
  61. public interface MB2_EditorMethodsInterface{
  62. void Clear();
  63. void RestoreReadFlagsAndFormats(ProgressUpdateDelegate progressInfo);
  64. void SetReadWriteFlag(Texture2D tx, bool isReadable, bool addToList);
  65. void AddTextureFormat(Texture2D tx, TextureFormat targetFormat, bool isNormalMap);
  66. void SaveTextureArrayToAssetDatabase(Texture2DArray atlas, TextureFormat foramt, string texPropertyName, int atlasNum, Material resMat);
  67. void SaveAtlasToAssetDatabase(Texture2D atlas, ShaderTextureProperty texPropertyName, int atlasNum, Material resMat);
  68. bool IsNormalMap(Texture2D tx);
  69. string GetPlatformString();
  70. void SetTextureSize(Texture2D tx, int size);
  71. bool IsCompressed(Texture2D tx);
  72. void CheckBuildSettings(long estimatedAtlasSize);
  73. bool CheckPrefabTypes(MB_ObjsToCombineTypes prefabType, List<GameObject> gos);
  74. bool ValidateSkinnedMeshes(List<GameObject> mom);
  75. void CommitChangesToAssets();
  76. void OnPreTextureBake();
  77. void OnPostTextureBake();
  78. /// <summary>
  79. /// Safe Destroy. Won't destroy assets.
  80. /// </summary>
  81. void Destroy(UnityEngine.Object o);
  82. void DestroyAsset(UnityEngine.Object o);
  83. bool IsAnAsset(UnityEngine.Object o);
  84. Texture2D CreateTemporaryAssetCopy(Texture2D sliceTex, int w, int h, TextureFormat format, MB2_LogLevel logLevel);
  85. bool TextureImporterFormatExistsForTextureFormat(TextureFormat texFormat);
  86. bool ConvertTexture2DArray(Texture2DArray inArray, Texture2DArray outArray, TextureFormat outFormat);
  87. }
  88. }