├── .gitignore ├── README.md ├── assets ├── Auto Atlas.meta ├── Auto Atlas │ ├── AutoAtlas.pac │ ├── AutoAtlas.pac.meta │ ├── run.anim │ ├── run.anim.meta │ ├── sheep_run_0.png │ ├── sheep_run_0.png.meta │ ├── sheep_run_1.png │ ├── sheep_run_1.png.meta │ ├── sheep_run_2.png │ ├── sheep_run_2.png.meta │ ├── sheep_run_3.png │ └── sheep_run_3.png.meta ├── Normal Texture.meta ├── Normal Texture │ ├── run.anim │ ├── run.anim.meta │ ├── sheep_run_0.png │ ├── sheep_run_0.png.meta │ ├── sheep_run_1.png │ ├── sheep_run_1.png.meta │ ├── sheep_run_2.png │ ├── sheep_run_2.png.meta │ ├── sheep_run_3.png │ └── sheep_run_3.png.meta ├── Packed Texture.meta ├── Packed Texture │ ├── atlas.plist │ ├── atlas.plist.meta │ ├── atlas.png │ ├── atlas.png.meta │ ├── run.anim │ └── run.anim.meta ├── main.fire └── main.fire.meta ├── creator.d.ts ├── jsconfig.json ├── packages └── build-textures │ ├── main.js │ └── package.json ├── project.json └── settings ├── builder.json └── project.json /.gitignore: -------------------------------------------------------------------------------- 1 | #///////////////////////////////////////////////////////////////////////////// 2 | # Fireball Projects 3 | #///////////////////////////////////////////////////////////////////////////// 4 | 5 | library/ 6 | temp/ 7 | local/ 8 | build/ 9 | 10 | #///////////////////////////////////////////////////////////////////////////// 11 | # Logs and databases 12 | #///////////////////////////////////////////////////////////////////////////// 13 | 14 | *.log 15 | *.sql 16 | *.sqlite 17 | 18 | #///////////////////////////////////////////////////////////////////////////// 19 | # files for debugger 20 | #///////////////////////////////////////////////////////////////////////////// 21 | 22 | *.sln 23 | *.csproj 24 | *.pidb 25 | *.unityproj 26 | *.suo 27 | 28 | #///////////////////////////////////////////////////////////////////////////// 29 | # OS generated files 30 | #///////////////////////////////////////////////////////////////////////////// 31 | 32 | .DS_Store 33 | ehthumbs.db 34 | Thumbs.db 35 | 36 | #///////////////////////////////////////////////////////////////////////////// 37 | # exvim files 38 | #///////////////////////////////////////////////////////////////////////////// 39 | 40 | *UnityVS.meta 41 | *.err 42 | *.err.meta 43 | *.exvim 44 | *.exvim.meta 45 | *.vimentry 46 | *.vimentry.meta 47 | *.vimproject 48 | *.vimproject.meta 49 | .vimfiles.*/ 50 | .exvim.*/ 51 | quick_gen_project_*_autogen.bat 52 | quick_gen_project_*_autogen.bat.meta 53 | quick_gen_project_*_autogen.sh 54 | quick_gen_project_*_autogen.sh.meta 55 | .exvim.app 56 | 57 | #///////////////////////////////////////////////////////////////////////////// 58 | # webstorm files 59 | #///////////////////////////////////////////////////////////////////////////// 60 | 61 | .idea/ 62 | 63 | #////////////////////////// 64 | # VS Code 65 | #////////////////////////// 66 | 67 | .vscode/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # How to get built textures in plugin 2 | 3 | 这个项目中包含了[一个构建插件](packages/build-textures),展示了如何在构建的过程中遍历项目中的各种类型的图片,并且输出它们构建后的路径,以便你对这些构建好的图片做进一步处理。 4 | 5 | 该项目依赖 Cocos Creator 2.4+。 6 | 7 | 构建插件的具体开发方式,请参考[《扩展构建流程》](https://docs.cocos.com/creator/2.4/manual/zh/publish/custom-project-build-template.html#%E6%89%A9%E5%B1%95%E6%9E%84%E5%BB%BA%E6%B5%81%E7%A8%8B)。 8 | 9 | ---- 10 | 11 | This project contains [a build plugin](packages/build-textures) that shows you how to traverse the various types of textures in your project during the build process, and then output the paths they build so that you can further process these built textures. 12 | 13 | This project relies on Cocos Creator 2.4+. 14 | 15 | For more information about build plugin, refer to [Extend The Build Process](https://docs.cocos.com/creator/2.4/manual/en/publish/custom-project-build-template.html#extend-the-build-process). 16 | -------------------------------------------------------------------------------- /assets/Auto Atlas.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "9a0492d4-221e-47d7-b22d-f52cba423870", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Auto Atlas/AutoAtlas.pac: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.AutoAtlas" 3 | } -------------------------------------------------------------------------------- /assets/Auto Atlas/AutoAtlas.pac.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.1.0", 3 | "uuid": "0ee46d3e-e838-41ae-9725-11eb2b683ba6", 4 | "maxWidth": 256, 5 | "maxHeight": 256, 6 | "padding": 2, 7 | "allowRotation": true, 8 | "forceSquared": false, 9 | "powerOfTwo": true, 10 | "heuristices": "BestAreaFit", 11 | "format": "png", 12 | "quality": 80, 13 | "contourBleed": false, 14 | "paddingBleed": false, 15 | "filterUnused": false, 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Auto Atlas/run.anim: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.AnimationClip", 3 | "_name": "run", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_duration": 0.6666666666666666, 7 | "sample": 6, 8 | "speed": 1, 9 | "wrapMode": "2", 10 | "curveData": { 11 | "comps": { 12 | "cc.Sprite": { 13 | "spriteFrame": [ 14 | { 15 | "frame": 0, 16 | "value": { 17 | "__uuid__": "23eb8387-ca49-4121-be68-56054ee539d8" 18 | } 19 | }, 20 | { 21 | "frame": 0.16666666666666666, 22 | "value": { 23 | "__uuid__": "a57012ff-2334-4d99-a651-62ccbf1444c8" 24 | } 25 | }, 26 | { 27 | "frame": 0.3333333333333333, 28 | "value": { 29 | "__uuid__": "5597fdf5-3cfc-45e5-b989-320c6a359428" 30 | } 31 | }, 32 | { 33 | "frame": 0.5, 34 | "value": { 35 | "__uuid__": "1d0db5b6-122b-4920-88d1-620c53a32a27" 36 | } 37 | } 38 | ] 39 | } 40 | } 41 | }, 42 | "events": [] 43 | } -------------------------------------------------------------------------------- /assets/Auto Atlas/run.anim.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "350a8a67-f376-45d7-9d76-98791b924ea2", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/Auto Atlas/sheep_run_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Auto Atlas/sheep_run_0.png -------------------------------------------------------------------------------- /assets/Auto Atlas/sheep_run_0.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "c6e4d9aa-bab9-4b01-974e-1ba6747af9c1", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sheep_run_0": { 10 | "ver": "1.0.3", 11 | "uuid": "23eb8387-ca49-4121-be68-56054ee539d8", 12 | "rawTextureUuid": "c6e4d9aa-bab9-4b01-974e-1ba6747af9c1", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": -3.5, 17 | "offsetY": -0.5, 18 | "trimX": 27, 19 | "trimY": 24, 20 | "width": 167, 21 | "height": 112, 22 | "rawWidth": 228, 23 | "rawHeight": 159, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Auto Atlas/sheep_run_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Auto Atlas/sheep_run_1.png -------------------------------------------------------------------------------- /assets/Auto Atlas/sheep_run_1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "c5a5b09c-e012-4da8-a31b-d1f541f64bf4", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sheep_run_1": { 10 | "ver": "1.0.3", 11 | "uuid": "a57012ff-2334-4d99-a651-62ccbf1444c8", 12 | "rawTextureUuid": "c5a5b09c-e012-4da8-a31b-d1f541f64bf4", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 1, 17 | "offsetY": 2, 18 | "trimX": 27, 19 | "trimY": 20, 20 | "width": 176, 21 | "height": 115, 22 | "rawWidth": 228, 23 | "rawHeight": 159, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Auto Atlas/sheep_run_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Auto Atlas/sheep_run_2.png -------------------------------------------------------------------------------- /assets/Auto Atlas/sheep_run_2.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "1ba0dabd-fc65-4172-adee-e9167c6eb9ad", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sheep_run_2": { 10 | "ver": "1.0.3", 11 | "uuid": "5597fdf5-3cfc-45e5-b989-320c6a359428", 12 | "rawTextureUuid": "1ba0dabd-fc65-4172-adee-e9167c6eb9ad", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 1.5, 17 | "offsetY": 10.5, 18 | "trimX": 27, 19 | "trimY": 12, 20 | "width": 177, 21 | "height": 114, 22 | "rawWidth": 228, 23 | "rawHeight": 159, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Auto Atlas/sheep_run_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Auto Atlas/sheep_run_3.png -------------------------------------------------------------------------------- /assets/Auto Atlas/sheep_run_3.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "7f97cb41-6ad1-45f7-afd9-3f9428490731", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sheep_run_3": { 10 | "ver": "1.0.3", 11 | "uuid": "1d0db5b6-122b-4920-88d1-620c53a32a27", 12 | "rawTextureUuid": "7f97cb41-6ad1-45f7-afd9-3f9428490731", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 2, 17 | "offsetY": 1, 18 | "trimX": 27, 19 | "trimY": 22, 20 | "width": 178, 21 | "height": 113, 22 | "rawWidth": 228, 23 | "rawHeight": 159, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Normal Texture.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "eab767cf-f0c9-422d-8641-195596d2e5ae", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Normal Texture/run.anim: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.AnimationClip", 3 | "_name": "run", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_duration": 0.6666666666666666, 7 | "sample": 6, 8 | "speed": 1, 9 | "wrapMode": "2", 10 | "curveData": { 11 | "comps": { 12 | "cc.Sprite": { 13 | "spriteFrame": [ 14 | { 15 | "frame": 0, 16 | "value": { 17 | "__uuid__": "8792fb1d-e091-413d-8c03-3822246c6ea9" 18 | } 19 | }, 20 | { 21 | "frame": 0.16666666666666666, 22 | "value": { 23 | "__uuid__": "5572d748-9adc-43e3-95dc-e1203d86bade" 24 | } 25 | }, 26 | { 27 | "frame": 0.3333333333333333, 28 | "value": { 29 | "__uuid__": "585d362b-1b48-4bae-8abc-41676692bec6" 30 | } 31 | }, 32 | { 33 | "frame": 0.5, 34 | "value": { 35 | "__uuid__": "bf12531d-f13f-4cca-9fa3-8cb1d5ebd8ba" 36 | } 37 | } 38 | ] 39 | } 40 | } 41 | }, 42 | "events": [] 43 | } -------------------------------------------------------------------------------- /assets/Normal Texture/run.anim.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "7d7d41cd-559f-41b5-bc60-5f63dacd2938", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/Normal Texture/sheep_run_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Normal Texture/sheep_run_0.png -------------------------------------------------------------------------------- /assets/Normal Texture/sheep_run_0.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "6f5b457e-77a6-434e-aa98-288ba836f4c1", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sheep_run_0": { 10 | "ver": "1.0.3", 11 | "uuid": "8792fb1d-e091-413d-8c03-3822246c6ea9", 12 | "rawTextureUuid": "6f5b457e-77a6-434e-aa98-288ba836f4c1", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": -3.5, 17 | "offsetY": -0.5, 18 | "trimX": 27, 19 | "trimY": 24, 20 | "width": 167, 21 | "height": 112, 22 | "rawWidth": 228, 23 | "rawHeight": 159, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Normal Texture/sheep_run_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Normal Texture/sheep_run_1.png -------------------------------------------------------------------------------- /assets/Normal Texture/sheep_run_1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "01b5b5c5-ba7e-4775-855c-acd71f7f4de1", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sheep_run_1": { 10 | "ver": "1.0.3", 11 | "uuid": "5572d748-9adc-43e3-95dc-e1203d86bade", 12 | "rawTextureUuid": "01b5b5c5-ba7e-4775-855c-acd71f7f4de1", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 1, 17 | "offsetY": 2, 18 | "trimX": 27, 19 | "trimY": 20, 20 | "width": 176, 21 | "height": 115, 22 | "rawWidth": 228, 23 | "rawHeight": 159, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Normal Texture/sheep_run_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Normal Texture/sheep_run_2.png -------------------------------------------------------------------------------- /assets/Normal Texture/sheep_run_2.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "13c5a571-c114-40d4-8ebc-0e7f282130f3", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sheep_run_2": { 10 | "ver": "1.0.3", 11 | "uuid": "585d362b-1b48-4bae-8abc-41676692bec6", 12 | "rawTextureUuid": "13c5a571-c114-40d4-8ebc-0e7f282130f3", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 1.5, 17 | "offsetY": 10.5, 18 | "trimX": 27, 19 | "trimY": 12, 20 | "width": 177, 21 | "height": 114, 22 | "rawWidth": 228, 23 | "rawHeight": 159, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Normal Texture/sheep_run_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Normal Texture/sheep_run_3.png -------------------------------------------------------------------------------- /assets/Normal Texture/sheep_run_3.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "91eb916b-053d-45f4-a3fe-7fc823976555", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sheep_run_3": { 10 | "ver": "1.0.3", 11 | "uuid": "bf12531d-f13f-4cca-9fa3-8cb1d5ebd8ba", 12 | "rawTextureUuid": "91eb916b-053d-45f4-a3fe-7fc823976555", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 2, 17 | "offsetY": 1, 18 | "trimX": 27, 19 | "trimY": 22, 20 | "width": 178, 21 | "height": 113, 22 | "rawWidth": 228, 23 | "rawHeight": 159, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Packed Texture.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "82fefb2c-69b5-43f8-a182-ba1ee530aed8", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Packed Texture/atlas.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | frames 6 | 7 | sheep_run_0.png 8 | 9 | aliases 10 | 11 | spriteOffset 12 | {-4,0} 13 | spriteSize 14 | {170,115} 15 | spriteSourceSize 16 | {228,159} 17 | textureRect 18 | {{545,1},{170,115}} 19 | textureRotated 20 | 21 | 22 | sheep_run_1.png 23 | 24 | aliases 25 | 26 | spriteOffset 27 | {1,2} 28 | spriteSize 29 | {178,117} 30 | spriteSourceSize 31 | {228,159} 32 | textureRect 33 | {{183,1},{178,117}} 34 | textureRotated 35 | 36 | 37 | sheep_run_2.png 38 | 39 | aliases 40 | 41 | spriteOffset 42 | {1,11} 43 | spriteSize 44 | {180,117} 45 | spriteSourceSize 46 | {228,159} 47 | textureRect 48 | {{1,1},{180,117}} 49 | textureRotated 50 | 51 | 52 | sheep_run_3.png 53 | 54 | aliases 55 | 56 | spriteOffset 57 | {2,1} 58 | spriteSize 59 | {180,115} 60 | spriteSourceSize 61 | {228,159} 62 | textureRect 63 | {{363,1},{180,115}} 64 | textureRotated 65 | 66 | 67 | 68 | metadata 69 | 70 | format 71 | 3 72 | realTextureFileName 73 | atlas.png 74 | size 75 | {716,119} 76 | smartupdate 77 | $TexturePacker:SmartUpdate:db54f5d8fc876d2b8dd51f7c0e0487e2:3e6ff3c157e0bd68f6b238b4b8a3276b:21d34b1ac1e7d41f765d139a133eeccc$ 78 | textureFileName 79 | atlas.png 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /assets/Packed Texture/atlas.plist.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.4", 3 | "uuid": "ae9e4b41-d749-46bd-8e54-92aa6292fec0", 4 | "rawTextureUuid": "0040ef84-ea1a-47a1-ab86-27420ea7619b", 5 | "size": { 6 | "width": 716, 7 | "height": 119 8 | }, 9 | "type": "Texture Packer", 10 | "subMetas": { 11 | "sheep_run_0.png": { 12 | "ver": "1.0.3", 13 | "uuid": "f5e4861b-fd17-43d9-a7c1-c24db95d2261", 14 | "rawTextureUuid": "0040ef84-ea1a-47a1-ab86-27420ea7619b", 15 | "trimType": "auto", 16 | "trimThreshold": 1, 17 | "rotated": false, 18 | "offsetX": -4, 19 | "offsetY": 0, 20 | "trimX": 545, 21 | "trimY": 1, 22 | "width": 170, 23 | "height": 115, 24 | "rawWidth": 228, 25 | "rawHeight": 159, 26 | "borderTop": 0, 27 | "borderBottom": 0, 28 | "borderLeft": 0, 29 | "borderRight": 0, 30 | "spriteType": "normal", 31 | "subMetas": {} 32 | }, 33 | "sheep_run_1.png": { 34 | "ver": "1.0.3", 35 | "uuid": "a8c0a2a8-97a2-418d-8151-39a1ad6e1faa", 36 | "rawTextureUuid": "0040ef84-ea1a-47a1-ab86-27420ea7619b", 37 | "trimType": "auto", 38 | "trimThreshold": 1, 39 | "rotated": false, 40 | "offsetX": 1, 41 | "offsetY": 2, 42 | "trimX": 183, 43 | "trimY": 1, 44 | "width": 178, 45 | "height": 117, 46 | "rawWidth": 228, 47 | "rawHeight": 159, 48 | "borderTop": 0, 49 | "borderBottom": 0, 50 | "borderLeft": 0, 51 | "borderRight": 0, 52 | "spriteType": "normal", 53 | "subMetas": {} 54 | }, 55 | "sheep_run_2.png": { 56 | "ver": "1.0.3", 57 | "uuid": "7e16378b-8f4a-4cac-b39c-40cb75c5ca8e", 58 | "rawTextureUuid": "0040ef84-ea1a-47a1-ab86-27420ea7619b", 59 | "trimType": "auto", 60 | "trimThreshold": 1, 61 | "rotated": false, 62 | "offsetX": 1, 63 | "offsetY": 11, 64 | "trimX": 1, 65 | "trimY": 1, 66 | "width": 180, 67 | "height": 117, 68 | "rawWidth": 228, 69 | "rawHeight": 159, 70 | "borderTop": 0, 71 | "borderBottom": 0, 72 | "borderLeft": 0, 73 | "borderRight": 0, 74 | "spriteType": "normal", 75 | "subMetas": {} 76 | }, 77 | "sheep_run_3.png": { 78 | "ver": "1.0.3", 79 | "uuid": "e8b9c839-c489-4aba-8f80-fb3d6535b850", 80 | "rawTextureUuid": "0040ef84-ea1a-47a1-ab86-27420ea7619b", 81 | "trimType": "auto", 82 | "trimThreshold": 1, 83 | "rotated": false, 84 | "offsetX": 2, 85 | "offsetY": 1, 86 | "trimX": 363, 87 | "trimY": 1, 88 | "width": 180, 89 | "height": 115, 90 | "rawWidth": 228, 91 | "rawHeight": 159, 92 | "borderTop": 0, 93 | "borderBottom": 0, 94 | "borderLeft": 0, 95 | "borderRight": 0, 96 | "spriteType": "normal", 97 | "subMetas": {} 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /assets/Packed Texture/atlas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos/cocos-example-process-build-textures/2eac811a44f88684613537af0da7cfe896855b14/assets/Packed Texture/atlas.png -------------------------------------------------------------------------------- /assets/Packed Texture/atlas.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "0040ef84-ea1a-47a1-ab86-27420ea7619b", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "atlas": { 10 | "ver": "1.0.3", 11 | "uuid": "dbb2d733-7c50-4b45-b06e-cfb7411e6d4d", 12 | "rawTextureUuid": "0040ef84-ea1a-47a1-ab86-27420ea7619b", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0.5, 17 | "offsetY": 0, 18 | "trimX": 3, 19 | "trimY": 2, 20 | "width": 711, 21 | "height": 115, 22 | "rawWidth": 716, 23 | "rawHeight": 119, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Packed Texture/run.anim: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.AnimationClip", 3 | "_name": "run", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_duration": 0.6666666666666666, 7 | "sample": 6, 8 | "speed": 1, 9 | "wrapMode": "2", 10 | "curveData": { 11 | "comps": { 12 | "cc.Sprite": { 13 | "spriteFrame": [ 14 | { 15 | "frame": 0, 16 | "value": { 17 | "__uuid__": "f5e4861b-fd17-43d9-a7c1-c24db95d2261" 18 | } 19 | }, 20 | { 21 | "frame": 0.16666666666666666, 22 | "value": { 23 | "__uuid__": "a8c0a2a8-97a2-418d-8151-39a1ad6e1faa" 24 | } 25 | }, 26 | { 27 | "frame": 0.3333333333333333, 28 | "value": { 29 | "__uuid__": "7e16378b-8f4a-4cac-b39c-40cb75c5ca8e" 30 | } 31 | }, 32 | { 33 | "frame": 0.5, 34 | "value": { 35 | "__uuid__": "e8b9c839-c489-4aba-8f80-fb3d6535b850" 36 | } 37 | } 38 | ] 39 | } 40 | } 41 | }, 42 | "events": [] 43 | } -------------------------------------------------------------------------------- /assets/Packed Texture/run.anim.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "67d57992-70d3-4dbd-bd0a-d7ae454dba0d", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/main.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_level": 0, 22 | "_components": [], 23 | "_prefab": null, 24 | "_opacity": 255, 25 | "_color": { 26 | "__type__": "cc.Color", 27 | "r": 255, 28 | "g": 255, 29 | "b": 255, 30 | "a": 255 31 | }, 32 | "_contentSize": { 33 | "__type__": "cc.Size", 34 | "width": 0, 35 | "height": 0 36 | }, 37 | "_anchorPoint": { 38 | "__type__": "cc.Vec2", 39 | "x": 0, 40 | "y": 0 41 | }, 42 | "_scale": { 43 | "__type__": "cc.Vec3", 44 | "x": 0.3734375, 45 | "y": 0.3734375, 46 | "z": 1 47 | }, 48 | "_quat": { 49 | "__type__": "cc.Quat", 50 | "x": 0, 51 | "y": 0, 52 | "z": 0, 53 | "w": 1 54 | }, 55 | "_zIndex": 0, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false, 58 | "_id": "20d747f8-f31e-4d5a-8605-cb04ccdc3a97" 59 | }, 60 | { 61 | "__type__": "cc.Node", 62 | "_name": "Canvas", 63 | "_objFlags": 0, 64 | "_parent": { 65 | "__id__": 1 66 | }, 67 | "_children": [ 68 | { 69 | "__id__": 3 70 | }, 71 | { 72 | "__id__": 5 73 | }, 74 | { 75 | "__id__": 8 76 | }, 77 | { 78 | "__id__": 11 79 | } 80 | ], 81 | "_active": true, 82 | "_level": 0, 83 | "_components": [ 84 | { 85 | "__id__": 14 86 | } 87 | ], 88 | "_prefab": null, 89 | "_opacity": 255, 90 | "_color": { 91 | "__type__": "cc.Color", 92 | "r": 255, 93 | "g": 255, 94 | "b": 255, 95 | "a": 255 96 | }, 97 | "_contentSize": { 98 | "__type__": "cc.Size", 99 | "width": 960, 100 | "height": 640 101 | }, 102 | "_anchorPoint": { 103 | "__type__": "cc.Vec2", 104 | "x": 0.5, 105 | "y": 0.5 106 | }, 107 | "_position": { 108 | "__type__": "cc.Vec3", 109 | "x": 480, 110 | "y": 320, 111 | "z": 0 112 | }, 113 | "_scale": { 114 | "__type__": "cc.Vec3", 115 | "x": 1, 116 | "y": 1, 117 | "z": 1 118 | }, 119 | "_rotationX": 0, 120 | "_rotationY": 0, 121 | "_quat": { 122 | "__type__": "cc.Quat", 123 | "x": 0, 124 | "y": 0, 125 | "z": 0, 126 | "w": 1 127 | }, 128 | "_skewX": 0, 129 | "_skewY": 0, 130 | "_zIndex": 0, 131 | "groupIndex": 0, 132 | "_id": "8aVkSp2DJDnqzbJLgmBHxF" 133 | }, 134 | { 135 | "__type__": "cc.Node", 136 | "_name": "Main Camera", 137 | "_objFlags": 0, 138 | "_parent": { 139 | "__id__": 2 140 | }, 141 | "_children": [], 142 | "_active": true, 143 | "_level": 1, 144 | "_components": [ 145 | { 146 | "__id__": 4 147 | } 148 | ], 149 | "_prefab": null, 150 | "_opacity": 255, 151 | "_color": { 152 | "__type__": "cc.Color", 153 | "r": 255, 154 | "g": 255, 155 | "b": 255, 156 | "a": 255 157 | }, 158 | "_contentSize": { 159 | "__type__": "cc.Size", 160 | "width": 0, 161 | "height": 0 162 | }, 163 | "_anchorPoint": { 164 | "__type__": "cc.Vec2", 165 | "x": 0.5, 166 | "y": 0.5 167 | }, 168 | "_position": { 169 | "__type__": "cc.Vec3", 170 | "x": 0, 171 | "y": 0, 172 | "z": 0 173 | }, 174 | "_scale": { 175 | "__type__": "cc.Vec3", 176 | "x": 1, 177 | "y": 1, 178 | "z": 1 179 | }, 180 | "_rotationX": 0, 181 | "_rotationY": 0, 182 | "_quat": { 183 | "__type__": "cc.Quat", 184 | "x": 0, 185 | "y": 0, 186 | "z": 0, 187 | "w": 1 188 | }, 189 | "_skewX": 0, 190 | "_skewY": 0, 191 | "_zIndex": 0, 192 | "groupIndex": 0, 193 | "_id": "25KKS1dRVJCqN4OOfoQ7/r" 194 | }, 195 | { 196 | "__type__": "cc.Camera", 197 | "_name": "", 198 | "_objFlags": 0, 199 | "node": { 200 | "__id__": 3 201 | }, 202 | "_enabled": true, 203 | "_cullingMask": 4294967295, 204 | "_clearFlags": 7, 205 | "_backgroundColor": { 206 | "__type__": "cc.Color", 207 | "r": 0, 208 | "g": 0, 209 | "b": 0, 210 | "a": 255 211 | }, 212 | "_depth": -1, 213 | "_zoomRatio": 1, 214 | "_targetTexture": null, 215 | "_id": "90RdEWsTdOv7CFlhfOppf8" 216 | }, 217 | { 218 | "__type__": "cc.Node", 219 | "_name": "auto atlas", 220 | "_objFlags": 0, 221 | "_parent": { 222 | "__id__": 2 223 | }, 224 | "_children": [], 225 | "_active": true, 226 | "_level": 0, 227 | "_components": [ 228 | { 229 | "__id__": 6 230 | }, 231 | { 232 | "__id__": 7 233 | } 234 | ], 235 | "_prefab": null, 236 | "_opacity": 255, 237 | "_color": { 238 | "__type__": "cc.Color", 239 | "r": 255, 240 | "g": 255, 241 | "b": 255, 242 | "a": 255 243 | }, 244 | "_contentSize": { 245 | "__type__": "cc.Size", 246 | "width": 228, 247 | "height": 159 248 | }, 249 | "_anchorPoint": { 250 | "__type__": "cc.Vec2", 251 | "x": 0.5, 252 | "y": 0.5 253 | }, 254 | "_position": { 255 | "__type__": "cc.Vec3", 256 | "x": -200, 257 | "y": 0, 258 | "z": 0 259 | }, 260 | "_scale": { 261 | "__type__": "cc.Vec3", 262 | "x": 1, 263 | "y": 1, 264 | "z": 1 265 | }, 266 | "_rotationX": 0, 267 | "_rotationY": 0, 268 | "_quat": { 269 | "__type__": "cc.Quat", 270 | "x": 0, 271 | "y": 0, 272 | "z": 0, 273 | "w": 1 274 | }, 275 | "_skewX": 0, 276 | "_skewY": 0, 277 | "_zIndex": 0, 278 | "groupIndex": 0, 279 | "_id": "3foziIYEZAfalXcWnxtJnA" 280 | }, 281 | { 282 | "__type__": "cc.Sprite", 283 | "_name": "", 284 | "_objFlags": 0, 285 | "node": { 286 | "__id__": 5 287 | }, 288 | "_enabled": true, 289 | "_srcBlendFactor": 770, 290 | "_dstBlendFactor": 771, 291 | "_spriteFrame": { 292 | "__uuid__": "23eb8387-ca49-4121-be68-56054ee539d8" 293 | }, 294 | "_type": 0, 295 | "_sizeMode": 2, 296 | "_fillType": 0, 297 | "_fillCenter": { 298 | "__type__": "cc.Vec2", 299 | "x": 0, 300 | "y": 0 301 | }, 302 | "_fillStart": 0, 303 | "_fillRange": 0, 304 | "_isTrimmedMode": false, 305 | "_state": 0, 306 | "_atlas": null, 307 | "_id": "45Ct6ccRBAVaH9zqU6lh9A" 308 | }, 309 | { 310 | "__type__": "cc.Animation", 311 | "_name": "", 312 | "_objFlags": 0, 313 | "node": { 314 | "__id__": 5 315 | }, 316 | "_enabled": true, 317 | "_defaultClip": { 318 | "__uuid__": "350a8a67-f376-45d7-9d76-98791b924ea2" 319 | }, 320 | "_clips": [ 321 | { 322 | "__uuid__": "350a8a67-f376-45d7-9d76-98791b924ea2" 323 | } 324 | ], 325 | "playOnLoad": true, 326 | "_id": "c0CdkxEMlGtrGI9DYFDRvo" 327 | }, 328 | { 329 | "__type__": "cc.Node", 330 | "_name": "normal texture", 331 | "_objFlags": 0, 332 | "_parent": { 333 | "__id__": 2 334 | }, 335 | "_children": [], 336 | "_active": true, 337 | "_level": 0, 338 | "_components": [ 339 | { 340 | "__id__": 9 341 | }, 342 | { 343 | "__id__": 10 344 | } 345 | ], 346 | "_prefab": null, 347 | "_opacity": 255, 348 | "_color": { 349 | "__type__": "cc.Color", 350 | "r": 255, 351 | "g": 255, 352 | "b": 255, 353 | "a": 255 354 | }, 355 | "_contentSize": { 356 | "__type__": "cc.Size", 357 | "width": 228, 358 | "height": 159 359 | }, 360 | "_anchorPoint": { 361 | "__type__": "cc.Vec2", 362 | "x": 0.5, 363 | "y": 0.5 364 | }, 365 | "_position": { 366 | "__type__": "cc.Vec3", 367 | "x": 0, 368 | "y": 0, 369 | "z": 0 370 | }, 371 | "_scale": { 372 | "__type__": "cc.Vec3", 373 | "x": 1, 374 | "y": 1, 375 | "z": 1 376 | }, 377 | "_rotationX": 0, 378 | "_rotationY": 0, 379 | "_quat": { 380 | "__type__": "cc.Quat", 381 | "x": 0, 382 | "y": 0, 383 | "z": 0, 384 | "w": 1 385 | }, 386 | "_skewX": 0, 387 | "_skewY": 0, 388 | "_zIndex": 0, 389 | "groupIndex": 0, 390 | "_id": "85fTO5ve1GYrMD1VTryMJC" 391 | }, 392 | { 393 | "__type__": "cc.Sprite", 394 | "_name": "", 395 | "_objFlags": 0, 396 | "node": { 397 | "__id__": 8 398 | }, 399 | "_enabled": true, 400 | "_srcBlendFactor": 770, 401 | "_dstBlendFactor": 771, 402 | "_spriteFrame": { 403 | "__uuid__": "8792fb1d-e091-413d-8c03-3822246c6ea9" 404 | }, 405 | "_type": 0, 406 | "_sizeMode": 2, 407 | "_fillType": 0, 408 | "_fillCenter": { 409 | "__type__": "cc.Vec2", 410 | "x": 0, 411 | "y": 0 412 | }, 413 | "_fillStart": 0, 414 | "_fillRange": 0, 415 | "_isTrimmedMode": false, 416 | "_state": 0, 417 | "_atlas": null, 418 | "_id": "08KpoKxANAn6SkLo1wM0xB" 419 | }, 420 | { 421 | "__type__": "cc.Animation", 422 | "_name": "", 423 | "_objFlags": 0, 424 | "node": { 425 | "__id__": 8 426 | }, 427 | "_enabled": true, 428 | "_defaultClip": { 429 | "__uuid__": "7d7d41cd-559f-41b5-bc60-5f63dacd2938" 430 | }, 431 | "_clips": [ 432 | { 433 | "__uuid__": "7d7d41cd-559f-41b5-bc60-5f63dacd2938" 434 | } 435 | ], 436 | "playOnLoad": true, 437 | "_id": "c1XpG79KlIbrorjs2rlIg7" 438 | }, 439 | { 440 | "__type__": "cc.Node", 441 | "_name": "packed texture", 442 | "_objFlags": 0, 443 | "_parent": { 444 | "__id__": 2 445 | }, 446 | "_children": [], 447 | "_active": true, 448 | "_level": 0, 449 | "_components": [ 450 | { 451 | "__id__": 12 452 | }, 453 | { 454 | "__id__": 13 455 | } 456 | ], 457 | "_prefab": null, 458 | "_opacity": 255, 459 | "_color": { 460 | "__type__": "cc.Color", 461 | "r": 255, 462 | "g": 255, 463 | "b": 255, 464 | "a": 255 465 | }, 466 | "_contentSize": { 467 | "__type__": "cc.Size", 468 | "width": 228, 469 | "height": 159 470 | }, 471 | "_anchorPoint": { 472 | "__type__": "cc.Vec2", 473 | "x": 0.5, 474 | "y": 0.5 475 | }, 476 | "_position": { 477 | "__type__": "cc.Vec3", 478 | "x": 200, 479 | "y": 0, 480 | "z": 0 481 | }, 482 | "_scale": { 483 | "__type__": "cc.Vec3", 484 | "x": 1, 485 | "y": 1, 486 | "z": 1 487 | }, 488 | "_rotationX": 0, 489 | "_rotationY": 0, 490 | "_quat": { 491 | "__type__": "cc.Quat", 492 | "x": 0, 493 | "y": 0, 494 | "z": 0, 495 | "w": 1 496 | }, 497 | "_skewX": 0, 498 | "_skewY": 0, 499 | "_zIndex": 0, 500 | "groupIndex": 0, 501 | "_id": "a42z+t6I5CA4/N2Zmr0x5e" 502 | }, 503 | { 504 | "__type__": "cc.Sprite", 505 | "_name": "", 506 | "_objFlags": 0, 507 | "node": { 508 | "__id__": 11 509 | }, 510 | "_enabled": true, 511 | "_srcBlendFactor": 770, 512 | "_dstBlendFactor": 771, 513 | "_spriteFrame": { 514 | "__uuid__": "f5e4861b-fd17-43d9-a7c1-c24db95d2261" 515 | }, 516 | "_type": 0, 517 | "_sizeMode": 2, 518 | "_fillType": 0, 519 | "_fillCenter": { 520 | "__type__": "cc.Vec2", 521 | "x": 0, 522 | "y": 0 523 | }, 524 | "_fillStart": 0, 525 | "_fillRange": 0, 526 | "_isTrimmedMode": false, 527 | "_state": 0, 528 | "_atlas": { 529 | "__uuid__": "ae9e4b41-d749-46bd-8e54-92aa6292fec0" 530 | }, 531 | "_id": "ebEtxn5gJNeY2LdZ4SFgMo" 532 | }, 533 | { 534 | "__type__": "cc.Animation", 535 | "_name": "", 536 | "_objFlags": 0, 537 | "node": { 538 | "__id__": 11 539 | }, 540 | "_enabled": true, 541 | "_defaultClip": { 542 | "__uuid__": "67d57992-70d3-4dbd-bd0a-d7ae454dba0d" 543 | }, 544 | "_clips": [ 545 | { 546 | "__uuid__": "67d57992-70d3-4dbd-bd0a-d7ae454dba0d" 547 | } 548 | ], 549 | "playOnLoad": true, 550 | "_id": "3bl8E3pyFNT7oq775BQUaj" 551 | }, 552 | { 553 | "__type__": "cc.Canvas", 554 | "_name": "", 555 | "_objFlags": 0, 556 | "node": { 557 | "__id__": 2 558 | }, 559 | "_enabled": true, 560 | "_designResolution": { 561 | "__type__": "cc.Size", 562 | "width": 960, 563 | "height": 640 564 | }, 565 | "_fitWidth": false, 566 | "_fitHeight": true, 567 | "_id": "36QZ+uKq5HwrdO2yQZr6N8" 568 | } 569 | ] -------------------------------------------------------------------------------- /assets/main.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "20d747f8-f31e-4d5a-8605-cb04ccdc3a97", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "experimentalDecorators": true 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | ".vscode", 10 | "library", 11 | "local", 12 | "settings", 13 | "temp" 14 | ] 15 | } -------------------------------------------------------------------------------- /packages/build-textures/main.js: -------------------------------------------------------------------------------- 1 | function onBeforeBuildFinish (options, callback) { 2 | options.bundles.forEach(bundle => { 3 | let buildResults = bundle.buildResults; 4 | 5 | // get path of textures auto generated by auto atlas 6 | Editor.assetdb.queryAssets('db://assets/Auto Atlas/**/*', 'sprite-frame', (err, assetInfos) => { 7 | let textures = _getTextureFromSpriteFrames(buildResults, assetInfos); 8 | for (let i = 0; i < textures.length; ++i) { 9 | let path = buildResults.getNativeAssetPath(textures[i]); 10 | Editor.log(`Texture of "db://assets/Auto Atlas/AutoAtlas": ${path}`); 11 | } 12 | }); 13 | 14 | // get texture path of plist atlas 15 | Editor.assetdb.queryAssets('db://assets/Packed Texture/atlas.png', 'texture', (err, assetInfos) => { 16 | for (let i = 0; i < assetInfos.length; ++i) { 17 | let tex = assetInfos[i].uuid; 18 | if (buildResults.containsAsset(tex)) { 19 | let path = buildResults.getNativeAssetPath(tex); 20 | Editor.log(`Texture of "${assetInfos[i].url}": ${path}`); 21 | } 22 | } 23 | }); 24 | 25 | // get common texture path 26 | Editor.assetdb.queryAssets('db://assets/Normal Texture/**/*', 'texture', (err, assetInfos) => { 27 | for (let i = 0; i < assetInfos.length; ++i) { 28 | let tex = assetInfos[i].uuid; 29 | if (buildResults.containsAsset(tex)) { 30 | let path = buildResults.getNativeAssetPath(tex); 31 | Editor.log(`Texture of "${assetInfos[i].url}": ${path}`); 32 | } 33 | } 34 | }); 35 | 36 | // get all textures in build 37 | let textures = []; 38 | let assets = buildResults.getAssetUuids(); 39 | let textureType = cc.js._getClassId(cc.Texture2D); 40 | for (let i = 0; i < assets.length; ++i) { 41 | let asset = assets[i]; 42 | if (buildResults.getAssetType(asset) === textureType) { 43 | textures.push(buildResults.getNativeAssetPath(asset)); 44 | } 45 | } 46 | Editor.log(`All textures in build: ${textures}`); 47 | }); 48 | callback(); 49 | } 50 | 51 | function _getTextureFromSpriteFrames (buildResults, assetInfos) { 52 | let textures = {}; 53 | for (let i = 0; i < assetInfos.length; ++i) { 54 | let info = assetInfos[i]; 55 | if (buildResults.containsAsset(info.uuid)) { 56 | let depends = buildResults.getDependencies(info.uuid); 57 | if (depends.length > 0) { 58 | // sprite frame should have only one texture 59 | textures[depends[0]] = true; 60 | } 61 | } 62 | } 63 | return Object.keys(textures); 64 | } 65 | 66 | module.exports = { 67 | load () { 68 | Editor.Builder.on('before-change-files', onBeforeBuildFinish); 69 | }, 70 | 71 | unload () { 72 | Editor.Builder.removeListener('before-change-files', onBeforeBuildFinish); 73 | } 74 | }; 75 | -------------------------------------------------------------------------------- /packages/build-textures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "build-textures", 3 | "version": "0.0.1", 4 | "description": "The package template for getting started.", 5 | "author": "Cocos Creator", 6 | "main": "main.js" 7 | } -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos-creator-js", 3 | "packages": "packages" 4 | } -------------------------------------------------------------------------------- /settings/builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "appKey": "", 3 | "appSecret": "", 4 | "encryptJs": true, 5 | "excludeScenes": [], 6 | "fb-instant-games": {}, 7 | "includeAnySDK": false, 8 | "includeSDKBox": false, 9 | "inlineSpriteFrames": true, 10 | "inlineSpriteFrames_native": true, 11 | "jailbreakPlatform": false, 12 | "md5Cache": false, 13 | "mergeStartScene": false, 14 | "oauthLoginServer": "", 15 | "optimizeHotUpdate": false, 16 | "orientation": { 17 | "landscapeLeft": true, 18 | "landscapeRight": true, 19 | "portrait": false, 20 | "upsideDown": false 21 | }, 22 | "packageName": "org.cocos2d.test-build-textures", 23 | "privateKey": "", 24 | "qqplay": { 25 | "REMOTE_SERVER_ROOT": "", 26 | "orientation": "portrait" 27 | }, 28 | "startScene": "20d747f8-f31e-4d5a-8605-cb04ccdc3a97", 29 | "title": "test-build-textures", 30 | "webOrientation": "auto", 31 | "wechatgame": { 32 | "REMOTE_SERVER_ROOT": "", 33 | "appid": "wx6ac3f5090a6b99c5", 34 | "isSubdomain": false, 35 | "orientation": "portrait", 36 | "subContext": "" 37 | }, 38 | "xxteaKey": "51856d77-2004-41", 39 | "zipCompressJs": true 40 | } -------------------------------------------------------------------------------- /settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "start-scene": "current", 3 | "group-list": [ 4 | "default" 5 | ], 6 | "collision-matrix": [ 7 | [ 8 | true 9 | ] 10 | ], 11 | "excluded-modules": [], 12 | "design-resolution-width": 960, 13 | "design-resolution-height": 640, 14 | "fit-width": false, 15 | "fit-height": true, 16 | "use-project-simulator-setting": false, 17 | "simulator-orientation": false, 18 | "use-customize-simulator": false, 19 | "simulator-resolution": { 20 | "width": 960, 21 | "height": 640 22 | }, 23 | "cocos-analytics": { 24 | "enable": false, 25 | "appID": "13798", 26 | "appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2" 27 | } 28 | } --------------------------------------------------------------------------------