修复丢失图片
This commit is contained in:
parent
d1d0649173
commit
bd1c047ea2
@ -39,4 +39,13 @@ SpriteAtlasAsset:
|
||||
- {fileID: 21300000, guid: a9f3f8cf21be33b42b0381b722521319, type: 3}
|
||||
- {fileID: 21300000, guid: 6be4bec99d7e66d44b6aeee857063d8d, type: 3}
|
||||
- {fileID: 21300000, guid: 4a01dd4e6a5f9414aab2b5375f76ffcb, type: 3}
|
||||
- {fileID: 21300000, guid: 201e6d88c2c921f44bf125df157f3345, type: 3}
|
||||
- {fileID: 21300000, guid: 1a0b60912d707cf4d93f0b5e5036375a, type: 3}
|
||||
- {fileID: 21300000, guid: 3ca0986f03c831644bcc0765add49578, type: 3}
|
||||
- {fileID: 21300000, guid: 3dc31b3fa78610d4185b5c6e6d3737a9, type: 3}
|
||||
- {fileID: 21300000, guid: f16ee304f428de54585c84a6768952bf, type: 3}
|
||||
- {fileID: 21300000, guid: b7e7058b11342b24a80cb37bbe81203d, type: 3}
|
||||
- {fileID: 21300000, guid: 5288fa3f99c6e81449ab288418f5eec8, type: 3}
|
||||
- {fileID: 21300000, guid: 1fe90947c9cdeb84ea4978ff35a7be73, type: 3}
|
||||
- {fileID: 21300000, guid: 379d9943ef398d24f8a8925568bfce9e, type: 3}
|
||||
m_IsVariant: 0
|
||||
|
||||
@ -6,7 +6,7 @@ SpriteAtlasAsset:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Name:
|
||||
serializedVersion: 2
|
||||
m_MasterAtlas: {fileID: 0}
|
||||
m_ImporterData:
|
||||
|
||||
@ -18,7 +18,7 @@ SpriteAtlasImporter:
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 52
|
||||
textureFormat: 51
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
|
||||
16
Art_Atlas/21Shop.spriteatlasv2
Normal file
16
Art_Atlas/21Shop.spriteatlasv2
Normal file
@ -0,0 +1,16 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!612988286 &1
|
||||
SpriteAtlasAsset:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
serializedVersion: 2
|
||||
m_MasterAtlas: {fileID: 0}
|
||||
m_ImporterData:
|
||||
packables:
|
||||
- {fileID: 21300000, guid: 326069d6b58e1b24b839152f9e376fcd, type: 3}
|
||||
- {fileID: 21300000, guid: 1ebd4c9ce8d897a4db5ac2abad99ea4d, type: 3}
|
||||
m_IsVariant: 0
|
||||
43
Art_Atlas/21Shop.spriteatlasv2.meta
Normal file
43
Art_Atlas/21Shop.spriteatlasv2.meta
Normal file
@ -0,0 +1,43 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2429069cb8eb99c47a5294e2aeb545a8
|
||||
SpriteAtlasImporter:
|
||||
externalObjects: {}
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
anisoLevel: 1
|
||||
compressionQuality: 50
|
||||
maxTextureSize: 2048
|
||||
textureCompression: 0
|
||||
filterMode: 1
|
||||
generateMipMaps: 0
|
||||
readable: 0
|
||||
crunchedCompression: 0
|
||||
sRGB: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 51
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
packingSettings:
|
||||
serializedVersion: 2
|
||||
padding: 4
|
||||
blockOffset: 1
|
||||
allowAlphaSplitting: 0
|
||||
enableRotation: 0
|
||||
enableTightPacking: 0
|
||||
enableAlphaDilation: 0
|
||||
secondaryTextureSettings: {}
|
||||
variantMultiplier: 1
|
||||
bindAsDefault: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
44
Art_Atlas/22GiftPack.spriteatlasv2
Normal file
44
Art_Atlas/22GiftPack.spriteatlasv2
Normal file
@ -0,0 +1,44 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!612988286 &1
|
||||
SpriteAtlasAsset:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
serializedVersion: 2
|
||||
m_MasterAtlas: {fileID: 0}
|
||||
m_ImporterData:
|
||||
packables:
|
||||
- {fileID: 21300000, guid: 27cd98c52145e3543a298ee7a893a1f1, type: 3}
|
||||
- {fileID: 21300000, guid: 7816ee411465a6f48aea4be9c7cb5395, type: 3}
|
||||
- {fileID: 21300000, guid: 5186cfe5b4f69934e8a9baf632074cc4, type: 3}
|
||||
- {fileID: 21300000, guid: b7b554e972daee54c80743c157a8287e, type: 3}
|
||||
- {fileID: 21300000, guid: 41dca68161c8a904fa77539f74ccaeaa, type: 3}
|
||||
- {fileID: 21300000, guid: 7de42b5b8862a7d49b1f574a19621d29, type: 3}
|
||||
- {fileID: 21300000, guid: 50d2910508e291f4a86003791be56018, type: 3}
|
||||
- {fileID: 21300000, guid: 7f7de2c3ad3eed646b14d6b32ef26bd6, type: 3}
|
||||
- {fileID: 21300000, guid: 78ad2325caadbd141947c1a45dfe2a3e, type: 3}
|
||||
- {fileID: 21300000, guid: c9bc24e6a4f94c743b521e4bcb1e6d5d, type: 3}
|
||||
- {fileID: 21300000, guid: 21929e3da1d50a9469b5e23c7bbe44af, type: 3}
|
||||
- {fileID: 21300000, guid: 1100b0f76acfd3c468fa55da55b14e4f, type: 3}
|
||||
- {fileID: 21300000, guid: f1e3a5f4273402341b4422d378ef47d7, type: 3}
|
||||
- {fileID: 21300000, guid: b7c98e549bf382f4094f83ea22d492a3, type: 3}
|
||||
- {fileID: 21300000, guid: 245e663a88950924eaf17b11ca29fadb, type: 3}
|
||||
- {fileID: 21300000, guid: cd0a3aa6f55739d4b95e4b8fd8914e57, type: 3}
|
||||
- {fileID: 21300000, guid: 3cb839793b7db48479dde62ba36dba89, type: 3}
|
||||
- {fileID: 21300000, guid: a3939d3687c650c41a9ea53ad0fa48f8, type: 3}
|
||||
- {fileID: 21300000, guid: 21f1c1f468541b247b8307e03529dc38, type: 3}
|
||||
- {fileID: 21300000, guid: a1a3c28751484f34e821be4c69bbbe4e, type: 3}
|
||||
- {fileID: 21300000, guid: cfaf014392e0b94499e529ea308fb5e5, type: 3}
|
||||
- {fileID: 21300000, guid: 9b99499a560b07541bc5430c992e051e, type: 3}
|
||||
- {fileID: 21300000, guid: 73ab1c0a5f81069498675a1eb5fdce92, type: 3}
|
||||
- {fileID: 21300000, guid: 9329b481ad0af3447acdc0749328ad96, type: 3}
|
||||
- {fileID: 21300000, guid: b81b162de5239ab418c94606955c8b5c, type: 3}
|
||||
- {fileID: 21300000, guid: a68735b96ba82b74aafe4b0316563317, type: 3}
|
||||
- {fileID: 21300000, guid: cc198aedd83700d43a2237c58695c5f1, type: 3}
|
||||
- {fileID: 21300000, guid: 9dd935a2ef18d084bafe46a06de255f4, type: 3}
|
||||
- {fileID: 21300000, guid: 459ee66caae1173419b1f617a3757da2, type: 3}
|
||||
- {fileID: 21300000, guid: 219d5766d171de84e829599dcd1f3955, type: 3}
|
||||
m_IsVariant: 0
|
||||
43
Art_Atlas/22GiftPack.spriteatlasv2.meta
Normal file
43
Art_Atlas/22GiftPack.spriteatlasv2.meta
Normal file
@ -0,0 +1,43 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ba8726e194cd024289522992a47d23e
|
||||
SpriteAtlasImporter:
|
||||
externalObjects: {}
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
anisoLevel: 1
|
||||
compressionQuality: 50
|
||||
maxTextureSize: 2048
|
||||
textureCompression: 0
|
||||
filterMode: 1
|
||||
generateMipMaps: 0
|
||||
readable: 0
|
||||
crunchedCompression: 0
|
||||
sRGB: 1
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 51
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
packingSettings:
|
||||
serializedVersion: 2
|
||||
padding: 4
|
||||
blockOffset: 1
|
||||
allowAlphaSplitting: 0
|
||||
enableRotation: 0
|
||||
enableTightPacking: 0
|
||||
enableAlphaDilation: 0
|
||||
secondaryTextureSettings: {}
|
||||
variantMultiplier: 1
|
||||
bindAsDefault: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1421,17 +1421,16 @@
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_pic_Transparent bag.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/panel_pink3.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/sub_emitter_count.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/Limitedtime_pic_smallicon_jiantou1.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "02MainHome",
|
||||
"SpritePaths": [
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/com_icn_set.png",
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/icn_pig_sidai2.png",
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/jb4.png",
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/merge_icn_XSSJjiantou_down.png",
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/DailyIcon/mini-games3DS_pic_icon_big.png"
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/Limitedtime_pic_smallicon_jiantou1.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_panel_order_mid_catblue.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_panel_order_mid_green.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_panel_order_mid_green_jindu.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_panel_order_mini_Blue.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_panel_order_mini_Blue2.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_panel_order_mini_purple.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_panel_order_mini_smwihte.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_pic_orderplate_playroom 1.png",
|
||||
"Assets/Art_SubModule/yyzl/01Mergeorder/image/merge_pic_orderplate_Preview.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1715,7 +1714,10 @@
|
||||
"Assets/Art_SubModule/yyzl/12PetHome/image/playroom_pic_huanzhuang_bg1.png",
|
||||
"Assets/Art_SubModule/yyzl/12PetHome/image/playroom_pic_huanzhuang_bg2.png",
|
||||
"Assets/Art_SubModule/yyzl/12PetHome/image/playroom_pic_huanzhuang_biaoti_bg.png",
|
||||
"Assets/Art_SubModule/yyzl/12PetHome/image/playroom_pic_huanzhuang_biaoti_maozhua.png"
|
||||
"Assets/Art_SubModule/yyzl/12PetHome/image/playroom_pic_huanzhuang_biaoti_maozhua.png",
|
||||
"Assets/Art_SubModule/yyzl/12PetHome/PR_Scene/WashCat/scene1_warm_box.png",
|
||||
"Assets/Art_SubModule/yyzl/12PetHome/image/playroom_pic_zhuangxiu__biaoti_bg.png",
|
||||
"Assets/Art_SubModule/yyzl/12PetHome/image/playroom_icon_diaodeng.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -2167,7 +2169,10 @@
|
||||
"Assets/Art_SubModule/yyzl/Common/Small/shop_pic_tagred.png",
|
||||
"Assets/Art_SubModule/yyzl/Common/Small/Sign_pic_light.png",
|
||||
"Assets/Art_SubModule/yyzl/Common/Small/Skin_icn_skinshop.png",
|
||||
"Assets/Art_SubModule/yyzl/Common/Small/TurnTable.png"
|
||||
"Assets/Art_SubModule/yyzl/Common/Small/TurnTable.png",
|
||||
"Assets/Art_SubModule/yyzl/Common/Small/collect_btn_big_blue.png",
|
||||
"Assets/Art_SubModule/yyzl/Common/Small/com_icn_flash.png",
|
||||
"Assets/Art_SubModule/yyzl/StockImages/Prop/Other/new_Production_energy_LV1.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -2194,6 +2199,58 @@
|
||||
"Assets/GameMain/Effect/Prefab/mastercard/zy/png/fx_baise.png",
|
||||
"Assets/GameMain/Effect/Prefab/mastercard/zy/png/镜头1.12wfg.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "21Shop",
|
||||
"SpritePaths": [
|
||||
"Assets/Art_SubModule/yyzl/21Shop/image/activity_icn_workcd.png",
|
||||
"Assets/Art_SubModule/yyzl/21Shop/image/shop_pic_guanggaojiangli_hezi.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "22GiftPack",
|
||||
"SpritePaths": [
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi1_banzi1.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi1_banzi2.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi1_banzi3.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi1_bg.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi2_banzi1.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi2_banzi2.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi2_banzi3.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi2_banzi5.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_chaozhi2_bg.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_icn_piggypink.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_pic_noADSgift_line.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_pic_noADSgift_qipao.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/activity_pic_piggyblack.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/Daily_pic_catcoin_bg.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/Daily_pic_giftpack_bg0.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_1jia1_banzi_1.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_1jia1_banzi_2.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_1jia1_bg.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_1jia1_plus.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_1jia1_top1.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_1jia1_top2.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_1jia1_top3.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_3xuan1_1.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_3xuan1_2.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_3xuan1_3.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_3xuan1_bg 1.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_3xuan1_sidai.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_3xuan1_top1.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/merge_pic_huodong_3xuan1_top2.png",
|
||||
"Assets/Art_SubModule/yyzl/22GiftPack/image/shop_pic_zhekou2.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "02MainHome",
|
||||
"SpritePaths": [
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/com_icn_set.png",
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/icn_pig_sidai2.png",
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/jb4.png",
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/merge_icn_XSSJjiantou_down.png",
|
||||
"Assets/Art_SubModule/yyzl/02MainHome/image/DailyIcon/mini-games3DS_pic_icon_big.png"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -6,7 +6,7 @@ SpriteAtlasAsset:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Name:
|
||||
serializedVersion: 2
|
||||
m_MasterAtlas: {fileID: 0}
|
||||
m_ImporterData:
|
||||
|
||||
@ -13,7 +13,20 @@ SpriteAtlasImporter:
|
||||
readable: 0
|
||||
crunchedCompression: 0
|
||||
sRGB: 1
|
||||
platformSettings: []
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: 51
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 1
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
packingSettings:
|
||||
serializedVersion: 2
|
||||
padding: 4
|
||||
|
||||
Binary file not shown.
@ -52,6 +52,7 @@ namespace ArtTools
|
||||
// 缓存
|
||||
private HashSet<SpriteAsset> cachedAssignedSprites = new HashSet<SpriteAsset>();
|
||||
private HashSet<SpriteFolder> cachedAssignedFolders = new HashSet<SpriteFolder>();
|
||||
private Dictionary<string, string> savedAtlasSignatures = new Dictionary<string, string>();
|
||||
|
||||
// 输入
|
||||
private string inputAtlasName = "";
|
||||
@ -550,6 +551,11 @@ namespace ArtTools
|
||||
{
|
||||
SaveAndBuildAllAtlases();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("全部重打包", GUILayout.Width(90f)))
|
||||
{
|
||||
SaveAndBuildAllAtlases(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -651,66 +657,93 @@ namespace ArtTools
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveAndBuildAllAtlases()
|
||||
private void SaveAndBuildAllAtlases(bool forceRebuild = false)
|
||||
{
|
||||
SaveConfig();
|
||||
|
||||
// 清理旧版 .spriteatlas 文件
|
||||
CleanOldSpriteAtlasFiles();
|
||||
|
||||
if (!Directory.Exists(ATLAS_ROOT_PATH))
|
||||
var timer = System.Diagnostics.Stopwatch.StartNew();
|
||||
int importedAtlasCount = 0;
|
||||
List<SpriteAtlas> atlasesToPack = new List<SpriteAtlas>();
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(ATLAS_ROOT_PATH);
|
||||
}
|
||||
|
||||
EditorUtility.DisplayProgressBar("构建图集", "生成图集文件...", 0f);
|
||||
|
||||
int count = config.Atlases.Count;
|
||||
|
||||
// 第一阶段:为每个图集写入 .spriteatlasv2 YAML 文件并逐个同步导入
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var atlas = config.Atlases[i];
|
||||
EditorUtility.DisplayProgressBar("构建图集", $"生成 {atlas.Name}...", (float)i / count * 0.5f);
|
||||
|
||||
string atlasPath = $"{ATLAS_ROOT_PATH}/{atlas.Name}.spriteatlasv2";
|
||||
WriteV2AtlasFile(atlas);
|
||||
AssetDatabase.ImportAsset(atlasPath, ImportAssetOptions.ForceSynchronousImport);
|
||||
}
|
||||
|
||||
// 第二阶段:统一打包
|
||||
EditorUtility.DisplayProgressBar("构建图集", "打包图集...", 0.6f);
|
||||
|
||||
List<SpriteAtlas> allAtlases = new List<SpriteAtlas>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var atlas = config.Atlases[i];
|
||||
string atlasPath = $"{ATLAS_ROOT_PATH}/{atlas.Name}.spriteatlasv2";
|
||||
SpriteAtlas spriteAtlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(atlasPath);
|
||||
if (spriteAtlas != null)
|
||||
SaveConfig();
|
||||
CleanOldSpriteAtlasFiles();
|
||||
|
||||
if (!Directory.Exists(ATLAS_ROOT_PATH))
|
||||
{
|
||||
allAtlases.Add(spriteAtlas);
|
||||
Directory.CreateDirectory(ATLAS_ROOT_PATH);
|
||||
}
|
||||
else
|
||||
|
||||
int count = config.Atlases.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Debug.LogWarning($"[AtlasBuilderEditor] 图集加载失败,跳过打包: {atlasPath}");
|
||||
var atlas = config.Atlases[i];
|
||||
float progress = count > 0 ? (float)i / count * 0.7f : 0.7f;
|
||||
EditorUtility.DisplayProgressBar("构建图集", $"检查 {atlas.Name}...", progress);
|
||||
|
||||
string atlasPath = $"{ATLAS_ROOT_PATH}/{atlas.Name}.spriteatlasv2";
|
||||
string atlasSignature = GetAtlasSignature(atlas);
|
||||
bool atlasDataChanged = forceRebuild || !savedAtlasSignatures.TryGetValue(atlas.Name, out string savedSignature) || savedSignature != atlasSignature;
|
||||
bool atlasFileMissing = !File.Exists(atlasPath);
|
||||
|
||||
if (!atlasDataChanged && !atlasFileMissing)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool atlasFileChanged = WriteV2AtlasFile(atlas);
|
||||
SpriteAtlas spriteAtlas = null;
|
||||
bool shouldImportAtlas = atlasFileChanged || atlasFileMissing;
|
||||
|
||||
if (shouldImportAtlas)
|
||||
{
|
||||
AssetDatabase.ImportAsset(atlasPath, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
|
||||
importedAtlasCount++;
|
||||
}
|
||||
|
||||
spriteAtlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(atlasPath);
|
||||
|
||||
if (spriteAtlas == null && File.Exists(atlasPath) && !shouldImportAtlas)
|
||||
{
|
||||
AssetDatabase.ImportAsset(atlasPath, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
|
||||
importedAtlasCount++;
|
||||
spriteAtlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(atlasPath);
|
||||
}
|
||||
|
||||
if (spriteAtlas == null)
|
||||
{
|
||||
Debug.LogWarning($"[AtlasBuilderEditor] 图集加载失败,跳过打包: {atlasPath}");
|
||||
continue;
|
||||
}
|
||||
|
||||
savedAtlasSignatures[atlas.Name] = atlasSignature;
|
||||
|
||||
if ((forceRebuild || atlasDataChanged || atlasFileChanged || atlasFileMissing) && atlas.SpritePaths.Count > 0)
|
||||
{
|
||||
atlasesToPack.Add(spriteAtlas);
|
||||
}
|
||||
}
|
||||
|
||||
if (atlasesToPack.Count > 0)
|
||||
{
|
||||
EditorUtility.DisplayProgressBar("构建图集", $"打包 {atlasesToPack.Count} 个图集...", 0.85f);
|
||||
SpriteAtlasUtility.PackAtlases(atlasesToPack.ToArray(), EditorUserBuildSettings.activeBuildTarget, true);
|
||||
}
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
timer.Stop();
|
||||
string modeText = forceRebuild ? "全部重打包" : "增量保存";
|
||||
EditorUtility.DisplayDialog("提示", $"{modeText}完成\n导入图集: {importedAtlasCount}\n打包图集: {atlasesToPack.Count}\n耗时: {timer.Elapsed.TotalSeconds:F1} 秒", "确定");
|
||||
}
|
||||
|
||||
if (allAtlases.Count > 0)
|
||||
finally
|
||||
{
|
||||
SpriteAtlasUtility.PackAtlases(allAtlases.ToArray(), EditorUserBuildSettings.activeBuildTarget);
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
EditorUtility.ClearProgressBar();
|
||||
EditorUtility.DisplayDialog("提示", $"已构建 {allAtlases.Count} 个图集并保存配置", "确定");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 直接写入 .spriteatlasv2 YAML 文件(V2 格式)
|
||||
/// </summary>
|
||||
private void WriteV2AtlasFile(AtlasData atlasData)
|
||||
private bool WriteV2AtlasFile(AtlasData atlasData)
|
||||
{
|
||||
string atlasPath = $"{ATLAS_ROOT_PATH}/{atlasData.Name}.spriteatlasv2";
|
||||
|
||||
@ -760,7 +793,7 @@ namespace ArtTools
|
||||
|
||||
sb.Append(" m_IsVariant: 0\n");
|
||||
|
||||
File.WriteAllText(atlasPath, sb.ToString());
|
||||
return WriteTextIfChanged(atlasPath, sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -795,13 +828,17 @@ namespace ArtTools
|
||||
}
|
||||
|
||||
string atlasPath = $"{ATLAS_ROOT_PATH}/{atlasData.Name}.spriteatlasv2";
|
||||
WriteV2AtlasFile(atlasData);
|
||||
AssetDatabase.ImportAsset(atlasPath, ImportAssetOptions.ForceSynchronousImport);
|
||||
|
||||
bool atlasFileChanged = WriteV2AtlasFile(atlasData);
|
||||
SpriteAtlas spriteAtlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(atlasPath);
|
||||
if (spriteAtlas != null)
|
||||
if (atlasFileChanged || spriteAtlas == null)
|
||||
{
|
||||
SpriteAtlasUtility.PackAtlases(new[] { spriteAtlas }, EditorUserBuildSettings.activeBuildTarget);
|
||||
AssetDatabase.ImportAsset(atlasPath, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
|
||||
spriteAtlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(atlasPath);
|
||||
}
|
||||
|
||||
if (spriteAtlas != null && atlasData.SpritePaths.Count > 0)
|
||||
{
|
||||
SpriteAtlasUtility.PackAtlases(new[] { spriteAtlas }, EditorUserBuildSettings.activeBuildTarget, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -817,11 +854,38 @@ namespace ArtTools
|
||||
config = new AtlasConfig { Atlases = new List<AtlasData>() };
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
RefreshSavedAtlasSignatures();
|
||||
}
|
||||
|
||||
private void SaveConfig()
|
||||
private void RefreshSavedAtlasSignatures()
|
||||
{
|
||||
// 保存JSON配置
|
||||
savedAtlasSignatures.Clear();
|
||||
if (config == null || config.Atlases == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var atlas in config.Atlases)
|
||||
{
|
||||
savedAtlasSignatures[atlas.Name] = GetAtlasSignature(atlas);
|
||||
}
|
||||
}
|
||||
|
||||
private string GetAtlasSignature(AtlasData atlas)
|
||||
{
|
||||
if (atlas == null || atlas.SpritePaths == null || atlas.SpritePaths.Count == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Join("\n", atlas.SpritePaths);
|
||||
}
|
||||
|
||||
private bool SaveConfig()
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
string dir = Path.GetDirectoryName(CONFIG_PATH);
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
@ -829,18 +893,26 @@ namespace ArtTools
|
||||
}
|
||||
|
||||
string json = JsonUtility.ToJson(config, true);
|
||||
File.WriteAllText(CONFIG_PATH, json);
|
||||
|
||||
// 生成Thrift Bytes配置
|
||||
SaveConfigToThriftBytes();
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
bool jsonChanged = WriteTextIfChanged(CONFIG_PATH, json);
|
||||
if (jsonChanged)
|
||||
{
|
||||
AssetDatabase.ImportAsset(CONFIG_PATH, ImportAssetOptions.ForceUpdate);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ((jsonChanged || !File.Exists(BYTES_PATH)) && SaveConfigToThriftBytes())
|
||||
{
|
||||
AssetDatabase.ImportAsset(BYTES_PATH, ImportAssetOptions.ForceUpdate);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存配置到Thrift Bytes格式
|
||||
/// </summary>
|
||||
private void SaveConfigToThriftBytes()
|
||||
private bool SaveConfigToThriftBytes()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -886,22 +958,65 @@ namespace ArtTools
|
||||
bytesData = memoryStream.ToArray();
|
||||
}
|
||||
|
||||
// 写入文件
|
||||
File.WriteAllBytes(BYTES_PATH, bytesData);
|
||||
bool changed = WriteBytesIfChanged(BYTES_PATH, bytesData);
|
||||
|
||||
startTime.Stop();
|
||||
|
||||
Debug.Log($"[AtlasBuilderEditor] ✅ Atlas Bytes生成成功!\n" +
|
||||
$" 路径: {BYTES_PATH}\n" +
|
||||
$" 图集数量: {thriftConfig.Atlases.Count}\n" +
|
||||
$" 文件大小: {bytesData.Length / 1024f:F2} KB\n" +
|
||||
$" 耗时: {startTime.ElapsedMilliseconds} ms");
|
||||
|
||||
if (changed)
|
||||
{
|
||||
Debug.Log($"[AtlasBuilderEditor] Atlas Bytes生成成功!\n" +
|
||||
$" 路径: {BYTES_PATH}\n" +
|
||||
$" 图集数量: {thriftConfig.Atlases.Count}\n" +
|
||||
$" 文件大小: {bytesData.Length / 1024f:F2} KB\n" +
|
||||
$" 耗时: {startTime.ElapsedMilliseconds} ms");
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Debug.LogError($"[AtlasBuilderEditor] ❌ 生成Atlas Bytes失败: {ex.Message}\n{ex.StackTrace}");
|
||||
Debug.LogError($"[AtlasBuilderEditor] 生成Atlas Bytes失败: {ex.Message}\n{ex.StackTrace}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool WriteTextIfChanged(string path, string content)
|
||||
{
|
||||
if (File.Exists(path) && File.ReadAllText(path) == content)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
File.WriteAllText(path, content);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool WriteBytesIfChanged(string path, byte[] content)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
byte[] current = File.ReadAllBytes(path);
|
||||
if (current.SequenceEqual(content))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
File.WriteAllBytes(path, content);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void RefreshSpriteTree()
|
||||
{
|
||||
|
||||
@ -101265,7 +101265,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 300}
|
||||
m_SizeDelta: {x: 514, y: 331}
|
||||
m_SizeDelta: {x: 670, y: 319}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3893706061561189785
|
||||
CanvasRenderer:
|
||||
@ -101295,7 +101295,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Sprite: {fileID: 21300000, guid: 3595ba8e8dcfb404e988881f57e90a2f, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user