Compare commits
70 Commits
versions/1
...
versions/1
| Author | SHA1 | Date | |
|---|---|---|---|
| 020e933092 | |||
| 5f987eeea8 | |||
| 08ac4cc73e | |||
| 5611da7a7c | |||
| 9f7f0e5a2b | |||
| 17a7a1f10e | |||
| 0d42dd1b12 | |||
| 2aa7ca4a0a | |||
| 7638614d33 | |||
| 262e1f8d40 | |||
| 9b89bfc00b | |||
| 6fe301153f | |||
| f342c83a39 | |||
| 36cc95cd60 | |||
| abaaced469 | |||
| 5f24a7dfd9 | |||
| 5f3302b459 | |||
| 4471d05910 | |||
| 9d0846d7dc | |||
| 8142f49e90 | |||
| 4033ca68e8 | |||
| f0fafc4314 | |||
| 47973918ad | |||
| 8b165ba45f | |||
| 0a9aa0c5de | |||
| a56825cf4b | |||
| 90b2d90157 | |||
| 84a7539b56 | |||
| f26d1f1f2e | |||
| 3b775751a2 | |||
| 26fde9fe89 | |||
| f0f18e6aec | |||
| 9ea77def56 | |||
| fa15c96de4 | |||
| a147b74ddf | |||
| 7ef01ccc2e | |||
| ee998c3770 | |||
| 26427f2220 | |||
| 1341a47f09 | |||
| 29dc1b3253 | |||
| 8ca72bf194 | |||
| d5575c005a | |||
| 94c44c37cb | |||
| f9b9acd3b7 | |||
| 26e30e45f2 | |||
| 4451018727 | |||
| b1feaec2c9 | |||
| a38e05f955 | |||
| d591379acc | |||
| 8ded077428 | |||
| 3c5f3784e5 | |||
| 513e477214 | |||
| 55d7df349e | |||
| faff1d4c6e | |||
| 103190fcc7 | |||
| 8867ed855a | |||
| df364244b4 | |||
| 5012b53ac1 | |||
| b7e026e8ff | |||
| 4df50242cc | |||
| 3f4fc9f8aa | |||
| 1976d315c4 | |||
| 1abb0878b9 | |||
| 294c6bba91 | |||
| df9d7ccd43 | |||
| 8981016d57 | |||
| bc8ea51463 | |||
| ce4c644ef2 | |||
| dc77088885 | |||
| ae5cc6de9f |
0
.projectile
Normal file
@@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e3bddf96333643c8a12fd862ebc9ec7
|
||||
guid: 2d8762b6bff92457aa59aaf03193018c
|
||||
folderAsset: yes
|
||||
timeCreated: 1480709542
|
||||
timeCreated: 1487860932
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Elefun/android.fla
Normal file
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffe731bf74d034b948a5ec392ba8e284
|
||||
timeCreated: 1476541234
|
||||
guid: 489500abc518741b59e7a95b93295317
|
||||
timeCreated: 1497866267
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Elefun/open.fla
Normal file
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfa1591b561424bf6a952fcb68bebbc0
|
||||
timeCreated: 1472651507
|
||||
guid: d481c08b811dc41eda079968a32efbb9
|
||||
timeCreated: 1487860937
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/DevTests/Animations/AlphaTests/Tests.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31fd11df111b54e3dbf8f0b135da45d9
|
||||
folderAsset: yes
|
||||
timeCreated: 1494224348
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/Characters_1.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b15c852977e54b3b8b1dfc4fa6fc920
|
||||
timeCreated: 1495641252
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/FX_overlay.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b037662f7f638455d9cc6d4251710ee2
|
||||
timeCreated: 1495627091
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/Torch.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 667a3cd1a987d40d5a4c9b6495da5480
|
||||
timeCreated: 1494255165
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/charexp.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12654680c0cae45d3a44f4fc666262bd
|
||||
timeCreated: 1494492625
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/cyclops_test.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7dc9a5d8bf33d4b30b9a58e370cad87e
|
||||
timeCreated: 1494508632
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/pyromancer_body.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f878ff9c96174385bb57a48f18a6335
|
||||
timeCreated: 1495910510
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/pyromancer_ci.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c82e30d4e993d450f8a475c408afc80f
|
||||
timeCreated: 1495664549
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/pyromancer_head.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89dfadc78afc648c3a5aaf39c5cec6e2
|
||||
timeCreated: 1495655881
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c9df19bccf1d4987a1c2359f55b921f
|
||||
timeCreated: 1495661693
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/tweens.fla
Executable file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b209e60e405544f2bbdc7a9db61b81d
|
||||
timeCreated: 1495206863
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tests/分镜修改版.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8006ea931faa744169bb2c56d2b04da8
|
||||
timeCreated: 1495311730
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/AlphaTests/Tortuga/cyclop.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b35790b065a454a32a0518138e64d15f
|
||||
timeCreated: 1491582789
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/FeatureTests/10_unlocks.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c95e140e6cc841508d2f6a21b33068b
|
||||
timeCreated: 1495287492
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/FeatureTests/9.1_groups.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad3f6a723d9604fe9b44fe73494e6899
|
||||
timeCreated: 1494279688
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/FeatureTests/9.2_groups.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 221b4d2156b3446cbbf03c70db9e69fd
|
||||
timeCreated: 1495746942
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/FeatureTests/9.3_groups.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16c36ac5146fc41799851c3b081b6846
|
||||
timeCreated: 1495749347
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/FeatureTests/9.4_groups.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 137690fcc02e7478f8f0c6733fe7889c
|
||||
timeCreated: 1495903354
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/DevTests/Animations/FeatureTests/9_groups.fla
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95dbb06a4f0c9413480c9e92aba982d3
|
||||
timeCreated: 1494272922
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Assets/FlashTools/Docs/CHANGELOG.md
Normal file
@@ -0,0 +1,93 @@
|
||||
###### Version 1.3.9
|
||||
* Not save generated meshes in scene
|
||||
* Fix (At line 908 of file "FTMain.jsfl": ReferenceError: ft is not defined)
|
||||
* Fix warning on add missing components
|
||||
* Replace string shader properties to id
|
||||
* Replace shader "if" instruction to "step"
|
||||
* Replace mask shader "if + discard" instruction to "clip"
|
||||
|
||||
###### Version 1.3.8
|
||||
* Fix shape groups in tweens problems
|
||||
* Fix drawing object shape problems
|
||||
* Fix locked elements problem
|
||||
* Fix optimizator bitmap trim problems
|
||||
* Fix Unity 5.6 submesh sorting bug
|
||||
* Fix convertSelectionToBitmap for big item (over 4000px)
|
||||
* Fix overlay blending mode
|
||||
* Add HD, SD script export
|
||||
* Add shape tween warning
|
||||
* Add SwfClip bounds functions (currentLocalBounds, currentWorldBounds)
|
||||
* Remove excess "if" instruction from shaders
|
||||
* Remove excess animation reimports
|
||||
|
||||
###### Version 1.3.7
|
||||
* Fix multiple import
|
||||
* Fix single frame optimization
|
||||
|
||||
###### Version 1.3.6
|
||||
* Fix for scale very small vector items
|
||||
* Big vector item optimization
|
||||
* More yield instructions and extensions
|
||||
|
||||
###### Version 1.3.5
|
||||
* Fix sprite import problem
|
||||
|
||||
###### Version 1.3.4
|
||||
* Fix CS6 export problem
|
||||
* Fix unity postprocessor problems
|
||||
|
||||
###### Version 1.3.3
|
||||
* Fix undefined unusedItems in CS6
|
||||
|
||||
###### Version 1.3.2
|
||||
* Fix bug custom scale export with small items optimization
|
||||
|
||||
###### Version 1.3.1
|
||||
* Fix some Unity 5.5 deprecated functions
|
||||
|
||||
###### Version 1.3.0
|
||||
* ETC separated alpha support
|
||||
* Export animations with custom scale (for retina)
|
||||
* New small vector scaled items optimization
|
||||
|
||||
###### Version 1.2.0
|
||||
* Add Yield instructions for wait in coroutines(SwfWaitPlayStopped, SwfWaitRewindPlaying, SwfWaitStopPlaying)
|
||||
* Add unscaled delta time support(for separate animations, groups of animations or for all)
|
||||
* Fix guide type flash layers
|
||||
* Some fixes for reconvert asset problem
|
||||
|
||||
###### Version 1.1.1
|
||||
* Add conversion error by shape tween in CS6
|
||||
* Fix life after death (problem about destroying with big lag by frame event)
|
||||
|
||||
###### Version 1.1.0
|
||||
* Sequence separator is anchor frame label (not common frame label)
|
||||
* SwfClip access to frame labels (currentLabelCount, GetCurrentFrameLabel)
|
||||
* SwfClip events (OnChangeClipEvent, OnChangeSequenceEvent, OnChangeCurrentFrameEvent)
|
||||
|
||||
###### Version 1.0.0
|
||||
* Initial asset store version
|
||||
* Sources to dll
|
||||
* Palette bitmaps support
|
||||
|
||||
###### Version 0.5.0
|
||||
* Flash optimizer twicks
|
||||
* Blending modes (except Alpha and Erase)
|
||||
|
||||
###### Version 0.4.0
|
||||
* Clip groups
|
||||
* Fix move assets bug
|
||||
* Tint color for clips
|
||||
* Animation API improvements
|
||||
|
||||
###### Version 0.3.0
|
||||
* Preview for animation assets and clips
|
||||
* Animation API improvements
|
||||
* Memory optimizations
|
||||
|
||||
###### Version 0.2.0
|
||||
* Export optimizations
|
||||
* Export clips with export names
|
||||
|
||||
###### Version 0.1.0
|
||||
* Initial alpha version
|
||||
8
Assets/FlashTools/Docs/CHANGELOG.md.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 309e798efeb2741c6853f2402363a067
|
||||
timeCreated: 1487174180
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,101 +0,0 @@
|
||||
-------------------
|
||||
-- Version 1.3.4 --
|
||||
-------------------
|
||||
|
||||
Fix CS6 export problem
|
||||
Fix unity postprocessor problems
|
||||
|
||||
-------------------
|
||||
-- Version 1.3.3 --
|
||||
-------------------
|
||||
|
||||
Fix undefined unusedItems in CS6
|
||||
|
||||
-------------------
|
||||
-- Version 1.3.2 --
|
||||
-------------------
|
||||
|
||||
Fix bug custom scale export with small items optimization
|
||||
|
||||
-------------------
|
||||
-- Version 1.3.1 --
|
||||
-------------------
|
||||
|
||||
Fix some Unity 5.5 deprecated functions
|
||||
|
||||
-------------------
|
||||
-- Version 1.3.0 --
|
||||
-------------------
|
||||
|
||||
ETC separated alpha support
|
||||
Export animations with custom scale (for retina)
|
||||
New small vector scaled items optimization
|
||||
|
||||
-------------------
|
||||
-- Version 1.2.0 --
|
||||
-------------------
|
||||
|
||||
Add Yield instructions for wait in coroutines(SwfWaitPlayStopped, SwfWaitRewindPlaying, SwfWaitStopPlaying)
|
||||
Add unscaled delta time support(for separate animations, groups of animations or for all)
|
||||
Fix guide type flash layers
|
||||
Some fixes for reconvert asset problem
|
||||
|
||||
-------------------
|
||||
-- Version 1.1.1 --
|
||||
-------------------
|
||||
|
||||
Add conversion error by shape tween in CS6
|
||||
Fix life after death (problem about destroying with big lag by frame event)
|
||||
|
||||
-------------------
|
||||
-- Version 1.1.0 --
|
||||
-------------------
|
||||
|
||||
Sequence separator is anchor frame label (not common frame label)
|
||||
SwfClip access to frame labels (currentLabelCount, GetCurrentFrameLabel)
|
||||
SwfClip events (OnChangeClipEvent, OnChangeSequenceEvent, OnChangeCurrentFrameEvent)
|
||||
|
||||
-------------------
|
||||
-- Version 1.0.0 --
|
||||
-------------------
|
||||
|
||||
Initial asset store version
|
||||
Sources to dll
|
||||
Palette bitmaps support
|
||||
|
||||
-------------------
|
||||
-- Version 0.5.0 --
|
||||
-------------------
|
||||
|
||||
Flash optimizer twicks
|
||||
Blending modes (except Alpha and Erase)
|
||||
|
||||
-------------------
|
||||
-- Version 0.4.0 --
|
||||
-------------------
|
||||
|
||||
Clip groups
|
||||
Fix move assets bug
|
||||
Tint color for clips
|
||||
Animation API improvements
|
||||
|
||||
-------------------
|
||||
-- Version 0.3.0 --
|
||||
-------------------
|
||||
|
||||
Preview for animation assets and clips
|
||||
Animation API improvements
|
||||
Memory optimizations
|
||||
|
||||
-------------------
|
||||
-- Version 0.2.0 --
|
||||
-------------------
|
||||
|
||||
Export optimizations
|
||||
Export clips with export names
|
||||
|
||||
-------------------
|
||||
-- Version 0.1.0 --
|
||||
-------------------
|
||||
|
||||
Initial alpha version
|
||||
33
Assets/FlashTools/Docs/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
##### Flash Animation Toolset
|
||||
|
||||
Convert your flash animation for Unity easy!
|
||||
|
||||
* [Usage video](http://www.youtube.com/watch?v=uE_XRWZ5KHA)
|
||||
|
||||
* [Blog](http://matov.me)
|
||||
* [Site](http://matov.me/flash-animation-toolset)
|
||||
* [Web demo](http://matov.me/public/blog_share/flash_tools/web_demo)
|
||||
* [User guide](http://matov.me/flash-animation-toolset-user-guide)
|
||||
|
||||
* [Trial version](https://www.assetstore.unity3d.com/#!/content/73896)
|
||||
* [Full version](https://www.assetstore.unity3d.com/#!/content/73323)
|
||||
|
||||
###### Features
|
||||
* Support all transformations like 'rotation', 'skew' and 'scale' (except 3D)
|
||||
* Support all tweens(classic, motion and etc), keyframes and layers
|
||||
* Support mask layers
|
||||
* Support bitmap and vector graphics
|
||||
* Support all clip color effects like 'brightness', 'tint', 'alpha' and etc
|
||||
* Support most blending modes (all except Alpha and Erase)
|
||||
* Simple runtime API for controlling your animations in Unity
|
||||
* Automatic packing texture atlases of animations with different settings
|
||||
* Great performance with zero allocations in update loop
|
||||
* Frame labels to separate sequences in one timeline
|
||||
* Export marked "for export" clips and main timeline
|
||||
* Live preview of animations in the Unity editor
|
||||
|
||||
Supports Unity 5.3 and newer, both Personal and Pro. Full C# source code included.
|
||||
|
||||
Leave your rating for this Asset. It is very important for me and the development of the project :) Thank you!
|
||||
|
||||
Samples use "Creative Commons CC0 1.0 Universal License" animations from [Glitch game](http://www.glitchthegame.com/public-domain-game-art)
|
||||
8
Assets/FlashTools/Docs/README.md.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67cb565c063ff409697ad8b538d2a46a
|
||||
timeCreated: 1487174181
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,35 +0,0 @@
|
||||
-----------------------------
|
||||
-- Flash Animation Toolset --
|
||||
-----------------------------
|
||||
|
||||
Convert your flash animation for Unity easy!
|
||||
|
||||
- Usage video "http://www.youtube.com/watch?v=uE_XRWZ5KHA"
|
||||
|
||||
- Blog "http://matov.me"
|
||||
- Site "http://matov.me/flash-animation-toolset"
|
||||
- Web demo "http://matov.me/public/blog_share/flash_tools/web_demo"
|
||||
- User guide "http://matov.me/flash-animation-toolset-user-guide"
|
||||
|
||||
- Trial version https://www.assetstore.unity3d.com/#!/content/73896
|
||||
- Full version https://www.assetstore.unity3d.com/#!/content/73323
|
||||
|
||||
Features
|
||||
- Support all transformations like 'rotation', 'skew' and 'scale' (except 3D)
|
||||
- Support all tweens(classic, motion and etc), keyframes and layers
|
||||
- Support mask layers
|
||||
- Support bitmap and vector graphics
|
||||
- Support all clip color effects like 'brightness', 'tint', 'alpha' and etc
|
||||
- Support most blending modes (all except Alpha and Erase)
|
||||
- Simple runtime API for controlling your animations in Unity
|
||||
- Automatic packing texture atlases of animations with different settings
|
||||
- Great performance with zero allocations in update loop
|
||||
- Frame labels to separate sequences in one timeline
|
||||
- Export marked "for export" clips and main timeline
|
||||
- Live preview of animations in the Unity editor
|
||||
|
||||
Supports Unity 5.3 and newer, both Personal and Pro. Full C# source code included.
|
||||
|
||||
Leave your rating for this Asset. It is very important for me and the development of the project :) Thank you!
|
||||
|
||||
Samples use "Creative Commons CC0 1.0 Universal License" animations from Glitch game "http://www.glitchthegame.com/public-domain-game-art"
|
||||
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 29 KiB |
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e336e165518cf4d8680e2fff9c6b59ba
|
||||
timeCreated: 1486894953
|
||||
timeCreated: 1502012907
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
@@ -39,7 +39,7 @@ TextureImporter:
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
spriteMeshType: 0
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
||||
@@ -22,14 +22,94 @@ MonoBehaviour:
|
||||
MeshData:
|
||||
SubMeshes:
|
||||
- StartVertex: 0
|
||||
IndexCount: 6
|
||||
IndexCount: 126
|
||||
Vertices:
|
||||
- {x: 0.028839836, y: -0.03892601}
|
||||
- {x: 0.9771797, y: -0.03892601}
|
||||
- {x: 0.9771797, y: -0.8959397}
|
||||
- {x: 0.028839836, y: -0.8959397}
|
||||
UVs: 00000000ff4aff52
|
||||
AddColors: 0000000000000000
|
||||
MulColors: 0002000200020002
|
||||
- {x: 0.093291655, y: -0.5527766}
|
||||
- {x: 0.5906427, y: -0.49855503}
|
||||
- {x: 0.5825955, y: -0.7595181}
|
||||
- {x: 0.08524446, y: -0.81373966}
|
||||
- {x: 0.6724206, y: -0.36256573}
|
||||
- {x: 0.8942103, y: -0.48526812}
|
||||
- {x: 0.7557899, y: -0.7355155}
|
||||
- {x: 0.5340002, y: -0.6128131}
|
||||
- {x: 0.66955954, y: -0.7525534}
|
||||
- {x: 0.8318795, y: -0.6832502}
|
||||
- {x: 0.8691911, y: -0.79836786}
|
||||
- {x: 0.70687115, y: -0.8676711}
|
||||
- {x: 0.43360725, y: -0.12802117}
|
||||
- {x: 0.88885266, y: -0.18992838}
|
||||
- {x: 0.80472267, y: -0.8087083}
|
||||
- {x: 0.3494773, y: -0.7468011}
|
||||
- {x: 0.37824008, y: -0.69763076}
|
||||
- {x: 0.49014634, y: -0.8738549}
|
||||
- {x: 0.38391614, y: -0.941326}
|
||||
- {x: 0.27200988, y: -0.76510197}
|
||||
- {x: 0.4438706, y: -0.5868737}
|
||||
- {x: 0.56574404, y: -0.6853528}
|
||||
- {x: 0.45655966, y: -0.82049984}
|
||||
- {x: 0.33468625, y: -0.7220208}
|
||||
- {x: 0.6787334, y: -0.4077256}
|
||||
- {x: 0.7619559, y: -0.41904274}
|
||||
- {x: 0.74033403, y: -0.5780727}
|
||||
- {x: 0.6571115, y: -0.5667556}
|
||||
- {x: 0.46749952, y: -0.34338287}
|
||||
- {x: 0.7503639, y: -0.3818486}
|
||||
- {x: 0.7349386, y: -0.49530196}
|
||||
- {x: 0.4520743, y: -0.45683625}
|
||||
- {x: 0.86364335, y: -0.09722355}
|
||||
- {x: 0.96060354, y: -0.09934438}
|
||||
- {x: 0.9590185, y: -0.17182186}
|
||||
- {x: 0.86205834, y: -0.16970102}
|
||||
- {x: 0.5517408, y: -0.22355518}
|
||||
- {x: 1.0120615, y: -0.23362388}
|
||||
- {x: 1.0079622, y: -0.42106485}
|
||||
- {x: 0.54764163, y: -0.41099614}
|
||||
- {x: 0.49390063, y: -0.07256326}
|
||||
- {x: 1.039184, y: -0.08449037}
|
||||
- {x: 1.032505, y: -0.38989362}
|
||||
- {x: 0.48722172, y: -0.3779665}
|
||||
- {x: 0.6388158, y: -0.13516656}
|
||||
- {x: 0.7662644, y: -0.13795426}
|
||||
- {x: 0.7637611, y: -0.25242078}
|
||||
- {x: 0.63631254, y: -0.24963307}
|
||||
- {x: 0.69845474, y: -0.20390525}
|
||||
- {x: 0.7184471, y: -0.20434254}
|
||||
- {x: 0.7180098, y: -0.22433674}
|
||||
- {x: 0.6980175, y: -0.22389945}
|
||||
- {x: 0.7316064, y: -0.20348743}
|
||||
- {x: 0.74759996, y: -0.20383726}
|
||||
- {x: 0.74697685, y: -0.23232873}
|
||||
- {x: 0.7309833, y: -0.2319789}
|
||||
- {x: 0.6183724, y: -0.18158044}
|
||||
- {x: 0.7728118, y: -0.18495853}
|
||||
- {x: 0.77112836, y: -0.26193565}
|
||||
- {x: 0.61668897, y: -0.2585576}
|
||||
- {x: 0.6127337, y: -0.099736005}
|
||||
- {x: 0.7977926, y: -0.10378384}
|
||||
- {x: 0.79564387, y: -0.20203815}
|
||||
- {x: 0.610585, y: -0.19799031}
|
||||
- {x: 0.507205, y: -0.11742941}
|
||||
- {x: 1.0924743, y: -0.13023114}
|
||||
- {x: 1.088419, y: -0.31567165}
|
||||
- {x: 0.50314957, y: -0.30286992}
|
||||
- {x: 0.42519823, y: -0.00019747685}
|
||||
- {x: 0.9140025, y: -0.010889203}
|
||||
- {x: 0.90442663, y: -0.44875968}
|
||||
- {x: 0.41562238, y: -0.43806794}
|
||||
- {x: 0.4386289, y: -0.40727332}
|
||||
- {x: 0.5306043, y: -0.40566462}
|
||||
- {x: 0.53292096, y: -0.5381406}
|
||||
- {x: 0.44094557, y: -0.53974926}
|
||||
- {x: 0.46142825, y: -0.5042712}
|
||||
- {x: 0.6632915, y: -0.4016091}
|
||||
- {x: 0.7555196, y: -0.58299005}
|
||||
- {x: 0.5536564, y: -0.68565214}
|
||||
- {x: 0.029411115, y: -0.035497963}
|
||||
- {x: 0.97329503, y: -0.035497963}
|
||||
- {x: 0.97329503, y: -0.8919796}
|
||||
- {x: 0.029411115, y: -0.8919796}
|
||||
UVs: 0000ffbfff19fff1ff56ff37ff73ff50ff1affecff26fffe0000ff5eff3dff8cff1affbfff27ffd4ff52ff76ff65ff87ff56ff51ff66ff59ff67ff5eff72ff7bff76ff0fff7dff19ff3eff5eff51ff8cff560000ff75ff36ff73ff5eff7eff6bff7aff1aff7cff1cff76ff1aff79ff1cff760000ff7eff0eff1affd5ff26ffebff2cff8dff3fffc80000ff8dff2bffbeff67ff51ff74ff5aff52ff5eff66ff7500000000ff55ff5d
|
||||
AddColors: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
MulColors: 000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200020002
|
||||
Materials:
|
||||
- {fileID: 2100000, guid: d58d9a5e482e8429f8d7d18a9538d94a, type: 2}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a25723a1cd8b141a6b489606584a6f65
|
||||
timeCreated: 1480707413
|
||||
timeCreated: 1494801036
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
|
||||
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 66 KiB |
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1278c7f98af44db8a86e620305eb32b
|
||||
timeCreated: 1486894967
|
||||
timeCreated: 1502012900
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
@@ -39,7 +39,7 @@ TextureImporter:
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
spriteMeshType: 0
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
||||
@@ -22,114 +22,154 @@ MonoBehaviour:
|
||||
MeshData:
|
||||
SubMeshes:
|
||||
- StartVertex: 0
|
||||
IndexCount: 6
|
||||
- StartVertex: 4
|
||||
IndexCount: 6
|
||||
- StartVertex: 8
|
||||
IndexCount: 24
|
||||
- StartVertex: 24
|
||||
IndexCount: 6
|
||||
- StartVertex: 28
|
||||
IndexCount: 156
|
||||
Vertices:
|
||||
- {x: 0.106315956, y: 0.12643726}
|
||||
- {x: 0.2629222, y: 0.12643726}
|
||||
- {x: 0.2629222, y: 0.0341479}
|
||||
- {x: 0.106315956, y: 0.0341479}
|
||||
- {x: 0.06176914, y: 0.14451343}
|
||||
- {x: 0.30489662, y: 0.14451343}
|
||||
- {x: 0.30489662, y: 0.05434666}
|
||||
- {x: 0.06176914, y: 0.05434666}
|
||||
- {x: 0.096862756, y: 0.1299182}
|
||||
- {x: 0.1545074, y: 0.1299182}
|
||||
- {x: 0.1545074, y: 0.050229903}
|
||||
- {x: 0.096862756, y: 0.050229903}
|
||||
- {x: 0.17279011, y: 0.12516041}
|
||||
- {x: 0.19912747, y: 0.12392976}
|
||||
- {x: 0.19211169, y: 0.04833745}
|
||||
- {x: 0.16577433, y: 0.049568094}
|
||||
- {x: 0.19564708, y: 0.121027105}
|
||||
- {x: 0.23835461, y: 0.12022791}
|
||||
- {x: 0.23566528, y: 0.048127156}
|
||||
- {x: 0.19295773, y: 0.048926346}
|
||||
- {x: 0.20316595, y: 0.11463966}
|
||||
- {x: 0.24947853, y: 0.11463966}
|
||||
- {x: 0.24947853, y: 0.047944065}
|
||||
- {x: 0.20316595, y: 0.047944065}
|
||||
- {x: 0.06176914, y: 0.14451343}
|
||||
- {x: 0.30489662, y: 0.14451343}
|
||||
- {x: 0.30489662, y: 0.05434666}
|
||||
- {x: 0.06176914, y: 0.05434666}
|
||||
- {x: 0.17883545, y: -0.33088514}
|
||||
- {x: 0.27845198, y: -0.41441038}
|
||||
- {x: 0.18850175, y: -0.5216897}
|
||||
- {x: 0.0888852, y: -0.4381645}
|
||||
- {x: 0.27924088, y: -0.41507185}
|
||||
- {x: 0.19028847, y: -0.52116114}
|
||||
- {x: 0.08988304, y: -0.43697444}
|
||||
- {x: 0.04699825, y: -0.5018102}
|
||||
- {x: 0.13128917, y: -0.5724854}
|
||||
- {x: 0.041338928, y: -0.67976475}
|
||||
- {x: -0.042951997, y: -0.60908955}
|
||||
- {x: 0.13262679, y: -0.57360697}
|
||||
- {x: 0.04558219, y: -0.67742085}
|
||||
- {x: -0.040046353, y: -0.60562414}
|
||||
- {x: 0.28633544, y: -0.32388517}
|
||||
- {x: 0.3936148, y: -0.4138354}
|
||||
- {x: 0.31008956, y: -0.51345193}
|
||||
- {x: 0.20281021, y: -0.4235017}
|
||||
- {x: 0.21864823, y: -0.34363583}
|
||||
- {x: 0.30293915, y: -0.41431102}
|
||||
- {x: 0.23868898, y: -0.49093914}
|
||||
- {x: 0.15439805, y: -0.42026395}
|
||||
- {x: 0.122, y: -0.39949995}
|
||||
- {x: 0.412, y: -0.39949995}
|
||||
- {x: 0.412, y: -0.7594999}
|
||||
- {x: 0.122, y: -0.7594999}
|
||||
- {x: 0.3912854, y: -0.4118823}
|
||||
- {x: 0.30582932, y: -0.5138017}
|
||||
- {x: 0.20087935, y: -0.42580456}
|
||||
- {x: 0.22631103, y: -0.35006085}
|
||||
- {x: 0.30587783, y: -0.41677502}
|
||||
- {x: 0.23916365, y: -0.49634182}
|
||||
- {x: 0.15959686, y: -0.42962766}
|
||||
- {x: 0.122, y: -0.40399995}
|
||||
- {x: 0.40749973, y: -0.40399995}
|
||||
- {x: 0.40749973, y: -0.7604953}
|
||||
- {x: 0.122, y: -0.7604953}
|
||||
- {x: 0.2266193, y: -0.65309644}
|
||||
- {x: 0.32225987, y: -0.60883987}
|
||||
- {x: 0.35238072, y: -0.7319035}
|
||||
- {x: 0.25674015, y: -0.7761601}
|
||||
- {x: 0.32643726, y: -0.6069068}
|
||||
- {x: 0.3576628, y: -0.7344838}
|
||||
- {x: 0.2578448, y: -0.7806734}
|
||||
- {x: 0.173, y: -0.71999997}
|
||||
- {x: 0.313, y: -0.71999997}
|
||||
- {x: 0.313, y: -0.79999995}
|
||||
- {x: 0.173, y: -0.79999995}
|
||||
- {x: 0.31064036, y: -0.71999997}
|
||||
- {x: 0.31064036, y: -0.79705167}
|
||||
- {x: 0.173, y: -0.79705167}
|
||||
- {x: 0.2075, y: -0.69649994}
|
||||
- {x: 0.3075, y: -0.69649994}
|
||||
- {x: 0.3075, y: -0.76649994}
|
||||
- {x: 0.2075, y: -0.76649994}
|
||||
- {x: 0.19299999, y: -0.6795}
|
||||
- {x: 0.30299997, y: -0.6795}
|
||||
- {x: 0.30299997, y: -0.7295}
|
||||
- {x: 0.19299999, y: -0.7295}
|
||||
- {x: 0.3041623, y: -0.69649994}
|
||||
- {x: 0.3041623, y: -0.7633929}
|
||||
- {x: 0.2075, y: -0.7633929}
|
||||
- {x: 0.19299999, y: -0.66949993}
|
||||
- {x: 0.30682567, y: -0.66949993}
|
||||
- {x: 0.30682567, y: -0.71853286}
|
||||
- {x: 0.19299999, y: -0.71853286}
|
||||
- {x: 0.315, y: -0.63199997}
|
||||
- {x: 0.45499998, y: -0.63199997}
|
||||
- {x: 0.45499998, y: -0.732}
|
||||
- {x: 0.315, y: -0.732}
|
||||
- {x: 0.45133758, y: -0.63199997}
|
||||
- {x: 0.45133758, y: -0.73108685}
|
||||
- {x: 0.315, y: -0.73108685}
|
||||
- {x: 0.305, y: -0.752}
|
||||
- {x: 0.45499998, y: -0.752}
|
||||
- {x: 0.45499998, y: -0.83199996}
|
||||
- {x: 0.305, y: -0.83199996}
|
||||
- {x: 0.44998062, y: -0.752}
|
||||
- {x: 0.44998062, y: -0.8315501}
|
||||
- {x: 0.305, y: -0.8315501}
|
||||
- {x: 0.337, y: -0.71599996}
|
||||
- {x: 0.447, y: -0.71599996}
|
||||
- {x: 0.447, y: -0.77599996}
|
||||
- {x: 0.337, y: -0.77599996}
|
||||
- {x: 0.3195, y: -0.70399994}
|
||||
- {x: 0.4495, y: -0.70399994}
|
||||
- {x: 0.4495, y: -0.74399996}
|
||||
- {x: 0.3195, y: -0.74399996}
|
||||
- {x: 0.18099998, y: -0.36449996}
|
||||
- {x: 0.571, y: -0.36449996}
|
||||
- {x: 0.571, y: -0.6744999}
|
||||
- {x: 0.18099998, y: -0.6744999}
|
||||
- {x: 0.3995, y: -0.32349998}
|
||||
- {x: 0.6395, y: -0.32349998}
|
||||
- {x: 0.6395, y: -0.8135}
|
||||
- {x: 0.3995, y: -0.8135}
|
||||
- {x: 0.1625, y: -0.49149996}
|
||||
- {x: 0.5925, y: -0.49149996}
|
||||
- {x: 0.5925, y: -0.6514999}
|
||||
- {x: 0.1625, y: -0.6514999}
|
||||
- {x: 0.13650002, y: 0.087000005}
|
||||
- {x: 0.6465, y: 0.087000005}
|
||||
- {x: 0.6465, y: -0.45299998}
|
||||
- {x: 0.13650002, y: -0.45299998}
|
||||
- {x: 0.442047, y: -0.71599996}
|
||||
- {x: 0.442047, y: -0.7778359}
|
||||
- {x: 0.337, y: -0.7778359}
|
||||
- {x: 0.3295, y: -0.70399994}
|
||||
- {x: 0.46136615, y: -0.70399994}
|
||||
- {x: 0.46136615, y: -0.7479553}
|
||||
- {x: 0.3295, y: -0.7479553}
|
||||
- {x: 0.17849998, y: -0.36099997}
|
||||
- {x: 0.5664945, y: -0.36099997}
|
||||
- {x: 0.5664945, y: -0.67049855}
|
||||
- {x: 0.17849998, y: -0.67049855}
|
||||
- {x: 0.40300003, y: -0.32099998}
|
||||
- {x: 0.6404988, y: -0.32099998}
|
||||
- {x: 0.6404988, y: -0.8089962}
|
||||
- {x: 0.40300003, y: -0.8089962}
|
||||
- {x: 0.1575, y: -0.49599996}
|
||||
- {x: 0.5875, y: -0.49599996}
|
||||
- {x: 0.5875, y: -0.65249896}
|
||||
- {x: 0.1575, y: -0.65249896}
|
||||
- {x: 0.13700001, y: 0.08049999}
|
||||
- {x: 0.65149796, y: 0.08049999}
|
||||
- {x: 0.65149796, y: -0.45499286}
|
||||
- {x: 0.13700001, y: -0.45499286}
|
||||
- {x: 0.262, y: -0.17849998}
|
||||
- {x: 0.362, y: -0.17849998}
|
||||
- {x: 0.362, y: -0.28849998}
|
||||
- {x: 0.262, y: -0.28849998}
|
||||
- {x: 0.36318973, y: -0.17849998}
|
||||
- {x: 0.36318973, y: -0.2919961}
|
||||
- {x: 0.262, y: -0.2919961}
|
||||
- {x: 0.13250002, y: -0.16}
|
||||
- {x: 0.22250001, y: -0.16}
|
||||
- {x: 0.22250001, y: -0.28}
|
||||
- {x: 0.13250002, y: -0.28}
|
||||
- {x: 0.21949664, y: -0.16}
|
||||
- {x: 0.21949664, y: -0.27586058}
|
||||
- {x: 0.13250002, y: -0.27586058}
|
||||
- {x: 0.11150001, y: -0.17449999}
|
||||
- {x: 0.5215, y: -0.17449999}
|
||||
- {x: 0.5215, y: -0.48449996}
|
||||
- {x: 0.11150001, y: -0.48449996}
|
||||
- {x: 0.09650002, y: 0.017000007}
|
||||
- {x: 0.5265, y: 0.017000007}
|
||||
- {x: 0.5265, y: -0.33299997}
|
||||
- {x: 0.09650002, y: -0.33299997}
|
||||
- {x: -0.020737303, y: -0.44349837}
|
||||
- {x: 0.3277887, y: -0.47559524}
|
||||
- {x: 0.30486238, y: -0.7245424}
|
||||
- {x: -0.043663636, y: -0.6924455}
|
||||
- {x: 0.4193734, y: -0.45619494}
|
||||
- {x: 0.559305, y: -0.45187333}
|
||||
- {x: 0.56331795, y: -0.5818099}
|
||||
- {x: 0.4233863, y: -0.58613145}
|
||||
- {x: 0.31538656, y: -0.5147328}
|
||||
- {x: 0.45426717, y: -0.5323866}
|
||||
- {x: 0.43661335, y: -0.6712672}
|
||||
- {x: 0.29773277, y: -0.6536134}
|
||||
- {x: 0.52488655, y: -0.17449999}
|
||||
- {x: 0.52488655, y: -0.48745242}
|
||||
- {x: 0.11150001, y: -0.48745242}
|
||||
- {x: 0.09200001, y: 0.015500011}
|
||||
- {x: 0.5254972, y: 0.015500011}
|
||||
- {x: 0.5254972, y: -0.3314986}
|
||||
- {x: 0.09200001, y: -0.3314986}
|
||||
- {x: -0.016302101, y: -0.44440895}
|
||||
- {x: 0.33271846, y: -0.47655135}
|
||||
- {x: 0.31025076, y: -0.72051847}
|
||||
- {x: -0.038769808, y: -0.68837607}
|
||||
- {x: 0.42293343, y: -0.45808592}
|
||||
- {x: 0.5598651, y: -0.45385697}
|
||||
- {x: 0.5639706, y: -0.5867913}
|
||||
- {x: 0.4270389, y: -0.5910202}
|
||||
- {x: 0.31725287, y: -0.5119459}
|
||||
- {x: 0.4556355, y: -0.5295364}
|
||||
- {x: 0.43754044, y: -0.6718882}
|
||||
- {x: 0.29915783, y: -0.6542977}
|
||||
- {x: 0.37866077, y: -0.5215725}
|
||||
- {x: 0.47755602, y: -0.50675315}
|
||||
- {x: 0.49533924, y: -0.6254274}
|
||||
- {x: 0.39644396, y: -0.6402468}
|
||||
- {x: 0.26616642, y: -0.5326745}
|
||||
- {x: 0.36073795, y: -0.58885443}
|
||||
- {x: 0.2892362, y: -0.7092182}
|
||||
- {x: 0.19466466, y: -0.65303826}
|
||||
UVs: ffbaff22ffc17f29fff7ff05fffe7f0bffbaff297fc1ff307fe57f0c7feaff117f3c7fc87f4effd6ffeaff11ffefff167fbeff417fc2ff48fff07f117ff47f167f4c7fabff4effb07f497fd77f4e7fde7fbeff317fc27f397f4c7fa57f4fffaa7f4c7fc17f4effc77f3c7fb4ff4bffc7ffde00007ff7ff0bff447fe9ff4cfffe7fc300007fde7f19ffea7f0c7ff07f11fff07f0cfff6ff107f3c7f9fff4bffb37f3c7f89ff4dff9e7f3c7fd7ff48ffe8ffbaff297fc1ff30ffba7f1bffc17f22ffde7f0cffe47f11fff70000fffe7f05
|
||||
AddColors: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
MulColors: 00020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002
|
||||
- {x: 0.47597006, y: -0.5069908}
|
||||
- {x: 0.49384904, y: -0.6263043}
|
||||
- {x: 0.39653975, y: -0.640886}
|
||||
- {x: 0.26679638, y: -0.53944594}
|
||||
- {x: 0.36222652, y: -0.596136}
|
||||
- {x: 0.29327887, y: -0.7122002}
|
||||
- {x: 0.19784872, y: -0.6555102}
|
||||
UVs: ffa000007ff37f63000000007f507f9a0000ff9a7f477fbfffa0ff63ffe4ff740000ffdd7f40fff80000ffbf7f3b7fdd000000007f507f9afff3ff27fffa7f2e7f437fd77f4affdcfff3ff2e7ffaff35ff4a7fd77f50ffdcffb97f75ffcbff83ff47fff17f4f7ff9fff3ff157ff9ff1ffff9ff15fffeff1cfff3ff457ff7ff4dff40fff17f47fffaff47ffb0ff4d7fbb7ffb7f207fff7f277ffc00007fffff08ff40ffdd7f507ff1ffa07f757fb97f81fff30000fffb7f15ff507f89ff6bffa27f077ff97f0dfffe00007ff9ff06fffeff3bffbf7f4dffd67fe5ff63fff67f797fcc7f75ffd8ff86fff3ff2e7ffaff35fff37f20fffa7f27ff0d7ff9ff137ffeff3b7fd7ff42ffdc
|
||||
AddColors: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
MulColors: 000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002
|
||||
Materials:
|
||||
- {fileID: 2100000, guid: d58d9a5e482e8429f8d7d18a9538d94a, type: 2}
|
||||
- {fileID: 2100000, guid: 3c29e337d2fa54be7af8d125c34562b7, type: 2}
|
||||
- {fileID: 2100000, guid: fd62ebda9455442f4a7861e78484f3b6, type: 2}
|
||||
- {fileID: 2100000, guid: 69837dba6d9e9419a8e22a6b25de0008, type: 2}
|
||||
- {fileID: 2100000, guid: d58d9a5e482e8429f8d7d18a9538d94a, type: 2}
|
||||
|
||||
|
Before Width: | Height: | Size: 269 KiB After Width: | Height: | Size: 1.4 MiB |
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a799322aa44e44b38980bc9d307f0c38
|
||||
timeCreated: 1486894960
|
||||
timeCreated: 1502012881
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
@@ -39,7 +39,7 @@ TextureImporter:
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
spriteMeshType: 0
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
||||
@@ -22,22 +22,154 @@ MonoBehaviour:
|
||||
MeshData:
|
||||
SubMeshes:
|
||||
- StartVertex: 0
|
||||
IndexCount: 18
|
||||
IndexCount: 216
|
||||
Vertices:
|
||||
- {x: 1.139, y: -2.095}
|
||||
- {x: 1.2790855, y: -2.095}
|
||||
- {x: 1.2790855, y: -2.8981402}
|
||||
- {x: 1.139, y: -2.8981402}
|
||||
- {x: 1.1025, y: -1.056}
|
||||
- {x: 1.3759177, y: -1.056}
|
||||
- {x: 1.3759177, y: -2.7861564}
|
||||
- {x: 1.1025, y: -2.7861564}
|
||||
- {x: 1.126, y: -1.0004998}
|
||||
- {x: 1.5205874, y: -1.0004998}
|
||||
- {x: 1.5205874, y: -2.9477496}
|
||||
- {x: 1.126, y: -2.9477496}
|
||||
- {x: 0.8705, y: -1.6520001}
|
||||
- {x: 1.2186888, y: -1.6520001}
|
||||
- {x: 1.2186888, y: -2.4983816}
|
||||
- {x: 0.8705, y: -2.4983816}
|
||||
- {x: 1.0625, y: -1.0354998}
|
||||
- {x: 1.3845642, y: -1.0354998}
|
||||
- {x: 1.3845642, y: -2.7268858}
|
||||
- {x: 1.0625, y: -2.7268858}
|
||||
- {x: 1.253, y: -1.2565002}
|
||||
- {x: 1.4584018, y: -1.2565002}
|
||||
- {x: 1.4584018, y: -3.0470023}
|
||||
- {x: 1.253, y: -3.0470023}
|
||||
- {x: 1.563, y: -2.0925}
|
||||
- {x: 1.7030854, y: -2.0925}
|
||||
- {x: 1.7030854, y: -2.8960884}
|
||||
- {x: 1.563, y: -2.8960884}
|
||||
- {x: 1.4990001, y: -1.0945001}
|
||||
- {x: 1.7719691, y: -1.0945001}
|
||||
- {x: 1.7719691, y: -2.8084314}
|
||||
- {x: 1.4990001, y: -2.8084314}
|
||||
- {x: 1.35, y: -1.0004998}
|
||||
- {x: 1.7445874, y: -1.0004998}
|
||||
- {x: 1.7445874, y: -2.9477496}
|
||||
- {x: 1.35, y: -2.9477496}
|
||||
- {x: 1.549, y: -1.547}
|
||||
- {x: 1.8971888, y: -1.547}
|
||||
- {x: 1.8971888, y: -2.3933816}
|
||||
- {x: 1.549, y: -2.3933816}
|
||||
- {x: 1.4805, y: -1.1229999}
|
||||
- {x: 1.8025641, y: -1.1229999}
|
||||
- {x: 1.8025641, y: -2.8139558}
|
||||
- {x: 1.4805, y: -2.8139558}
|
||||
- {x: 1.4475, y: -1.1140002}
|
||||
- {x: 1.6529018, y: -1.1140002}
|
||||
- {x: 1.6529018, y: -2.812595}
|
||||
- {x: 1.4475, y: -2.812595}
|
||||
- {x: 0.5695001, y: 0.005499954}
|
||||
- {x: 1.5321016, y: 0.005499954}
|
||||
- {x: 1.5321016, y: -0.96880054}
|
||||
- {x: 0.5695001, y: -0.96880054}
|
||||
- {x: 1.3535, y: 0.005499954}
|
||||
- {x: 2.3156445, y: 0.005499954}
|
||||
- {x: 2.3156445, y: -0.96880054}
|
||||
- {x: 1.3535, y: -0.96880054}
|
||||
- {x: -0.0025, y: -0.82850003}
|
||||
- {x: 1.305124, y: -0.82850003}
|
||||
- {x: 1.305124, y: -1.5514493}
|
||||
- {x: -0.0025, y: -1.5514493}
|
||||
- {x: 1.54, y: -0.829}
|
||||
- {x: 2.847624, y: -0.829}
|
||||
- {x: 2.847624, y: -1.5519493}
|
||||
- {x: 1.54, y: -1.5519493}
|
||||
- {x: 1.4375, y: -1.4825}
|
||||
- {x: 2.5618057, y: -1.4825}
|
||||
- {x: 2.5618057, y: -2.2865365}
|
||||
- {x: 1.4375, y: -2.2865365}
|
||||
- {x: 0.36249998, y: -1.4825}
|
||||
- {x: 1.4868057, y: -1.4825}
|
||||
- {x: 1.4868057, y: -2.2869847}
|
||||
- {x: 0.36249998, y: -2.2869847}
|
||||
- {x: 0.7260001, y: -1.1345}
|
||||
- {x: 2.1597319, y: -1.1345}
|
||||
- {x: 2.1597319, y: -1.9128515}
|
||||
- {x: 0.7260001, y: -1.9128515}
|
||||
- {x: 0.778, y: -1.3199999}
|
||||
- {x: 2.1261826, y: -1.3199999}
|
||||
- {x: 2.1261826, y: -1.8591814}
|
||||
- {x: 0.778, y: -1.8591814}
|
||||
- {x: 0.66600007, y: -0.48749998}
|
||||
- {x: 2.2209303, y: -0.48749998}
|
||||
- {x: 2.2209303, y: -1.3311706}
|
||||
- {x: 0.66600007, y: -1.3311706}
|
||||
- {x: 0.7415001, y: -0.57449996}
|
||||
- {x: 2.1793175, y: -0.57449996}
|
||||
- {x: 2.1793175, y: -1.3046691}
|
||||
- {x: 0.7415001, y: -1.3046691}
|
||||
- {x: 0.7995001, y: -1.148}
|
||||
- {x: 2.0819185, y: -1.148}
|
||||
- {x: 2.0819185, y: -1.7824947}
|
||||
- {x: 0.7995001, y: -1.7824947}
|
||||
- {x: 0.8690001, y: -1.366}
|
||||
- {x: 2.0115485, y: -1.366}
|
||||
- {x: 2.0115485, y: -1.7135457}
|
||||
- {x: 0.8690001, y: -1.7135457}
|
||||
- {x: 1.2855, y: -1.458}
|
||||
- {x: 1.6248952, y: -1.458}
|
||||
- {x: 1.6248952, y: -2.4030576}
|
||||
- {x: 1.2855, y: -2.4030576}
|
||||
- {x: 0.8095001, y: -1.2175}
|
||||
- {x: 2.0860398, y: -1.2175}
|
||||
- {x: 2.0860398, y: -1.5008262}
|
||||
- {x: 0.8095001, y: -1.5008262}
|
||||
- {x: 0.788, y: -0.67550004}
|
||||
- {x: 2.098783, y: -0.67550004}
|
||||
- {x: 2.098783, y: -1.3583705}
|
||||
- {x: 0.788, y: -1.3583705}
|
||||
- {x: 0.81250006, y: -1.163}
|
||||
- {x: 0.8850208, y: -1.163}
|
||||
- {x: 0.8850208, y: -1.290926}
|
||||
- {x: 0.81250006, y: -1.290926}
|
||||
- {x: 1.7355, y: -0.92499995}
|
||||
- {x: 2.035947, y: -0.92499995}
|
||||
- {x: 2.035947, y: -1.2623844}
|
||||
- {x: 1.7355, y: -1.2623844}
|
||||
- {x: 1.8845, y: -1.153}
|
||||
- {x: 2.1408007, y: -1.153}
|
||||
- {x: 2.1408007, y: -0.79580396}
|
||||
- {x: 1.8845, y: -0.79580396}
|
||||
- {x: 1.7355, y: -0.92499995}
|
||||
- {x: 2.035947, y: -0.92499995}
|
||||
- {x: 2.035947, y: -1.2623844}
|
||||
- {x: 1.7355, y: -1.2623844}
|
||||
- {x: 0.7215001, y: -0.92499995}
|
||||
- {x: 1.1629382, y: -0.92499995}
|
||||
- {x: 1.1629382, y: -1.4857965}
|
||||
- {x: 0.7215001, y: -1.4857965}
|
||||
- {x: 1.4074999, y: -1.2465}
|
||||
- {x: 1.4567962, y: -1.2465}
|
||||
- {x: 1.4567962, y: -1.265126}
|
||||
- {x: 1.4074999, y: -1.265126}
|
||||
- {x: 1.4563452, y: -1.2465}
|
||||
- {x: 1.4563452, y: -1.2653537}
|
||||
- {x: 1.4074999, y: -1.2653537}
|
||||
- {x: 1.3113072, y: -1.1273378}
|
||||
- {x: 1.6636108, y: -1.226211}
|
||||
- {x: 1.4024341, y: -1.3672544}
|
||||
- {x: 1.0501305, y: -1.2683811}
|
||||
- {x: 1.3955, y: -1.242}
|
||||
- {x: 1.4708942, y: -1.242}
|
||||
- {x: 1.4708942, y: -1.2696567}
|
||||
- {x: 1.3955, y: -1.2696567}
|
||||
- {x: 1.4714679, y: -1.242}
|
||||
- {x: 1.4714679, y: -1.2697064}
|
||||
- {x: 1.3955, y: -1.2697064}
|
||||
- {x: 1.3870001, y: -1.2475}
|
||||
- {x: 1.4810733, y: -1.2475}
|
||||
- {x: 1.4810733, y: -1.2815095}
|
||||
- {x: 1.3870001, y: -1.2815095}
|
||||
UVs: bf443fa4ff4cbfacff0f7ff23f1c7fff7f1c7fee3f26fff8
|
||||
AddColors: 000000000000000000000000000000000000000000000000
|
||||
MulColors: 000200020001000200020002000100020002000200010002
|
||||
- {x: 1.4802694, y: -1.2475}
|
||||
- {x: 1.4802694, y: -1.2818046}
|
||||
- {x: 1.3870001, y: -1.2818046}
|
||||
UVs: 3fcd9f875fd89f89df4f7fcedf673fd23f265fd33f41dfd83f119ffaff1c7fff1f255fec9f3cdff03f5e5fd21f773fd5dfdadf85ffe5df87ff677fcebf7f3fd2bf1dffdabf387fe0df4f1fee9f5bfff21f25fff09f3c7ff53f5e5fd5df753fd83fcd1f7abfda7f873fcd9f6cbfdaff79ffb89f6cffc2bf7e1fc39f6c1fcdbf7edfda9f6cffe53f7c1fe69f6c3ff13f7c1ff5ff1edfffdf323f11bfe7bf187ffaffa29f6cbfae3f821ff5ff323fffff4600005fd31f11fff51ff500007ffedf1e3f115fd31f26dfdafffa9f6cdffe5f7e5ff19f6cdffadf7e9ffddf4e5fffdf4fbf49fff95f4e1ffedf7f7fcedf84ffd1bf3cfff05f411ff5df4f1ff39f573ff95f447f8a9f875fce000000005f8e5f8a00007f8a3f443fd37f8e0000fff47f6c
|
||||
AddColors: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
MulColors: 000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200000002000200020000000200020002000000020002000200010002000200020000000200020002000100020002000200010002
|
||||
Materials:
|
||||
- {fileID: 2100000, guid: d58d9a5e482e8429f8d7d18a9538d94a, type: 2}
|
||||
|
||||
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 133 KiB |
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47e46d443fd064d78ae33281e2840297
|
||||
timeCreated: 1486894975
|
||||
timeCreated: 1502012889
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
@@ -39,7 +39,7 @@ TextureImporter:
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
spriteMeshType: 0
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
||||
@@ -18,22 +18,25 @@ namespace FlashTools.Examples {
|
||||
|
||||
IEnumerator StartCoro(SwfClipController ctrl) {
|
||||
while ( true ) {
|
||||
ctrl.Play(_fadeInSequence);
|
||||
yield return new SwfWaitStopPlaying(ctrl);
|
||||
|
||||
yield return ctrl.PlayAndWaitStopOrRewind(_fadeInSequence);
|
||||
for ( var i = 0; i < 3; ++i ) {
|
||||
var last_seq = ctrl.clip.sequence;
|
||||
do {
|
||||
var seq_index = Random.Range(0, _idleSequences.Length);
|
||||
ctrl.Play(_idleSequences[seq_index]);
|
||||
} while ( last_seq == ctrl.clip.sequence );
|
||||
yield return new SwfWaitStopPlaying(ctrl);
|
||||
var idle_seq = GetRandomIdleSequence(ctrl);
|
||||
yield return ctrl.PlayAndWaitStopOrRewind(idle_seq);
|
||||
}
|
||||
|
||||
ctrl.Play(_fadeOutSequence);
|
||||
yield return new SwfWaitStopPlaying(ctrl);
|
||||
yield return ctrl.PlayAndWaitStopOrRewind(_fadeOutSequence);
|
||||
yield return new WaitForSeconds(2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
string GetRandomIdleSequence(SwfClipController ctrl) {
|
||||
var cur_seq = ctrl.clip.sequence;
|
||||
do {
|
||||
var seq_index = Random.Range(0, _idleSequences.Length);
|
||||
var new_sequence = _idleSequences[seq_index];
|
||||
if ( new_sequence != cur_seq ) {
|
||||
return new_sequence;
|
||||
}
|
||||
} while ( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,832 +1,5 @@
|
||||
if (!String.prototype.format) {
|
||||
String.prototype.format = function () {
|
||||
var args = arguments;
|
||||
return this.replace(/{(\d+)}/g, function (match, number) {
|
||||
return typeof args[number] != 'undefined' ? args[number] : match;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
//
|
||||
// ft config
|
||||
//
|
||||
|
||||
var ft = {
|
||||
profile_mode : false,
|
||||
verbose_mode : false,
|
||||
graphics_scale : 1.0,
|
||||
optimize_small_items : true,
|
||||
optimize_static_items : true,
|
||||
optimize_single_graphics : true
|
||||
};
|
||||
|
||||
//
|
||||
// ft base functions
|
||||
//
|
||||
|
||||
ft.trace = function () {
|
||||
fl.outputPanel.trace(
|
||||
Array.prototype.join.call(arguments, " "));
|
||||
};
|
||||
|
||||
ft.trace_fmt = function (format) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
ft.trace(format.format.apply(format, args));
|
||||
};
|
||||
|
||||
ft.clear_output = function () {
|
||||
fl.outputPanel.clear();
|
||||
};
|
||||
|
||||
ft.assert = function (expr, format) {
|
||||
if (!expr) {
|
||||
if (format === undefined) {
|
||||
throw "!!!Assert!!!";
|
||||
} else {
|
||||
var args = Array.prototype.slice.call(arguments, 2);
|
||||
throw "!!!Assert!!! " + format.format.apply(format, args);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ft.type_assert = function (item, type) {
|
||||
var type_is_string = (typeof type === 'string');
|
||||
ft.assert(
|
||||
(type_is_string && typeof item === type) ||
|
||||
(!type_is_string && item instanceof type),
|
||||
"Type error: {0} != {1}",
|
||||
typeof item,
|
||||
type_is_string ? type : type.constructor.name);
|
||||
};
|
||||
|
||||
ft.type_assert_if_defined = function (item, type) {
|
||||
if (item && item !== undefined) {
|
||||
ft.type_assert(item, type);
|
||||
}
|
||||
};
|
||||
|
||||
ft.is_function = function (func) {
|
||||
return func && typeof(func) === 'function';
|
||||
};
|
||||
|
||||
ft.profile_function = function (func, msg) {
|
||||
ft.type_assert(func, Function);
|
||||
ft.type_assert(msg, 'string');
|
||||
if (!ft.profile_function_stack) {
|
||||
ft.profile_function_stack = [];
|
||||
}
|
||||
if (!ft.profile_function_level) {
|
||||
ft.profile_function_level = 0;
|
||||
}
|
||||
var stack_index = ft.profile_function_stack.length;
|
||||
ft.profile_function_stack.push({
|
||||
msg: msg,
|
||||
level: ft.profile_function_level,
|
||||
time: 0
|
||||
});
|
||||
++ft.profile_function_level;
|
||||
var func_time = ft.get_call_function_time(func);
|
||||
--ft.profile_function_level;
|
||||
ft.profile_function_stack[stack_index].time = func_time;
|
||||
if (stack_index == 0) {
|
||||
for (var i = 0; i < ft.profile_function_stack.length; ++i) {
|
||||
var info = ft.profile_function_stack[i];
|
||||
var ident = "--";
|
||||
for (var j = 0; j < info.level; ++j) {
|
||||
ident += "--";
|
||||
}
|
||||
if (ft.profile_mode) {
|
||||
ft.trace_fmt("{0} Profile: '{1}' : {2}", ident, info.msg, info.time);
|
||||
}
|
||||
}
|
||||
ft.profile_function_stack = [];
|
||||
}
|
||||
};
|
||||
|
||||
ft.get_call_function_time = function (func) {
|
||||
ft.type_assert(func, Function);
|
||||
var b_time = Date.now();
|
||||
func();
|
||||
var e_time = Date.now();
|
||||
return (e_time - b_time) / 1000;
|
||||
};
|
||||
|
||||
ft.escape_path = function (path) {
|
||||
ft.type_assert(path, 'string');
|
||||
return path.replace(/ /g, '%20');
|
||||
};
|
||||
|
||||
ft.escape_string = function (str) {
|
||||
ft.type_assert(str, 'string');
|
||||
return str
|
||||
.replace(/\&/g, '&')
|
||||
.replace(/\"/g, '"')
|
||||
.replace(/\'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
};
|
||||
|
||||
ft.combine_path = function (lhs, rhs) {
|
||||
ft.type_assert(lhs, 'string');
|
||||
ft.type_assert(rhs, 'string');
|
||||
return ft.escape_path(lhs) + ft.escape_path(rhs);
|
||||
};
|
||||
|
||||
ft.array_foldl = function (arr, func, acc) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
for (var index = 0; index < arr.length; ++index) {
|
||||
var value = arr[index];
|
||||
acc = func(value, acc);
|
||||
}
|
||||
return acc;
|
||||
};
|
||||
|
||||
ft.array_foldr = function (arr, func, acc) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
for (var index = arr.length - 1; index >= 0; --index) {
|
||||
var value = arr[index];
|
||||
acc = func(value, acc);
|
||||
}
|
||||
return acc;
|
||||
};
|
||||
|
||||
ft.array_filter = function (arr, filter) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(filter, Function);
|
||||
var new_arr = [];
|
||||
for (var index = 0; index < arr.length; ++index) {
|
||||
var value = arr[index];
|
||||
if (filter(value, index)) {
|
||||
new_arr.push(value);
|
||||
}
|
||||
}
|
||||
return new_arr;
|
||||
};
|
||||
|
||||
ft.array_foreach = function (arr, func, filter) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
ft.type_assert_if_defined(filter, Function);
|
||||
for (var index = 0; index < arr.length; ++index) {
|
||||
var value = arr[index];
|
||||
if (filter === undefined || filter(value, index)) {
|
||||
func(value, index);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ft.array_reverse_foreach = function (arr, func, filter) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
ft.type_assert_if_defined(filter, Function);
|
||||
for (var index = arr.length - 1; index >= 0; --index) {
|
||||
var value = arr[index];
|
||||
if (filter === undefined || filter(value, index)) {
|
||||
func(value, index);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ft.approximately = function(a, b, precision) {
|
||||
ft.type_assert(a, 'number');
|
||||
ft.type_assert(b, 'number');
|
||||
ft.type_assert(precision, 'number');
|
||||
return Math.abs(b - a) < Math.abs(precision);
|
||||
};
|
||||
|
||||
ft.gen_unique_name = function () {
|
||||
if (!ft.gen_unique_name_index) {
|
||||
ft.gen_unique_name_index = 0;
|
||||
}
|
||||
++ft.gen_unique_name_index;
|
||||
return "ft_unique_name_" + ft.gen_unique_name_index;
|
||||
};
|
||||
|
||||
//
|
||||
// document
|
||||
//
|
||||
|
||||
var ftdoc = {};
|
||||
|
||||
ftdoc.prepare = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.profile_function(function() { ftdoc.prepare_folders(doc); }, "Prepare folders");
|
||||
ft.profile_function(function() { ftdoc.full_exit_edit_mode(doc); }, "Full exit edit mode");
|
||||
ft.profile_function(function() { ftdoc.remove_unused_items(doc); }, "Remove unused items");
|
||||
ft.profile_function(function() { ftdoc.prepare_all_bitmaps(doc); }, "Prepare all bitmaps");
|
||||
ft.profile_function(function() { ftdoc.unlock_all_timelines(doc); }, "Unlock all timelines");
|
||||
ft.profile_function(function() { ftdoc.optimize_all_timelines(doc); }, "Optimize all timelines");
|
||||
ft.profile_function(function() { ftdoc.rasterize_all_shapes(doc); }, "Rasterize all shapes");
|
||||
ft.profile_function(function() { ftdoc.export_swf(doc); }, "Export swf");
|
||||
};
|
||||
|
||||
ftdoc.get_temp = function (doc) {
|
||||
if (!ftdoc.hasOwnProperty("temp")) {
|
||||
ftdoc["temp"] = {
|
||||
x_max_scales : {},
|
||||
y_max_scales : {}
|
||||
}
|
||||
}
|
||||
return ftdoc["temp"];
|
||||
};
|
||||
|
||||
ftdoc.calculate_item_final_scale = function (doc, optional_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
var final_scale = ft.graphics_scale;
|
||||
if (optional_item && ft.optimize_small_items) {
|
||||
var item_name = optional_item.name;
|
||||
var x_max_scales = ftdoc.get_temp(doc).x_max_scales;
|
||||
var y_max_scales = ftdoc.get_temp(doc).y_max_scales;
|
||||
if (x_max_scales.hasOwnProperty(item_name) && y_max_scales.hasOwnProperty(item_name)) {
|
||||
var max_x_scale = x_max_scales[item_name];
|
||||
var max_y_scale = y_max_scales[item_name];
|
||||
var max_c_scale = Math.max(max_x_scale, max_y_scale);
|
||||
if (max_c_scale < 1.0) {
|
||||
final_scale *= max_c_scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
return final_scale;
|
||||
};
|
||||
|
||||
ftdoc.convert_selection_to_bitmap = function (doc, optional_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
var final_scale = ftdoc.calculate_item_final_scale(doc, optional_item);
|
||||
if (ft.approximately(final_scale, 1.0, 0.01)) {
|
||||
doc.convertSelectionToBitmap();
|
||||
} else {
|
||||
var wrapper_item_name = ft.gen_unique_name();
|
||||
var wrapper_item = doc.convertToSymbol("graphic", wrapper_item_name , "center");
|
||||
fttim.recursive_scale_filters(doc, wrapper_item.timeline, final_scale);
|
||||
doc.scaleSelection(final_scale, final_scale);
|
||||
doc.convertSelectionToBitmap();
|
||||
doc.scaleSelection(1.0 / final_scale, 1.0 / final_scale);
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.prepare_folders = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
var export_folder = ftdoc.get_export_folder(doc);
|
||||
if (!FLfile.exists(export_folder) && !FLfile.createFolder(export_folder)) {
|
||||
throw "Can't create document export folder ({0})!"
|
||||
.format(export_folder);
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.get_export_folder = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
return ft.combine_path(
|
||||
ft.escape_path(doc.pathURI),
|
||||
"_export/");
|
||||
};
|
||||
|
||||
ftdoc.full_exit_edit_mode = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
doc.exitEditMode();
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.remove_unused_items = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
var unused_items = doc.library.unusedItems;
|
||||
if (unused_items && unused_items !== undefined) {
|
||||
ft.array_reverse_foreach(unused_items, function(item) {
|
||||
if (ft.verbose_mode) {
|
||||
ft.trace_fmt("Remove unused item: {0}", item.name);
|
||||
}
|
||||
doc.library.deleteItem(item.name);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.unlock_all_timelines = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ftlib.unlock_all_timelines(doc, doc.library);
|
||||
fttim.unlock(doc.getTimeline());
|
||||
};
|
||||
|
||||
ftdoc.optimize_all_timelines = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
if (ft.optimize_small_items) {
|
||||
ft.profile_function(function () {
|
||||
ftlib.optimize_small_items(doc, doc.library);
|
||||
}, "Optimize small items");
|
||||
}
|
||||
if (ft.optimize_static_items) {
|
||||
ft.profile_function(function () {
|
||||
ftlib.optimize_static_items(doc, doc.library);
|
||||
}, "Optimize static items");
|
||||
}
|
||||
if (ft.optimize_single_graphics) {
|
||||
ft.profile_function(function () {
|
||||
ftlib.optimize_single_graphics(doc, doc.library);
|
||||
}, "Optimize single graphics");
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.rasterize_all_shapes = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ftlib.rasterize_all_shapes(doc, doc.library);
|
||||
fttim.rasterize_all_shapes(doc, doc.getTimeline());
|
||||
};
|
||||
|
||||
ftdoc.prepare_all_bitmaps = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ftlib.prepare_all_bitmaps(doc.library);
|
||||
};
|
||||
|
||||
ftdoc.export_swf = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.trace_fmt("!!!Document!!!: '{0}' conversion complete!", doc.name);
|
||||
doc.exportSWF(ftdoc.get_export_swf_path(doc));
|
||||
};
|
||||
|
||||
ftdoc.get_export_swf_path = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
return ft.combine_path(
|
||||
ftdoc.get_export_folder(doc),
|
||||
doc.name + ".swf");
|
||||
};
|
||||
|
||||
//
|
||||
// library
|
||||
//
|
||||
|
||||
var ftlib = {};
|
||||
|
||||
ftlib.is_folder_item = function (item) {
|
||||
ft.type_assert(item, LibraryItem);
|
||||
return item.itemType == "folder";
|
||||
};
|
||||
|
||||
ftlib.is_bitmap_item = function (item) {
|
||||
ft.type_assert(item, LibraryItem);
|
||||
return item.itemType == "bitmap";
|
||||
};
|
||||
|
||||
ftlib.is_symbol_item = function (item) {
|
||||
ft.type_assert(item, LibraryItem);
|
||||
return item.itemType == "graphic" || item.itemType == "movie clip";
|
||||
};
|
||||
|
||||
ftlib.find_item_by_name = function (library, item_name) {
|
||||
ft.type_assert(library, Library);
|
||||
ft.type_assert(item_name, 'string');
|
||||
for (var i = 0; i < library.items.length; ++i) {
|
||||
var item = library.items[i];
|
||||
if (item.name == item_name) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
ftlib.edit_all_items = function (doc, library, func, filter) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ft.type_assert(func, Function);
|
||||
ft.type_assert_if_defined(filter, Function);
|
||||
ft.array_foreach(library.items, function (item) {
|
||||
if (library.editItem(item.name)) {
|
||||
func(item);
|
||||
doc.exitEditMode();
|
||||
}
|
||||
}, filter);
|
||||
};
|
||||
|
||||
ftlib.edit_all_symbol_items = function (doc, library, func) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ft.type_assert(func, Function);
|
||||
ftlib.edit_all_items(doc, library, func, ftlib.is_symbol_item);
|
||||
};
|
||||
|
||||
ftlib.unlock_all_timelines = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ftlib.edit_all_symbol_items(doc, library, function (item) {
|
||||
fttim.unlock(item.timeline);
|
||||
});
|
||||
};
|
||||
|
||||
ftlib.optimize_small_items = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
|
||||
var x_max_scales = ftdoc.get_temp(doc).x_max_scales;
|
||||
var y_max_scales = ftdoc.get_temp(doc).y_max_scales;
|
||||
|
||||
var walk_by_timeline = function(timeline, func, acc) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.type_assert(func, Function);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
walk_by_timeline(
|
||||
elem.libraryItem.timeline,
|
||||
func,
|
||||
func(elem, acc));
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
});
|
||||
};
|
||||
|
||||
var walk_by_library = function(lib, func, acc) {
|
||||
ft.type_assert(lib, Library);
|
||||
ft.type_assert(func, Function);
|
||||
ft.array_foreach(lib.items, function (item) {
|
||||
walk_by_timeline(item.timeline, func, acc)
|
||||
}, ftlib.is_symbol_item);
|
||||
};
|
||||
|
||||
var x_func = function(elem, acc) {
|
||||
var elem_sx = elem.scaleX * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
x_max_scales[item_name] = Math.max(
|
||||
x_max_scales.hasOwnProperty(item_name) ? x_max_scales[item_name] : elem_sx,
|
||||
elem_sx);
|
||||
return elem_sx;
|
||||
};
|
||||
|
||||
var y_func = function(elem, acc) {
|
||||
var elem_sy = elem.scaleY * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
y_max_scales[item_name] = Math.max(
|
||||
y_max_scales.hasOwnProperty(item_name) ? y_max_scales[item_name] : elem_sy,
|
||||
elem_sy);
|
||||
return elem_sy;
|
||||
};
|
||||
|
||||
walk_by_library(library, x_func, 1.0);
|
||||
walk_by_timeline(doc.getTimeline(), x_func, 1.0);
|
||||
|
||||
walk_by_library(library, y_func, 1.0);
|
||||
walk_by_timeline(doc.getTimeline(), y_func, 1.0);
|
||||
|
||||
if (ft.verbose_mode) {
|
||||
for (var item_name in x_max_scales) {
|
||||
var max_x_scale = x_max_scales.hasOwnProperty(item_name) ? x_max_scales[item_name] : 1.0;
|
||||
var max_y_scale = y_max_scales.hasOwnProperty(item_name) ? y_max_scales[item_name] : 1.0;
|
||||
var max_c_scale = Math.max(max_x_scale, max_y_scale);
|
||||
if (max_c_scale < 1.0) {
|
||||
ft.trace_fmt("Small item for optimize: {0} - {1}", item_name, max_c_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ftlib.optimize_static_items = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
|
||||
var replaces = {};
|
||||
ft.array_reverse_foreach(library.items, function (item) {
|
||||
var new_item_name = ft.gen_unique_name();
|
||||
if (ftlib.bake_symbol_item(doc, library, item.name, new_item_name, 0)) {
|
||||
replaces[item.name] = new_item_name;
|
||||
if (ft.verbose_mode) {
|
||||
ft.trace_fmt("Optimize static item: '{0}'", item.name);
|
||||
}
|
||||
} else {
|
||||
if (ft.verbose_mode) {
|
||||
ft.trace_fmt("NOT Optimize static item: '{0}'", item.name);
|
||||
}
|
||||
}
|
||||
}, function (item) {
|
||||
return ftlib.is_symbol_item(item) && fttim.is_static(item.timeline);
|
||||
});
|
||||
|
||||
ftlib.edit_all_symbol_items(doc, library, function (item) {
|
||||
fttim.replace_baked_symbols(doc, item.timeline, replaces);
|
||||
});
|
||||
fttim.replace_baked_symbols(doc, doc.getTimeline(), replaces);
|
||||
};
|
||||
|
||||
ftlib.bake_symbol_item = function (doc, library, item_name, new_item_name, first_frame) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ft.type_assert(item_name, 'string');
|
||||
ft.type_assert(new_item_name, 'string');
|
||||
ft.type_assert(first_frame, 'number');
|
||||
|
||||
if (library.itemExists(new_item_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var item = ftlib.find_item_by_name(library, item_name);
|
||||
if (!item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var item_frame_area = fttim.calculate_frame_area(item.timeline, first_frame);
|
||||
var item_elems_area = fttim.calculate_elems_area(item.timeline, first_frame);
|
||||
|
||||
if (ft.verbose_mode) {
|
||||
ft.trace_fmt(
|
||||
"Library item: '{0}'\n- frame area: {1}\n- elems area: {2}",
|
||||
item_name, item_frame_area, item_elems_area);
|
||||
}
|
||||
|
||||
if (item_frame_area >= item_elems_area) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!library.addNewItem("graphic", new_item_name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!library.editItem(new_item_name)) {
|
||||
library.deleteItem(new_item_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (library.addItemToDocument({x: 0, y: 0}, item_name)) {
|
||||
var new_item_elem = doc.selection[0];
|
||||
new_item_elem.symbolType = "graphic";
|
||||
new_item_elem.firstFrame = first_frame;
|
||||
new_item_elem.setTransformationPoint({x: 0, y: 0});
|
||||
new_item_elem.transformX = 0;
|
||||
new_item_elem.transformY = 0;
|
||||
ftdoc.convert_selection_to_bitmap(doc, item);
|
||||
return true;
|
||||
} else {
|
||||
doc.exitEditMode();
|
||||
library.deleteItem(new_item_name);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
ftlib.optimize_single_graphics = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ft.array_reverse_foreach(library.items, function (item) {
|
||||
fttim.optimize_single_graphics(doc, item.timeline, item);
|
||||
}, ftlib.is_symbol_item);
|
||||
fttim.optimize_single_graphics(doc, doc.getTimeline(), null);
|
||||
};
|
||||
|
||||
ftlib.rasterize_all_shapes = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ftlib.edit_all_symbol_items(doc, library, function (item) {
|
||||
fttim.rasterize_all_shapes(doc, item.timeline);
|
||||
});
|
||||
};
|
||||
|
||||
ftlib.prepare_all_bitmaps = function (library) {
|
||||
ft.type_assert(library, Library);
|
||||
ft.array_foreach(library.items, function (item) {
|
||||
item.compressionType = "lossless";
|
||||
}, ftlib.is_bitmap_item);
|
||||
};
|
||||
|
||||
//
|
||||
// timeline
|
||||
//
|
||||
|
||||
var fttim = {};
|
||||
|
||||
fttim.is_shape_instance = function (elem) {
|
||||
return elem.elementType == "shape";
|
||||
};
|
||||
|
||||
fttim.is_symbol_instance = function (elem) {
|
||||
return elem.elementType == "instance" && elem.instanceType == "symbol";
|
||||
};
|
||||
|
||||
fttim.is_symbol_graphic_instance = function (elem) {
|
||||
return fttim.is_symbol_instance(elem) && elem.symbolType == "graphic";
|
||||
};
|
||||
|
||||
fttim.is_symbol_graphic_single_frame_instance = function (elem) {
|
||||
return fttim.is_symbol_instance(elem) && elem.symbolType == "graphic" && elem.loop == "single frame";
|
||||
};
|
||||
|
||||
fttim.is_symbol_movie_clip_instance = function (elem) {
|
||||
return fttim.is_symbol_instance(elem) && elem.symbolType == "movie clip";
|
||||
};
|
||||
|
||||
fttim.is_shape_frame = function (frame) {
|
||||
ft.type_assert(frame, Frame);
|
||||
return frame.tweenType == "shape";
|
||||
};
|
||||
|
||||
fttim.is_keyframe = function (frame, frame_index) {
|
||||
ft.type_assert(frame, Frame);
|
||||
ft.type_assert(frame_index, 'number');
|
||||
return frame.startFrame == frame_index;
|
||||
};
|
||||
|
||||
fttim.is_not_guide_layer = function(layer) {
|
||||
ft.type_assert(layer, Layer);
|
||||
return layer.layerType != "guide";
|
||||
};
|
||||
|
||||
fttim.unlock = function (timeline) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
layer.locked = false;
|
||||
layer.visible = true;
|
||||
});
|
||||
};
|
||||
|
||||
fttim.calculate_elems_area = function (timeline, frame_index) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.type_assert(frame_index, 'number');
|
||||
return ft.array_foldl(timeline.layers, function (layer, acc) {
|
||||
if (frame_index >= 0 && frame_index < layer.frames.length) {
|
||||
return ft.array_foldl(layer.frames[frame_index].elements, function (elem, acc2) {
|
||||
return acc2 + Math.round(elem.width) * Math.round(elem.height);
|
||||
}, acc);
|
||||
} else {
|
||||
return acc;
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
||||
fttim.calculate_frame_area = function (timeline, frame_index) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.type_assert(frame_index, 'number');
|
||||
var bounds = ft.array_foldl(timeline.layers, function (layer, acc) {
|
||||
if (frame_index >= 0 && frame_index < layer.frames.length) {
|
||||
return ft.array_foldl(layer.frames[frame_index].elements, function (elem, acc2) {
|
||||
acc2.left = Math.min(acc2.left, elem.left);
|
||||
acc2.right = Math.max(acc2.right, elem.left + elem.width);
|
||||
acc2.top = Math.min(acc2.top, elem.top);
|
||||
acc2.bottom = Math.max(acc2.bottom, elem.top + elem.height);
|
||||
return acc2;
|
||||
}, acc);
|
||||
} else {
|
||||
return acc;
|
||||
}
|
||||
}, {
|
||||
left: Number.POSITIVE_INFINITY,
|
||||
right: Number.NEGATIVE_INFINITY,
|
||||
top: Number.POSITIVE_INFINITY,
|
||||
bottom: Number.NEGATIVE_INFINITY
|
||||
});
|
||||
var frame_width = Math.max(0, bounds.right - bounds.left);
|
||||
var frame_height = Math.max(0, bounds.bottom - bounds.top);
|
||||
return Math.round(frame_width) * Math.round(frame_height);
|
||||
}
|
||||
|
||||
fttim.recursive_scale_filters = function (doc, timeline, scale) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
var elem_filters = elem.filters;
|
||||
if (elem_filters && elem_filters !== undefined) {
|
||||
ft.array_foreach(elem_filters, function (elem_filter, filter_index) {
|
||||
elem_filter.blurX *= scale;
|
||||
elem_filter.blurY *= scale;
|
||||
});
|
||||
elem.filters = elem_filters;
|
||||
}
|
||||
fttim.recursive_scale_filters(doc, elem.libraryItem.timeline, scale);
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.replace_baked_symbols = function (doc, timeline, replaces) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
if (timeline.currentFrame != frame_index) {
|
||||
timeline.currentFrame = frame_index;
|
||||
}
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
if (replaces.hasOwnProperty(elem.libraryItem.name)) {
|
||||
doc.selectNone();
|
||||
doc.selection = [elem];
|
||||
doc.swapElement(replaces[elem.libraryItem.name]);
|
||||
}
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.optimize_single_graphics = function (doc, timeline, opt_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
var lib_item_name = elem.libraryItem.name;
|
||||
var lib_item_cache_name = "ft_cache_name_" + lib_item_name + "_" + elem.firstFrame;
|
||||
if (ftlib.bake_symbol_item(doc, doc.library, lib_item_name, lib_item_cache_name, elem.firstFrame)) {
|
||||
if (ft.verbose_mode) {
|
||||
ft.trace_fmt("Optimize single graphic '{0}' for frame '{1}' in '{2}'",
|
||||
lib_item_name, elem.firstFrame, timeline.name);
|
||||
}
|
||||
if (opt_item == null || doc.library.editItem(opt_item.name)) {
|
||||
if (timeline.currentFrame != frame_index) {
|
||||
timeline.currentFrame = frame_index;
|
||||
}
|
||||
doc.selectNone();
|
||||
doc.selection = [elem];
|
||||
doc.swapElement(lib_item_cache_name);
|
||||
doc.selection[0].firstFrame = 0;
|
||||
doc.exitEditMode();
|
||||
}
|
||||
} else {
|
||||
if (ft.verbose_mode) {
|
||||
ft.trace_fmt("NOT Optimize single graphic '{0}' for frame '{1}' in '{2}'",
|
||||
lib_item_name, elem.firstFrame, timeline.name);
|
||||
}
|
||||
}
|
||||
}, function (elem) {
|
||||
return fttim.is_symbol_graphic_single_frame_instance(elem) && !fttim.is_static(elem.libraryItem.timeline);
|
||||
});
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.is_static = function (timeline) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
if (timeline.frameCount > 1) {
|
||||
return false;
|
||||
}
|
||||
return ft.array_foldl(timeline.layers, function (layer, acc) {
|
||||
return ft.array_foldl(layer.frames, function (frame, acc2) {
|
||||
return ft.array_foldl(frame.elements, function (elem, acc3) {
|
||||
return acc3 && fttim.is_symbol_instance(elem) ? elem.blendMode != "erase" && (fttim.is_symbol_graphic_single_frame_instance(elem) || fttim.is_static(elem.libraryItem.timeline)) : acc3;
|
||||
}, acc2);
|
||||
}, acc);
|
||||
}, true);
|
||||
};
|
||||
|
||||
fttim.rasterize_all_shapes = function (doc, timeline) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
|
||||
ft.array_reverse_foreach(timeline.layers, function (layer, layer_index) {
|
||||
timeline.setSelectedLayers(layer_index);
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
if ( ft.is_function(frame.convertToFrameByFrameAnimation) ) {
|
||||
frame.convertToFrameByFrameAnimation();
|
||||
} else {
|
||||
throw "Animation uses shape tweens. To export this animation you should use Adobe Animate CC or higher!";
|
||||
}
|
||||
}, function (frame, frame_index) {
|
||||
return fttim.is_keyframe(frame, frame_index) && fttim.is_shape_frame(frame);
|
||||
});
|
||||
}, fttim.is_not_guide_layer);
|
||||
|
||||
var any_rasterize = false;
|
||||
ft.array_reverse_foreach(timeline.layers, function (layer, layer_index) {
|
||||
timeline.setSelectedLayers(layer_index);
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
timeline.currentFrame = frame_index;
|
||||
timeline.setSelectedFrames(frame_index, frame_index + 1, true);
|
||||
doc.selectNone();
|
||||
doc.selection = ft.array_filter(frame.elements, fttim.is_shape_instance);
|
||||
if (doc.selection.length > 0) {
|
||||
ftdoc.convert_selection_to_bitmap(doc, timeline.libraryItem);
|
||||
doc.arrange("back");
|
||||
any_rasterize = true;
|
||||
}
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
if (any_rasterize && ft.verbose_mode) {
|
||||
ft.trace_fmt("Rasterize vector shapes in '{0}'", timeline.name);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// main
|
||||
//
|
||||
|
||||
(function () {
|
||||
ft.clear_output();
|
||||
fl.showIdleMessage(false);
|
||||
ft.trace("- Start -");
|
||||
ft.array_foreach(fl.documents, function (doc) {
|
||||
try {
|
||||
ft.trace_fmt("!!!Document!!!: '{0}'", doc.name);
|
||||
ftdoc.prepare(doc);
|
||||
} catch (e) {
|
||||
ft.trace_fmt("!!!Document!!!: '{0}' conversion error: '{1}'", doc.name, e);
|
||||
}
|
||||
});
|
||||
ft.profile_function(function () {
|
||||
ft.array_foreach(fl.documents, function (doc) {
|
||||
if (doc.canRevert()) {
|
||||
fl.revertDocument(doc);
|
||||
}
|
||||
});
|
||||
}, "Revert documents");
|
||||
ft.trace("- Finish -");
|
||||
})();
|
||||
})();
|
||||
var script_dir = fl.scriptURI.replace('FlashExport.jsfl', '');
|
||||
fl.runScript(script_dir + 'Internal/FTBase.jsfl');
|
||||
fl.runScript(script_dir + 'Internal/FTMain.jsfl', "ft_main", ft, {
|
||||
graphics_scale : 1.0
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a1ba4a960de04365b94351f8c3f24d0
|
||||
timeCreated: 1472974636
|
||||
guid: 7646daba632cc4e63997be01363bc478
|
||||
timeCreated: 1495135907
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
|
||||
5
Assets/FlashTools/FlashExport/FlashExport_HD.jsfl
Normal file
@@ -0,0 +1,5 @@
|
||||
var script_dir = fl.scriptURI.replace('FlashExport_HD.jsfl', '');
|
||||
fl.runScript(script_dir + 'Internal/FTBase.jsfl');
|
||||
fl.runScript(script_dir + 'Internal/FTMain.jsfl', "ft_main", ft, {
|
||||
graphics_scale : 2.0
|
||||
});
|
||||
8
Assets/FlashTools/FlashExport/FlashExport_HD.jsfl.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da5312cca96fd439c854e5cea0aa8eb5
|
||||
timeCreated: 1495136101
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5
Assets/FlashTools/FlashExport/FlashExport_SD.jsfl
Normal file
@@ -0,0 +1,5 @@
|
||||
var script_dir = fl.scriptURI.replace('FlashExport_SD.jsfl', '');
|
||||
fl.runScript(script_dir + 'Internal/FTBase.jsfl');
|
||||
fl.runScript(script_dir + 'Internal/FTMain.jsfl', "ft_main", ft, {
|
||||
graphics_scale : 0.5
|
||||
});
|
||||
8
Assets/FlashTools/FlashExport/FlashExport_SD.jsfl.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16e7c78934deb4375b76aebfee58b550
|
||||
timeCreated: 1495136690
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/FlashTools/FlashExport/Internal.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c77692aa8dc1141c6897240794676fd8
|
||||
folderAsset: yes
|
||||
timeCreated: 1495136428
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
238
Assets/FlashTools/FlashExport/Internal/FTBase.jsfl
Normal file
@@ -0,0 +1,238 @@
|
||||
if (!Array.prototype.peek) {
|
||||
Array.prototype.peek = function () {
|
||||
return this[this.length - 1];
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.format) {
|
||||
String.prototype.format = function () {
|
||||
var args = arguments;
|
||||
return this.replace(/{(\d+)}/g, function (match, number) {
|
||||
return typeof args[number] != 'undefined' ? args[number] : match;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
ft = {};
|
||||
|
||||
ft.trace = function () {
|
||||
fl.outputPanel.trace(
|
||||
Array.prototype.join.call(arguments, " "));
|
||||
};
|
||||
|
||||
ft.trace_fmt = function (format) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
ft.trace(format.format.apply(format, args));
|
||||
};
|
||||
|
||||
ft.clear_output = function () {
|
||||
fl.outputPanel.clear();
|
||||
};
|
||||
|
||||
ft.assert = function (expr, format) {
|
||||
if (!expr) {
|
||||
if (format === undefined) {
|
||||
throw "!!!Assert!!!";
|
||||
} else {
|
||||
var args = Array.prototype.slice.call(arguments, 2);
|
||||
throw "!!!Assert!!! " + format.format.apply(format, args);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ft.type_assert = function (item, type) {
|
||||
var type_is_string = (typeof type === 'string');
|
||||
ft.assert(
|
||||
(type_is_string && typeof item === type) ||
|
||||
(!type_is_string && item instanceof type),
|
||||
"Type error: {0} != {1}",
|
||||
typeof item,
|
||||
type_is_string ? type : type.constructor.name);
|
||||
};
|
||||
|
||||
ft.type_assert_if_defined = function (item, type) {
|
||||
if (item && item !== undefined) {
|
||||
ft.type_assert(item, type);
|
||||
}
|
||||
};
|
||||
|
||||
ft.is_function = function (func) {
|
||||
return func && typeof(func) === 'function';
|
||||
};
|
||||
|
||||
ft.profile_function = function (verbose, func, msg) {
|
||||
ft.type_assert(verbose, 'boolean');
|
||||
ft.type_assert(func, Function);
|
||||
ft.type_assert(msg, 'string');
|
||||
if (!ft.profile_function_stack) {
|
||||
ft.profile_function_stack = [];
|
||||
}
|
||||
if (!ft.profile_function_level) {
|
||||
ft.profile_function_level = 0;
|
||||
}
|
||||
var stack_index = ft.profile_function_stack.length;
|
||||
ft.profile_function_stack.push({
|
||||
msg: msg,
|
||||
level: ft.profile_function_level,
|
||||
time: 0
|
||||
});
|
||||
++ft.profile_function_level;
|
||||
var func_time = ft.get_call_function_time(func);
|
||||
--ft.profile_function_level;
|
||||
ft.profile_function_stack[stack_index].time = func_time;
|
||||
if (stack_index === 0) {
|
||||
for (var i = 0; i < ft.profile_function_stack.length; ++i) {
|
||||
var info = ft.profile_function_stack[i];
|
||||
var ident = "-";
|
||||
for (var j = 0; j < info.level; ++j) {
|
||||
ident += "-";
|
||||
}
|
||||
if (verbose) {
|
||||
ft.trace_fmt("{0} [Profile] {1} ({2}s)", ident, info.msg, info.time);
|
||||
}
|
||||
}
|
||||
ft.profile_function_stack = [];
|
||||
}
|
||||
};
|
||||
|
||||
ft.get_call_function_time = function (func) {
|
||||
ft.type_assert(func, Function);
|
||||
var b_time = Date.now();
|
||||
func();
|
||||
var e_time = Date.now();
|
||||
return (e_time - b_time) / 1000;
|
||||
};
|
||||
|
||||
ft.escape_path = function (path) {
|
||||
ft.type_assert(path, 'string');
|
||||
return path.replace(/ /g, '%20');
|
||||
};
|
||||
|
||||
ft.escape_string = function (str) {
|
||||
ft.type_assert(str, 'string');
|
||||
return str
|
||||
.replace(/\&/g, '&')
|
||||
.replace(/\"/g, '"')
|
||||
.replace(/\'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
};
|
||||
|
||||
ft.combine_path = function (lhs, rhs) {
|
||||
ft.type_assert(lhs, 'string');
|
||||
ft.type_assert(rhs, 'string');
|
||||
return ft.escape_path(lhs) + ft.escape_path(rhs);
|
||||
};
|
||||
|
||||
ft.array_any = function (arr, func) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
for (var index = 0; index < arr.length; ++index) {
|
||||
var value = arr[index];
|
||||
if (func(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
ft.array_foldl = function (arr, func, acc) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
for (var index = 0; index < arr.length; ++index) {
|
||||
var value = arr[index];
|
||||
acc = func(value, acc);
|
||||
}
|
||||
return acc;
|
||||
};
|
||||
|
||||
ft.array_foldr = function (arr, func, acc) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
for (var index = arr.length - 1; index >= 0; --index) {
|
||||
var value = arr[index];
|
||||
acc = func(value, acc);
|
||||
}
|
||||
return acc;
|
||||
};
|
||||
|
||||
ft.array_clone = function (arr) {
|
||||
ft.type_assert(arr, Array);
|
||||
return arr.concat();
|
||||
};
|
||||
|
||||
ft.array_filter = function (arr, filter) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(filter, Function);
|
||||
var new_arr = [];
|
||||
for (var index = 0; index < arr.length; ++index) {
|
||||
var value = arr[index];
|
||||
if (filter(value, index)) {
|
||||
new_arr.push(value);
|
||||
}
|
||||
}
|
||||
return new_arr;
|
||||
};
|
||||
|
||||
ft.array_merge = function (arrA, arrB) {
|
||||
ft.type_assert(arrA, Array);
|
||||
ft.type_assert(arrB, Array);
|
||||
return arrA.concat(ft.array_filter(arrB, function (value) {
|
||||
return !ft.array_contains(arrA, value);
|
||||
}));
|
||||
};
|
||||
|
||||
ft.array_contains = function (arr, elem) {
|
||||
ft.type_assert(arr, Array);
|
||||
return arr.indexOf(elem) >= 0;
|
||||
};
|
||||
|
||||
ft.array_foreach = function (arr, func, filter) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
ft.type_assert_if_defined(filter, Function);
|
||||
for (var index = 0; index < arr.length; ++index) {
|
||||
var value = arr[index];
|
||||
if (filter === undefined || filter(value, index)) {
|
||||
func(value, index);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ft.array_group_by = function (arr, func) {
|
||||
return ft.array_foldl(arr, function (value, acc) {
|
||||
if (acc.length > 0 && func(acc.peek().peek()) === func(value)) {
|
||||
acc.peek().push(value);
|
||||
} else {
|
||||
acc.push([value]);
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
};
|
||||
|
||||
ft.array_reverse_foreach = function (arr, func, filter) {
|
||||
ft.type_assert(arr, Array);
|
||||
ft.type_assert(func, Function);
|
||||
ft.type_assert_if_defined(filter, Function);
|
||||
for (var index = arr.length - 1; index >= 0; --index) {
|
||||
var value = arr[index];
|
||||
if (filter === undefined || filter(value, index)) {
|
||||
func(value, index);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ft.approximately = function(a, b, precision) {
|
||||
ft.type_assert(a, 'number');
|
||||
ft.type_assert(b, 'number');
|
||||
ft.type_assert(precision, 'number');
|
||||
return Math.abs(b - a) < Math.abs(precision);
|
||||
};
|
||||
|
||||
ft.gen_unique_name = function () {
|
||||
if (!ft.gen_unique_name_index) {
|
||||
ft.gen_unique_name_index = 0;
|
||||
}
|
||||
++ft.gen_unique_name_index;
|
||||
return "ft_unique_name_" + ft.gen_unique_name_index;
|
||||
};
|
||||
8
Assets/FlashTools/FlashExport/Internal/FTBase.jsfl.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1332fd3507afd4431af5d795f220d01e
|
||||
timeCreated: 1495302866
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
956
Assets/FlashTools/FlashExport/Internal/FTMain.jsfl
Normal file
@@ -0,0 +1,956 @@
|
||||
ft_main = function (external_ft, opts) {
|
||||
ft = external_ft;
|
||||
opts = opts || {};
|
||||
|
||||
//
|
||||
// config
|
||||
//
|
||||
|
||||
var cfg = {
|
||||
profile_mode : opts.profile_mode === undefined ? false : opts.profile_mode,
|
||||
verbose_mode : opts.verbose_mode === undefined ? false : opts.verbose_mode,
|
||||
|
||||
graphics_scale : opts.graphics_scale === undefined ? 1.0 : opts.graphics_scale,
|
||||
scale_precision : opts.scale_precision === undefined ? 0.01 : opts.scale_precision,
|
||||
|
||||
optimize_big_items : opts.optimize_big_items === undefined ? true : opts.optimize_big_items,
|
||||
optimize_small_items : opts.optimize_small_items === undefined ? true : opts.optimize_small_items,
|
||||
optimize_static_items : opts.optimize_static_items === undefined ? true : opts.optimize_static_items,
|
||||
optimize_single_graphics : opts.optimize_single_graphics === undefined ? true : opts.optimize_single_graphics,
|
||||
|
||||
open_documents : opts.open_documents === undefined ? [] : opts.open_documents,
|
||||
export_path_postfix : opts.export_path_postfix === undefined ? "_export" : opts.export_path_postfix,
|
||||
close_after_conversion : opts.close_after_conversion === undefined ? false : opts.close_after_conversion,
|
||||
revert_after_conversion : opts.revert_after_conversion === undefined ? true : opts.revert_after_conversion,
|
||||
max_convertible_selection : opts.max_convertible_selection === undefined ? 3900 : opts.max_convertible_selection
|
||||
};
|
||||
|
||||
//
|
||||
// document
|
||||
//
|
||||
|
||||
var ftdoc = {};
|
||||
|
||||
ftdoc.prepare = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.prepare_folders(doc); }, "Prepare folders");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.full_exit_edit_mode(doc); }, "Full exit edit mode");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.remove_unused_items(doc); }, "Remove unused items");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.prepare_all_bitmaps(doc); }, "Prepare all bitmaps");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.unlock_all_timelines(doc); }, "Unlock all timelines");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.prepare_all_tweens(doc); }, "Prepare all tweens");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.prepare_all_groups(doc); }, "Prepare all groups");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.calculate_item_scales(doc); }, "Calculate item scales");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.optimize_all_timelines(doc); }, "Optimize all timelines");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.rasterize_all_shapes(doc); }, "Rasterize all shapes");
|
||||
ft.profile_function(cfg.profile_mode, function() { ftdoc.export_swf(doc); }, "Export swf");
|
||||
};
|
||||
|
||||
ftdoc.get_temp = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
if (!ftdoc.get_temp_ft_temp) {
|
||||
ftdoc.get_temp_ft_temp = {};
|
||||
}
|
||||
if (!ftdoc.get_temp_ft_temp[doc.pathURI]) {
|
||||
ftdoc.get_temp_ft_temp[doc.pathURI] = {
|
||||
max_scales : {}
|
||||
};
|
||||
}
|
||||
return ftdoc.get_temp_ft_temp[doc.pathURI];
|
||||
};
|
||||
|
||||
ftdoc.calculate_item_prefer_scale = function (doc, optional_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
var final_scale = cfg.graphics_scale;
|
||||
if (optional_item && (cfg.optimize_big_items || cfg.optimize_small_items)) {
|
||||
var item_name = optional_item.name;
|
||||
var max_scales = ftdoc.get_temp(doc).max_scales;
|
||||
if (max_scales && max_scales.hasOwnProperty(item_name)) {
|
||||
var max_scale = max_scales[item_name];
|
||||
var big_item = cfg.optimize_big_items && (max_scale - cfg.scale_precision > 1.0);
|
||||
var small_item = cfg.optimize_small_items && (max_scale + cfg.scale_precision < 1.0);
|
||||
if (big_item || small_item) {
|
||||
final_scale *= max_scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
return final_scale;
|
||||
};
|
||||
|
||||
ftdoc.convert_selection_to_bitmap = function (doc, location_name, optional_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(location_name, 'string');
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
|
||||
var selection_r = doc.getSelectionRect();
|
||||
var selection_w = selection_r.right - selection_r.left;
|
||||
var selection_h = selection_r.bottom - selection_r.top;
|
||||
|
||||
var max_scale = cfg.max_convertible_selection / Math.max(selection_w, selection_h);
|
||||
var prefer_scale = ftdoc.calculate_item_prefer_scale(doc, optional_item);
|
||||
var final_scale = Math.min(prefer_scale, max_scale);
|
||||
|
||||
if (final_scale < prefer_scale) {
|
||||
var down_scale = Math.floor(final_scale / prefer_scale * 1000) * 0.001;
|
||||
ft.trace_fmt(
|
||||
"[Warning] {0}\n" +
|
||||
"- Converted element was downscaled ({1}x) to maximum allowed size ({2}px)",
|
||||
location_name, down_scale, cfg.max_convertible_selection);
|
||||
}
|
||||
|
||||
if (ft.approximately(final_scale, 1.0, cfg.scale_precision)) {
|
||||
(function() {
|
||||
var elem_r = doc.getSelectionRect();
|
||||
|
||||
var elem_x = elem_r.left;
|
||||
var elem_y = elem_r.top;
|
||||
var elem_w = elem_r.right - elem_r.left;
|
||||
var elem_h = elem_r.bottom - elem_r.top;
|
||||
|
||||
var elem_dx = Math.round(elem_x) - elem_x;
|
||||
var elem_dy = Math.round(elem_y) - elem_y;
|
||||
var elem_dw = Math.round(elem_w) - elem_w;
|
||||
var elem_dh = Math.round(elem_h) - elem_h;
|
||||
|
||||
doc.convertSelectionToBitmap();
|
||||
var elem = doc.selection[0];
|
||||
|
||||
elem.x -= elem_dx;
|
||||
elem.y -= elem_dy;
|
||||
elem.width -= elem_dw;
|
||||
elem.height -= elem_dh;
|
||||
})();
|
||||
} else {
|
||||
(function() {
|
||||
var wrapper_item_name = ft.gen_unique_name();
|
||||
var wrapper_item = doc.convertToSymbol("graphic", wrapper_item_name , "top left");
|
||||
fttim.recursive_scale_filters(doc, wrapper_item, final_scale);
|
||||
|
||||
var elem = doc.selection[0];
|
||||
elem.setTransformationPoint({x: 0, y: 0});
|
||||
doc.scaleSelection(final_scale, final_scale);
|
||||
|
||||
var elem_x = elem.x;
|
||||
var elem_y = elem.y;
|
||||
var elem_w = elem.width;
|
||||
var elem_h = elem.height;
|
||||
|
||||
var elem_dx = Math.round(elem_x) - elem_x;
|
||||
var elem_dy = Math.round(elem_y) - elem_y;
|
||||
var elem_dw = Math.round(elem_w) - elem_w;
|
||||
var elem_dh = Math.round(elem_h) - elem_h;
|
||||
|
||||
doc.convertSelectionToBitmap();
|
||||
elem = doc.selection[0];
|
||||
|
||||
elem.x -= elem_dx;
|
||||
elem.y -= elem_dy;
|
||||
elem.width -= elem_dw;
|
||||
elem.height -= elem_dh;
|
||||
|
||||
elem.setTransformationPoint({x: (elem_x - elem.x), y: (elem_y - elem.y)});
|
||||
doc.scaleSelection(1.0 / final_scale, 1.0 / final_scale);
|
||||
|
||||
fttim.recursive_scale_filters(doc, wrapper_item, 1.0 / final_scale);
|
||||
})();
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.prepare_folders = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
var export_folder = ftdoc.get_export_folder(doc);
|
||||
if (!FLfile.exists(export_folder) && !FLfile.createFolder(export_folder)) {
|
||||
throw "Can't create document export folder ({0})!"
|
||||
.format(export_folder);
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.get_export_folder = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
return ft.combine_path(
|
||||
ft.escape_path(doc.pathURI),
|
||||
cfg.export_path_postfix + "/");
|
||||
};
|
||||
|
||||
ftdoc.full_exit_edit_mode = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
doc.exitEditMode();
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.remove_unused_items = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
var unused_items = doc.library.unusedItems;
|
||||
if (unused_items && unused_items !== undefined) {
|
||||
ft.array_reverse_foreach(unused_items, function(item) {
|
||||
if (cfg.verbose_mode) {
|
||||
ft.trace_fmt("Remove unused item: {0}", item.name);
|
||||
}
|
||||
doc.library.deleteItem(item.name);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.prepare_all_bitmaps = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ftlib.prepare_all_bitmaps(doc.library);
|
||||
};
|
||||
|
||||
ftdoc.unlock_all_timelines = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ftlib.unlock_all_timelines(doc, doc.library);
|
||||
fttim.unlock_all_layers(doc, doc.getTimeline());
|
||||
};
|
||||
|
||||
ftdoc.prepare_all_tweens = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ftlib.prepare_all_tweens(doc, doc.library);
|
||||
fttim.prepare_all_tweens(doc, doc.getTimeline());
|
||||
};
|
||||
|
||||
ftdoc.prepare_all_groups = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
var arr1 = ftlib.prepare_all_groups(doc, doc.library);
|
||||
var arr2 = fttim.prepare_all_groups(doc, doc.getTimeline());
|
||||
var new_symbols = arr1.concat(arr2);
|
||||
var process_item = function (item) {
|
||||
if (doc.library.editItem(item.name)) {
|
||||
var arr3 = fttim.prepare_all_groups(doc, item.timeline);
|
||||
new_symbols = new_symbols.concat(arr3);
|
||||
doc.exitEditMode();
|
||||
}
|
||||
};
|
||||
while (new_symbols.length > 0) {
|
||||
var new_symbols_copy = ft.array_clone(new_symbols);
|
||||
new_symbols = [];
|
||||
ft.array_foreach(new_symbols_copy, process_item);
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.calculate_item_scales = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
|
||||
var max_scales = {};
|
||||
|
||||
var walk_by_timeline = function(timeline, func, acc) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.type_assert(func, Function);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
walk_by_timeline(
|
||||
elem.libraryItem.timeline,
|
||||
func,
|
||||
func(elem, acc));
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
});
|
||||
};
|
||||
|
||||
var walk_by_library = function(lib, func, acc) {
|
||||
ft.type_assert(lib, Library);
|
||||
ft.type_assert(func, Function);
|
||||
ft.array_foreach(lib.items, function (item) {
|
||||
walk_by_timeline(item.timeline, func, acc);
|
||||
}, ftlib.is_symbol_item);
|
||||
};
|
||||
|
||||
var x_func = function(elem, acc) {
|
||||
var elem_sx = elem.scaleX * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
max_scales[item_name] = Math.max(
|
||||
max_scales.hasOwnProperty(item_name) ? max_scales[item_name] : elem_sx,
|
||||
elem_sx);
|
||||
return elem_sx;
|
||||
};
|
||||
|
||||
var y_func = function(elem, acc) {
|
||||
var elem_sy = elem.scaleY * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
max_scales[item_name] = Math.max(
|
||||
max_scales.hasOwnProperty(item_name) ? max_scales[item_name] : elem_sy,
|
||||
elem_sy);
|
||||
return elem_sy;
|
||||
};
|
||||
|
||||
walk_by_library(doc.library, x_func, 1.0);
|
||||
walk_by_timeline(doc.getTimeline(), x_func, 1.0);
|
||||
|
||||
walk_by_library(doc.library, y_func, 1.0);
|
||||
walk_by_timeline(doc.getTimeline(), y_func, 1.0);
|
||||
|
||||
ftdoc.get_temp(doc).max_scales = max_scales;
|
||||
|
||||
if (cfg.verbose_mode) {
|
||||
for (var item_name in max_scales) {
|
||||
var max_scale = max_scales.hasOwnProperty(item_name) ? max_scales[item_name] : 1.0;
|
||||
if (max_scale - cfg.scale_precision > 1.0) {
|
||||
ft.trace_fmt("Big item for optimize: {0} - {1}", item_name, max_scale);
|
||||
} else if (max_scale + cfg.scale_precision < 1.0) {
|
||||
ft.trace_fmt("Small item for optimize: {0} - {1}", item_name, max_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.optimize_all_timelines = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
if (cfg.optimize_static_items) {
|
||||
ft.profile_function(cfg.profile_mode, function () {
|
||||
ftlib.optimize_static_items(doc, doc.library);
|
||||
}, "Optimize static items");
|
||||
}
|
||||
if (cfg.optimize_single_graphics) {
|
||||
ft.profile_function(cfg.profile_mode, function () {
|
||||
ftlib.optimize_single_graphics(doc, doc.library);
|
||||
}, "Optimize single graphics");
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.rasterize_all_shapes = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
ftlib.rasterize_all_shapes(doc, doc.library);
|
||||
fttim.rasterize_all_shapes(doc, doc.getTimeline());
|
||||
};
|
||||
|
||||
ftdoc.export_swf = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
doc.exportSWF(ftdoc.get_export_swf_path(doc));
|
||||
};
|
||||
|
||||
ftdoc.get_export_swf_path = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
return ft.combine_path(
|
||||
ftdoc.get_export_folder(doc),
|
||||
doc.name + ".swf");
|
||||
};
|
||||
|
||||
//
|
||||
// library
|
||||
//
|
||||
|
||||
var ftlib = {};
|
||||
|
||||
ftlib.is_folder_item = function (item) {
|
||||
ft.type_assert(item, LibraryItem);
|
||||
return item.itemType == "folder";
|
||||
};
|
||||
|
||||
ftlib.is_bitmap_item = function (item) {
|
||||
ft.type_assert(item, LibraryItem);
|
||||
return item.itemType == "bitmap";
|
||||
};
|
||||
|
||||
ftlib.is_symbol_item = function (item) {
|
||||
ft.type_assert(item, LibraryItem);
|
||||
return item.itemType == "graphic" || item.itemType == "movie clip";
|
||||
};
|
||||
|
||||
ftlib.find_item_by_name = function (library, item_name) {
|
||||
ft.type_assert(library, Library);
|
||||
ft.type_assert(item_name, 'string');
|
||||
for (var i = 0; i < library.items.length; ++i) {
|
||||
var item = library.items[i];
|
||||
if (item.name == item_name) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
ftlib.edit_all_items = function (doc, library, func, filter) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ft.type_assert(func, Function);
|
||||
ft.type_assert_if_defined(filter, Function);
|
||||
ft.array_foreach(library.items, function (item) {
|
||||
if (library.editItem(item.name)) {
|
||||
func(item);
|
||||
doc.exitEditMode();
|
||||
}
|
||||
}, filter);
|
||||
};
|
||||
|
||||
ftlib.edit_all_symbol_items = function (doc, library, func) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ft.type_assert(func, Function);
|
||||
ftlib.edit_all_items(doc, library, func, ftlib.is_symbol_item);
|
||||
};
|
||||
|
||||
ftlib.prepare_all_bitmaps = function (library) {
|
||||
ft.type_assert(library, Library);
|
||||
ft.array_foreach(library.items, function (item) {
|
||||
item.compressionType = "lossless";
|
||||
}, ftlib.is_bitmap_item);
|
||||
};
|
||||
|
||||
ftlib.unlock_all_timelines = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ftlib.edit_all_symbol_items(doc, library, function (item) {
|
||||
fttim.unlock_all_layers(doc, item.timeline);
|
||||
});
|
||||
};
|
||||
|
||||
ftlib.optimize_static_items = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
|
||||
var replaces = {};
|
||||
ft.array_reverse_foreach(library.items, function (item) {
|
||||
var new_item_name = ft.gen_unique_name();
|
||||
if (ftlib.bake_symbol_item(doc, library, item.name, new_item_name, 0)) {
|
||||
replaces[item.name] = new_item_name;
|
||||
if (cfg.verbose_mode) {
|
||||
ft.trace_fmt("Optimize static item: '{0}'", item.name);
|
||||
}
|
||||
} else {
|
||||
if (cfg.verbose_mode) {
|
||||
ft.trace_fmt("NOT Optimize static item: '{0}'", item.name);
|
||||
}
|
||||
}
|
||||
}, function (item) {
|
||||
return ftlib.is_symbol_item(item) && fttim.is_static(item.timeline);
|
||||
});
|
||||
|
||||
ftlib.edit_all_symbol_items(doc, library, function (item) {
|
||||
fttim.replace_baked_symbols(doc, item.timeline, replaces);
|
||||
});
|
||||
fttim.replace_baked_symbols(doc, doc.getTimeline(), replaces);
|
||||
};
|
||||
|
||||
ftlib.bake_symbol_item = function (doc, library, item_name, new_item_name, first_frame) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ft.type_assert(item_name, 'string');
|
||||
ft.type_assert(new_item_name, 'string');
|
||||
ft.type_assert(first_frame, 'number');
|
||||
|
||||
if (library.itemExists(new_item_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var item = ftlib.find_item_by_name(library, item_name);
|
||||
if (!item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var item_frame_area = fttim.calculate_frame_area(item.timeline, first_frame);
|
||||
var item_elems_area = fttim.calculate_elems_area(item.timeline, first_frame);
|
||||
|
||||
if (cfg.verbose_mode) {
|
||||
ft.trace_fmt(
|
||||
"Library item: '{0}'\n- frame area: {1}\n- elems area: {2}",
|
||||
item_name, item_frame_area, item_elems_area);
|
||||
}
|
||||
|
||||
if (item_frame_area >= item_elems_area) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!library.addNewItem("graphic", new_item_name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!library.editItem(new_item_name)) {
|
||||
library.deleteItem(new_item_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (library.addItemToDocument({x: 0, y: 0}, item_name)) {
|
||||
var new_item_elem = doc.selection[0];
|
||||
new_item_elem.symbolType = "graphic";
|
||||
new_item_elem.firstFrame = first_frame;
|
||||
new_item_elem.setTransformationPoint({x: 0, y: 0});
|
||||
new_item_elem.transformX = 0;
|
||||
new_item_elem.transformY = 0;
|
||||
var location_name = "Symbol: {0}".format(item_name);
|
||||
ftdoc.convert_selection_to_bitmap(doc, location_name, item);
|
||||
doc.exitEditMode();
|
||||
return true;
|
||||
} else {
|
||||
doc.exitEditMode();
|
||||
library.deleteItem(new_item_name);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
ftlib.optimize_single_graphics = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ft.array_reverse_foreach(library.items, function (item) {
|
||||
fttim.optimize_single_graphics(doc, item.timeline, item);
|
||||
}, ftlib.is_symbol_item);
|
||||
fttim.optimize_single_graphics(doc, doc.getTimeline(), null);
|
||||
};
|
||||
|
||||
ftlib.rasterize_all_shapes = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ftlib.edit_all_symbol_items(doc, library, function (item) {
|
||||
fttim.rasterize_all_shapes(doc, item.timeline);
|
||||
});
|
||||
};
|
||||
|
||||
ftlib.prepare_all_tweens = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
ftlib.edit_all_symbol_items(doc, library, function (item) {
|
||||
fttim.prepare_all_tweens(doc, item.timeline);
|
||||
});
|
||||
};
|
||||
|
||||
ftlib.prepare_all_groups = function (doc, library) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
var new_symbols = [];
|
||||
ftlib.edit_all_symbol_items(doc, library, function (item) {
|
||||
var arr = fttim.prepare_all_groups(doc, item.timeline);
|
||||
new_symbols = new_symbols.concat(arr);
|
||||
});
|
||||
return new_symbols;
|
||||
};
|
||||
|
||||
//
|
||||
// timeline
|
||||
//
|
||||
|
||||
var fttim = {};
|
||||
|
||||
fttim.is_element_locked = function (elem) {
|
||||
return elem.locked;
|
||||
};
|
||||
|
||||
fttim.is_shape_element = function (elem) {
|
||||
return elem.elementType == "shape";
|
||||
};
|
||||
|
||||
fttim.is_group_shape_element = function (elem) {
|
||||
return fttim.is_shape_element(elem) && elem.isGroup;
|
||||
};
|
||||
|
||||
fttim.is_object_shape_element = function (elem) {
|
||||
return fttim.is_shape_element(elem) && elem.isDrawingObject;
|
||||
};
|
||||
|
||||
fttim.is_simple_shape_element = function (elem) {
|
||||
return fttim.is_shape_element(elem) && !elem.isGroup && !elem.isDrawingObject;
|
||||
};
|
||||
|
||||
fttim.is_complex_shape_element = function (elem) {
|
||||
return fttim.is_shape_element(elem) && (elem.isGroup || elem.isDrawingObject);
|
||||
};
|
||||
|
||||
fttim.is_instance_element = function (elem) {
|
||||
return elem.elementType == "instance";
|
||||
};
|
||||
|
||||
fttim.is_bitmap_instance = function (elem) {
|
||||
return fttim.is_instance_element(elem) && elem.instanceType == "bitmap";
|
||||
};
|
||||
|
||||
fttim.is_symbol_instance = function (elem) {
|
||||
return fttim.is_instance_element(elem) && elem.instanceType == "symbol";
|
||||
};
|
||||
|
||||
fttim.is_symbol_graphic_instance = function (elem) {
|
||||
return fttim.is_symbol_instance(elem) && elem.symbolType == "graphic";
|
||||
};
|
||||
|
||||
fttim.is_symbol_graphic_single_frame_instance = function (elem) {
|
||||
return fttim.is_symbol_instance(elem) && elem.symbolType == "graphic" && elem.loop == "single frame";
|
||||
};
|
||||
|
||||
fttim.is_symbol_movie_clip_instance = function (elem) {
|
||||
return fttim.is_symbol_instance(elem) && elem.symbolType == "movie clip";
|
||||
};
|
||||
|
||||
fttim.is_tween_frame = function (frame) {
|
||||
ft.type_assert(frame, Frame);
|
||||
return frame.tweenType != "none";
|
||||
};
|
||||
|
||||
fttim.is_shape_tween_frame = function (frame) {
|
||||
ft.type_assert(frame, Frame);
|
||||
return frame.tweenType == "shape";
|
||||
};
|
||||
|
||||
fttim.is_motion_tween_frame = function (frame) {
|
||||
ft.type_assert(frame, Frame);
|
||||
return frame.tweenType == "motion";
|
||||
};
|
||||
|
||||
fttim.is_keyframe = function (frame, frame_index) {
|
||||
ft.type_assert(frame, Frame);
|
||||
ft.type_assert(frame_index, 'number');
|
||||
return frame.startFrame == frame_index;
|
||||
};
|
||||
|
||||
fttim.is_not_guide_layer = function(layer) {
|
||||
ft.type_assert(layer, Layer);
|
||||
return layer.layerType != "guide";
|
||||
};
|
||||
|
||||
fttim.unlock_all_layers = function (doc, timeline) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer, layer_index) {
|
||||
layer.locked = false;
|
||||
layer.visible = true;
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
var has_locked = ft.array_any(frame.elements, fttim.is_element_locked);
|
||||
if (has_locked) {
|
||||
timeline.currentFrame = frame_index;
|
||||
try {
|
||||
doc.unlockAllElements();
|
||||
} catch (e) {}
|
||||
}
|
||||
}, fttim.is_keyframe);
|
||||
});
|
||||
};
|
||||
|
||||
fttim.calculate_elems_area = function (timeline, frame_index) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.type_assert(frame_index, 'number');
|
||||
return ft.array_foldl(timeline.layers, function (layer, acc) {
|
||||
if (frame_index >= 0 && frame_index < layer.frames.length) {
|
||||
return ft.array_foldl(layer.frames[frame_index].elements, function (elem, acc2) {
|
||||
return acc2 + Math.round(elem.width) * Math.round(elem.height);
|
||||
}, acc);
|
||||
} else {
|
||||
return acc;
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
||||
fttim.calculate_frame_area = function (timeline, frame_index) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.type_assert(frame_index, 'number');
|
||||
var bounds = ft.array_foldl(timeline.layers, function (layer, acc) {
|
||||
if (frame_index >= 0 && frame_index < layer.frames.length) {
|
||||
return ft.array_foldl(layer.frames[frame_index].elements, function (elem, acc2) {
|
||||
acc2.left = Math.min(acc2.left, elem.left);
|
||||
acc2.right = Math.max(acc2.right, elem.left + elem.width);
|
||||
acc2.top = Math.min(acc2.top, elem.top);
|
||||
acc2.bottom = Math.max(acc2.bottom, elem.top + elem.height);
|
||||
return acc2;
|
||||
}, acc);
|
||||
} else {
|
||||
return acc;
|
||||
}
|
||||
}, {
|
||||
left: Number.POSITIVE_INFINITY,
|
||||
right: Number.NEGATIVE_INFINITY,
|
||||
top: Number.POSITIVE_INFINITY,
|
||||
bottom: Number.NEGATIVE_INFINITY
|
||||
});
|
||||
var frame_width = Math.max(0, bounds.right - bounds.left);
|
||||
var frame_height = Math.max(0, bounds.bottom - bounds.top);
|
||||
return Math.round(frame_width) * Math.round(frame_height);
|
||||
};
|
||||
|
||||
fttim.scale_elem_filters = function (elem, scale) {
|
||||
if (fttim.is_symbol_instance(elem)) {
|
||||
var elem_filters = elem.filters;
|
||||
if (elem_filters && elem_filters !== undefined) {
|
||||
ft.array_foreach(elem_filters, function (elem_filter, filter_index) {
|
||||
elem_filter.blurX *= scale;
|
||||
elem_filter.blurY *= scale;
|
||||
});
|
||||
elem.filters = elem_filters;
|
||||
}
|
||||
}
|
||||
if (fttim.is_group_shape_element(elem)) {
|
||||
ft.array_foreach(elem.members, function(member) {
|
||||
fttim.scale_elem_filters(member, scale);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
fttim.recursive_scale_filters = function (doc, item, scale, optional_scaled_items) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(item, LibraryItem);
|
||||
ft.type_assert(scale, 'number');
|
||||
ft.type_assert_if_defined(optional_scaled_items, Array);
|
||||
|
||||
var scaled_items = optional_scaled_items || [];
|
||||
if (ft.array_contains(scaled_items, item)) {
|
||||
return;
|
||||
} else {
|
||||
scaled_items.push(item);
|
||||
}
|
||||
|
||||
ft.array_foreach(item.timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
fttim.scale_elem_filters(elem, scale);
|
||||
if (fttim.is_group_shape_element(elem)) {
|
||||
ft.array_foreach(elem.members, function(member) {
|
||||
fttim.recursive_scale_filters(doc, member.libraryItem, scale, scaled_items);
|
||||
}, fttim.is_symbol_instance);
|
||||
}
|
||||
if (fttim.is_symbol_instance(elem)) {
|
||||
fttim.recursive_scale_filters(doc, elem.libraryItem, scale, scaled_items);
|
||||
}
|
||||
});
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.replace_baked_symbols = function (doc, timeline, replaces) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
timeline.currentFrame = frame_index;
|
||||
doc.selectNone();
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
if (replaces.hasOwnProperty(elem.libraryItem.name)) {
|
||||
doc.selectNone();
|
||||
doc.selection = [elem];
|
||||
doc.swapElement(replaces[elem.libraryItem.name]);
|
||||
}
|
||||
}, fttim.is_symbol_instance);
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.optimize_single_graphics = function (doc, timeline, opt_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
ft.array_foreach(timeline.layers, function (layer) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
ft.array_foreach(frame.elements, function (elem) {
|
||||
var lib_item_name = elem.libraryItem.name;
|
||||
var lib_item_cache_name = "ft_cache_name_" + lib_item_name + "_" + elem.firstFrame;
|
||||
if (ftlib.bake_symbol_item(doc, doc.library, lib_item_name, lib_item_cache_name, elem.firstFrame)) {
|
||||
if (cfg.verbose_mode) {
|
||||
ft.trace_fmt("Optimize single graphic '{0}' for frame '{1}' in '{2}'",
|
||||
lib_item_name, elem.firstFrame, timeline.name);
|
||||
}
|
||||
if (opt_item === null || doc.library.editItem(opt_item.name)) {
|
||||
if (timeline.currentFrame != frame_index) {
|
||||
timeline.currentFrame = frame_index;
|
||||
}
|
||||
doc.selectNone();
|
||||
doc.selection = [elem];
|
||||
doc.swapElement(lib_item_cache_name);
|
||||
doc.selection[0].firstFrame = 0;
|
||||
doc.exitEditMode();
|
||||
}
|
||||
} else {
|
||||
if (cfg.verbose_mode) {
|
||||
ft.trace_fmt("NOT Optimize single graphic '{0}' for frame '{1}' in '{2}'",
|
||||
lib_item_name, elem.firstFrame, timeline.name);
|
||||
}
|
||||
}
|
||||
}, function (elem) {
|
||||
return fttim.is_symbol_graphic_single_frame_instance(elem) && !fttim.is_static(elem.libraryItem.timeline);
|
||||
});
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.is_static = function (timeline) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
if (timeline.frameCount > 1) {
|
||||
return false;
|
||||
}
|
||||
return ft.array_foldl(timeline.layers, function (layer, acc) {
|
||||
return ft.array_foldl(layer.frames, function (frame, acc2) {
|
||||
return ft.array_foldl(frame.elements, function (elem, acc3) {
|
||||
return acc3 && fttim.is_symbol_instance(elem) ? elem.blendMode != "erase" && (fttim.is_symbol_graphic_single_frame_instance(elem) || fttim.is_static(elem.libraryItem.timeline)) : acc3;
|
||||
}, acc2);
|
||||
}, acc);
|
||||
}, true);
|
||||
};
|
||||
|
||||
fttim.prepare_all_tweens = function (doc, timeline) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
|
||||
var is_end_of_tween = function(frame_index, frames) {
|
||||
while (--frame_index >= 0) {
|
||||
var frame = frames[frame_index];
|
||||
if (fttim.is_keyframe(frame, frame_index)) {
|
||||
return fttim.is_motion_tween_frame(frame) && frame.duration > 1;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
ft.array_reverse_foreach(timeline.layers, function (layer, layer_index) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
if (fttim.is_shape_tween_frame(frame)) {
|
||||
if (ft.is_function(frame.convertToFrameByFrameAnimation)) {
|
||||
ft.trace_fmt(
|
||||
"[Warning] Timeline: '{0}' Layer: '{1}' Frame: {2}\n" +
|
||||
"- Shape tween strongly not recommended because it rasterized to frame-by-frame bitmap sequence.",
|
||||
timeline.name, layer.name, frame_index + 1);
|
||||
frame.convertToFrameByFrameAnimation();
|
||||
} else {
|
||||
throw "Animation uses shape tweens. To export this animation you should use Adobe Animate CC or higher!";
|
||||
}
|
||||
} else if (fttim.is_motion_tween_frame(frame) || is_end_of_tween(frame_index, layer.frames)) {
|
||||
var has_shapes = ft.array_any(frame.elements, fttim.is_shape_element);
|
||||
if (has_shapes || frame.elements.length > 1) {
|
||||
ft.trace_fmt(
|
||||
"[Warning] Timeline: '{0}' Layer: '{1}' Frame: {2}\n" +
|
||||
"- Frame contains incorrect objects for motion tween.",
|
||||
timeline.name, layer.name, frame_index + 1);
|
||||
timeline.currentFrame = frame_index;
|
||||
doc.selectNone();
|
||||
doc.selection = frame.elements;
|
||||
doc.convertToSymbol("graphic", ft.gen_unique_name(), "top left");
|
||||
}
|
||||
}
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
};
|
||||
|
||||
fttim.prepare_all_groups = function (doc, timeline) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
|
||||
var check_need_for_ungroup = function (frame, elem) {
|
||||
if (fttim.is_tween_frame(frame)) {
|
||||
return true;
|
||||
}
|
||||
if (fttim.is_group_shape_element(elem)) {
|
||||
return ft.array_any(elem.members, function (member) {
|
||||
if (fttim.is_instance_element(member)) {
|
||||
return true;
|
||||
}
|
||||
return check_need_for_ungroup(frame, member);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var new_symbols = [];
|
||||
ft.array_reverse_foreach(timeline.layers, function (layer, layer_index) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
var has_complex_shapes = ft.array_any(frame.elements, fttim.is_complex_shape_element);
|
||||
if (has_complex_shapes) {
|
||||
timeline.currentFrame = frame_index;
|
||||
doc.selectNone();
|
||||
|
||||
var elements = ft.array_clone(frame.elements);
|
||||
ft.array_foreach(elements, function (elem, elem_index) {
|
||||
if (fttim.is_simple_shape_element(elem)) {
|
||||
// nothing
|
||||
} else if (fttim.is_complex_shape_element(elem) && check_need_for_ungroup(frame, elem)) {
|
||||
doc.selectNone();
|
||||
doc.selection = [elem];
|
||||
if (fttim.is_object_shape_element(elem)) {
|
||||
doc.breakApart();
|
||||
doc.group();
|
||||
}
|
||||
doc.unGroup();
|
||||
try {
|
||||
doc.unlockAllElements();
|
||||
} catch (e) {}
|
||||
var wrapper_item = doc.convertToSymbol("graphic", ft.gen_unique_name(), "top left");
|
||||
new_symbols.push(wrapper_item);
|
||||
} else {
|
||||
doc.selectNone();
|
||||
doc.selection = [elem];
|
||||
doc.arrange("front");
|
||||
}
|
||||
});
|
||||
}
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
return new_symbols;
|
||||
};
|
||||
|
||||
fttim.rasterize_all_shapes = function (doc, timeline) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(timeline, Timeline);
|
||||
|
||||
var rasterize_count = 0;
|
||||
ft.array_reverse_foreach(timeline.layers, function (layer, layer_index) {
|
||||
ft.array_foreach(layer.frames, function (frame, frame_index) {
|
||||
var has_shapes = ft.array_any(frame.elements, fttim.is_shape_element);
|
||||
if (has_shapes) {
|
||||
timeline.currentFrame = frame_index;
|
||||
doc.selectNone();
|
||||
var groups_arr = ft.array_group_by(frame.elements, fttim.is_shape_element);
|
||||
for (var i = 0; i < groups_arr.length; ++i) {
|
||||
var groups = groups_arr[i];
|
||||
if (fttim.is_shape_element(groups.peek())) {
|
||||
doc.selectNone();
|
||||
doc.selection = groups;
|
||||
var location_name = "Timeline: {0}".format(timeline.name);
|
||||
ftdoc.convert_selection_to_bitmap(doc, location_name, timeline.libraryItem);
|
||||
++rasterize_count;
|
||||
} else {
|
||||
doc.selectNone();
|
||||
doc.selection = groups;
|
||||
doc.arrange("front");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, fttim.is_keyframe);
|
||||
}, fttim.is_not_guide_layer);
|
||||
|
||||
if (rasterize_count > 0 && cfg.verbose_mode) {
|
||||
ft.trace_fmt("Rasterize vector shapes({0}) in '{1}'", rasterize_count, timeline.name);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// run
|
||||
//
|
||||
|
||||
(function () {
|
||||
ft.clear_output();
|
||||
fl.showIdleMessage(false);
|
||||
ft.trace("[Start]");
|
||||
|
||||
if (cfg.open_documents.length > 0) {
|
||||
ft.profile_function(cfg.profile_mode, function () {
|
||||
ft.array_foreach(cfg.open_documents, function (uri) {
|
||||
fl.openDocument(uri);
|
||||
});
|
||||
}, "Open documents");
|
||||
}
|
||||
|
||||
ft.profile_function(cfg.profile_mode, function() {
|
||||
ft.array_foreach(fl.documents, function (doc) {
|
||||
ft.profile_function(cfg.profile_mode, function() {
|
||||
try {
|
||||
ft.trace_fmt("[Document] '{0}' conversion started...", doc.name);
|
||||
ftdoc.prepare(doc);
|
||||
ft.trace_fmt("[Document] '{0}' conversion complete!", doc.name);
|
||||
} catch (e) {
|
||||
ft.trace_fmt("[Document] '{0}' conversion error: '{1}'", doc.name, e);
|
||||
}
|
||||
}, "Prepare document: '{0}'".format(doc.name));
|
||||
});
|
||||
}, "Prepare documents");
|
||||
|
||||
if (cfg.revert_after_conversion) {
|
||||
ft.profile_function(cfg.profile_mode, function () {
|
||||
ft.array_foreach(fl.documents, function (doc) {
|
||||
if (doc.canRevert()) {
|
||||
fl.revertDocument(doc);
|
||||
}
|
||||
});
|
||||
}, "Revert documents");
|
||||
}
|
||||
|
||||
if (cfg.close_after_conversion) {
|
||||
ft.profile_function(cfg.profile_mode, function () {
|
||||
ft.array_foreach(fl.documents, function (doc) {
|
||||
fl.closeDocument(doc, false);
|
||||
});
|
||||
}, "Close documents");
|
||||
}
|
||||
|
||||
ft.trace("[Finish]");
|
||||
})();
|
||||
};
|
||||
8
Assets/FlashTools/FlashExport/Internal/FTMain.jsfl.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3dd0d0b9e23846999d958ecbe82e112
|
||||
timeCreated: 1495142673
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -135,37 +135,28 @@ inline swf_mask_v2f_t swf_mask_vert(swf_mask_appdata_t IN) {
|
||||
|
||||
inline fixed4 swf_frag(swf_v2f_t IN) : SV_Target {
|
||||
fixed4 c = tex2D(_MainTex, IN.uv);
|
||||
if ( _ExternalAlpha ) {
|
||||
c.a *= tex2D(_AlphaTex, IN.uv).r;
|
||||
}
|
||||
if ( c.a > 0.01 ) {
|
||||
c = c * IN.mulcolor + IN.addcolor;
|
||||
}
|
||||
fixed4 a = tex2D(_AlphaTex, IN.uv).r;
|
||||
c.a = lerp(c.a, a.r, _ExternalAlpha);
|
||||
c = c * IN.mulcolor + step(0.01, c.a) * IN.addcolor;
|
||||
c.rgb *= c.a;
|
||||
return c;
|
||||
}
|
||||
|
||||
inline fixed4 swf_grab_frag(swf_grab_v2f_t IN) : SV_Target {
|
||||
fixed4 c = tex2D(_MainTex, IN.uv);
|
||||
if ( _ExternalAlpha ) {
|
||||
c.a *= tex2D(_AlphaTex, IN.uv).r;
|
||||
}
|
||||
if ( c.a > 0.01 ) {
|
||||
c = c * IN.mulcolor + IN.addcolor;
|
||||
c = grab_blend(_GrabTexture, IN.screenpos, c);
|
||||
}
|
||||
fixed4 a = tex2D(_AlphaTex, IN.uv).r;
|
||||
c.a = lerp(c.a, a.r, _ExternalAlpha);
|
||||
c = c * IN.mulcolor + step(0.01, c.a) * IN.addcolor;
|
||||
c = grab_blend(_GrabTexture, IN.screenpos, c);
|
||||
c.rgb *= c.a;
|
||||
return c;
|
||||
}
|
||||
|
||||
inline fixed4 swf_mask_frag(swf_mask_v2f_t IN) : SV_Target {
|
||||
fixed4 c = tex2D(_MainTex, IN.uv);
|
||||
if ( _ExternalAlpha ) {
|
||||
c.a *= tex2D(_AlphaTex, IN.uv).r;
|
||||
}
|
||||
if ( c.a < 0.01 ) {
|
||||
discard;
|
||||
}
|
||||
fixed4 a = tex2D(_AlphaTex, IN.uv).r;
|
||||
c.a = lerp(c.a, a.r, _ExternalAlpha);
|
||||
clip(c.a - 0.01);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@ MonoBehaviour:
|
||||
m_Name: SwfSettings
|
||||
m_EditorClassIdentifier:
|
||||
Settings:
|
||||
MaxAtlasSize: 1024
|
||||
MaxAtlasSize: 2048
|
||||
AtlasPadding: 1
|
||||
PixelsPerUnit: 100
|
||||
GenerateMipMaps: 0
|
||||
AtlasPowerOfTwo: 1
|
||||
AtlasForceSquare: 1
|
||||
AtlasTextureFilter: 1
|
||||
AtlasTextureFormat: 0
|
||||
AtlasTextureFormat: 2
|
||||
|
||||
@@ -42,7 +42,11 @@ namespace FTEditor.Editors {
|
||||
}
|
||||
|
||||
static void ReconvertAsset(SwfAsset asset) {
|
||||
asset.Atlas = null;
|
||||
if ( asset.Atlas ) {
|
||||
AssetDatabase.DeleteAsset(
|
||||
AssetDatabase.GetAssetPath(asset.Atlas));
|
||||
asset.Atlas = null;
|
||||
}
|
||||
EditorUtility.SetDirty(asset);
|
||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(asset));
|
||||
}
|
||||
@@ -69,10 +73,6 @@ namespace FTEditor.Editors {
|
||||
AllAssetsForeach(p => ApplyOverriddenSettings(p));
|
||||
}
|
||||
|
||||
void ReconvertAllAsset() {
|
||||
AllAssetsForeach(p => ReconvertAsset(p));
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -105,7 +105,7 @@ namespace FTEditor.Editors {
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
if ( GUILayout.Button("Reconvert") ) {
|
||||
ReconvertAllAsset();
|
||||
ApplyAllOverriddenSettings();
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
var default_settings = GetSettingsHolder().Settings;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEditor;
|
||||
|
||||
using System.IO;
|
||||
@@ -40,6 +41,9 @@ namespace FTEditor.Editors {
|
||||
var clip_go = new GameObject(clip.name);
|
||||
clip_go.AddComponent<MeshFilter>();
|
||||
clip_go.AddComponent<MeshRenderer>();
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
clip_go.AddComponent<SortingGroup>();
|
||||
#endif
|
||||
clip_go.AddComponent<SwfClip>().clip = clip;
|
||||
clip_go.AddComponent<SwfClipController>();
|
||||
return clip_go;
|
||||
|
||||
@@ -174,13 +174,14 @@ namespace FTEditor.Editors {
|
||||
if ( isTargetValidForPreview ) {
|
||||
_previewUtils.BeginPreview(r, background);
|
||||
{
|
||||
if ( targetAtlas ) {
|
||||
_matPropBlock.SetTexture("_MainTex", targetAtlas);
|
||||
}
|
||||
_matPropBlock.SetTexture(
|
||||
"_MainTex",
|
||||
targetAtlas ? targetAtlas : Texture2D.whiteTexture);
|
||||
if ( targetAtlasA ) {
|
||||
_matPropBlock.SetTexture("_AlphaTex", targetAtlasA);
|
||||
_matPropBlock.SetFloat("_ExternalAlpha", 1.0f);
|
||||
} else {
|
||||
_matPropBlock.SetTexture("_AlphaTex", Texture2D.whiteTexture);
|
||||
_matPropBlock.SetFloat("_ExternalAlpha", 0.0f);
|
||||
}
|
||||
ConfigureCameraForSequence(_previewUtils.m_Camera, targetSequence);
|
||||
|
||||
@@ -18,14 +18,15 @@ namespace FTEditor.Postprocessors {
|
||||
string[] moved_assets,
|
||||
string[] moved_from_asset_paths)
|
||||
{
|
||||
var asset_paths = imported_assets
|
||||
.Where(p => Path.GetExtension(p).ToLower().Equals(".asset"));
|
||||
var assets = asset_paths
|
||||
var assets = imported_assets
|
||||
.Where(p => Path.GetExtension(p).ToLower().Equals(".asset"))
|
||||
.Select(p => AssetDatabase.LoadAssetAtPath<SwfAsset>(p))
|
||||
.Where(p => !!p);
|
||||
foreach ( var asset in assets ) {
|
||||
.Where(p => p && !p.Atlas);
|
||||
if ( assets.Any() ) {
|
||||
EditorApplication.delayCall += () => {
|
||||
SwfAssetProcess(asset);
|
||||
foreach ( var asset in assets ) {
|
||||
SwfAssetProcess(asset);
|
||||
}
|
||||
AssetDatabase.SaveAssets();
|
||||
};
|
||||
}
|
||||
@@ -33,23 +34,26 @@ namespace FTEditor.Postprocessors {
|
||||
|
||||
static void SwfAssetProcess(SwfAsset asset) {
|
||||
try {
|
||||
if ( !asset.Atlas ) {
|
||||
EditorUtility.SetDirty(asset);
|
||||
var asset_data = SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data, progress => {
|
||||
_progressBar.UpdateProgress("decompress swf asset", progress);
|
||||
});
|
||||
asset.Atlas = LoadAssetAtlas(asset);
|
||||
if ( asset.Atlas ) {
|
||||
ConfigureAtlas(asset);
|
||||
ConfigureClips(asset, asset_data);
|
||||
} else {
|
||||
_progressBar.UpdateTitle(asset.name);
|
||||
var new_data = ConfigureBitmaps(
|
||||
asset,
|
||||
SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data));
|
||||
asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
asset.Atlas = LoadAssetAtlas(asset);
|
||||
if ( asset.Atlas ) {
|
||||
ConfigureAtlas(asset);
|
||||
ConfigureClips(asset, new_data);
|
||||
}
|
||||
EditorUtility.SetDirty(asset);
|
||||
var new_data = ConfigureBitmaps(asset, asset_data);
|
||||
asset.Data = SwfEditorUtils.CompressAsset(new_data, progress => {
|
||||
_progressBar.UpdateProgress("compress swf asset", progress);
|
||||
});
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Debug.LogErrorFormat(
|
||||
"<b>[FlashTools]</b> Postprocess swf asset error: {0}",
|
||||
e.Message);
|
||||
asset,
|
||||
"<b>[FlashTools]</b> Postprocess swf asset error: {0}\nPath: {1}",
|
||||
e.Message, AssetDatabase.GetAssetPath(asset));
|
||||
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(asset));
|
||||
} finally {
|
||||
if ( asset ) {
|
||||
@@ -196,7 +200,6 @@ namespace FTEditor.Postprocessors {
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
static void ConfigureAtlas(SwfAsset asset) {
|
||||
var atlas_path = AssetDatabase.GetAssetPath(asset.Atlas);
|
||||
var atlas_importer = GetBitmapsAtlasImporter(asset);
|
||||
atlas_importer.textureType = TextureImporterType.Sprite;
|
||||
atlas_importer.spriteImportMode = SpriteImportMode.Single;
|
||||
@@ -208,7 +211,13 @@ namespace FTEditor.Postprocessors {
|
||||
#else
|
||||
atlas_importer.textureFormat = SwfAtlasFormatToImporterFormat(asset.Settings.AtlasTextureFormat);
|
||||
#endif
|
||||
AssetDatabase.WriteImportSettingsIfDirty(atlas_path);
|
||||
|
||||
var atlas_settings = new TextureImporterSettings();
|
||||
atlas_importer.ReadTextureSettings(atlas_settings);
|
||||
atlas_settings.spriteMeshType = SpriteMeshType.FullRect;
|
||||
atlas_importer.SetTextureSettings(atlas_settings);
|
||||
|
||||
atlas_importer.SaveAndReimport();
|
||||
}
|
||||
|
||||
static TextureImporter GetBitmapsAtlasImporter(SwfAsset asset) {
|
||||
@@ -369,7 +378,7 @@ namespace FTEditor.Postprocessors {
|
||||
var bitmap = inst != null
|
||||
? FindBitmapFromAssetData(data, inst.Bitmap)
|
||||
: null;
|
||||
if ( bitmap != null && IsVisibleInstance(inst) ) {
|
||||
if ( bitmap != null ) {
|
||||
var width = bitmap.RealWidth / 20.0f;
|
||||
var height = bitmap.RealHeight / 20.0f;
|
||||
|
||||
@@ -482,11 +491,6 @@ namespace FTEditor.Postprocessors {
|
||||
return null;
|
||||
}
|
||||
|
||||
static bool IsVisibleInstance(SwfInstanceData inst) {
|
||||
var result_color = inst.ColorTrans.ApplyToColor(Color.white);
|
||||
return result_color.a >= 0.01f;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// UpdateAssetClips
|
||||
|
||||
@@ -24,16 +24,18 @@ namespace FTEditor.Postprocessors {
|
||||
{
|
||||
var swf_paths = imported_assets
|
||||
.Where(p => Path.GetExtension(p).ToLower().Equals(".swf"));
|
||||
if ( swf_paths.Any() && SwfEditorUtils.IsDemoEnded ) {
|
||||
var title = "Demo version";
|
||||
var message =
|
||||
"This demo is for evaluation purpose only. " +
|
||||
"It means that you can't have more than 5 animation assets in the project.";
|
||||
EditorUtility.DisplayDialog(title, message, "Ok");
|
||||
} else {
|
||||
foreach ( var swf_path in swf_paths ) {
|
||||
if ( swf_paths.Any() ) {
|
||||
if ( SwfEditorUtils.IsDemoEnded ) {
|
||||
var title = "Demo version";
|
||||
var message =
|
||||
"This demo is for evaluation purpose only. " +
|
||||
"It means that you can't have more than 5 animation assets in the project.";
|
||||
EditorUtility.DisplayDialog(title, message, "Ok");
|
||||
} else {
|
||||
EditorApplication.delayCall += () => {
|
||||
SwfFileProcess(swf_path);
|
||||
foreach ( var swf_path in swf_paths ) {
|
||||
SwfFileProcess(swf_path);
|
||||
}
|
||||
AssetDatabase.SaveAssets();
|
||||
};
|
||||
}
|
||||
@@ -41,29 +43,40 @@ namespace FTEditor.Postprocessors {
|
||||
}
|
||||
|
||||
static void SwfFileProcess(string swf_path) {
|
||||
var swf_hash = SwfEditorUtils.GetFileHashWithVersion(swf_path);
|
||||
var swf_asset_path = Path.ChangeExtension(swf_path, ".asset");
|
||||
SwfEditorUtils.LoadOrCreateAsset<SwfAsset>(swf_asset_path, (swf_asset, created) => {
|
||||
if ( created ) {
|
||||
if ( !string.IsNullOrEmpty(swf_asset.Hash) && swf_asset.Hash == swf_hash ) {
|
||||
return true;
|
||||
} else if ( created ) {
|
||||
var default_settings = SwfEditorUtils.GetSettingsHolder().Settings;
|
||||
swf_asset.Settings = default_settings;
|
||||
swf_asset.Overridden = default_settings;
|
||||
}
|
||||
return SafeLoadSwfAsset(swf_path, swf_asset);
|
||||
return SafeLoadSwfAsset(swf_path, swf_hash, swf_asset);
|
||||
});
|
||||
}
|
||||
|
||||
static bool SafeLoadSwfAsset(string swf_path, SwfAsset swf_asset) {
|
||||
static bool SafeLoadSwfAsset(string swf_path, string swf_hash, SwfAsset swf_asset) {
|
||||
try {
|
||||
_progressBar.UpdateTitle(Path.GetFileName(swf_path));
|
||||
var new_data = LoadSwfAssetData(swf_path);
|
||||
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
swf_asset.Atlas = null;
|
||||
var new_data = LoadSwfAssetData(swf_path);
|
||||
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data, progress => {
|
||||
_progressBar.UpdateProgress("swf asset compression", progress);
|
||||
});
|
||||
swf_asset.Hash = swf_hash;
|
||||
if ( swf_asset.Atlas ) {
|
||||
AssetDatabase.DeleteAsset(
|
||||
AssetDatabase.GetAssetPath(swf_asset.Atlas));
|
||||
swf_asset.Atlas = null;
|
||||
}
|
||||
EditorUtility.SetDirty(swf_asset);
|
||||
return true;
|
||||
} catch ( Exception e ) {
|
||||
Debug.LogErrorFormat(
|
||||
"<b>[FlashTools]</b> Parsing swf error: {0}",
|
||||
e.Message);
|
||||
AssetDatabase.LoadMainAssetAtPath(swf_path),
|
||||
"<b>[FlashTools]</b> Parsing swf error: {0}\nPath: {1}",
|
||||
e.Message, swf_path);
|
||||
return false;
|
||||
} finally {
|
||||
_progressBar.HideProgress();
|
||||
@@ -97,9 +110,6 @@ namespace FTEditor.Postprocessors {
|
||||
.Where(p => !string.IsNullOrEmpty(p.ExportName))
|
||||
.ToList();
|
||||
for ( var i = 0; i < sprite_defs.Count; ++i ) {
|
||||
_progressBar.UpdateProgress(
|
||||
"load swf symbols",
|
||||
(float)(i + 1) / sprite_defs.Count);
|
||||
var def = sprite_defs[i];
|
||||
var name = def.ExportName;
|
||||
var tags = def.ControlTags.Tags;
|
||||
@@ -117,6 +127,9 @@ namespace FTEditor.Postprocessors {
|
||||
});
|
||||
var symbol_frames = new List<SwfFrameData>();
|
||||
while ( executer.NextFrame(tags, disp_lst) ) {
|
||||
_progressBar.UpdateProgress(
|
||||
string.Format("swf symbols loading ({0})", symbol_name),
|
||||
(float)(executer.CurrentTag + 1) / tags.Count);
|
||||
symbol_frames.Add(LoadSymbolFrameData(library, disp_lst));
|
||||
}
|
||||
return new SwfSymbolData{
|
||||
@@ -369,6 +382,8 @@ namespace FTEditor.Postprocessors {
|
||||
return new SwfBlendModeData(SwfBlendModeData.Types.Subtract);
|
||||
case SwfBlendMode.Mode.Invert:
|
||||
return new SwfBlendModeData(SwfBlendModeData.Types.Invert);
|
||||
case SwfBlendMode.Mode.Overlay:
|
||||
return new SwfBlendModeData(SwfBlendModeData.Types.Overlay);
|
||||
case SwfBlendMode.Mode.Hardlight:
|
||||
return new SwfBlendModeData(SwfBlendModeData.Types.Hardlight);
|
||||
default:
|
||||
|
||||
@@ -154,14 +154,6 @@ namespace FTEditor {
|
||||
public SwfVec4Data mulColor;
|
||||
public SwfVec4Data addColor;
|
||||
|
||||
public Color ApplyToColor(Color color) {
|
||||
return new Color(
|
||||
Mathf.Clamp01(color.r * mulColor.x + addColor.x),
|
||||
Mathf.Clamp01(color.g * mulColor.y + addColor.y),
|
||||
Mathf.Clamp01(color.b * mulColor.z + addColor.z),
|
||||
Mathf.Clamp01(color.a * mulColor.w + addColor.w));
|
||||
}
|
||||
|
||||
public static SwfColorTransData identity {
|
||||
get {
|
||||
return new SwfColorTransData{
|
||||
|
||||
@@ -4,6 +4,7 @@ using UnityEditor;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
|
||||
using Ionic.Zlib;
|
||||
@@ -184,14 +185,14 @@ namespace FTEditor {
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] CompressAsset<T>(T asset) {
|
||||
public static byte[] CompressAsset<T>(T asset, System.Action<float> progress_act) {
|
||||
var bytes = AssetToBytes(asset);
|
||||
var result = ZlibStream.CompressBuffer(bytes);
|
||||
var result = CompressBuffer(bytes, progress_act);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static T DecompressAsset<T>(byte[] data) {
|
||||
var bytes = ZlibStream.UncompressBuffer(data);
|
||||
public static T DecompressAsset<T>(byte[] data, System.Action<float> progress_act) {
|
||||
var bytes = DecompressBuffer(data, progress_act);
|
||||
var result = BytesToAsset<T>(bytes);
|
||||
return result;
|
||||
}
|
||||
@@ -211,6 +212,41 @@ namespace FTEditor {
|
||||
}
|
||||
}
|
||||
|
||||
static byte[] CompressBuffer(byte[] bytes, System.Action<float> progress_act) {
|
||||
using ( var output = new MemoryStream() ) {
|
||||
using ( var compressor = new ZlibStream(output, CompressionMode.Compress, CompressionLevel.Default) ) {
|
||||
var n = 0;
|
||||
while ( n < bytes.Length ) {
|
||||
var count = Mathf.Min(4 * 1024, bytes.Length - n);
|
||||
compressor.Write(bytes, n, count);
|
||||
n += count;
|
||||
if ( progress_act != null ) {
|
||||
progress_act((float)n / bytes.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
return output.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
static byte[] DecompressBuffer(byte[] compressed_bytes, System.Action<float> progress_act) {
|
||||
using ( var input = new MemoryStream(compressed_bytes) ) {
|
||||
using ( var decompressor = new ZlibStream(input, CompressionMode.Decompress) ) {
|
||||
using ( var output = new MemoryStream() ) {
|
||||
int n;
|
||||
var buffer = new byte[4 * 1024];
|
||||
while ( (n = decompressor.Read(buffer, 0, buffer.Length)) != 0 ) {
|
||||
output.Write(buffer, 0, n);
|
||||
if ( progress_act != null ) {
|
||||
progress_act((float)decompressor.Position / input.Length);
|
||||
}
|
||||
}
|
||||
return output.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Demo
|
||||
@@ -259,6 +295,32 @@ namespace FTEditor {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// FileHash
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
public static string GetFileHashWithVersion(string path) {
|
||||
return string.Format(
|
||||
"{0}={1}",
|
||||
GetFileHash(path), SwfVersion.AsString);
|
||||
}
|
||||
|
||||
static string GetFileHash(string path) {
|
||||
try {
|
||||
using ( var sha256 = SHA256.Create() ) {
|
||||
var file_bytes = File.ReadAllBytes(path);
|
||||
var hash_bytes = sha256.ComputeHash(file_bytes);
|
||||
return
|
||||
System.Convert.ToBase64String(hash_bytes) +
|
||||
file_bytes.LongLength.ToString();
|
||||
}
|
||||
} catch ( System.Exception ) {
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Menu
|
||||
@@ -286,6 +348,21 @@ namespace FTEditor {
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Tools/FlashTools/Reconvert all swf assets")]
|
||||
static void Tools_FlashTools_ReconvertAllSwfAssets() {
|
||||
Tools_FlashTools_ReimportAllSwfFiles();
|
||||
var swf_assets = GetAllSwfAssets();
|
||||
foreach ( var swf_asset in swf_assets ) {
|
||||
if ( swf_asset.Atlas ) {
|
||||
AssetDatabase.DeleteAsset(
|
||||
AssetDatabase.GetAssetPath(swf_asset.Atlas));
|
||||
swf_asset.Atlas = null;
|
||||
}
|
||||
EditorUtility.SetDirty(swf_asset);
|
||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(swf_asset));
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Tools/FlashTools/Pregenerate all materials")]
|
||||
static void PregenerateAllMaterials() {
|
||||
var blend_modes = System.Enum.GetValues(typeof(SwfBlendModeData.Types));
|
||||
@@ -299,6 +376,10 @@ namespace FTEditor {
|
||||
SwfMaterialCache.GetDecrMaskMaterial();
|
||||
}
|
||||
|
||||
static SwfAsset[] GetAllSwfAssets() {
|
||||
return SwfEditorUtils.LoadAllAssetsDBByFilter<SwfAsset>("t:SwfAsset");
|
||||
}
|
||||
|
||||
static string[] GetAllSwfFilePaths() {
|
||||
return AssetDatabase.GetAllAssetPaths()
|
||||
.Where(p => Path.GetExtension(p).ToLower().Equals(".swf"))
|
||||
|
||||
@@ -71,38 +71,38 @@
|
||||
// Fonts and Text
|
||||
// -----------------------------
|
||||
|
||||
DefineFont = 10,
|
||||
DefineFontInfo = 13,
|
||||
DefineFontInfo2 = 62,
|
||||
DefineFont2 = 48,
|
||||
DefineFont3 = 75,
|
||||
DefineFontAlignZones = 73,
|
||||
DefineFontName = 88,
|
||||
DefineText = 11,
|
||||
DefineText2 = 33,
|
||||
DefineEditText = 37,
|
||||
CSMTextSettings = 74,
|
||||
DefineFont4 = 91,
|
||||
DefineFont = 10, // Unsupported
|
||||
DefineFontInfo = 13, // Unsupported
|
||||
DefineFontInfo2 = 62, // Unsupported
|
||||
DefineFont2 = 48, // Unsupported
|
||||
DefineFont3 = 75, // Unsupported
|
||||
DefineFontAlignZones = 73, // Unsupported
|
||||
DefineFontName = 88, // Unsupported
|
||||
DefineText = 11, // Unsupported
|
||||
DefineText2 = 33, // Unsupported
|
||||
DefineEditText = 37, // Unsupported
|
||||
CSMTextSettings = 74, // Unsupported
|
||||
DefineFont4 = 91, // Unsupported
|
||||
|
||||
// -----------------------------
|
||||
// Sounds
|
||||
// -----------------------------
|
||||
|
||||
//DefineSound = 14,
|
||||
//StartSound = 15,
|
||||
//StartSound2 = 89,
|
||||
//SoundStreamHead = 18,
|
||||
//SoundStreamHead2 = 45,
|
||||
//SoundStreamBlock = 19,
|
||||
DefineSound = 14, // Unsupported
|
||||
StartSound = 15, // Unsupported
|
||||
StartSound2 = 89, // Unsupported
|
||||
SoundStreamHead = 18, // Unsupported
|
||||
SoundStreamHead2 = 45, // Unsupported
|
||||
SoundStreamBlock = 19, // Unsupported
|
||||
|
||||
// -----------------------------
|
||||
// Buttons
|
||||
// -----------------------------
|
||||
|
||||
//DefineButton = 7,
|
||||
//DefineButton2 = 34,
|
||||
//DefineButtonCxform = 23,
|
||||
//DefineButtonSound = 17,
|
||||
DefineButton = 7, // Unsupported
|
||||
DefineButton2 = 34, // Unsupported
|
||||
DefineButtonCxform = 23, // Unsupported
|
||||
DefineButtonSound = 17, // Unsupported
|
||||
|
||||
// -----------------------------
|
||||
// Sprites and Movie Clips
|
||||
@@ -212,6 +212,18 @@
|
||||
case (int)SwfTagType.DefineEditText: return UnsupportedTag.Create(SwfTagType.DefineEditText);
|
||||
case (int)SwfTagType.CSMTextSettings: return UnsupportedTag.Create(SwfTagType.CSMTextSettings);
|
||||
case (int)SwfTagType.DefineFont4: return UnsupportedTag.Create(SwfTagType.DefineFont4);
|
||||
// Sounds
|
||||
case (int)SwfTagType.DefineSound: return UnsupportedTag.Create(SwfTagType.DefineSound);
|
||||
case (int)SwfTagType.StartSound: return UnsupportedTag.Create(SwfTagType.StartSound);
|
||||
case (int)SwfTagType.StartSound2: return UnsupportedTag.Create(SwfTagType.StartSound2);
|
||||
case (int)SwfTagType.SoundStreamHead: return UnsupportedTag.Create(SwfTagType.SoundStreamHead);
|
||||
case (int)SwfTagType.SoundStreamHead2: return UnsupportedTag.Create(SwfTagType.SoundStreamHead2);
|
||||
case (int)SwfTagType.SoundStreamBlock: return UnsupportedTag.Create(SwfTagType.SoundStreamBlock);
|
||||
// Buttons
|
||||
case (int)SwfTagType.DefineButton: return UnsupportedTag.Create(SwfTagType.DefineButton);
|
||||
case (int)SwfTagType.DefineButton2: return UnsupportedTag.Create(SwfTagType.DefineButton2);
|
||||
case (int)SwfTagType.DefineButtonCxform: return UnsupportedTag.Create(SwfTagType.DefineButtonCxform);
|
||||
case (int)SwfTagType.DefineButtonSound: return UnsupportedTag.Create(SwfTagType.DefineButtonSound);
|
||||
// Sprites and Movie Clips
|
||||
case (int)SwfTagType.DefineSprite: return DefineSpriteTag.Create(reader);
|
||||
// Video
|
||||
|
||||