Compare commits

...

65 Commits

Author SHA1 Message Date
7b16000369 version 0.5 2016-10-01 20:21:53 +07:00
5718916aeb warning on filters 2016-10-01 03:51:10 +07:00
37230465b7 remove color mode 2016-10-01 03:09:12 +07:00
874fc29375 remove dummy alpha and erase blend modes 2016-10-01 03:00:51 +07:00
549235460b dummy alpha and erase blend modes 2016-09-30 22:29:19 +07:00
f5315ad47f + color mode for instances 2016-09-30 21:30:56 +07:00
c0a7121f60 exporter optimizer twicks 2016-09-30 03:21:12 +07:00
5ae09addae Layer blend mode 2016-09-29 02:18:35 +07:00
f59b207483 remove custom color mask 2016-09-29 02:06:22 +07:00
2d2cbdf525 custom color mask for shaders 2016-09-28 02:50:14 +07:00
f15b386b34 mask shader to common code 2016-09-27 21:17:05 +07:00
cc966f6675 little shader fix 2016-09-27 18:29:54 +07:00
7bf56d9c7d style shader fixes 2016-09-27 18:02:13 +07:00
a49a1081c5 grab blend modes wip 2016-09-27 17:32:10 +07:00
792becc261 + Lighten blend mode 2016-09-27 13:57:55 +07:00
2f28dfc674 little exporter fix 2016-09-26 23:42:38 +07:00
8ebc80b0d4 auto generate materials 2016-09-25 16:49:16 +07:00
d06288b9a8 Screen and Subtract blend modes 2016-09-25 12:44:01 +07:00
c6bf0eefed + Normal, Add, Multiply blend modes 2016-09-25 11:21:09 +07:00
af674df004 little fixes 2016-09-22 23:37:55 +07:00
7cb031a54e Added tag versions/0.4 for changeset e17287dc7c8d 2016-09-22 02:19:32 +07:00
8942aceef2 version 0.4 2016-09-22 02:19:15 +07:00
7057cd71a8 clear code 2016-09-22 02:14:58 +07:00
1d402eb91e clip groups 2016-09-21 23:36:32 +07:00
2ce9897d60 compress asset data 2016-09-21 01:16:12 +07:00
63fea79f49 able move containers and assets 2016-09-20 15:19:39 +07:00
5d29da73c7 tint color for clips 2016-09-16 05:08:06 +07:00
0c4efc0111 flash tools log prefix 2016-09-16 04:50:07 +07:00
6474828774 open settings menu button 2016-09-16 04:36:47 +07:00
78758786e6 'reimport all' menu button 2016-09-16 03:25:44 +07:00
7a0940b6a1 pause, resume and rate scale for manger 2016-09-16 03:03:33 +07:00
3d688d1ac2 controller API improvements 2016-09-16 02:33:48 +07:00
6d69b46c2f Added tag versions/0.3 for changeset d2d05072620c 2016-09-14 22:30:25 +07:00
2e6fc73bfe version 0.3 2016-09-14 22:30:09 +07:00
46a340d615 fix empty texture after reimport 2016-09-14 21:14:07 +07:00
e41eae8c72 GotoAndStop, GotoAndPlay 2016-09-14 18:38:07 +07:00
1991da1f6b fill mesh optimizations 2016-09-14 16:17:35 +07:00
14d1088db9 remove vertex coords tricks. skip many fill mesh in one frame 2016-09-14 14:19:51 +07:00
d1777239cd cut invisible geometry 2016-09-14 01:16:50 +07:00
dc539b1e27 style fixes 2016-09-14 00:42:46 +07:00
8108516350 compress mesh wip 2016-09-13 03:03:36 +07:00
c5270a01a7 compress mesh wip 2016-09-13 00:25:32 +07:00
c424a4d507 compress mesh data wip 2016-09-12 20:29:54 +07:00
876859a0e1 color transform range fix 2016-09-12 16:45:18 +07:00
00d66fa94e hide materials in inspector again 2016-09-11 23:04:51 +07:00
e98071f471 chached meshes wip 2016-09-11 22:55:02 +07:00
f068463454 style fixes 2016-09-11 02:25:43 +07:00
8ddb0d2bcb settings fix 2016-09-10 23:21:31 +07:00
6ba10b4875 little optimize asset size of disk 2016-09-10 22:47:31 +07:00
ddacef7275 show frame count for clip asset 2016-09-10 21:15:44 +07:00
6881f46d89 correct inspector for overriden order layer 2016-09-10 19:57:38 +07:00
811bd73fa1 fix prefab current mesh bug 2016-09-10 18:41:50 +07:00
5bce0db290 style fixes 2016-09-10 18:22:59 +07:00
a5c9d21b66 show clips for container asset in editor 2016-09-10 15:04:35 +07:00
fd0fae1590 preview fixes 2016-09-10 14:05:50 +07:00
225ab99153 style fixes 2016-09-10 05:17:18 +07:00
9609e07e5c preview for assets and clips 2016-09-10 01:49:19 +07:00
060594dc29 little style fix 2016-09-09 21:33:49 +07:00
891c1790c3 safe update controllers 2016-09-09 21:16:47 +07:00
b3783f22c4 jpg rasterize fix 2016-09-09 17:15:48 +07:00
205d4aad8c revert documents after export fix 2016-09-08 22:18:25 +07:00
c749b0ca9d multiple sequences edit 2016-09-08 22:08:45 +07:00
d1a992e421 fix empty mesh bug and to 5.3.6f1 2016-09-08 15:23:41 +07:00
950b7b663d DS_Store to ignore 2016-09-08 03:31:10 +07:00
1a3d541771 Added tag versions/0.2 for changeset aa93e17d4cac 2016-09-08 03:28:30 +07:00
93 changed files with 2951 additions and 3149 deletions

View File

@@ -1,3 +1,5 @@
glob:obj/*
glob:Temp/*
glob:Library/*
glob:.DS_Store

View File

@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_5;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_6;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
@@ -47,6 +47,7 @@
<ItemGroup>
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\Editors\SwfAssetEditor.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\Editors\SwfClipAssetEditor.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\Editors\SwfClipAssetPreview.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\Editors\SwfClipControllerEditor.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\Editors\SwfClipEditor.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\Editors\SwfManagerEditor.cs" />
@@ -102,11 +103,15 @@
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\SwfTools\SwfTypes\SwfShapesWithStyle.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\SwfTools\SwfTypes\SwfShortHeader.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\SwfTools\SwfTypes\SwfSurfaceFilters.cs" />
<None Include="Assets\FlashTools\Resources\Shaders\SwfDecrMask.shader" />
<None Include="Assets\FlashTools\Resources\Shaders\SwfSimple.shader" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\Tests\SwfUtilsTests.cs" />
<None Include="Assets\FlashTools\Resources\Materials\SwfBaseCG.cginc" />
<None Include="Assets\FlashTools\Resources\Materials\SwfDecrMaskShader.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfSimpleShader.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfMaskedGrabShader.shader" />
<None Include="Assets\FlashTools\CHANGELOG.txt" />
<None Include="Assets\FlashTools\Resources\Shaders\SwfIncrMask.shader" />
<None Include="Assets\FlashTools\Resources\Shaders\SwfMasked.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfSimpleGrabShader.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfIncrMaskShader.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfMaskedShader.shader" />
<Reference Include="UnityEditor.Advertisements">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll</HintPath>
</Reference>
@@ -143,21 +148,9 @@
<Reference Include="UnityEditor.iOS.Extensions">
<HintPath>/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.AppleTV.Extensions">
<HintPath>/Applications/Unity/PlaybackEngines/AppleTVSupport/UnityEditor.AppleTV.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Tizen.Extensions">
<HintPath>/Applications/Unity/PlaybackEngines/TizenPlayer/UnityEditor.Tizen.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.SamsungTV.Extensions">
<HintPath>/Applications/Unity/PlaybackEngines/STVPlayer/UnityEditor.SamsungTV.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WebGL.Extensions">
<HintPath>/Applications/Unity/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.LinuxStandalone.Extensions">
<HintPath>/Applications/Unity/PlaybackEngines/LinuxStandaloneSupport/UnityEditor.LinuxStandalone.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>/Applications/Unity/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
@@ -165,12 +158,6 @@
<HintPath>/Applications/Unity/PlaybackEngines/MacStandaloneSupport/UnityEditor.OSXStandalone.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Xcode">
<HintPath>/Applications/Unity/PlaybackEngines/AppleTVSupport/UnityEditor.iOS.Extensions.Xcode.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Common">
<HintPath>/Applications/Unity/PlaybackEngines/AppleTVSupport/UnityEditor.iOS.Extensions.Common.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Xcode">
<HintPath>/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Xcode.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.iOS.Extensions.Common">

View File

@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_5;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_3_6;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
@@ -49,16 +49,20 @@
<Compile Include="Assets\FlashTools\Scripts\Internal\SwfAttributes.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\SwfList.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\SwfSettings.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\SwfUtils.cs" />
<Compile Include="Assets\FlashTools\Scripts\SwfAsset.cs" />
<Compile Include="Assets\FlashTools\Scripts\SwfClip.cs" />
<Compile Include="Assets\FlashTools\Scripts\SwfClipAsset.cs" />
<Compile Include="Assets\FlashTools\Scripts\SwfClipController.cs" />
<Compile Include="Assets\FlashTools\Scripts\SwfManager.cs" />
<None Include="Assets\FlashTools\Resources\Shaders\SwfDecrMask.shader" />
<None Include="Assets\FlashTools\Resources\Shaders\SwfSimple.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfBaseCG.cginc" />
<None Include="Assets\FlashTools\Resources\Materials\SwfDecrMaskShader.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfSimpleShader.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfMaskedGrabShader.shader" />
<None Include="Assets\FlashTools\CHANGELOG.txt" />
<None Include="Assets\FlashTools\Resources\Shaders\SwfIncrMask.shader" />
<None Include="Assets\FlashTools\Resources\Shaders\SwfMasked.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfSimpleGrabShader.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfIncrMaskShader.shader" />
<None Include="Assets\FlashTools\Resources\Materials\SwfMaskedShader.shader" />
<Reference Include="UnityEngine.UI">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
</Reference>

View File

@@ -1,3 +1,27 @@
-----------------
-- Version 0.5 --
-----------------
Flash optimizer twicks
Blending modes (except Alpha and Erase)
-----------------
-- Version 0.4 --
-----------------
Clip groups
Fix move assets bug
Tint color for clips
Animation API improvements
-----------------
-- Version 0.3 --
-----------------
Preview for animation assets and clips
Animation API improvements
Memory optimizations
-----------------
-- Version 0.2 --
-----------------
@@ -9,4 +33,4 @@ Export clips with export names
-- Version 0.1 --
-----------------
Initial alpha version.
Initial alpha version

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 075eada96ece147de8eeee4710c5ab0f
timeCreated: 1474360714
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: beb0fd4f1c9444a96b597ba9217d5b5b
timeCreated: 1475326695
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -145,7 +145,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 3
orthographic size: 2.3
m_Depth: 0
m_CullingMask:
serializedVersion: 2

View File

@@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: d9c0a113e9c274efda30bf000cce59ff
guid: ee7c6466110fb4e278e247d3d334450f
folderAsset: yes
timeCreated: 1472125740
licenseType: Pro
timeCreated: 1456948832
licenseType: Free
DefaultImporter:
userData:
assetBundleName:

View File

@@ -0,0 +1,163 @@
#ifndef SWF_BASE_CG_INCLUDED
#define SWF_BASE_CG_INCLUDED
//
// blending functions
//
inline fixed4 swf_darken(fixed4 ca, fixed4 cb) {
fixed4 r = min(ca, cb);
r.a = cb.a;
return r;
}
inline fixed4 swf_difference(fixed4 ca, fixed4 cb) {
fixed4 r = abs(ca - cb);
r.a = cb.a;
return r;
}
inline fixed4 swf_invert(fixed4 ca, fixed4 cb) {
fixed4 r = 1.0 - ca;
r.a = cb.a;
return r;
}
inline fixed4 swf_overlay(fixed4 ca, fixed4 cb) {
fixed4 r = ca > 0.5 ? 1.0 - 2.0 * (1.0 - ca) * (1.0 - cb) : 2.0 * ca * cb;
r.a = cb.a;
return r;
}
inline fixed4 swf_hardlight(fixed4 ca, fixed4 cb) {
fixed4 r = cb > 0.5 ? 1.0 - (1.0 - ca) * (1.0 - 2.0 * (cb - 0.5)) : ca * (2.0 * cb);
r.a = cb.a;
return r;
}
inline fixed4 grab_blend(sampler2D grab_tex, float4 screenpos, fixed4 c) {
float2 grab_uv = screenpos.xy / screenpos.w;
grab_uv = (grab_uv + 1.0) * 0.5;
#if UNITY_UV_STARTS_AT_TOP
grab_uv.y = 1.0 - grab_uv.y;
#endif
fixed4 grab_c = tex2D(grab_tex, grab_uv);
#if SWF_DARKEN_BLEND
c = swf_darken(grab_c, c);
#elif SWF_DIFFERENCE_BLEND
c = swf_difference(grab_c, c);
#elif SWF_INVERT_BLEND
c = swf_invert(grab_c, c);
#elif SWF_OVERLAY_BLEND
c = swf_overlay(grab_c, c);
#elif SWF_HARDLIGHT_BLEND
c = swf_hardlight(grab_c, c);
#endif
return c;
}
//
// structs
//
struct swf_appdata_t {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 mulcolor : COLOR;
float4 addcolor : TEXCOORD1;
};
struct swf_grab_appdata_t {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 mulcolor : COLOR;
float4 addcolor : TEXCOORD1;
};
struct swf_mask_appdata_t {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct swf_v2f_t {
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
fixed4 mulcolor : COLOR;
fixed4 addcolor : TEXCOORD1;
};
struct swf_grab_v2f_t {
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
fixed4 mulcolor : COLOR;
fixed4 addcolor : TEXCOORD1;
float4 screenpos : TEXCOORD2;
};
struct swf_mask_v2f_t {
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
};
//
// vert functions
//
inline swf_v2f_t swf_vert(swf_appdata_t IN) {
swf_v2f_t OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
OUT.mulcolor = IN.mulcolor * _Tint;
OUT.addcolor = IN.addcolor;
return OUT;
}
inline swf_grab_v2f_t swf_grab_vert(swf_grab_appdata_t IN) {
swf_grab_v2f_t OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
OUT.mulcolor = IN.mulcolor * _Tint;
OUT.addcolor = IN.addcolor;
OUT.screenpos = OUT.vertex;
return OUT;
}
inline swf_mask_v2f_t swf_mask_vert(swf_mask_appdata_t IN) {
swf_mask_v2f_t OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
return OUT;
}
//
// frag functions
//
inline fixed4 swf_frag(swf_v2f_t IN) : SV_Target {
fixed4 c = tex2D(_MainTex, IN.uv);
if ( c.a > 0.01 ) {
c = c * IN.mulcolor + 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 ( c.a > 0.01 ) {
c = c * IN.mulcolor + 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 ( c.a < 0.01 ) {
discard;
}
return c;
}
#endif // SWF_BASE_CG_INCLUDED

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 22b5ede0e40fe4227abf1d8ba84d05b2
timeCreated: 1474967647
licenseType: Free
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,138 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfDecrMaskMat
m_Shader: {fileID: 4800000, guid: f1e8cd2344e824b6a9b12efcacde262c, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d63a68532164d470d887fd2603e79ffa
timeCreated: 1472125896
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
Shader "FlashTools/SwfDecrMask" {
Properties {
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
ColorMask 0
Blend One OneMinusSrcAlpha
Pass {
Stencil {
Ref 0
Comp always
Pass DecrSat
}
CGPROGRAM
fixed4 _Tint;
sampler2D _MainTex;
sampler2D _GrabTexture;
#include "UnityCG.cginc"
#include "SwfBaseCG.cginc"
#pragma vertex swf_mask_vert
#pragma fragment swf_mask_frag
ENDCG
}
}
}

View File

@@ -1,138 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfIncrMaskMat
m_Shader: {fileID: 4800000, guid: 86b3e29b378884f228862fd1170176b5, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e62e8efca5cac42c9a323961b58d05d6
timeCreated: 1472125761
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
Shader "FlashTools/SwfIncrMask" {
Properties {
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
ColorMask 0
Blend One OneMinusSrcAlpha
Pass {
Stencil {
Ref 0
Comp always
Pass IncrSat
}
CGPROGRAM
fixed4 _Tint;
sampler2D _MainTex;
sampler2D _GrabTexture;
#include "UnityCG.cginc"
#include "SwfBaseCG.cginc"
#pragma vertex swf_mask_vert
#pragma fragment swf_mask_frag
ENDCG
}
}
}

View File

@@ -0,0 +1,50 @@
Shader "FlashTools/SwfMaskedGrab" {
Properties {
[PerRendererData] _MainTex ("Main Texture", 2D ) = "white" {}
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
_StencilID ("Stencil ID", Int) = 0
[Enum(UnityEngine.Rendering.BlendOp )] _BlendOp ("BlendOp" , Int) = 0
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("SrcBlend", Int) = 1
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("DstBlend", Int) = 10
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
BlendOp [_BlendOp]
Blend [_SrcBlend] [_DstBlend]
GrabPass { }
Pass {
Stencil {
Ref [_StencilID]
Comp Equal
}
CGPROGRAM
fixed4 _Tint;
sampler2D _MainTex;
sampler2D _GrabTexture;
#pragma multi_compile SWF_DARKEN_BLEND SWF_DIFFERENCE_BLEND SWF_INVERT_BLEND SWF_OVERLAY_BLEND SWF_HARDLIGHT_BLEND
#include "UnityCG.cginc"
#include "SwfBaseCG.cginc"
#pragma vertex swf_grab_vert
#pragma fragment swf_grab_frag
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1fe2c789c6a584e829f4c364674513b9
timeCreated: 1474963000
licenseType: Free
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_0
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 0
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3902e0561ba6046079e975f4b8340dbd
timeCreated: 1472125897
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_1
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 1
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 362db403211244f70830b07296318936
timeCreated: 1472126253
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_2
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 2
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 43234b460d10f41088cbd327c045074b
timeCreated: 1472126254
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_3
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 3
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f9e8b8b157ffa4866812a11237c48758
timeCreated: 1472126254
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_4
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 4
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 04597a59523be4b939c0a5dfd05b973e
timeCreated: 1472126255
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_5
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 5
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 502586963b8c243d48808238fb1210ef
timeCreated: 1472126255
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_6
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 6
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: dfbc0da8152b047b58270d40b138b36c
timeCreated: 1472126255
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_7
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 7
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: efeaba40d10a4417eb27036131ba80b1
timeCreated: 1472126256
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_8
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 8
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 0f131b0532a4e4feaba67826153a42b7
timeCreated: 1472126256
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,142 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfMaskedMat_9
m_Shader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _StencilID
second: 9
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ccd8fc1b2c96543ff9dc43ed384704a2
timeCreated: 1472126257
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
Shader "FlashTools/SwfMasked" {
Properties {
[PerRendererData] _MainTex ("Main Texture", 2D ) = "white" {}
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
_StencilID ("Stencil ID", Int) = 0
[Enum(UnityEngine.Rendering.BlendOp )] _BlendOp ("BlendOp" , Int) = 0
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("SrcBlend", Int) = 1
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("DstBlend", Int) = 10
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
BlendOp [_BlendOp]
Blend [_SrcBlend] [_DstBlend]
Pass {
Stencil {
Ref [_StencilID]
Comp Equal
}
CGPROGRAM
fixed4 _Tint;
sampler2D _MainTex;
sampler2D _GrabTexture;
#include "UnityCG.cginc"
#include "SwfBaseCG.cginc"
#pragma vertex swf_vert
#pragma fragment swf_frag
ENDCG
}
}
}

View File

@@ -0,0 +1,45 @@
Shader "FlashTools/SwfSimpleGrab" {
Properties {
[PerRendererData] _MainTex ("Main Texture", 2D ) = "white" {}
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
[Enum(UnityEngine.Rendering.BlendOp )] _BlendOp ("BlendOp" , Int) = 0
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("SrcBlend", Int) = 1
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("DstBlend", Int) = 10
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
BlendOp [_BlendOp]
Blend [_SrcBlend] [_DstBlend]
GrabPass { }
Pass {
CGPROGRAM
fixed4 _Tint;
sampler2D _MainTex;
sampler2D _GrabTexture;
#pragma multi_compile SWF_DARKEN_BLEND SWF_DIFFERENCE_BLEND SWF_INVERT_BLEND SWF_OVERLAY_BLEND SWF_HARDLIGHT_BLEND
#include "UnityCG.cginc"
#include "SwfBaseCG.cginc"
#pragma vertex swf_grab_vert
#pragma fragment swf_grab_frag
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 75e1212bdbac941a4a085c1aecfc6bef
timeCreated: 1474962993
licenseType: Free
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,138 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: SwfSimpleMat
m_Shader: {fileID: 4800000, guid: 71f5f783ce2ab4fc4bf826e4acb105dd, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Cutoff
second: 0.5
data:
first:
name: _Parallax
second: 0.02
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: 0.5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e92fbe00d5b6d4a3aa9355a4b23f107d
timeCreated: 1472125897
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
Shader "FlashTools/SwfSimple" {
Properties {
[PerRendererData] _MainTex ("Main Texture", 2D ) = "white" {}
[PerRendererData] _Tint ("Tint" , Color) = (1,1,1,1)
[Enum(UnityEngine.Rendering.BlendOp )] _BlendOp ("BlendOp" , Int) = 0
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("SrcBlend", Int) = 1
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("DstBlend", Int) = 10
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
BlendOp [_BlendOp]
Blend [_SrcBlend] [_DstBlend]
Pass {
CGPROGRAM
fixed4 _Tint;
sampler2D _MainTex;
sampler2D _GrabTexture;
#include "UnityCG.cginc"
#include "SwfBaseCG.cginc"
#pragma vertex swf_vert
#pragma fragment swf_frag
ENDCG
}
}
}

View File

@@ -1,72 +0,0 @@
Shader "FlashTools/SwfDecrMask" {
Properties {
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
ColorMask 0
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
Pass {
Stencil {
Ref 0
Comp always
Pass DecrSat
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f {
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
};
v2f vert(appdata_t IN) {
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
return OUT;
}
sampler2D _MainTex;
sampler2D _AlphaTex;
float _AlphaSplitEnabled;
fixed4 SampleSpriteTexture(float2 uv) {
fixed4 color = tex2D(_MainTex, uv);
#if UNITY_TEXTURE_ALPHASPLIT_ALLOWED
if (_AlphaSplitEnabled)
color.a = tex2D(_AlphaTex, uv).r;
#endif //UNITY_TEXTURE_ALPHASPLIT_ALLOWED
return color;
}
fixed4 frag(v2f IN) : SV_Target {
fixed4 c = SampleSpriteTexture(IN.uv);
if ( c.a < 0.01 ) {
discard;
}
return c;
}
ENDCG
}
}
}

View File

@@ -1,72 +0,0 @@
Shader "FlashTools/SwfIncrMask" {
Properties {
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
ColorMask 0
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
Pass {
Stencil {
Ref 0
Comp always
Pass IncrSat
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f {
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
};
v2f vert(appdata_t IN) {
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
return OUT;
}
sampler2D _MainTex;
sampler2D _AlphaTex;
float _AlphaSplitEnabled;
fixed4 SampleSpriteTexture(float2 uv) {
fixed4 color = tex2D(_MainTex, uv);
#if UNITY_TEXTURE_ALPHASPLIT_ALLOWED
if (_AlphaSplitEnabled)
color.a = tex2D(_AlphaTex, uv).r;
#endif //UNITY_TEXTURE_ALPHASPLIT_ALLOWED
return color;
}
fixed4 frag(v2f IN) : SV_Target {
fixed4 c = SampleSpriteTexture(IN.uv);
if ( c.a < 0.01 ) {
discard;
}
return c;
}
ENDCG
}
}
}

View File

@@ -1,78 +0,0 @@
Shader "FlashTools/SwfMasked" {
Properties {
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
_StencilID ("Stencil ID", Int) = 0
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
Pass {
Stencil {
Ref [_StencilID]
Comp Equal
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 mulcolor : COLOR;
float4 addcolor : TEXCOORD1;
};
struct v2f {
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
fixed4 mulcolor : COLOR;
fixed4 addcolor : TEXCOORD1;
};
v2f vert(appdata_t IN) {
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
OUT.mulcolor = IN.mulcolor;
OUT.addcolor = IN.addcolor;
return OUT;
}
sampler2D _MainTex;
sampler2D _AlphaTex;
float _AlphaSplitEnabled;
fixed4 SampleSpriteTexture(float2 uv) {
fixed4 color = tex2D(_MainTex, uv);
#if UNITY_TEXTURE_ALPHASPLIT_ALLOWED
if (_AlphaSplitEnabled)
color.a = tex2D(_AlphaTex, uv).r;
#endif //UNITY_TEXTURE_ALPHASPLIT_ALLOWED
return color;
}
fixed4 frag(v2f IN) : SV_Target {
fixed4 c = SampleSpriteTexture(IN.uv);
if ( c.a > 0.01 ) {
c = c * IN.mulcolor + IN.addcolor;
}
c.rgb *= c.a;
return c;
}
ENDCG
}
}
}

View File

@@ -1,73 +0,0 @@
Shader "FlashTools/SwfSimple" {
Properties {
[PerRendererData] _MainTex("Main Texture", 2D) = "white" {}
}
SubShader {
Tags {
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 mulcolor : COLOR;
float4 addcolor : TEXCOORD1;
};
struct v2f {
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
fixed4 mulcolor : COLOR;
fixed4 addcolor : TEXCOORD1;
};
v2f vert(appdata_t IN) {
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
OUT.mulcolor = IN.mulcolor;
OUT.addcolor = IN.addcolor;
return OUT;
}
sampler2D _MainTex;
sampler2D _AlphaTex;
float _AlphaSplitEnabled;
fixed4 SampleSpriteTexture(float2 uv) {
fixed4 color = tex2D(_MainTex, uv);
#if UNITY_TEXTURE_ALPHASPLIT_ALLOWED
if (_AlphaSplitEnabled)
color.a = tex2D(_AlphaTex, uv).r;
#endif //UNITY_TEXTURE_ALPHASPLIT_ALLOWED
return color;
}
fixed4 frag(v2f IN) : SV_Target {
fixed4 c = SampleSpriteTexture(IN.uv);
if ( c.a > 0.01 ) {
c = c * IN.mulcolor + IN.addcolor;
}
c.rgb *= c.a;
return c;
}
ENDCG
}
}
}

View File

@@ -20,17 +20,9 @@ MonoBehaviour:
AtlasForceSquare: 1
AtlasTextureFilter: 1
AtlasTextureFormat: 0
SimpleMaterial: {fileID: 2100000, guid: e92fbe00d5b6d4a3aa9355a4b23f107d, type: 2}
IncrMaskMaterial: {fileID: 2100000, guid: e62e8efca5cac42c9a323961b58d05d6, type: 2}
DecrMaskMaterial: {fileID: 2100000, guid: d63a68532164d470d887fd2603e79ffa, type: 2}
MaskedMaterials:
- {fileID: 2100000, guid: 3902e0561ba6046079e975f4b8340dbd, type: 2}
- {fileID: 2100000, guid: 362db403211244f70830b07296318936, type: 2}
- {fileID: 2100000, guid: 43234b460d10f41088cbd327c045074b, type: 2}
- {fileID: 2100000, guid: f9e8b8b157ffa4866812a11237c48758, type: 2}
- {fileID: 2100000, guid: 04597a59523be4b939c0a5dfd05b973e, type: 2}
- {fileID: 2100000, guid: 502586963b8c243d48808238fb1210ef, type: 2}
- {fileID: 2100000, guid: dfbc0da8152b047b58270d40b138b36c, type: 2}
- {fileID: 2100000, guid: efeaba40d10a4417eb27036131ba80b1, type: 2}
- {fileID: 2100000, guid: 0f131b0532a4e4feaba67826153a42b7, type: 2}
- {fileID: 2100000, guid: ccd8fc1b2c96543ff9dc43ed384704a2, type: 2}
SimpleShader: {fileID: 4800000, guid: 71f5f783ce2ab4fc4bf826e4acb105dd, type: 3}
MaskedShader: {fileID: 4800000, guid: 2fb923af3a46a49fdb944d636b6f79e8, type: 3}
SimpleGrabShader: {fileID: 4800000, guid: 75e1212bdbac941a4a085c1aecfc6bef, type: 3}
MaskedGrabShader: {fileID: 4800000, guid: 1fe2c789c6a584e829f4c364674513b9, type: 3}
IncrMaskShader: {fileID: 4800000, guid: 86b3e29b378884f228862fd1170176b5, type: 3}
DecrMaskShader: {fileID: 4800000, guid: f1e8cd2344e824b6a9b12efcacde262c, type: 3}

View File

@@ -1,7 +1,6 @@
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
@@ -9,24 +8,18 @@ using System.Collections.Generic;
namespace FlashTools.Internal {
[CustomEditor(typeof(SwfAsset)), CanEditMultipleObjects]
public class SwfAssetEditor : Editor {
List<SwfAsset> _assets = new List<SwfAsset>();
bool _settingsFoldout = false;
List<SwfAsset> _assets = new List<SwfAsset>();
//
//
//
static string GetAssetPath(SwfAsset asset) {
return asset
? AssetDatabase.GetAssetPath(asset)
: string.Empty;
}
static string GetSwfPath(SwfAsset asset) {
var asset_path = GetAssetPath(asset);
return string.IsNullOrEmpty(asset_path)
? string.Empty
: Path.ChangeExtension(asset_path, ".swf");
static SwfSettings _defaultSettingsCache = null;
static SwfSettings GetDefaultSettings() {
if ( !_defaultSettingsCache ) {
_defaultSettingsCache = SwfSettings.GetHolder();
}
return _defaultSettingsCache;
}
//
@@ -38,30 +31,25 @@ namespace FlashTools.Internal {
}
static void OverriddenSettingsToDefault(SwfAsset asset) {
asset.Overridden = SwfSettings.GetDefault();
asset.Overridden = GetDefaultSettings().Settings;
}
static void ApplyOverriddenSettings(SwfAsset asset) {
if ( File.Exists(GetSwfPath(asset)) ) {
asset.Settings = asset.Overridden;
ReconvertAsset(asset);
} else {
Debug.LogErrorFormat(
"Swf source for asset not found: '{0}'",
GetSwfPath(asset));
RevertOverriddenSettings(asset);
}
asset.Settings = asset.Overridden;
ReconvertAsset(asset);
}
static void ReconvertAsset(SwfAsset asset) {
AssetDatabase.ImportAsset(GetSwfPath(asset));
asset.Converting = new SwfAsset.ConvertingState();
AssetDatabase.ImportAsset(
AssetDatabase.GetAssetPath(asset));
}
//
//
//
void AllAssetsForeach(Action<SwfAsset> act) {
void AllAssetsForeach(System.Action<SwfAsset> act) {
foreach ( var asset in _assets ) {
act(asset);
}
@@ -79,6 +67,10 @@ namespace FlashTools.Internal {
AllAssetsForeach(p => ApplyOverriddenSettings(p));
}
void ReconvertAllAsset() {
AllAssetsForeach(p => ReconvertAsset(p));
}
//
//
//
@@ -105,39 +97,34 @@ namespace FlashTools.Internal {
}
}
void DrawGUISettings() {
_settingsFoldout = EditorGUILayout.Foldout(_settingsFoldout, "Settings");
if ( _settingsFoldout ) {
var it = SwfEditorUtils.GetPropertyByName(serializedObject, "Overridden");
while ( it.Next(true) ) {
EditorGUILayout.PropertyField(it, true);
}
DrawGUISettingsControls();
}
}
void DrawGUISettingsControls() {
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
{
var default_settings = SwfSettings.GetDefault();
SwfEditorUtils.DoWithEnabledGUI(
_assets.Any(p => !p.Overridden.CheckEquals(default_settings)), () => {
if ( GUILayout.Button("Default") ) {
AllOverriddenSettingsToDefault();
}
});
SwfEditorUtils.DoWithEnabledGUI(
_assets.Any(p => !p.Overridden.CheckEquals(p.Settings)), () => {
if ( GUILayout.Button("Revert") ) {
RevertAllOverriddenSettings();
}
if ( GUILayout.Button("Apply") ) {
ApplyAllOverriddenSettings();
}
});
var prop = SwfEditorUtils.GetPropertyByName(serializedObject, "Overridden");
if ( prop.isExpanded ) {
GUILayout.BeginHorizontal();
{
if ( GUILayout.Button("Reconvert") ) {
ReconvertAllAsset();
}
GUILayout.FlexibleSpace();
var default_settings = GetDefaultSettings().Settings;
SwfEditorUtils.DoWithEnabledGUI(
_assets.Any(p => !p.Overridden.CheckEquals(default_settings)), () => {
if ( GUILayout.Button("Default") ) {
AllOverriddenSettingsToDefault();
}
});
SwfEditorUtils.DoWithEnabledGUI(
_assets.Any(p => !p.Overridden.CheckEquals(p.Settings)), () => {
if ( GUILayout.Button("Revert") ) {
RevertAllOverriddenSettings();
}
if ( GUILayout.Button("Apply") ) {
ApplyAllOverriddenSettings();
}
});
}
GUILayout.EndHorizontal();
}
GUILayout.EndHorizontal();
}
// ---------------------------------------------------------------------
@@ -147,8 +134,7 @@ namespace FlashTools.Internal {
// ---------------------------------------------------------------------
void OnEnable() {
_assets = targets.OfType<SwfAsset>().ToList();
_settingsFoldout = true;
_assets = targets.OfType<SwfAsset>().ToList();
}
void OnDisable() {
@@ -158,7 +144,7 @@ namespace FlashTools.Internal {
public override void OnInspectorGUI() {
serializedObject.Update();
DrawDefaultInspector();
DrawGUISettings();
DrawGUISettingsControls();
if ( GUI.changed ) {
serializedObject.ApplyModifiedProperties();
}

View File

@@ -1,7 +1,6 @@
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
@@ -24,6 +23,12 @@ namespace FlashTools.Internal {
: Path.ChangeExtension(clip_path, ".prefab");
}
static int GetFrameCount(SwfClipAsset clip) {
return clip != null ? clip.Sequences.Aggregate(0, (acc, seq) => {
return seq.Frames.Count + acc;
}) : 0;
}
//
//
//
@@ -90,9 +95,21 @@ namespace FlashTools.Internal {
//
//
void DrawGUIFrameCount() {
var counts = _clips.Select(p => GetFrameCount(p));
var mixed_value = counts.GroupBy(p => p).Count() > 1;
SwfEditorUtils.DoWithEnabledGUI(false, () => {
SwfEditorUtils.DoWithMixedValue(
mixed_value, () => {
EditorGUILayout.IntField("Frame count", counts.First());
});
});
}
void DrawGUISequences() {
SwfEditorUtils.DoWithEnabledGUI(false, () => {
var sequences_prop = SwfEditorUtils.GetPropertyByName(serializedObject, "Sequences");
var sequences_prop = SwfEditorUtils.GetPropertyByName(
serializedObject, "Sequences");
if ( sequences_prop.isArray ) {
SwfEditorUtils.DoWithMixedValue(
sequences_prop.hasMultipleDifferentValues, () => {
@@ -103,16 +120,14 @@ namespace FlashTools.Internal {
}
void DrawGUIControls() {
GUILayout.BeginHorizontal();
{
SwfEditorUtils.DoHorizontalGUI(() => {
if ( GUILayout.Button("Create prefab") ) {
CreateAllClipsPrefabs();
}
if ( GUILayout.Button("Instance to scene") ) {
CreateAllClipsOnScene();
}
}
GUILayout.EndHorizontal();
});
}
// ---------------------------------------------------------------------
@@ -122,19 +137,22 @@ namespace FlashTools.Internal {
// ---------------------------------------------------------------------
void OnEnable() {
_clips = targets
.OfType<SwfClipAsset>()
.ToList();
_clips = targets.OfType<SwfClipAsset>().ToList();
}
public override void OnInspectorGUI() {
serializedObject.Update();
DrawDefaultInspector();
DrawGUIFrameCount();
DrawGUISequences();
DrawGUIControls();
if ( GUI.changed ) {
serializedObject.ApplyModifiedProperties();
}
}
public override bool RequiresConstantRepaint() {
return true;
}
}
}

View File

@@ -0,0 +1,179 @@
using UnityEngine;
using UnityEditor;
using System.Linq;
namespace FlashTools.Internal {
[CustomPreview(typeof(SwfClipAsset))]
public class SwfClipAssetPreview : ObjectPreview {
int _sequence = 0;
static MaterialPropertyBlock _matPropBlock = null;
static PreviewRenderUtility _previewUtils = null;
Texture2D targetAtlas {
get {
var clip = target as SwfClipAsset;
return clip.Atlas;
}
}
int targetSequenceCount {
get {
var clip = target as SwfClipAsset;
return clip && clip.Sequences != null
? clip.Sequences.Count
: 0;
}
}
SwfClipAsset.Frame targetFrame {
get {
var clip = target as SwfClipAsset;
return GetFrameForClip(clip, _sequence);
}
}
SwfClipAsset.Sequence targetSequence {
get {
var clip = target as SwfClipAsset;
return GetSequenceForClip(clip, _sequence);
}
}
bool isTargetValidForPreview {
get {
var atlas = targetAtlas;
var frame = targetFrame;
var sequence = targetSequence;
return
atlas &&
frame != null &&
sequence != null &&
frame.CachedMesh && frame.CachedMesh.vertexCount > 0;
}
}
static SwfClipAsset.Frame GetFrameForClip(SwfClipAsset clip, int sequence_index) {
var sequence = GetSequenceForClip(clip, sequence_index);
var frames = sequence != null && sequence.Frames != null && sequence.Frames.Count > 0
? sequence.Frames
: null;
var frame_time = (float)(EditorApplication.timeSinceStartup * clip.FrameRate);
return frames != null
? frames[Mathf.FloorToInt(frame_time) % frames.Count]
: null;
}
static SwfClipAsset.Sequence GetSequenceForClip(SwfClipAsset clip, int sequence_index) {
return clip && clip.Sequences != null && clip.Sequences.Count > 0
? clip.Sequences[Mathf.Abs(sequence_index) % clip.Sequences.Count]
: null;
}
static Bounds CalculateBoundsForSequence(SwfClipAsset.Sequence sequence) {
var bounds = sequence != null && sequence.Frames != null && sequence.Frames.Count > 0
? sequence.Frames
.Where (p => !!p.CachedMesh)
.Select(p => p.CachedMesh.bounds)
: new Bounds[0];
var result = bounds.Any() ? bounds.First() : new Bounds();
foreach ( var bound in bounds ) {
result.Encapsulate(bound);
}
return result;
}
static void ConfigureCameraForSequence(Camera camera, SwfClipAsset.Sequence sequence) {
var bounds = CalculateBoundsForSequence(sequence);
camera.orthographic = true;
camera.orthographicSize = Mathf.Max(
Mathf.Abs(bounds.extents.x),
Mathf.Abs(bounds.extents.y));
camera.transform.position = new Vector3(
bounds.center.x,
bounds.center.y,
-10.0f);
}
// ---------------------------------------------------------------------
//
// Functions
//
// ---------------------------------------------------------------------
public void SetCurrentSequence(string sequence_name) {
var clip = target as SwfClipAsset;
_sequence = clip && clip.Sequences != null
? Mathf.Max(0, clip.Sequences.FindIndex(p => p.Name == sequence_name))
: 0;
}
// ---------------------------------------------------------------------
//
// Messages
//
// ---------------------------------------------------------------------
public override void Initialize(Object[] targets) {
base.Initialize(targets);
if ( _matPropBlock == null ) {
_matPropBlock = new MaterialPropertyBlock();
}
if ( _previewUtils == null ) {
_previewUtils = new PreviewRenderUtility();
}
}
public override bool HasPreviewGUI() {
return true;
}
public override void OnPreviewSettings() {
var any_multi_sequences = m_Targets
.OfType<SwfClipAsset>()
.Any(p => p.Sequences != null && p.Sequences.Count > 1);
if ( any_multi_sequences && GUILayout.Button("<", EditorStyles.miniButton) ) {
--_sequence;
}
var sequence_names = m_Targets
.OfType<SwfClipAsset>()
.Select (p => GetSequenceForClip(p, _sequence))
.Where (p => p != null && !string.IsNullOrEmpty(p.Name))
.Select (p => p.Name)
.ToArray();
var label_text = string.Empty;
for ( int i = 0, e = sequence_names.Length; i < e; ++i ) {
label_text += string.Format(
i < e - 1 ? "{0}, " : "{0}",
sequence_names[i]);
}
GUILayout.Label(label_text, EditorStyles.whiteLabel);
if ( any_multi_sequences && GUILayout.Button(">", EditorStyles.miniButton) ) {
++_sequence;
}
}
public override void OnPreviewGUI(Rect r, GUIStyle background) {
if ( Event.current.type == EventType.Repaint ) {
if ( isTargetValidForPreview ) {
_previewUtils.BeginPreview(r, background);
{
_matPropBlock.SetTexture("_MainTex", targetAtlas);
ConfigureCameraForSequence(_previewUtils.m_Camera, targetSequence);
var frame = targetFrame;
for ( var i = 0; i < frame.Materials.Length; ++i ) {
_previewUtils.DrawMesh(
frame.CachedMesh,
Matrix4x4.identity,
frame.Materials[i],
i,
_matPropBlock);
}
_previewUtils.m_Camera.Render();
}
_previewUtils.EndAndDrawPreview(r);
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 61493c5b6491d4432a831d25914ed92a
timeCreated: 1473360782
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +1,6 @@
using UnityEngine;
using UnityEditor;
using System;
using System.Linq;
using System.Collections.Generic;
@@ -10,30 +9,21 @@ namespace FlashTools.Internal {
public class SwfClipControllerEditor : Editor {
List<SwfClipController> _controllers = new List<SwfClipController>();
void AllControllersForeach(Action<SwfClipController> act) {
void AllControllersForeach(System.Action<SwfClipController> act) {
foreach ( var controller in _controllers ) {
act(controller);
}
}
void DrawClipControls() {
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
{
SwfEditorUtils.DoRightHorizontalGUI(() => {
if ( GUILayout.Button("Stop") ) {
AllControllersForeach(p => p.Stop());
}
if ( GUILayout.Button("Pause") ) {
AllControllersForeach(p => p.Pause());
}
if ( GUILayout.Button("Resume") ) {
AllControllersForeach(p => p.Resume());
AllControllersForeach(ctrl => ctrl.Stop(ctrl.isStopped));
}
if ( GUILayout.Button("Play") ) {
AllControllersForeach(p => p.Play());
AllControllersForeach(ctrl => ctrl.Play(ctrl.isPlaying));
}
}
GUILayout.EndHorizontal();
});
}
// ---------------------------------------------------------------------
@@ -43,9 +33,7 @@ namespace FlashTools.Internal {
// ---------------------------------------------------------------------
void OnEnable() {
_controllers = targets
.OfType<SwfClipController>()
.ToList();
_controllers = targets.OfType<SwfClipController>().ToList();
}
public override void OnInspectorGUI() {

View File

@@ -1,19 +1,17 @@
using UnityEngine;
using UnityEditor;
using System;
using System.Linq;
using System.Collections.Generic;
namespace FlashTools.Internal {
[CustomEditor(typeof(SwfClip)), CanEditMultipleObjects]
public class SwfClipEditor : Editor {
List<SwfClip> _clips = new List<SwfClip>();
List<SwfClip> _clips = new List<SwfClip>();
Dictionary<SwfClip, SwfClipAssetPreview> _previews = new Dictionary<SwfClip, SwfClipAssetPreview>();
void AllClipsForeachWithUndo(Action<SwfClip> act) {
Undo.RecordObjects(
_clips.ToArray(),
"Inspector");
void AllClipsForeachWithUndo(System.Action<SwfClip> act) {
Undo.RecordObjects(_clips.ToArray(), "Inspector");
foreach ( var clip in _clips ) {
act(clip);
EditorUtility.SetDirty(clip);
@@ -46,48 +44,52 @@ namespace FlashTools.Internal {
});
}
bool IsAllClipsHasOneClip() {
foreach ( var clip in _clips ) {
if ( !clip.clip ) {
return false;
}
if ( clip.clip != _clips.First().clip ) {
return false;
}
}
return true;
}
List<string> GetAllSequences(bool include_empty) {
var seq_set = new HashSet<string>(_clips
.Where(p => p.clip)
.SelectMany(p => p.clip.Sequences)
.Select(p => p.Name));
if ( include_empty ) {
seq_set.Add(string.Empty);
var result = new List<string>();
var result_clips = _clips
.Where (p => p.clip && p.clip.Sequences.Count > 0)
.Select(p => p.clip.Sequences)
.Where (p => p.All(s => !string.IsNullOrEmpty(s.Name)))
.ToList();
if ( result_clips.Count > 0 ) {
result = result_clips.First()
.Select(p => p.Name)
.ToList();
var sequences_enum = result_clips
.Select(p => p.Select(s => s.Name));
foreach ( var sequences in sequences_enum ) {
result = result
.Where(p => sequences.Contains(p))
.ToList();
}
if ( include_empty ) {
result.Add(string.Empty);
}
}
return seq_set.ToList();
return result;
}
void DrawSequence() {
if ( IsAllClipsHasOneClip() ) {
var all_sequences = GetAllSequences(true);
if ( all_sequences.Count > 0 ) {
var sequence_prop = SwfEditorUtils.GetPropertyByName(serializedObject, "_sequence");
SwfEditorUtils.DoWithMixedValue(
sequence_prop.hasMultipleDifferentValues, () => {
var all_sequences = GetAllSequences(true);
var sequence_index = EditorGUILayout.Popup(
"Sequence",
sequence_prop.hasMultipleDifferentValues
? all_sequences.FindIndex(p => string.IsNullOrEmpty(p))
: all_sequences.FindIndex(p => p == sequence_prop.stringValue),
all_sequences.ToArray());
var new_sequence = all_sequences[sequence_index];
if ( !string.IsNullOrEmpty(new_sequence) ) {
if ( sequence_prop.hasMultipleDifferentValues ) {
sequence_prop.stringValue = string.Empty;
if ( sequence_index >= 0 && sequence_index < all_sequences.Count ) {
var new_sequence = all_sequences[sequence_index];
if ( !string.IsNullOrEmpty(new_sequence) ) {
if ( sequence_prop.hasMultipleDifferentValues ) {
sequence_prop.stringValue = string.Empty;
}
sequence_prop.stringValue = new_sequence;
sequence_prop.serializedObject.ApplyModifiedProperties();
}
sequence_prop.stringValue = new_sequence;
sequence_prop.serializedObject.ApplyModifiedProperties();
}
});
}
@@ -107,9 +109,7 @@ namespace FlashTools.Internal {
void DrawClipControls() {
EditorGUILayout.Space();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
{
SwfEditorUtils.DoCenterHorizontalGUI(() => {
if ( GUILayout.Button(new GUIContent("<<", "to begin frame")) ) {
AllClipsForeachWithUndo(p => p.ToBeginFrame());
}
@@ -125,9 +125,16 @@ namespace FlashTools.Internal {
if ( GUILayout.Button(new GUIContent(">>", "to end frame")) ) {
AllClipsForeachWithUndo(p => p.ToEndFrame());
}
});
}
void SetupPreviews() {
_previews.Clear();
foreach ( var clip in _clips.Where(p => !!p.clip) ) {
var preview = new SwfClipAssetPreview();
preview.Initialize(new Object[]{clip.clip});
_previews.Add(clip, preview);
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
// ---------------------------------------------------------------------
@@ -137,9 +144,8 @@ namespace FlashTools.Internal {
// ---------------------------------------------------------------------
void OnEnable() {
_clips = targets
.OfType<SwfClip>()
.ToList();
_clips = targets.OfType<SwfClip>().ToList();
SetupPreviews();
}
public override void OnInspectorGUI() {
@@ -149,6 +155,26 @@ namespace FlashTools.Internal {
DrawCurrentFrame();
if ( GUI.changed ) {
serializedObject.ApplyModifiedProperties();
SetupPreviews();
}
}
public override bool RequiresConstantRepaint() {
return _previews.Count > 0;
}
public override bool HasPreviewGUI() {
return _previews.Count > 0;
}
public override void OnPreviewGUI(Rect r, GUIStyle background) {
if ( Event.current.type == EventType.Repaint ) {
SwfClipAssetPreview preview;
var clip = target as SwfClip;
if ( _previews.TryGetValue(clip, out preview) ) {
preview.SetCurrentSequence(clip.sequence);
preview.DrawPreview(r);
}
}
}
}

View File

@@ -1,19 +1,76 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
namespace FlashTools.Internal {
[CustomEditor(typeof(SwfManager))]
public class SwfManagerEditor : Editor {
SwfManager _manager = null;
SwfManager _manager = null;
SwfList<SwfClipController> _controllers = new SwfList<SwfClipController>();
bool _groupsFoldout = true;
void DrawAnimationCount() {
void DrawCounts() {
SwfEditorUtils.DoWithEnabledGUI(false, () => {
EditorGUILayout.IntField(
"Clip count",
_manager.AllClipCount);
_manager.clipCount);
EditorGUILayout.IntField(
"Controller count",
_manager.controllerCount);
});
}
void DrawControls() {
SwfEditorUtils.DoRightHorizontalGUI(() => {
if ( _manager.isPaused && GUILayout.Button("Resume") ) {
_manager.Resume();
}
if ( _manager.isPlaying && GUILayout.Button("Pause") ) {
_manager.Pause();
}
});
}
void DrawGroupControls() {
var group_names = GetAllGroupNames();
if ( group_names.Count > 0 ) {
_groupsFoldout = EditorGUILayout.Foldout(_groupsFoldout, "Groups");
if ( _groupsFoldout ) {
foreach ( var group_name in group_names ) {
SwfEditorUtils.DoWithEnabledGUI(false, () => {
EditorGUILayout.TextField("Name", group_name);
});
EditorGUI.BeginChangeCheck();
var new_rate_scale = EditorGUILayout.FloatField(
"Rate Scale", _manager.GetGroupRateScale(group_name));
if ( EditorGUI.EndChangeCheck() ) {
_manager.SetGroupRateScale(group_name, new_rate_scale);
}
SwfEditorUtils.DoRightHorizontalGUI(() => {
if ( _manager.IsGroupPaused(group_name) && GUILayout.Button("Resume") ) {
_manager.ResumeGroup(group_name);
}
if ( _manager.IsGroupPlaying(group_name) && GUILayout.Button("Pause") ) {
_manager.PauseGroup(group_name);
}
});
}
}
}
}
HashSet<string> GetAllGroupNames() {
var result = new HashSet<string>();
for ( int i = 0, e = _controllers.Count; i < e; ++i ) {
var ctrl = _controllers[i];
if ( !string.IsNullOrEmpty(ctrl.groupName) ) {
result.Add(ctrl.groupName);
}
}
return result;
}
// ---------------------------------------------------------------------
//
// Messages
@@ -22,11 +79,20 @@ namespace FlashTools.Internal {
void OnEnable() {
_manager = target as SwfManager;
_manager.GetAllControllers(_controllers);
}
public override void OnInspectorGUI() {
serializedObject.Update();
DrawDefaultInspector();
DrawAnimationCount();
DrawCounts();
if ( Application.isPlaying ) {
DrawControls();
DrawGroupControls();
}
if ( GUI.changed ) {
serializedObject.ApplyModifiedProperties();
}
}
}
}

View File

@@ -3,7 +3,6 @@ using UnityEditor;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
namespace FlashTools.Internal {
@@ -26,26 +25,157 @@ namespace FlashTools.Internal {
static void SwfAssetProcess(SwfAsset asset) {
try {
var atlas_asset = LoadAtlasAsset(asset);
if ( atlas_asset != asset.Atlas ) {
asset.Atlas = atlas_asset;
ConfigureAtlas(asset);
ConfigureClips(asset);
if ( asset.Converting.Stage == 0 ) {
var new_data = ConfigureBitmaps(
asset,
SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data));
asset.Data = SwfEditorUtils.CompressAsset(new_data);
++asset.Converting.Stage;
EditorUtility.SetDirty(asset);
AssetDatabase.SaveAssets();
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(asset));
} else if ( asset.Converting.Stage == 1 ) {
asset.Atlas = LoadAssetAtlas(asset);
if ( asset.Atlas ) {
ConfigureAtlas(asset);
ConfigureClips(
asset,
SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data));
}
++asset.Converting.Stage;
EditorUtility.SetDirty(asset);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(asset));
}
ConfigureAssetClips(asset);
} catch ( Exception e ) {
Debug.LogErrorFormat(
"Postprocess swf asset error: {0}",
"<b>[FlashTools]</b> Postprocess swf asset error: {0}",
e.Message);
SwfEditorUtils.DeleteAssetWithDepends(asset);
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(asset));
} finally {
if ( asset ) {
UpdateAssetClips(asset);
}
}
}
static Texture2D LoadAtlasAsset(SwfAsset asset) {
static Texture2D LoadAssetAtlas(SwfAsset asset) {
return AssetDatabase.LoadAssetAtPath<Texture2D>(
SwfEditorUtils.GetAtlasPathFromAsset(asset));
GetAtlasPath(asset));
}
static string GetAtlasPath(SwfAsset asset) {
if ( asset.Atlas ) {
return AssetDatabase.GetAssetPath(asset.Atlas);
} else {
var asset_path = AssetDatabase.GetAssetPath(asset);
return Path.ChangeExtension(asset_path, "._Atlas_.png");
}
}
// ---------------------------------------------------------------------
//
// ConfigureBitmaps
//
// ---------------------------------------------------------------------
static SwfAssetData ConfigureBitmaps(SwfAsset asset, SwfAssetData data) {
var textures = data.Bitmaps
.Where (p => p.Redirect == 0)
.Select (p => new KeyValuePair<ushort, Texture2D>(
p.Id,
LoadTextureFromData(p)))
.ToList();
var rects = PackAndSaveBitmapsAtlas(
GetAtlasPath(asset),
textures.Select(p => p.Value).ToArray(),
asset.Settings);
for ( var i = 0; i < data.Bitmaps.Count; ++i ) {
var bitmap = data.Bitmaps[i];
var texture_key = bitmap.Redirect > 0 ? bitmap.Redirect : bitmap.Id;
bitmap.SourceRect = SwfRectData.FromURect(
rects[textures.FindIndex(p => p.Key == texture_key)]);
}
return data;
}
static Texture2D LoadTextureFromData(SwfBitmapData bitmap) {
var texture = new Texture2D(
bitmap.RealWidth, bitmap.RealHeight,
TextureFormat.ARGB32, false);
texture.LoadRawTextureData(bitmap.ARGB32);
return texture;
}
struct BitmapsAtlasInfo {
public Texture2D Atlas;
public Rect[] Rects;
}
static Rect[] PackAndSaveBitmapsAtlas(
string atlas_path, Texture2D[] textures, SwfSettingsData settings)
{
var atlas_info = PackBitmapsAtlas(textures, settings);
RevertTexturePremultipliedAlpha(atlas_info.Atlas);
File.WriteAllBytes(atlas_path, atlas_info.Atlas.EncodeToPNG());
GameObject.DestroyImmediate(atlas_info.Atlas, true);
AssetDatabase.ImportAsset(atlas_path);
return atlas_info.Rects;
}
static BitmapsAtlasInfo PackBitmapsAtlas(
Texture2D[] textures, SwfSettingsData settings)
{
var atlas_padding = Mathf.Max(0, settings.AtlasPadding);
var max_atlas_size = Mathf.Max(32, settings.AtlasPowerOfTwo
? Mathf.ClosestPowerOfTwo(settings.MaxAtlasSize)
: settings.MaxAtlasSize);
var atlas = new Texture2D(0, 0);
var rects = atlas.PackTextures(textures, atlas_padding, max_atlas_size);
while ( rects == null ) {
max_atlas_size = Mathf.NextPowerOfTwo(max_atlas_size + 1);
rects = atlas.PackTextures(textures, atlas_padding, max_atlas_size);
}
return settings.AtlasForceSquare && atlas.width != atlas.height
? BitmapsAtlasToSquare(atlas, rects)
: new BitmapsAtlasInfo{Atlas = atlas, Rects = rects};
}
static BitmapsAtlasInfo BitmapsAtlasToSquare(Texture2D atlas, Rect[] rects) {
var atlas_size = Mathf.Max(atlas.width, atlas.height);
var atlas_scale = new Vector2(atlas.width, atlas.height) / atlas_size;
var new_atlas = new Texture2D(atlas_size, atlas_size, TextureFormat.ARGB32, false);
for ( var i = 0; i < rects.Length; ++i ) {
var new_position = rects[i].position;
new_position.Scale(atlas_scale);
var new_size = rects[i].size;
new_size.Scale(atlas_scale);
rects[i] = new Rect(new_position, new_size);
}
var fill_pixels = new Color32[atlas_size * atlas_size];
for ( var i = 0; i < atlas_size * atlas_size; ++i ) {
fill_pixels[i] = new Color(1,1,1,0);
}
new_atlas.SetPixels32(fill_pixels);
new_atlas.SetPixels32(0, 0, atlas.width, atlas.height, atlas.GetPixels32());
new_atlas.Apply();
GameObject.DestroyImmediate(atlas, true);
return new BitmapsAtlasInfo{
Atlas = new_atlas,
Rects = rects};
}
static void RevertTexturePremultipliedAlpha(Texture2D texture) {
var pixels = texture.GetPixels();
for ( var i = 0; i < pixels.Length; ++i ) {
var c = pixels[i];
if ( c.a > 0 ) {
c.r /= c.a;
c.g /= c.a;
c.b /= c.a;
}
pixels[i] = c;
}
texture.SetPixels(pixels);
texture.Apply();
}
// ---------------------------------------------------------------------
@@ -55,28 +185,21 @@ namespace FlashTools.Internal {
// ---------------------------------------------------------------------
static void ConfigureAtlas(SwfAsset asset) {
var atlas_importer = GetBitmapsAtlasImporter(asset);
var atlas_importer_size = GetSizeFromTextureImporter(atlas_importer);
atlas_importer.spritesheet = asset.Data.Bitmaps
.Select(bitmap => new SpriteMetaData{
name = bitmap.Id.ToString(),
rect = new Rect(
bitmap.SourceRect.xMin * atlas_importer_size.x,
bitmap.SourceRect.yMin * atlas_importer_size.y,
bitmap.SourceRect.width * atlas_importer_size.x,
bitmap.SourceRect.height * atlas_importer_size.y)})
.ToArray();
var atlas_path = AssetDatabase.GetAssetPath(asset.Atlas);
var atlas_importer = GetBitmapsAtlasImporter(asset);
atlas_importer.spritesheet = new SpriteMetaData[0];
atlas_importer.textureType = TextureImporterType.Sprite;
atlas_importer.spriteImportMode = SpriteImportMode.Multiple;
atlas_importer.spritePixelsPerUnit = asset.Settings.PixelsPerUnit;
atlas_importer.mipmapEnabled = asset.Settings.GenerateMipMaps;
atlas_importer.filterMode = SwfAtlasFilterToImporterFilter(asset.Settings.AtlasTextureFilter);
atlas_importer.textureFormat = SwfAtlasFormatToImporterFormat(asset.Settings.AtlasTextureFormat);
AssetDatabase.ImportAsset(SwfEditorUtils.GetAtlasPathFromAsset(asset));
AssetDatabase.WriteImportSettingsIfDirty(atlas_path);
AssetDatabase.ImportAsset(atlas_path);
}
static TextureImporter GetBitmapsAtlasImporter(SwfAsset asset) {
var atlas_path = SwfEditorUtils.GetAtlasPathFromAsset(asset);
var atlas_path = AssetDatabase.GetAssetPath(asset.Atlas);
var atlas_importer = AssetImporter.GetAtPath(atlas_path) as TextureImporter;
if ( !atlas_importer ) {
throw new UnityException(string.Format(
@@ -86,14 +209,6 @@ namespace FlashTools.Internal {
return atlas_importer;
}
static Vector2 GetSizeFromTextureImporter(TextureImporter importer) {
var method_args = new object[2]{0,0};
typeof(TextureImporter)
.GetMethod("GetWidthAndHeight", BindingFlags.NonPublic | BindingFlags.Instance)
.Invoke(importer, method_args);
return new Vector2((int)method_args[0], (int)method_args[1]);
}
static FilterMode SwfAtlasFilterToImporterFilter(
SwfSettingsData.AtlasFilter filter)
{
@@ -136,44 +251,45 @@ namespace FlashTools.Internal {
//
// ---------------------------------------------------------------------
static void ConfigureClips(SwfAsset asset) {
foreach ( var symbol in asset.Data.Symbols ) {
ConfigureClip(asset, symbol);
static SwfAssetData ConfigureClips(SwfAsset asset, SwfAssetData data) {
asset.Clips = asset.Clips.Where(p => !!p).Distinct().ToList();
foreach ( var symbol in data.Symbols ) {
ConfigureClip(asset, data, symbol);
}
return data;
}
static void ConfigureClip(SwfAsset asset, SwfAssetData data, SwfSymbolData symbol) {
var clip_asset = asset.Clips.FirstOrDefault(p => p.Name == symbol.Name);
if ( clip_asset ) {
ConfigureClipAsset(clip_asset, asset, data, symbol);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(clip_asset));
} else {
var asset_path = AssetDatabase.GetAssetPath(asset);
var clip_asset_path = Path.ChangeExtension(asset_path, symbol.Name + ".asset");
SwfEditorUtils.LoadOrCreateAsset<SwfClipAsset>(clip_asset_path, new_clip_asset => {
ConfigureClipAsset(new_clip_asset, asset, data, symbol);
asset.Clips.Add(new_clip_asset);
});
}
}
static void ConfigureClip(SwfAsset asset, SwfSymbolData symbol) {
var clip_asset_path = Path.ChangeExtension(
AssetDatabase.GetAssetPath(asset),
symbol.Name + ".asset");
var clip_asset = SwfEditorUtils
.LoadOrCreateAsset<SwfClipAsset>(clip_asset_path);
static void ConfigureClipAsset(
SwfClipAsset clip_asset, SwfAsset asset, SwfAssetData data, SwfSymbolData symbol)
{
clip_asset.Name = symbol.Name;
clip_asset.Atlas = asset.Atlas;
clip_asset.FrameRate = asset.Data.FrameRate;
clip_asset.Sequences = LoadClipSequences(asset, symbol);
ConfigureClipSubAssets(clip_asset);
asset.Clips.Add(clip_asset);
}
static void ConfigureClipSubAssets(SwfClipAsset clip_asset) {
SwfEditorUtils.RemoveAllSubAssets(
AssetDatabase.GetAssetPath(clip_asset));
foreach ( var sequence in clip_asset.Sequences ) {
for ( var i = 0; i < sequence.Frames.Count; ++i ) {
var mesh = sequence.Frames[i].Mesh;
mesh.name = string.Format("{0}_{1}", sequence.Name, i);
AssetDatabase.AddObjectToAsset(mesh, clip_asset);
}
}
clip_asset.FrameRate = data.FrameRate;
clip_asset.Sequences = LoadClipSequences(asset, data, symbol);
}
static List<SwfClipAsset.Sequence> LoadClipSequences(
SwfAsset asset, SwfSymbolData symbol)
SwfAsset asset, SwfAssetData data, SwfSymbolData symbol)
{
var sequences = new List<SwfClipAsset.Sequence>();
if ( IsValidAssetsForFrame(asset, symbol) ) {
foreach ( var frame in symbol.Frames ) {
var baked_frame = BakeClipFrame(asset, frame);
var baked_frame = BakeClipFrame(asset, data, frame);
if ( !string.IsNullOrEmpty(frame.Name) &&
(sequences.Count < 1 || sequences.Last().Name != frame.Name) )
{
@@ -196,41 +312,42 @@ namespace FlashTools.Internal {
}
class BakedGroup {
public SwfInstanceData.Types Type;
public int ClipDepth;
public List<int> Triangles;
public Material Material;
public SwfInstanceData.Types Type;
public SwfBlendModeData.Types BlendMode;
public int ClipDepth;
public int StartVertex;
public int TriangleCount;
public Material Material;
}
static SwfClipAsset.Frame BakeClipFrame(
SwfAsset asset, SwfFrameData frame)
SwfAsset asset, SwfAssetData data, SwfFrameData frame)
{
List<Vector2> baked_uvs = new List<Vector2>();
List<Color> baked_mulcolors = new List<Color>();
List<Vector4> baked_addcolors = new List<Vector4>();
List<Vector3> baked_vertices = new List<Vector3>();
List<uint> baked_uvs = new List<uint>();
List<uint> baked_mulcolors = new List<uint>();
List<uint> baked_addcolors = new List<uint>();
List<Vector2> baked_vertices = new List<Vector2>();
List<BakedGroup> baked_groups = new List<BakedGroup>();
List<Material> baked_materials = new List<Material>();
foreach ( var inst in frame.Instances ) {
var bitmap = inst != null
? FindBitmapFromAssetData(asset.Data, inst.Bitmap)
? FindBitmapFromAssetData(data, inst.Bitmap)
: null;
if ( bitmap != null ) {
var width = bitmap.RealSize.x / 20.0f;
var height = bitmap.RealSize.y / 20.0f;
if ( bitmap != null && IsVisibleInstance(inst) ) {
var width = bitmap.RealWidth / 20.0f;
var height = bitmap.RealHeight / 20.0f;
var v0 = new Vector3( 0, 0, 0);
var v1 = new Vector3(width, 0, 0);
var v2 = new Vector3(width, height, 0);
var v3 = new Vector3( 0, height, 0);
var v0 = new Vector2( 0, 0);
var v1 = new Vector2(width, 0);
var v2 = new Vector2(width, height);
var v3 = new Vector2( 0, height);
var matrix =
Matrix4x4.Scale(new Vector3(
+1.0f / asset.Settings.PixelsPerUnit,
-1.0f / asset.Settings.PixelsPerUnit,
+1.0f / asset.Settings.PixelsPerUnit)) *
inst.Matrix;
Matrix4x4.Scale(
new Vector3(1.0f, -1.0f, 1.0f) /
asset.Settings.PixelsPerUnit) *
inst.Matrix.ToUMatrix();
baked_vertices.Add(matrix.MultiplyPoint3x4(v0));
baked_vertices.Add(matrix.MultiplyPoint3x4(v1));
@@ -238,39 +355,39 @@ namespace FlashTools.Internal {
baked_vertices.Add(matrix.MultiplyPoint3x4(v3));
var source_rect = bitmap.SourceRect;
baked_uvs.Add(new Vector2(source_rect.xMin, source_rect.yMin));
baked_uvs.Add(new Vector2(source_rect.xMax, source_rect.yMin));
baked_uvs.Add(new Vector2(source_rect.xMax, source_rect.yMax));
baked_uvs.Add(new Vector2(source_rect.xMin, source_rect.yMax));
baked_uvs.Add(SwfUtils.PackUV(source_rect.xMin, source_rect.yMin));
baked_uvs.Add(SwfUtils.PackUV(source_rect.xMax, source_rect.yMax));
baked_mulcolors.Add(inst.ColorTrans.Mul);
baked_mulcolors.Add(inst.ColorTrans.Mul);
baked_mulcolors.Add(inst.ColorTrans.Mul);
baked_mulcolors.Add(inst.ColorTrans.Mul);
uint mul_pack0, mul_pack1;
SwfUtils.PackFColorToUInts(
inst.ColorTrans.mulColor,
out mul_pack0, out mul_pack1);
baked_mulcolors.Add(mul_pack0);
baked_mulcolors.Add(mul_pack1);
baked_addcolors.Add(inst.ColorTrans.Add);
baked_addcolors.Add(inst.ColorTrans.Add);
baked_addcolors.Add(inst.ColorTrans.Add);
baked_addcolors.Add(inst.ColorTrans.Add);
uint add_pack0, add_pack1;
SwfUtils.PackFColorToUInts(
inst.ColorTrans.addColor,
out add_pack0, out add_pack1);
baked_addcolors.Add(add_pack0);
baked_addcolors.Add(add_pack1);
if ( baked_groups.Count == 0 ||
baked_groups[baked_groups.Count - 1].Type != inst.Type ||
baked_groups[baked_groups.Count - 1].Type != inst.Type ||
baked_groups[baked_groups.Count - 1].BlendMode != inst.BlendMode.type ||
baked_groups[baked_groups.Count - 1].ClipDepth != inst.ClipDepth )
{
baked_groups.Add(new BakedGroup{
Type = inst.Type,
ClipDepth = inst.ClipDepth,
Triangles = new List<int>(),
Material = null
Type = inst.Type,
BlendMode = inst.BlendMode.type,
ClipDepth = inst.ClipDepth,
StartVertex = baked_vertices.Count - 4,
TriangleCount = 0,
Material = null
});
}
baked_groups.Last().Triangles.Add(baked_vertices.Count - 4 + 2);
baked_groups.Last().Triangles.Add(baked_vertices.Count - 4 + 1);
baked_groups.Last().Triangles.Add(baked_vertices.Count - 4 + 0);
baked_groups.Last().Triangles.Add(baked_vertices.Count - 4 + 0);
baked_groups.Last().Triangles.Add(baked_vertices.Count - 4 + 3);
baked_groups.Last().Triangles.Add(baked_vertices.Count - 4 + 2);
baked_groups.Last().TriangleCount += 6;
}
}
@@ -282,10 +399,10 @@ namespace FlashTools.Internal {
group.Material = settings_holder.GetIncrMaskMaterial();
break;
case SwfInstanceData.Types.Group:
group.Material = settings_holder.GetSimpleMaterial();
group.Material = settings_holder.GetSimpleMaterial(group.BlendMode);
break;
case SwfInstanceData.Types.Masked:
group.Material = settings_holder.GetMaskedMaterial(group.ClipDepth);
group.Material = settings_holder.GetMaskedMaterial(group.BlendMode, group.ClipDepth);
break;
case SwfInstanceData.Types.MaskReset:
group.Material = settings_holder.GetDecrMaskMaterial();
@@ -296,7 +413,6 @@ namespace FlashTools.Internal {
group.Type));
}
if ( group.Material ) {
group.Material.hideFlags = HideFlags.HideInInspector;
baked_materials.Add(group.Material);
} else {
throw new UnityException(string.Format(
@@ -305,20 +421,20 @@ namespace FlashTools.Internal {
}
}
var mesh = new Mesh();
mesh.subMeshCount = baked_groups.Count;
mesh.SetVertices(baked_vertices);
for ( var i = 0; i < baked_groups.Count; ++i ) {
mesh.SetTriangles(baked_groups[i].Triangles, i);
}
mesh.SetUVs(0, baked_uvs);
mesh.SetUVs(1, baked_addcolors);
mesh.SetColors(baked_mulcolors);
mesh.RecalculateNormals();
var mesh_data = new SwfClipAsset.MeshData{
SubMeshes = baked_groups
.Select(p => new SwfClipAsset.SubMeshData{
StartVertex = p.StartVertex,
IndexCount = p.TriangleCount})
.ToArray(),
Vertices = baked_vertices .ToArray(),
UVs = baked_uvs .ToArray(),
AddColors = baked_addcolors.ToArray(),
MulColors = baked_mulcolors.ToArray()};
return new SwfClipAsset.Frame{
Mesh = mesh,
Materials = baked_materials.ToArray()};
return new SwfClipAsset.Frame(
mesh_data,
baked_materials.ToArray());
}
static SwfBitmapData FindBitmapFromAssetData(SwfAssetData data, int bitmap_id) {
@@ -331,13 +447,18 @@ namespace FlashTools.Internal {
return null;
}
static bool IsVisibleInstance(SwfInstanceData inst) {
var result_color = inst.ColorTrans.ApplyToColor(Color.white);
return result_color.a >= 0.01f;
}
// ---------------------------------------------------------------------
//
// ConfigureAssetClips
// UpdateAssetClips
//
// ---------------------------------------------------------------------
static void ConfigureAssetClips(SwfAsset asset) {
static void UpdateAssetClips(SwfAsset asset) {
var clips = GameObject.FindObjectsOfType<SwfClip>();
foreach ( var clip in clips ) {
if ( clip && clip.clip && asset.Clips.Contains(clip.clip) ) {

View File

@@ -26,46 +26,38 @@ namespace FlashTools.Internal {
static void SwfFileProcess(string swf_path) {
var swf_asset_path = Path.ChangeExtension(swf_path, ".asset");
var swf_asset = AssetDatabase.LoadAssetAtPath<SwfAsset>(swf_asset_path);
if ( !swf_asset ) {
swf_asset = ScriptableObject.CreateInstance<SwfAsset>();
AssetDatabase.CreateAsset(swf_asset, swf_asset_path);
}
if ( LoadSwfAsset(swf_path, swf_asset) ) {
EditorUtility.SetDirty(swf_asset);
AssetDatabase.SaveAssets();
} else {
SwfEditorUtils.DeleteAssetWithDepends(swf_asset);
}
SwfEditorUtils.LoadOrCreateAsset<SwfAsset>(swf_asset_path, swf_asset => {
SafeLoadSwfAsset(swf_path, swf_asset);
});
}
static bool LoadSwfAsset(string swf_path, SwfAsset swf_asset) {
static void SafeLoadSwfAsset(string swf_path, SwfAsset swf_asset) {
try {
if ( swf_asset.Atlas ) {
AssetDatabase.DeleteAsset(
AssetDatabase.GetAssetPath(swf_asset.Atlas));
swf_asset.Atlas = null;
}
swf_asset.Data = LoadSwfAssetData(
swf_asset,
new SwfDecoder(swf_path));
return true;
var new_data = LoadSwfAssetData(swf_path);
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data);
swf_asset.Converting = new SwfAsset.ConvertingState();
} catch ( Exception e ) {
Debug.LogErrorFormat("Parsing swf error: {0}", e.Message);
return false;
Debug.LogErrorFormat(
"<b>[FlashTools]</b> Parsing swf error: {0}",
e.Message);
}
}
static SwfAssetData LoadSwfAssetData(
SwfAsset swf_asset, SwfDecoder swf_decoder)
{
static SwfAssetData LoadSwfAssetData(string swf_path) {
var library = new SwfLibrary();
var decoder = new SwfDecoder(swf_path);
return new SwfAssetData{
FrameRate = swf_decoder.UncompressedHeader.FrameRate,
Symbols = LoadSymbols(library, swf_decoder),
Bitmaps = LoadBitmaps(library, swf_asset)};
FrameRate = decoder.UncompressedHeader.FrameRate,
Symbols = LoadSymbols(library, decoder),
Bitmaps = LoadBitmaps(library)};
}
// ---------------------------------------------------------------------
//
// LoadSymbols
//
// ---------------------------------------------------------------------
static List<SwfSymbolData> LoadSymbols(
SwfLibrary library, SwfDecoder decoder)
{
@@ -104,91 +96,165 @@ namespace FlashTools.Internal {
return AddDisplayListToFrame(
library,
display_list,
Matrix4x4.identity,
SwfBlendModeData.identity,
SwfColorTransData.identity,
0,
0,
null,
Matrix4x4.identity,
SwfColorTransData.identity,
frame);
}
static SwfFrameData AddDisplayListToFrame(
SwfLibrary library,
SwfDisplayList display_list,
Matrix4x4 parent_matrix,
SwfBlendModeData parent_blend_mode,
SwfColorTransData parent_color_transform,
ushort parent_masked,
ushort parent_mask,
List<SwfInstanceData> parent_masks,
Matrix4x4 parent_matrix,
SwfColorTransData parent_color_transform,
SwfFrameData frame)
{
var inst_filter_types = display_list.Instances.Values
.Where(p => p.Visible && p.FilterList.Filters.Count > 0)
.SelectMany(p => p.FilterList.Filters)
.Select(p => p.Type)
.Distinct();
foreach ( var filter_type in inst_filter_types ) {
Debug.LogWarningFormat(
"<b>[FlashTools]</b> SwfSurfaceFilters. Unsupported filter type '{0}'",
filter_type);
}
var self_masks = new List<SwfInstanceData>();
foreach ( var inst in display_list.Instances.Values.Where(p => p.Visible) ) {
CheckSelfMasks(self_masks, inst.Depth, frame);
var child_matrix = parent_matrix * inst.Matrix.ToUnityMatrix();
var child_matrix = parent_matrix * inst.Matrix .ToUMatrix();
var child_blend_mode = parent_blend_mode * inst.BlendMode .ToBlendModeData();
var child_color_transform = parent_color_transform * inst.ColorTransform.ToColorTransData();
switch ( inst.Type ) {
case SwfDisplayInstanceType.Shape:
var shape_def = library.FindDefine<SwfLibraryShapeDefine>(inst.Id);
if ( shape_def != null ) {
for ( var i = 0; i < shape_def.Bitmaps.Length; ++i ) {
var bitmap_id = shape_def.Bitmaps[i];
var bitmap_matrix = i < shape_def.Matrices.Length ? shape_def.Matrices[i] : SwfMatrix.identity;
var bitmap_def = library.FindDefine<SwfLibraryBitmapDefine>(bitmap_id);
if ( bitmap_def != null ) {
var frame_inst_type =
(parent_mask > 0 || inst.ClipDepth > 0)
? SwfInstanceData.Types.Mask
: (parent_masked > 0 || self_masks.Count > 0)
? SwfInstanceData.Types.Masked
: SwfInstanceData.Types.Group;
var frame_inst_clip_depth =
(parent_mask > 0)
? parent_mask
: (inst.ClipDepth > 0)
? inst.ClipDepth
: parent_masked + self_masks.Count;
frame.Instances.Add(new SwfInstanceData{
Type = frame_inst_type,
ClipDepth = (ushort)frame_inst_clip_depth,
Bitmap = bitmap_id,
Matrix = child_matrix * bitmap_matrix.ToUnityMatrix(),
ColorTrans = child_color_transform});
if ( parent_mask > 0 ) {
parent_masks.Add(frame.Instances[frame.Instances.Count - 1]);
} else if ( inst.ClipDepth > 0 ) {
self_masks.Add(frame.Instances[frame.Instances.Count - 1]);
}
}
}
}
AddShapeInstanceToFrame(
library,
inst as SwfDisplayShapeInstance,
child_matrix,
child_blend_mode,
child_color_transform,
parent_masked,
parent_mask,
parent_masks,
self_masks,
frame);
break;
case SwfDisplayInstanceType.Sprite:
var sprite_def = library.FindDefine<SwfLibrarySpriteDefine>(inst.Id);
if ( sprite_def != null ) {
var sprite_inst = inst as SwfDisplaySpriteInstance;
AddDisplayListToFrame(
library,
sprite_inst.DisplayList,
(ushort)(parent_masked + self_masks.Count),
(ushort)(parent_mask > 0 ? parent_mask : (inst.ClipDepth > 0 ? inst.ClipDepth : (ushort)0)),
parent_mask > 0 ? parent_masks : (inst.ClipDepth > 0 ? self_masks : null),
child_matrix,
child_color_transform,
frame);
}
AddSpriteInstanceToFrame(
library,
inst as SwfDisplaySpriteInstance,
child_matrix,
child_blend_mode,
child_color_transform,
parent_masked,
parent_mask,
parent_masks,
self_masks,
frame);
break;
default:
throw new UnityException(string.Format(
"Unsupported SwfDisplayInstanceType: {0}", inst.Type));
"unsupported SwfDisplayInstanceType: {0}", inst.Type));
}
}
CheckSelfMasks(self_masks, ushort.MaxValue, frame);
return frame;
}
static void AddShapeInstanceToFrame(
SwfLibrary library,
SwfDisplayShapeInstance inst,
Matrix4x4 inst_matrix,
SwfBlendModeData inst_blend_mode,
SwfColorTransData inst_color_transform,
ushort parent_masked,
ushort parent_mask,
List<SwfInstanceData> parent_masks,
List<SwfInstanceData> self_masks,
SwfFrameData frame)
{
var shape_def = library.FindDefine<SwfLibraryShapeDefine>(inst.Id);
if ( shape_def != null ) {
for ( var i = 0; i < shape_def.Bitmaps.Length; ++i ) {
var bitmap_id = shape_def.Bitmaps[i];
var bitmap_matrix = i < shape_def.Matrices.Length ? shape_def.Matrices[i] : SwfMatrix.identity;
var bitmap_def = library.FindDefine<SwfLibraryBitmapDefine>(bitmap_id);
if ( bitmap_def != null ) {
var frame_inst_type =
(parent_mask > 0 || inst.ClipDepth > 0)
? SwfInstanceData.Types.Mask
: (parent_masked > 0 || self_masks.Count > 0)
? SwfInstanceData.Types.Masked
: SwfInstanceData.Types.Group;
var frame_inst_clip_depth =
(parent_mask > 0)
? parent_mask
: (inst.ClipDepth > 0)
? inst.ClipDepth
: parent_masked + self_masks.Count;
frame.Instances.Add(new SwfInstanceData{
Type = frame_inst_type,
ClipDepth = (ushort)frame_inst_clip_depth,
Bitmap = bitmap_id,
Matrix = SwfMatrixData.FromUMatrix(inst_matrix * bitmap_matrix.ToUMatrix()),
BlendMode = inst_blend_mode,
ColorTrans = inst_color_transform});
if ( parent_mask > 0 ) {
parent_masks.Add(frame.Instances[frame.Instances.Count - 1]);
} else if ( inst.ClipDepth > 0 ) {
self_masks.Add(frame.Instances[frame.Instances.Count - 1]);
}
}
}
}
}
static void AddSpriteInstanceToFrame(
SwfLibrary library,
SwfDisplaySpriteInstance inst,
Matrix4x4 inst_matrix,
SwfBlendModeData inst_blend_mode,
SwfColorTransData inst_color_transform,
ushort parent_masked,
ushort parent_mask,
List<SwfInstanceData> parent_masks,
List<SwfInstanceData> self_masks,
SwfFrameData frame)
{
var sprite_def = library.FindDefine<SwfLibrarySpriteDefine>(inst.Id);
if ( sprite_def != null ) {
AddDisplayListToFrame(
library,
inst.DisplayList,
inst_matrix,
inst_blend_mode,
inst_color_transform,
(ushort)(parent_masked + self_masks.Count),
(ushort)(parent_mask > 0
? parent_mask
: (inst.ClipDepth > 0
? inst.ClipDepth
: (ushort)0)),
parent_mask > 0
? parent_masks
: (inst.ClipDepth > 0
? self_masks
: null),
frame);
}
}
static void CheckSelfMasks(
List<SwfInstanceData> masks, ushort depth, SwfFrameData frame)
List<SwfInstanceData> masks,
ushort depth,
SwfFrameData frame)
{
foreach ( var mask in masks ) {
if ( mask.ClipDepth < depth ) {
@@ -197,111 +263,30 @@ namespace FlashTools.Internal {
ClipDepth = 0,
Bitmap = mask.Bitmap,
Matrix = mask.Matrix,
BlendMode = mask.BlendMode,
ColorTrans = mask.ColorTrans});
}
}
masks.RemoveAll(p => p.ClipDepth < depth);
}
static List<SwfBitmapData> LoadBitmaps(
SwfLibrary library, SwfAsset asset)
{
var bitmap_defines = library.Defines
// ---------------------------------------------------------------------
//
// LoadBitmaps
//
// ---------------------------------------------------------------------
static List<SwfBitmapData> LoadBitmaps(SwfLibrary library) {
return library.Defines
.Where (p => p.Value.Type == SwfLibraryDefineType.Bitmap)
.ToDictionary(p => p.Key, p => p.Value as SwfLibraryBitmapDefine);
var textures = bitmap_defines
.Where (p => p.Value.Redirect == 0)
.Select (p => new KeyValuePair<int, Texture2D>(
p.Key, LoadTextureFromBitmapDefine(p.Value)))
.ToDictionary(p => p.Key, p => p.Value as SwfLibraryBitmapDefine)
.Select (p => new SwfBitmapData{
Id = p.Key,
ARGB32 = p.Value.ARGB32,
Redirect = p.Value.Redirect,
RealWidth = p.Value.Width,
RealHeight = p.Value.Height})
.ToList();
var rects = PackAndSaveBitmapsAtlas(asset, textures.Select(p => p.Value).ToArray());
var bitmaps = new List<SwfBitmapData>(bitmap_defines.Count);
foreach ( var bitmap_define in bitmap_defines ) {
var texture_key = bitmap_define.Value.Redirect > 0
? bitmap_define.Value.Redirect
: bitmap_define.Key;
var bitmap_data = new SwfBitmapData{
Id = bitmap_define.Key,
RealSize = new Vector2(bitmap_define.Value.Width, bitmap_define.Value.Height),
SourceRect = rects[textures.FindIndex(p => p.Key == texture_key)]};
bitmaps.Add(bitmap_data);
}
return bitmaps;
}
static Texture2D LoadTextureFromBitmapDefine(SwfLibraryBitmapDefine bitmap) {
var texture = new Texture2D(
bitmap.Width, bitmap.Height,
TextureFormat.ARGB32, false);
texture.LoadRawTextureData(bitmap.ARGB32);
RevertTexturePremultipliedAlpha(texture);
return texture;
}
static void RevertTexturePremultipliedAlpha(Texture2D texture) {
for ( int y = 0; y < texture.height; ++y ) {
for ( int x = 0; x < texture.width; ++x ) {
var c = texture.GetPixel(x, y);
if ( c.a > 0 ) {
c.r /= c.a;
c.g /= c.a;
c.b /= c.a;
}
texture.SetPixel(x, y, c);
}
}
texture.Apply();
}
struct BitmapsAtlasInfo {
public Texture2D Atlas;
public Rect[] Rects;
}
static Rect[] PackAndSaveBitmapsAtlas(SwfAsset asset, Texture2D[] textures) {
var atlas_info = PackBitmapsAtlas(textures, asset.Settings);
var atlas_path = SwfEditorUtils.GetAtlasPathFromAsset(asset);
File.WriteAllBytes(atlas_path, atlas_info.Atlas.EncodeToPNG());
GameObject.DestroyImmediate(atlas_info.Atlas, true);
AssetDatabase.ImportAsset(atlas_path);
return atlas_info.Rects;
}
static BitmapsAtlasInfo PackBitmapsAtlas(Texture2D[] textures, SwfSettingsData settings) {
var atlas_padding = Mathf.Max(0, settings.AtlasPadding);
var max_atlas_size = Mathf.Max(32, settings.AtlasPowerOfTwo
? Mathf.ClosestPowerOfTwo(settings.MaxAtlasSize)
: settings.MaxAtlasSize);
var atlas = new Texture2D(0, 0);
var rects = atlas.PackTextures(textures, atlas_padding, max_atlas_size);
if ( rects == null ) {
throw new UnityException("Pack textures to atlas error");
}
return settings.AtlasForceSquare && atlas.width != atlas.height
? BitmapsAtlasToSquare(atlas, rects)
: new BitmapsAtlasInfo{Atlas = atlas, Rects = rects};
}
static BitmapsAtlasInfo BitmapsAtlasToSquare(Texture2D atlas, Rect[] rects) {
var atlas_size = Mathf.Max(atlas.width, atlas.height);
var atlas_scale = new Vector2(atlas.width, atlas.height) / atlas_size;
var new_atlas = new Texture2D(atlas_size, atlas_size, TextureFormat.ARGB32, false);
for ( var i = 0; i < rects.Length; ++i ) {
var new_position = rects[i].position;
new_position.Scale(atlas_scale);
var new_size = rects[i].size;
new_size.Scale(atlas_scale);
rects[i] = new Rect(new_position, new_size);
}
var fill_pixels = new Color32[atlas_size * atlas_size];
for ( var i = 0; i < atlas_size * atlas_size; ++i ) {
fill_pixels[i] = new Color(1,1,1,0);
}
new_atlas.SetPixels32(fill_pixels);
new_atlas.SetPixels32(0, 0, atlas.width, atlas.height, atlas.GetPixels32());
new_atlas.Apply();
GameObject.DestroyImmediate(atlas, true);
return new BitmapsAtlasInfo{Atlas = new_atlas, Rects = rects};
}
}
}

View File

@@ -2,10 +2,21 @@
using UnityEditor;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using Ionic.Zlib;
namespace FlashTools.Internal {
public static class SwfEditorUtils {
// ---------------------------------------------------------------------
//
// Functions
//
// ---------------------------------------------------------------------
public static void DoWithMixedValue(bool mixed, System.Action act) {
var last_show_mixed_value = EditorGUI.showMixedValue;
EditorGUI.showMixedValue = mixed;
@@ -17,12 +28,41 @@ namespace FlashTools.Internal {
}
public static void DoWithEnabledGUI(bool enabled, System.Action act) {
var last_gui_enabled = GUI.enabled;
GUI.enabled = enabled;
EditorGUI.BeginDisabledGroup(!enabled);
try {
act();
} finally {
GUI.enabled = last_gui_enabled;
EditorGUI.EndDisabledGroup();
}
}
public static void DoHorizontalGUI(System.Action act) {
GUILayout.BeginHorizontal();
try {
act();
} finally {
GUILayout.EndHorizontal();
}
}
public static void DoRightHorizontalGUI(System.Action act) {
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
try {
act();
} finally {
GUILayout.EndHorizontal();
}
}
public static void DoCenterHorizontalGUI(System.Action act) {
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
try {
act();
} finally {
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
}
@@ -36,38 +76,77 @@ namespace FlashTools.Internal {
return prop;
}
public static void DeleteAssetWithDepends(SwfAsset asset) {
if ( asset ) {
if ( asset.Atlas ) {
AssetDatabase.DeleteAsset(
AssetDatabase.GetAssetPath(asset.Atlas));
}
AssetDatabase.DeleteAsset(
AssetDatabase.GetAssetPath(asset));
}
}
public static void RemoveAllSubAssets(string asset_path) {
var assets = AssetDatabase.LoadAllAssetsAtPath(asset_path);
foreach ( var asset in assets ) {
if ( !AssetDatabase.IsMainAsset(asset) ) {
GameObject.DestroyImmediate(asset, true);
}
}
}
public static T LoadOrCreateAsset<T>(string asset_path) where T : ScriptableObject {
public static T LoadOrCreateAsset<T>(string asset_path, System.Action<T> act) where T : ScriptableObject {
var asset = AssetDatabase.LoadAssetAtPath<T>(asset_path);
if ( !asset ) {
if ( asset ) {
act(asset);
EditorUtility.SetDirty(asset);
} else {
asset = ScriptableObject.CreateInstance<T>();
act(asset);
AssetDatabase.CreateAsset(asset, asset_path);
}
AssetDatabase.ImportAsset(asset_path);
return asset;
}
public static string GetAtlasPathFromAsset(SwfAsset asset) {
var asset_path = AssetDatabase.GetAssetPath(asset);
return Path.ChangeExtension(asset_path, "._Atlas_.png");
public static byte[] CompressAsset<T>(T asset) {
var bytes = AssetToBytes(asset);
var result = ZlibStream.CompressBuffer(bytes);
return result;
}
public static T DecompressAsset<T>(byte[] data) {
var bytes = ZlibStream.UncompressBuffer(data);
var result = BytesToAsset<T>(bytes);
return result;
}
static byte[] AssetToBytes<T>(T asset) {
var formatter = new BinaryFormatter();
using ( var stream = new MemoryStream() ) {
formatter.Serialize(stream, asset);
return stream.ToArray();
}
}
static T BytesToAsset<T>(byte[] bytes) {
var formatter = new BinaryFormatter();
using ( var stream = new MemoryStream(bytes) ) {
return (T)formatter.Deserialize(stream);
}
}
// ---------------------------------------------------------------------
//
// Internal
//
// ---------------------------------------------------------------------
[MenuItem("Tools/FlashTools/Open settings...")]
static void Tools_FlashTools_OpenSettings() {
var settings_holder = SwfSettings.GetHolder();
Selection.objects = new Object[]{settings_holder};
}
[MenuItem("Tools/FlashTools/Reimport all swf files")]
static void Tools_FlashTools_ReimportAllSwfFiles() {
var swf_paths = GetAllSwfFilePaths();
var title = "Reimport";
var message = string.Format(
"Do you really want to reimport all ({0}) swf files?",
swf_paths.Length);
if ( EditorUtility.DisplayDialog(title, message, "Ok", "Cancel") ) {
foreach ( var swf_path in swf_paths ) {
AssetDatabase.ImportAsset(swf_path);
}
}
}
static string[] GetAllSwfFilePaths() {
return AssetDatabase.GetAllAssetPaths()
.Where(p => Path.GetExtension(p).ToLower().Equals(".swf"))
.ToArray();
}
}
}

View File

@@ -4,7 +4,7 @@ using UnityEditor;
using System.Linq;
using System.Collections.Generic;
namespace FlashTools.Internal.SwfEditorTools {
namespace FlashTools.Internal {
//
// SwfIntRange
@@ -103,6 +103,7 @@ namespace FlashTools.Internal.SwfEditorTools {
if ( property.propertyType == SerializedPropertyType.String ) {
var all_sorting_layers = GetAllSortingLayers(false);
if ( !all_sorting_layers.Contains(property.stringValue) ) {
property.stringValue = string.Empty;
property.stringValue = DefaultLayerName;
property.serializedObject.ApplyModifiedProperties();
}
@@ -117,6 +118,8 @@ namespace FlashTools.Internal.SwfEditorTools {
ValidateProperty(property);
SwfEditorUtils.DoWithMixedValue(
property.hasMultipleDifferentValues, () => {
label = EditorGUI.BeginProperty(position, label, property);
EditorGUI.BeginChangeCheck();
var all_sorting_layers = GetAllSortingLayers(true);
var sorting_layer_index = EditorGUI.Popup(
position,
@@ -125,14 +128,20 @@ namespace FlashTools.Internal.SwfEditorTools {
? all_sorting_layers.FindIndex(p => string.IsNullOrEmpty(p))
: all_sorting_layers.FindIndex(p => p == property.stringValue),
all_sorting_layers.Select(p => new GUIContent(p)).ToArray());
var new_value = all_sorting_layers[sorting_layer_index];
if ( !string.IsNullOrEmpty(new_value) ) {
if ( property.hasMultipleDifferentValues ) {
property.stringValue = string.Empty;
if ( EditorGUI.EndChangeCheck() ) {
if ( sorting_layer_index >= 0 && sorting_layer_index < all_sorting_layers.Count ) {
var new_value = all_sorting_layers[sorting_layer_index];
if ( !string.IsNullOrEmpty(new_value) ) {
if ( property.hasMultipleDifferentValues ) {
property.stringValue = string.Empty;
}
property.stringValue = new_value;
property.serializedObject.ApplyModifiedProperties();
}
}
property.stringValue = new_value;
property.serializedObject.ApplyModifiedProperties();
}});
}
EditorGUI.EndProperty();
});
} else {
EditorGUI.LabelField(position, label.text, "Use SwfSortingLayer with string attribute.");
}
@@ -203,7 +212,8 @@ namespace FlashTools.Internal.SwfEditorTools {
EditorGUI.IntPopup(position, property, vnames, values, label);
} else {
EditorGUI.PropertyField(position, property, label, true);
}});
}
});
} else {
EditorGUI.LabelField(position, label.text, "Use SwfPowerOfTwoIf with integer attribute.");
}
@@ -239,6 +249,7 @@ namespace FlashTools.Internal.SwfEditorTools {
SwfEditorUtils.DoWithEnabledGUI(!attr.ReadOnly, () => {
SwfEditorUtils.DoWithMixedValue(
property.hasMultipleDifferentValues, () => {
label = EditorGUI.BeginProperty(position, label, property);
EditorGUI.BeginChangeCheck();
var asset_path = AssetDatabase.GUIDToAssetPath(property.stringValue);
var asset = AssetDatabase.LoadMainAssetAtPath(asset_path);
@@ -252,6 +263,7 @@ namespace FlashTools.Internal.SwfEditorTools {
property.stringValue = AssetDatabase.AssetPathToGUID(new_asset_path);
property.serializedObject.ApplyModifiedProperties();
}
EditorGUI.EndProperty();
});
});
} else {
@@ -259,4 +271,23 @@ namespace FlashTools.Internal.SwfEditorTools {
}
}
}
//
// SwfDisplayNameDrawer
//
[CustomPropertyDrawer(typeof(SwfDisplayNameAttribute))]
public class SwfDisplayNameDrawer : PropertyDrawer {
public override void OnGUI(
Rect position, SerializedProperty property, GUIContent label)
{
var new_label = new GUIContent(label);
new_label.text = (attribute as SwfDisplayNameAttribute).DisplayName;
if ( EditorGUI.PropertyField(position, property, new_label) ) {
foreach ( SerializedProperty child in property ) {
EditorGUILayout.PropertyField(child);
}
}
}
}
}

View File

@@ -82,6 +82,8 @@ namespace FlashTools.Internal.SwfTools {
public ushort ClipDepth;
public bool Visible;
public SwfMatrix Matrix;
public SwfBlendMode BlendMode;
public SwfSurfaceFilters FilterList;
public SwfColorTransform ColorTransform;
}

View File

@@ -44,6 +44,8 @@ namespace FlashTools.Internal.SwfTools {
new_inst.ClipDepth = 0;
new_inst.Visible = true;
new_inst.Matrix = tag.Matrix;
new_inst.BlendMode = SwfBlendMode.identity;
new_inst.FilterList = SwfSurfaceFilters.identity;
new_inst.ColorTransform = tag.ColorTransform;
dl.Instances.Add(new_inst.Depth, new_inst);
}
@@ -77,6 +79,8 @@ namespace FlashTools.Internal.SwfTools {
new_inst.ClipDepth = tag.HasClipDepth ? tag.ClipDepth : (old_inst != null ? old_inst.ClipDepth : (ushort)0);
new_inst.Visible = true;
new_inst.Matrix = tag.HasMatrix ? tag.Matrix : (old_inst != null ? old_inst.Matrix : SwfMatrix.identity);
new_inst.BlendMode = SwfBlendMode.identity;
new_inst.FilterList = SwfSurfaceFilters.identity;
new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : (old_inst != null ? old_inst.ColorTransform : SwfColorTransform.identity);
dl.Instances.Add(new_inst.Depth, new_inst);
}
@@ -124,6 +128,8 @@ namespace FlashTools.Internal.SwfTools {
new_inst.ClipDepth = tag.HasClipDepth ? tag.ClipDepth : (old_inst != null ? old_inst.ClipDepth : (ushort)0);
new_inst.Visible = tag.HasVisible ? tag.Visible : (old_inst != null ? old_inst.Visible : true);
new_inst.Matrix = tag.HasMatrix ? tag.Matrix : (old_inst != null ? old_inst.Matrix : SwfMatrix.identity);
new_inst.BlendMode = tag.HasBlendMode ? tag.BlendMode : (old_inst != null ? old_inst.BlendMode : SwfBlendMode.identity);
new_inst.FilterList = tag.HasFilterList ? tag.SurfaceFilters : (old_inst != null ? old_inst.FilterList : SwfSurfaceFilters.identity);
new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : (old_inst != null ? old_inst.ColorTransform : SwfColorTransform.identity);
dl.Instances.Add(new_inst.Depth, new_inst);
}
@@ -139,6 +145,12 @@ namespace FlashTools.Internal.SwfTools {
if ( tag.HasMatrix ) {
inst.Matrix = tag.Matrix;
}
if ( tag.HasBlendMode ) {
inst.BlendMode = tag.BlendMode;
}
if ( tag.HasFilterList ) {
inst.FilterList = tag.SurfaceFilters;
}
if ( tag.HasColorTransform ) {
inst.ColorTransform = tag.ColorTransform;
}
@@ -364,7 +376,9 @@ namespace FlashTools.Internal.SwfTools {
void TagToDebugLog(SwfTagBase tag) {
if ( tag is UnsupportedTag || tag is UnknownTag ) {
Debug.LogWarningFormat("SwfContextExecuter. {0}", tag);
Debug.LogWarningFormat(
"<b>[FlashTools]</b> SwfContextExecuter. {0}",
tag);
}
}
}

View File

@@ -3,20 +3,20 @@
namespace FlashTools.Internal.SwfTools.SwfTypes {
public struct SwfBlendMode {
public enum Mode {
Normal,
Layer,
Multiply,
Screen,
Lighten,
Darken,
Difference,
Add,
Subtract,
Invert,
Alpha,
Erase,
Overlay,
Hardlight
Normal, // +
Layer, // +
Multiply, // +
Screen, // +
Lighten, // +
Darken, // +
Difference, // +
Add, // +
Subtract, // +
Invert, // +
Alpha, // -
Erase, // -
Overlay, // +
Hardlight // +
}
public Mode Value;
@@ -39,6 +39,38 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
Value);
}
public SwfBlendModeData ToBlendModeData() {
switch ( Value ) {
case Mode.Normal:
return new SwfBlendModeData(SwfBlendModeData.Types.Normal);
case Mode.Layer:
return new SwfBlendModeData(SwfBlendModeData.Types.Layer);
case Mode.Multiply:
return new SwfBlendModeData(SwfBlendModeData.Types.Multiply);
case Mode.Screen:
return new SwfBlendModeData(SwfBlendModeData.Types.Screen);
case Mode.Lighten:
return new SwfBlendModeData(SwfBlendModeData.Types.Lighten);
case Mode.Darken:
return new SwfBlendModeData(SwfBlendModeData.Types.Darken);
case Mode.Difference:
return new SwfBlendModeData(SwfBlendModeData.Types.Difference);
case Mode.Add:
return new SwfBlendModeData(SwfBlendModeData.Types.Add);
case Mode.Subtract:
return new SwfBlendModeData(SwfBlendModeData.Types.Subtract);
case Mode.Invert:
return new SwfBlendModeData(SwfBlendModeData.Types.Invert);
case Mode.Hardlight:
return new SwfBlendModeData(SwfBlendModeData.Types.Hardlight);
default:
Debug.LogWarningFormat(
"<b>[FlashTools]</b> SwfBlendMode. Unsupported blend mode '{0}'",
Value);
return new SwfBlendModeData(SwfBlendModeData.Types.Normal);
}
}
static Mode ModeFromByte(byte mode_id) {
switch ( mode_id ) {
case 0: // Mode.Normal too

View File

@@ -34,21 +34,5 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
"SwfColor. R: {0}, G: {1}, B: {2}, A: {3}",
R, G, B, A);
}
public Color ToUnityColor() {
return new Color(
R / 255.0f,
G / 255.0f,
B / 255.0f,
A / 255.0f);
}
public Color32 ToUnityColor32() {
return new Color32(
R,
G,
B,
A);
}
}
}

View File

@@ -62,18 +62,18 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
public SwfColorTransData ToColorTransData() {
var trans = SwfColorTransData.identity;
if ( HasAdd ) {
trans.Add = new Vector4(
RAdd / 255.0f,
GAdd / 255.0f,
BAdd / 255.0f,
AAdd / 255.0f);
trans.addColor = new SwfVec4Data(
RAdd / 256.0f,
GAdd / 256.0f,
BAdd / 256.0f,
AAdd / 256.0f);
}
if ( HasMul ) {
trans.Mul = new Vector4(
RMul / 255.0f,
GMul / 255.0f,
BMul / 255.0f,
AMul / 255.0f);
trans.mulColor = new SwfVec4Data(
RMul / 256.0f,
GMul / 256.0f,
BMul / 256.0f,
AMul / 256.0f);
}
return trans;
}

View File

@@ -59,7 +59,7 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
TranslateX, TranslateY);
}
public Matrix4x4 ToUnityMatrix() {
public Matrix4x4 ToUMatrix() {
var mat = Matrix4x4.identity;
mat.m00 = ScaleX;
mat.m10 = RotateSkew0;

View File

@@ -37,11 +37,5 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
"XMin: {0}, XMax: {1}, YMin: {2}, YMax: {3}",
XMin, XMax, YMin, YMax);
}
public Rect ToUnityRect() {
return Rect.MinMaxRect(
XMin, YMin,
XMax, YMax);
}
}
}

View File

@@ -114,7 +114,7 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
fill_style.BitmapMatrix = SwfMatrix.Read(reader, true);
} else {
Debug.LogError(
"imported .swf file contains vector graphics. " +
"<b>[FlashTools]</b> Imported .swf file contains vector graphics. " +
"You should use Tools/FlashExport.jsfl script for prepare .fla file");
}
return fill_style;

View File

@@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: ee7c6466110fb4e278e247d3d334450f
guid: 8e21e87290a7a4488ac2343d6defe08f
folderAsset: yes
timeCreated: 1456948832
timeCreated: 1473785847
licenseType: Free
DefaultImporter:
userData:

View File

@@ -0,0 +1,102 @@
using UnityEngine;
using NUnit.Framework;
namespace FlashTools.Internal.Tests {
public static class SwfUtilsTests {
static void AssertAreEqualVectors(Vector2 v0, Vector2 v1, float delta) {
Assert.AreEqual(v0.x, v1.x, delta);
Assert.AreEqual(v0.y, v1.y, delta);
}
static void AssertAreEqualVectors(Vector4 v0, Vector4 v1, float delta) {
Assert.AreEqual(v0.x, v1.x, delta);
Assert.AreEqual(v0.y, v1.y, delta);
Assert.AreEqual(v0.z, v1.z, delta);
Assert.AreEqual(v0.w, v1.w, delta);
}
//
//
//
[Test]
public static void PackUShortsToUIntTests() {
ushort v0 = 11, v1 = 99;
ushort o0, o1;
SwfUtils.UnpackUShortsFromUInt(
SwfUtils.PackUShortsToUInt(v0, v1), out o0, out o1);
Assert.AreEqual(v0, o0);
Assert.AreEqual(v1, o1);
ushort v2 = 16789, v3 = 31234;
ushort o2, o3;
SwfUtils.UnpackUShortsFromUInt(
SwfUtils.PackUShortsToUInt(v2, v3), out o2, out o3);
Assert.AreEqual(v2, o2);
Assert.AreEqual(v3, o3);
}
[Test]
public static void PackUVTests() {
var v0 = new Vector2(0.9999f, 0.1111f);
float u0, u1;
SwfUtils.UnpackUV(SwfUtils.PackUV(v0.x, v0.y), out u0, out u1);
AssertAreEqualVectors(v0, new Vector2(u0, u1), SwfUtils.UVPrecision);
var v1 = new Vector2(0.0987f, 0.0123f);
float u2, u3;
SwfUtils.UnpackUV(SwfUtils.PackUV(v1.x, v1.y), out u2, out u3);
AssertAreEqualVectors(v1, new Vector2(u2, u3), SwfUtils.UVPrecision);
var v2 = new Vector2(1.0f, 0.0f);
float u4, u5;
SwfUtils.UnpackUV(SwfUtils.PackUV(v2.x, v2.y), out u4, out u5);
AssertAreEqualVectors(v2, new Vector2(u4, u5), SwfUtils.UVPrecision);
}
[Test]
public static void PackFloatColorToUShortTests() {
float v0 = -5.678f;
Assert.AreEqual(
v0,
SwfUtils.UnpackFloatColorFromUShort(SwfUtils.PackFloatColorToUShort(v0)),
SwfUtils.FColorPrecision);
float v1 = 60.678f;
Assert.AreEqual(
v1,
SwfUtils.UnpackFloatColorFromUShort(SwfUtils.PackFloatColorToUShort(v1)),
SwfUtils.FColorPrecision);
float v2 = 0.678f;
Assert.AreEqual(
v2,
SwfUtils.UnpackFloatColorFromUShort(SwfUtils.PackFloatColorToUShort(v2)),
SwfUtils.FColorPrecision);
}
[Test]
public static void PackColorToUIntsTests() {
var v0 = new Color(0.01f, 0.02f, 0.33f, 1.0f);
uint u0, u1;
SwfUtils.PackFColorToUInts(v0, out u0, out u1);
Color c0;
SwfUtils.UnpackFColorFromUInts(
u0, u1,
out c0.r, out c0.g, out c0.b, out c0.a);
AssertAreEqualVectors(
v0, c0, SwfUtils.FColorPrecision);
var v1 = new Vector4(0.01f, 0.02f, 0.33f, 1.0f);
uint u2, u3;
SwfUtils.PackFColorToUInts(v1, out u2, out u3);
Vector4 c1;
SwfUtils.UnpackFColorFromUInts(
u2, u3,
out c1.x, out c1.y, out c1.z, out c1.w);
AssertAreEqualVectors(
v1, c1, SwfUtils.FColorPrecision);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 56c243ac3822b44ffa1520cfc5471e75
timeCreated: 1473785856
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -62,5 +62,9 @@ namespace FlashTools.Internal {
_list.Clear();
_dict.Clear();
}
public void AssignTo(SwfList<T> list) {
_list.AssignTo(list);
}
}
}

View File

@@ -42,4 +42,11 @@ namespace FlashTools.Internal {
ReadOnly = read_only;
}
}
public class SwfDisplayNameAttribute : PropertyAttribute {
public string DisplayName;
public SwfDisplayNameAttribute(string display_name) {
DisplayName = display_name;
}
}
}

View File

@@ -106,5 +106,22 @@ namespace FlashTools.Internal {
}
}
}
public void AssignTo(SwfList<T> list) {
if ( list._data.Length < _size ) {
var new_data = new T[_size * 2];
Array.Copy(_data, new_data, _size);
list._data = new_data;
list._size = _size;
} else {
if ( _size < list._size ) {
Array.Clear(list._data, _size, list._size - _size);
}
if ( _size > 0 ) {
Array.Copy(_data, list._data, _size);
}
list._size = _size;
}
}
}
}

View File

@@ -1,8 +1,9 @@
using UnityEngine;
using System.Collections.Generic;
#if UNITY_EDITOR
using System.IO;
using UnityEditor;
using UnityEngine.Rendering;
#endif
namespace FlashTools.Internal {
@@ -64,57 +65,60 @@ namespace FlashTools.Internal {
public SwfSettingsData Settings;
[HideInInspector] public Material SimpleMaterial;
[HideInInspector] public Material IncrMaskMaterial;
[HideInInspector] public Material DecrMaskMaterial;
[HideInInspector] public List<Material> MaskedMaterials;
[HideInInspector] public Shader SimpleShader;
[HideInInspector] public Shader MaskedShader;
[HideInInspector] public Shader SimpleGrabShader;
[HideInInspector] public Shader MaskedGrabShader;
[HideInInspector] public Shader IncrMaskShader;
[HideInInspector] public Shader DecrMaskShader;
#if UNITY_EDITOR
// ---------------------------------------------------------------------
//
// Private
// Internal
//
// ---------------------------------------------------------------------
const string SwfSimpleMatName = "SwfSimpleMat";
const string SwfIncrMaskMatName = "SwfIncrMaskMat";
const string SwfDecrMaskMatName = "SwfDecrMaskMat";
const string SwfMaskedMatNameFmt = "SwfMaskedMat_{0}";
const string SwfSimpleShaderName = "SwfSimpleShader";
const string SwfMaskedShaderName = "SwfMaskedShader";
const string SwfSimpleGrabShaderName = "SwfSimpleGrabShader";
const string SwfMaskedGrabShaderName = "SwfMaskedGrabShader";
const string SwfIncrMaskShaderName = "SwfIncrMaskShader";
const string SwfDecrMaskShaderName = "SwfDecrMaskShader";
void FillMaterialsCache() {
SimpleMaterial = SafeLoadMaterial(SwfSimpleMatName, true);
IncrMaskMaterial = SafeLoadMaterial(SwfIncrMaskMatName, true);
DecrMaskMaterial = SafeLoadMaterial(SwfDecrMaskMatName, true);
MaskedMaterials = new List<Material>();
for ( var i = 0; i < int.MaxValue; ++i ) {
var mat = SafeLoadMaterial(string.Format(SwfMaskedMatNameFmt, i), false);
if ( mat ) {
MaskedMaterials.Add(mat);
} else {
break;
}
}
void FillShadersCache() {
SimpleShader = SafeLoadShader(SwfSimpleShaderName);
MaskedShader = SafeLoadShader(SwfMaskedShaderName);
SimpleGrabShader = SafeLoadShader(SwfSimpleGrabShaderName);
MaskedGrabShader = SafeLoadShader(SwfMaskedGrabShaderName);
IncrMaskShader = SafeLoadShader(SwfIncrMaskShaderName);
DecrMaskShader = SafeLoadShader(SwfDecrMaskShaderName);
EditorUtility.SetDirty(this);
AssetDatabase.SaveAssets();
}
Material SafeLoadMaterial(string name, bool exception) {
var filter = string.Format("t:Material {0}", name);
var material = LoadFirstAssetByFilter<Material>(filter);
if ( !material && exception ) {
throw new UnityException(string.Format(
"SwfSettings. Material not found: {0}",
name));
void PregenerateMaterials() {
var blend_modes = System.Enum.GetValues(typeof(SwfBlendModeData.Types));
foreach ( SwfBlendModeData.Types blend_mode in blend_modes ) {
GetSimpleMaterial(blend_mode);
for ( var i = 0; i < 10; ++i ) {
GetMaskedMaterial(blend_mode, i);
}
}
return material;
GetIncrMaskMaterial();
GetDecrMaskMaterial();
}
Material CheckExistsMaterial(Material material) {
if ( !material ) {
throw new UnityException("SwfSettings. Material not found");
static Shader SafeLoadShader(string shader_name) {
var filter = string.Format("t:Shader {0}", shader_name);
var shader = LoadFirstAssetByFilter<Shader>(filter);
if ( !shader ) {
throw new UnityException(string.Format(
"SwfSettings. Shader not found: {0}",
shader_name));
}
return material;
return shader;
}
static T LoadFirstAssetByFilter<T>(string filter) where T : UnityEngine.Object {
@@ -129,43 +133,199 @@ namespace FlashTools.Internal {
return null;
}
static Material LoadOrCreateMaterial(
Shader shader,
System.Func<string, string, string> path_factory,
System.Func<Material, Material> fill_material)
{
var shader_path = AssetDatabase.GetAssetPath(shader);
var shader_dir = Path.GetDirectoryName(shader_path);
var generated_dir = Path.Combine(shader_dir, "Generated");
if ( !AssetDatabase.IsValidFolder(generated_dir) ) {
AssetDatabase.CreateFolder(shader_dir, "Generated");
}
var material_path = path_factory(
generated_dir,
Path.GetFileNameWithoutExtension(shader_path));
var material = AssetDatabase.LoadAssetAtPath<Material>(material_path);
if ( !material ) {
material = fill_material(new Material(shader));
material.hideFlags = HideFlags.HideInInspector;
AssetDatabase.CreateAsset(material, material_path);
}
return material;
}
Shader SelectShader(bool masked, SwfBlendModeData.Types blend_mode) {
switch ( blend_mode ) {
case SwfBlendModeData.Types.Normal:
case SwfBlendModeData.Types.Layer:
case SwfBlendModeData.Types.Multiply:
case SwfBlendModeData.Types.Screen:
case SwfBlendModeData.Types.Lighten:
case SwfBlendModeData.Types.Add:
case SwfBlendModeData.Types.Subtract:
return CheckAndGetShader(masked ? MaskedShader : SimpleShader);
case SwfBlendModeData.Types.Darken:
case SwfBlendModeData.Types.Difference:
case SwfBlendModeData.Types.Invert:
case SwfBlendModeData.Types.Overlay:
case SwfBlendModeData.Types.Hardlight:
return CheckAndGetShader(masked ? MaskedGrabShader : SimpleGrabShader);
default:
throw new UnityException(string.Format(
"SwfSettings. Incorrect blend mode: {0}",
blend_mode));
}
}
Shader CheckAndGetShader(Shader shader) {
if ( !shader ) {
FillShadersCache();
}
return CheckExistsShader(shader);
}
static Shader CheckExistsShader(Shader shader) {
if ( !shader ) {
throw new UnityException("SwfSettings. Shader not found");
}
return shader;
}
static Material FillMaterial(
Material material,
SwfBlendModeData.Types blend_mode,
int stencil_id)
{
switch ( blend_mode ) {
case SwfBlendModeData.Types.Normal:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
break;
case SwfBlendModeData.Types.Layer:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
break;
case SwfBlendModeData.Types.Multiply:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.DstColor);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
break;
case SwfBlendModeData.Types.Screen:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.OneMinusDstColor);
material.SetInt("_DstBlend", (int)BlendMode.One);
break;
case SwfBlendModeData.Types.Lighten:
material.SetInt("_BlendOp" , (int)BlendOp.Max);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
break;
case SwfBlendModeData.Types.Darken:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
material.EnableKeyword("SWF_DARKEN_BLEND");
break;
case SwfBlendModeData.Types.Difference:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
material.EnableKeyword("SWF_DIFFERENCE_BLEND");
break;
case SwfBlendModeData.Types.Add:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.One);
break;
case SwfBlendModeData.Types.Subtract:
material.SetInt("_BlendOp" , (int)BlendOp.ReverseSubtract);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.One);
break;
case SwfBlendModeData.Types.Invert:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
material.EnableKeyword("SWF_INVERT_BLEND");
break;
case SwfBlendModeData.Types.Overlay:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
material.EnableKeyword("SWF_OVERLAY_BLEND");
break;
case SwfBlendModeData.Types.Hardlight:
material.SetInt("_BlendOp" , (int)BlendOp.Add);
material.SetInt("_SrcBlend", (int)BlendMode.One);
material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
material.EnableKeyword("SWF_HARDLIGHT_BLEND");
break;
default:
throw new UnityException(string.Format(
"SwfSettings. Incorrect blend mode: {0}",
blend_mode));
}
material.SetInt("_StencilID", stencil_id);
return material;
}
// ---------------------------------------------------------------------
//
// Functions
//
// ---------------------------------------------------------------------
public Material GetMaskedMaterial(int stencil_id) {
if ( MaskedMaterials == null || stencil_id < MaskedMaterials.Count ) {
FillMaterialsCache();
}
if ( stencil_id < 0 || stencil_id >= MaskedMaterials.Count ) {
throw new UnityException(string.Format(
"SwfSettings. Unsupported stencil id: {0}",
stencil_id));
}
return CheckExistsMaterial(MaskedMaterials[stencil_id]);
public Material GetSimpleMaterial(
SwfBlendModeData.Types blend_mode)
{
return LoadOrCreateMaterial(
CheckAndGetShader(SelectShader(false, blend_mode)),
(dir_path, filename) => {
return string.Format(
"{0}/{1}_{2}.mat",
dir_path, filename, blend_mode);
},
material => FillMaterial(material, blend_mode, 0));
}
public Material GetSimpleMaterial() {
if ( !SimpleMaterial ) {
FillMaterialsCache();
}
return CheckExistsMaterial(SimpleMaterial);
public Material GetMaskedMaterial(
SwfBlendModeData.Types blend_mode,
int stencil_id)
{
return LoadOrCreateMaterial(
CheckAndGetShader(SelectShader(true, blend_mode)),
(dir_path, filename) => {
return string.Format(
"{0}/{1}_{2}_{3}.mat",
dir_path, filename, blend_mode, stencil_id);
},
material => FillMaterial(material, blend_mode, stencil_id));
}
public Material GetIncrMaskMaterial() {
if ( !IncrMaskMaterial ) {
FillMaterialsCache();
}
return CheckExistsMaterial(IncrMaskMaterial);
return LoadOrCreateMaterial(
CheckAndGetShader(IncrMaskShader),
(dir_path, filename) => {
return string.Format(
"{0}/{1}.mat",
dir_path, filename);
},
material => material);
}
public Material GetDecrMaskMaterial() {
if ( !DecrMaskMaterial ) {
FillMaterialsCache();
}
return CheckExistsMaterial(DecrMaskMaterial);
return LoadOrCreateMaterial(
CheckAndGetShader(DecrMaskShader),
(dir_path, filename) => {
return string.Format(
"{0}/{1}.mat",
dir_path, filename);
},
material => material);
}
// ---------------------------------------------------------------------
@@ -176,7 +336,8 @@ namespace FlashTools.Internal {
void Reset() {
Settings = SwfSettingsData.identity;
FillMaterialsCache();
FillShadersCache();
PregenerateMaterials();
}
public static SwfSettings GetHolder() {

View File

@@ -0,0 +1,100 @@
using UnityEngine;
namespace FlashTools.Internal {
public static class SwfUtils {
public const float UVPrecision = 1.0f / 16384.0f;
public const float FColorPrecision = 1.0f / 512.0f;
const ushort UShortMax = ushort.MaxValue;
const float InvFColorPrecision = 1.0f / FColorPrecision;
//
//
//
public static uint PackUShortsToUInt(ushort x, ushort y) {
var xx = (uint)x;
var yy = (uint)y;
return (xx << 16) + yy;
}
public static void UnpackUShortsFromUInt(
uint pack,
out ushort x, out ushort y)
{
x = (ushort)((pack >> 16) & 0xFFFF);
y = (ushort)((pack ) & 0xFFFF);
}
//
//
//
public static uint PackUV(float u, float v) {
var uu = (uint)(Mathf.Clamp01(u) * UShortMax);
var vv = (uint)(Mathf.Clamp01(v) * UShortMax);
return (uu << 16) + vv;
}
public static void UnpackUV(uint pack, out float u, out float v) {
u = (float)((pack >> 16) & 0xFFFF) / UShortMax;
v = (float)((pack ) & 0xFFFF) / UShortMax;
}
//
//
//
public static ushort PackFloatColorToUShort(float v) {
return (ushort)Mathf.Clamp(
v * (1.0f / FColorPrecision),
short.MinValue,
short.MaxValue);
}
public static float UnpackFloatColorFromUShort(ushort pack) {
return (short)pack / InvFColorPrecision;
}
//
//
//
public static void PackFColorToUInts(
Color v,
out uint pack0, out uint pack1)
{
PackFColorToUInts(v.r, v.g, v.b, v.a, out pack0, out pack1);
}
public static void PackFColorToUInts(
SwfVec4Data v,
out uint pack0, out uint pack1)
{
PackFColorToUInts(v.x, v.y, v.z, v.w, out pack0, out pack1);
}
public static void PackFColorToUInts(
float v0, float v1, float v2, float v3,
out uint pack0, out uint pack1)
{
pack0 = PackUShortsToUInt(
PackFloatColorToUShort(v0),
PackFloatColorToUShort(v1));
pack1 = PackUShortsToUInt(
PackFloatColorToUShort(v2),
PackFloatColorToUShort(v3));
}
public static void UnpackFColorFromUInts(
uint pack0, uint pack1,
out float c0, out float c1, out float c2, out float c3)
{
c0 = (short)((pack0 >> 16) & 0xFFFF) / InvFColorPrecision;
c1 = (short)((pack0 ) & 0xFFFF) / InvFColorPrecision;
c2 = (short)((pack1 >> 16) & 0xFFFF) / InvFColorPrecision;
c3 = (short)((pack1 ) & 0xFFFF) / InvFColorPrecision;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7403812bd90474c01b689738c58fd8dc
timeCreated: 1473684950
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,16 +3,162 @@ using FlashTools.Internal;
using System.Collections.Generic;
namespace FlashTools {
[System.Serializable]
public struct SwfVec2Data {
public float x;
public float y;
public SwfVec2Data(float x, float y) {
this.x = x;
this.y = y;
}
public static SwfVec2Data one {
get { return new SwfVec2Data(1.0f, 1.0f); }
}
public static SwfVec2Data zero {
get { return new SwfVec2Data(0.0f, 0.0f); }
}
}
[System.Serializable]
public struct SwfVec4Data {
public float x;
public float y;
public float z;
public float w;
public SwfVec4Data(float x, float y, float z, float w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
public static SwfVec4Data one {
get { return new SwfVec4Data(1.0f, 1.0f, 1.0f, 1.0f); }
}
public static SwfVec4Data zero {
get { return new SwfVec4Data(0.0f, 0.0f, 0.0f, 0.0f); }
}
}
[System.Serializable]
public struct SwfRectData {
public float xMin;
public float xMax;
public float yMin;
public float yMax;
public static SwfRectData identity {
get {
return new SwfRectData{
xMin = 0.0f,
xMax = 0.0f,
yMin = 0.0f,
yMax = 0.0f};
}
}
public static SwfRectData FromURect(Rect rect) {
return new SwfRectData{
xMin = rect.xMin,
xMax = rect.xMax,
yMin = rect.yMin,
yMax = rect.yMax};
}
}
[System.Serializable]
public struct SwfMatrixData {
public SwfVec2Data sc;
public SwfVec2Data sk;
public SwfVec2Data tr;
public static SwfMatrixData identity {
get {
return new SwfMatrixData{
sc = SwfVec2Data.one,
sk = SwfVec2Data.zero,
tr = SwfVec2Data.zero};
}
}
public Matrix4x4 ToUMatrix() {
var mat = Matrix4x4.identity;
mat.m00 = sc.x;
mat.m11 = sc.y;
mat.m10 = sk.x;
mat.m01 = sk.y;
mat.m03 = tr.x;
mat.m13 = tr.y;
return mat;
}
public static SwfMatrixData FromUMatrix(Matrix4x4 mat) {
return new SwfMatrixData{
sc = new SwfVec2Data(mat.m00, mat.m11),
sk = new SwfVec2Data(mat.m10, mat.m01),
tr = new SwfVec2Data(mat.m03, mat.m13)};
}
}
[System.Serializable]
public struct SwfBlendModeData {
public enum Types : byte {
Normal,
Layer,
Multiply,
Screen,
Lighten,
Darken, // GrabPass
Difference, // GrabPass
Add,
Subtract,
Invert, // GrabPass
Overlay, // GrabPass
Hardlight // GrabPass
}
public Types type;
public SwfBlendModeData(Types type) {
this.type = type;
}
public static SwfBlendModeData identity {
get {
return new SwfBlendModeData{
type = Types.Normal};
}
}
public static SwfBlendModeData operator*(
SwfBlendModeData a, SwfBlendModeData b)
{
return (a.type == Types.Normal || a.type == Types.Layer) ? b : a;
}
}
[System.Serializable]
public struct SwfColorTransData {
public Vector4 Mul;
public Vector4 Add;
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{
Mul = Vector4.one,
Add = Vector4.zero};
mulColor = SwfVec4Data.one,
addColor = SwfVec4Data.zero};
}
}
@@ -20,16 +166,16 @@ namespace FlashTools {
SwfColorTransData a, SwfColorTransData b)
{
return new SwfColorTransData{
Mul = new Vector4(
b.Mul.x * a.Mul.x,
b.Mul.y * a.Mul.y,
b.Mul.z * a.Mul.z,
b.Mul.w * a.Mul.w),
Add = new Vector4(
b.Add.x * a.Mul.x + a.Add.x,
b.Add.y * a.Mul.y + a.Add.y,
b.Add.z * a.Mul.z + a.Add.z,
b.Add.w * a.Mul.w + a.Add.w)};
mulColor = new SwfVec4Data(
b.mulColor.x * a.mulColor.x,
b.mulColor.y * a.mulColor.y,
b.mulColor.z * a.mulColor.z,
b.mulColor.w * a.mulColor.w),
addColor = new SwfVec4Data(
b.addColor.x * a.mulColor.x + a.addColor.x,
b.addColor.y * a.mulColor.y + a.addColor.y,
b.addColor.z * a.mulColor.z + a.addColor.z,
b.addColor.w * a.mulColor.w + a.addColor.w)};
}
}
@@ -44,7 +190,8 @@ namespace FlashTools {
public Types Type = Types.Group;
public ushort ClipDepth = 0;
public ushort Bitmap = 0;
public Matrix4x4 Matrix = Matrix4x4.identity;
public SwfMatrixData Matrix = SwfMatrixData.identity;
public SwfBlendModeData BlendMode = SwfBlendModeData.identity;
public SwfColorTransData ColorTrans = SwfColorTransData.identity;
}
@@ -62,9 +209,12 @@ namespace FlashTools {
[System.Serializable]
public class SwfBitmapData {
public int Id = 0;
public Vector2 RealSize = Vector2.zero;
public Rect SourceRect = new Rect();
public ushort Id = 0;
public byte[] ARGB32 = new byte[0];
public ushort Redirect = 0;
public int RealWidth = 0;
public int RealHeight = 0;
public SwfRectData SourceRect = SwfRectData.identity;
}
[System.Serializable]
@@ -75,24 +225,31 @@ namespace FlashTools {
}
public class SwfAsset : ScriptableObject {
[System.Serializable]
public struct ConvertingState {
public int Stage;
}
[HideInInspector]
public SwfAssetData Data;
public byte[] Data;
[SwfReadOnly]
public Texture2D Atlas;
[HideInInspector]
public List<SwfClipAsset> Clips;
[HideInInspector]
public SwfSettingsData Settings;
[HideInInspector]
[SwfDisplayName("Settings")]
public SwfSettingsData Overridden;
[HideInInspector]
public ConvertingState Converting;
#if UNITY_EDITOR
void Reset() {
Data = new SwfAssetData();
Data = new byte[0];
Atlas = null;
Clips = new List<SwfClipAsset>();
Settings = SwfSettings.GetDefault();
Overridden = SwfSettings.GetDefault();
Converting = new ConvertingState();
}
#endif
}

View File

@@ -1,6 +1,10 @@
using UnityEngine;
using FlashTools.Internal;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace FlashTools {
[ExecuteInEditMode, DisallowMultipleComponent]
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
@@ -9,6 +13,7 @@ namespace FlashTools {
MeshFilter _meshFilter = null;
MeshRenderer _meshRenderer = null;
bool _dirtyMesh = true;
SwfClipAsset.Sequence _curSequence = null;
MaterialPropertyBlock _curPropBlock = null;
@@ -20,7 +25,7 @@ namespace FlashTools {
[Header("Sorting")]
[SerializeField][SwfSortingLayer]
public string _sortingLayer = "Default";
public string _sortingLayer = string.Empty;
public string sortingLayer {
get { return _sortingLayer; }
set {
@@ -40,22 +45,35 @@ namespace FlashTools {
}
[Header("Animation")]
[SerializeField]
Color _tint = Color.white;
public Color tint {
get { return _tint; }
set {
_tint = value;
ChangeTint();
}
}
[SerializeField]
SwfClipAsset _clip = null;
public SwfClipAsset clip {
get { return _clip; }
set {
_clip = value;
_clip = value;
_sequence = string.Empty;
_currentFrame = 0;
ChangeClip();
}
}
[SerializeField][HideInInspector]
string _sequence = "Default";
string _sequence = string.Empty;
public string sequence {
get { return _sequence; }
set {
_sequence = value;
_sequence = value;
_currentFrame = 0;
ChangeSequence();
}
}
@@ -80,7 +98,9 @@ namespace FlashTools {
public float frameRate {
get {
return clip ? clip.FrameRate : 1.0f;
return clip
? clip.FrameRate
: 1.0f;
}
}
@@ -95,7 +115,9 @@ namespace FlashTools {
}
public void ToEndFrame() {
currentFrame = frameCount - 1;
currentFrame = frameCount > 0
? frameCount - 1
: 0;
}
public bool ToPrevFrame() {
@@ -116,16 +138,42 @@ namespace FlashTools {
// ---------------------------------------------------------------------
//
// Private
// Internal
//
// ---------------------------------------------------------------------
public void InternalLateUpdate() {
if ( _meshFilter && _meshRenderer && _dirtyMesh ) {
var baked_frame = GetCurrentBakedFrame();
if ( baked_frame != null ) {
_meshFilter .sharedMesh = baked_frame.CachedMesh;
_meshRenderer.sharedMaterials = baked_frame.Materials;
} else {
_meshFilter .sharedMesh = null;
_meshRenderer.sharedMaterials = new Material[0];
}
}
}
public void UpdateAllProperties() {
clip = _clip;
sequence = _sequence;
currentFrame = _currentFrame;
sortingLayer = _sortingLayer;
sortingOrder = _sortingOrder;
ClearCache();
ChangeTint();
ChangeClip();
ChangeSequence();
ChangeCurrentFrame();
ChangeSortingProperties();
}
void ClearCache() {
_meshFilter = GetComponent<MeshFilter>();
_meshRenderer = GetComponent<MeshRenderer>();
_dirtyMesh = true;
_curSequence = null;
_curPropBlock = null;
}
void ChangeTint() {
UpdatePropBlock();
}
void ChangeClip() {
@@ -139,10 +187,18 @@ namespace FlashTools {
void ChangeSequence() {
_curSequence = null;
if ( clip && clip.Sequences != null ) {
for ( int i = 0, e = clip.Sequences.Count; i < e; ++i ) {
var clip_sequence = clip.Sequences[i];
if ( clip_sequence != null && clip_sequence.Name == sequence ) {
_curSequence = clip_sequence;
if ( !string.IsNullOrEmpty(sequence) ) {
for ( int i = 0, e = clip.Sequences.Count; i < e; ++i ) {
var clip_sequence = clip.Sequences[i];
if ( clip_sequence != null && clip_sequence.Name == sequence ) {
_curSequence = clip_sequence;
break;
}
}
if ( _curSequence == null ) {
Debug.LogWarningFormat(this,
"<b>[FlashTools]</b> Sequence '{0}' not found",
sequence);
}
}
if ( _curSequence == null ) {
@@ -163,7 +219,7 @@ namespace FlashTools {
_currentFrame = frameCount > 0
? Mathf.Clamp(currentFrame, 0, frameCount - 1)
: 0;
UpdateCurrentMesh();
SetDirtyCurrentMesh();
}
void ChangeSortingProperties() {
@@ -179,6 +235,9 @@ namespace FlashTools {
_curPropBlock = new MaterialPropertyBlock();
}
_meshRenderer.GetPropertyBlock(_curPropBlock);
_curPropBlock.SetColor(
"_Tint",
tint);
_curPropBlock.SetTexture(
"_MainTex",
clip && clip.Atlas ? clip.Atlas : Texture2D.whiteTexture);
@@ -186,22 +245,18 @@ namespace FlashTools {
}
}
void UpdateCurrentMesh() {
if ( _meshFilter && _meshRenderer ) {
var baked_frame = GetCurrentBakedFrame();
_meshFilter.sharedMesh = baked_frame.Mesh;
_meshRenderer.sharedMaterials = baked_frame.Materials;
}
void SetDirtyCurrentMesh() {
_dirtyMesh = true;
#if UNITY_EDITOR
EditorUtility.SetDirty(this);
#endif
}
SwfClipAsset.Frame GetCurrentBakedFrame() {
var frames = _curSequence != null ? _curSequence.Frames : null;
var frame = frames != null && currentFrame >= 0 && currentFrame < frames.Count
return frames != null && currentFrame >= 0 && currentFrame < frames.Count
? frames[currentFrame]
: new SwfClipAsset.Frame();
return frame != null
? frame
: new SwfClipAsset.Frame();
: null;
}
// ---------------------------------------------------------------------
@@ -211,24 +266,20 @@ namespace FlashTools {
// ---------------------------------------------------------------------
void Awake() {
_meshFilter = GetComponent<MeshFilter>();
_meshRenderer = GetComponent<MeshRenderer>();
_curSequence = null;
_curPropBlock = null;
UpdateAllProperties();
}
void OnEnable() {
var swf_manager = SwfManager.GetInstance(true);
if ( swf_manager ) {
swf_manager.AddSwfClip(this);
swf_manager.AddClip(this);
}
}
void OnDisable() {
var swf_manager = SwfManager.GetInstance(false);
if ( swf_manager ) {
swf_manager.RemoveSwfClip(this);
swf_manager.RemoveClip(this);
}
}

View File

@@ -5,16 +5,80 @@ using System.Collections.Generic;
namespace FlashTools {
public class SwfClipAsset : ScriptableObject {
[System.Serializable]
public class Frame {
public Mesh Mesh = new Mesh();
public Material[] Materials = new Material[0];
}
[System.Serializable]
public class Sequence {
public string Name = string.Empty;
public List<Frame> Frames = new List<Frame>();
public class SubMeshData {
public int StartVertex;
public int IndexCount;
}
[System.Serializable]
public class MeshData {
public SubMeshData[] SubMeshes = new SubMeshData[0];
public Vector2[] Vertices = new Vector2[0];
public uint[] UVs = new uint[0];
public uint[] AddColors = new uint[0];
public uint[] MulColors = new uint[0];
public void FillMesh(Mesh mesh) {
if ( SubMeshes.Length > 0 ) {
mesh.subMeshCount = SubMeshes.Length;
SwfClipAssetCache.FillVertices(Vertices);
mesh.SetVertices(SwfClipAssetCache.Vertices);
for ( int i = 0, e = SubMeshes.Length; i < e; ++i ) {
SwfClipAssetCache.FillTriangles(
SubMeshes[i].StartVertex,
SubMeshes[i].IndexCount);
mesh.SetTriangles(SwfClipAssetCache.Indices, i);
}
SwfClipAssetCache.FillUVs(UVs);
mesh.SetUVs(0, SwfClipAssetCache.UVs);
SwfClipAssetCache.FillAddColors(AddColors);
mesh.SetUVs(1, SwfClipAssetCache.AddColors);
SwfClipAssetCache.FillMulColors(MulColors);
mesh.SetColors(SwfClipAssetCache.MulColors);
}
}
}
[System.Serializable]
public class Frame {
public MeshData MeshData = new MeshData();
public Material[] Materials = new Material[0];
public Frame() {
MeshData = new MeshData();
Materials = new Material[0];
}
public Frame(MeshData mesh_data, Material[] materials) {
MeshData = mesh_data;
Materials = materials;
}
Mesh _cachedMesh = null;
public Mesh CachedMesh {
get {
if ( !_cachedMesh ) {
_cachedMesh = new Mesh();
MeshData.FillMesh(_cachedMesh);
}
return _cachedMesh;
}
}
}
[System.Serializable]
public class Sequence {
public string Name = string.Empty;
public List<Frame> Frames = new List<Frame>();
}
[SwfReadOnly]
public string Name;
[SwfReadOnly]
public Texture2D Atlas;
[SwfReadOnly]
@@ -24,10 +88,118 @@ namespace FlashTools {
#if UNITY_EDITOR
void Reset() {
Name = string.Empty;
Atlas = null;
FrameRate = 1.0f;
Sequences = new List<Sequence>();
}
#endif
}
// ---------------------------------------------------------------------
//
// SwfClipAssetCache
//
// ---------------------------------------------------------------------
static class SwfClipAssetCache {
const int PreallocatedVertices = 500;
public static List<int> Indices = new List<int>(PreallocatedVertices * 6 / 4);
public static void FillTriangles(int start_vertex, int index_count) {
Indices.Clear();
if ( Indices.Capacity < index_count ) {
Indices.Capacity = index_count * 2;
}
for ( var i = 0; i < index_count; i += 6 ) {
Indices.Add(start_vertex + 2);
Indices.Add(start_vertex + 1);
Indices.Add(start_vertex + 0);
Indices.Add(start_vertex + 0);
Indices.Add(start_vertex + 3);
Indices.Add(start_vertex + 2);
start_vertex += 4;
}
}
static Vector3 Vertex = Vector3.zero;
public static List<Vector3> Vertices = new List<Vector3>(PreallocatedVertices);
public static void FillVertices(Vector2[] vertices) {
Vertices.Clear();
if ( Vertices.Capacity < vertices.Length ) {
Vertices.Capacity = vertices.Length * 2;
}
for ( int i = 0, e = vertices.Length; i < e; ++i ) {
var vert = vertices[i];
Vertex.x = vert.x;
Vertex.y = vert.y;
Vertices.Add(Vertex);
}
}
static Vector2 UV0 = Vector2.zero;
static Vector2 UV1 = Vector2.zero;
static Vector2 UV2 = Vector2.zero;
static Vector2 UV3 = Vector2.zero;
public static List<Vector2> UVs = new List<Vector2>(PreallocatedVertices);
public static void FillUVs(uint[] uvs) {
UVs.Clear();
if ( UVs.Capacity < uvs.Length * 2 ) {
UVs.Capacity = uvs.Length * 2 * 2;
}
for ( int i = 0, e = uvs.Length; i < e; i += 2 ) {
float min_x, min_y, max_x, max_y;
SwfUtils.UnpackUV(uvs[i+0], out min_x, out min_y);
SwfUtils.UnpackUV(uvs[i+1], out max_x, out max_y);
UV0.x = min_x; UV0.y = min_y;
UV1.x = max_x; UV1.y = min_y;
UV2.x = max_x; UV2.y = max_y;
UV3.x = min_x; UV3.y = max_y;
UVs.Add(UV0);
UVs.Add(UV1);
UVs.Add(UV2);
UVs.Add(UV3);
}
}
static Vector4 AddColor = Vector4.one;
public static List<Vector4> AddColors = new List<Vector4>(PreallocatedVertices);
public static void FillAddColors(uint[] colors) {
AddColors.Clear();
if ( AddColors.Capacity < colors.Length * 2 ) {
AddColors.Capacity = colors.Length * 2 * 2;
}
for ( int i = 0, e = colors.Length; i < e; i += 2 ) {
SwfUtils.UnpackFColorFromUInts(
colors[i+0], colors[i+1],
out AddColor.x, out AddColor.y,
out AddColor.z, out AddColor.w);
AddColors.Add(AddColor);
AddColors.Add(AddColor);
AddColors.Add(AddColor);
AddColors.Add(AddColor);
}
}
static Color MulColor = Color.white;
public static List<Color> MulColors = new List<Color>(PreallocatedVertices);
public static void FillMulColors(uint[] colors) {
MulColors.Clear();
if ( MulColors.Capacity < colors.Length * 2 ) {
MulColors.Capacity = colors.Length * 2 * 2;
}
for ( int i = 0, e = colors.Length; i < e; i += 2 ) {
SwfUtils.UnpackFColorFromUInts(
colors[i+0], colors[i+1],
out MulColor.r, out MulColor.g,
out MulColor.b, out MulColor.a);
MulColors.Add(MulColor);
MulColors.Add(MulColor);
MulColors.Add(MulColor);
MulColors.Add(MulColor);
}
}
}
}

View File

@@ -6,8 +6,9 @@ namespace FlashTools {
[RequireComponent(typeof(SwfClip))]
public class SwfClipController : MonoBehaviour {
SwfClip _clip = null;
float _timer = 0.0f;
SwfClip _clip = null;
bool _isPlaying = false;
float _tickTimer = 0.0f;
// ---------------------------------------------------------------------
//
@@ -16,11 +17,9 @@ namespace FlashTools {
// ---------------------------------------------------------------------
public event System.Action<SwfClipController> OnStopPlayingEvent;
public event System.Action<SwfClipController> OnPlayStoppedEvent;
public event System.Action<SwfClipController> OnRewindPlayingEvent;
public event System.Action<SwfClipController> OnPausePlayingEvent;
public event System.Action<SwfClipController> OnResumePausedEvent;
// ---------------------------------------------------------------------
//
// Properties
@@ -37,12 +36,6 @@ namespace FlashTools {
Loop
}
public enum States {
Stopped,
Paused,
Playing
}
[SerializeField]
bool _autoPlay = false;
public bool autoPlay {
@@ -58,6 +51,13 @@ namespace FlashTools {
set { _rateScale = Mathf.Clamp(value, 0.0f, float.MaxValue); }
}
[SerializeField]
string _groupName = string.Empty;
public string groupName {
get { return _groupName; }
set { _groupName = value; }
}
[SerializeField]
PlayModes _playMode = PlayModes.Forward;
public PlayModes playMode {
@@ -72,21 +72,16 @@ namespace FlashTools {
set { _loopMode = value; }
}
States _state = States.Stopped;
public States state {
get { return _state; }
}
public bool isStopped {
get { return state == States.Stopped; }
}
public bool isPaused {
get { return state == States.Paused; }
public SwfClip clip {
get { return _clip; }
}
public bool isPlaying {
get { return state == States.Playing; }
get { return _isPlaying; }
}
public bool isStopped {
get { return !_isPlaying; }
}
// ---------------------------------------------------------------------
@@ -95,14 +90,48 @@ namespace FlashTools {
//
// ---------------------------------------------------------------------
public void Stop() {
Stop(true);
public void GotoAndStop(int frame) {
if ( clip ) {
clip.currentFrame = frame;
}
Stop(false);
}
public void GotoAndStop(string sequence, int frame) {
if ( clip ) {
clip.sequence = sequence;
}
GotoAndStop(frame);
}
//
//
//
public void GotoAndPlay(int frame) {
if ( clip ) {
clip.currentFrame = frame;
}
Play(false);
}
public void GotoAndPlay(string sequence, int frame) {
if ( clip ) {
clip.sequence = sequence;
}
GotoAndPlay(frame);
}
//
//
//
public void Stop(bool rewind) {
var is_playing = isPlaying;
_timer = 0.0f;
_state = States.Stopped;
if ( is_playing ) {
_isPlaying = false;
_tickTimer = 0.0f;
}
if ( rewind ) {
Rewind();
}
@@ -111,40 +140,52 @@ namespace FlashTools {
}
}
public void Pause() {
if ( isPlaying ) {
_state = States.Paused;
if ( OnPausePlayingEvent != null ) {
OnPausePlayingEvent(this);
}
public void Stop(string sequence) {
if ( clip ) {
clip.sequence = sequence;
}
Stop(true);
}
//
//
//
public void Play(bool rewind) {
var is_stopped = isStopped;
if ( is_stopped ) {
_isPlaying = true;
_tickTimer = 0.0f;
}
if ( rewind ) {
Rewind();
}
if ( is_stopped && OnPlayStoppedEvent != null ) {
OnPlayStoppedEvent(this);
}
}
public void Resume() {
if ( isPaused ) {
_state = States.Playing;
if ( OnResumePausedEvent != null ) {
OnResumePausedEvent(this);
}
public void Play(string sequence) {
if ( clip ) {
clip.sequence = sequence;
}
Play(true);
}
public void Play() {
Rewind();
_timer = 0.0f;
_state = States.Playing;
}
//
//
//
public void Rewind() {
switch ( playMode ) {
case PlayModes.Forward:
if ( _clip ) {
_clip.ToBeginFrame();
if ( clip ) {
clip.ToBeginFrame();
}
break;
case PlayModes.Backward:
if ( _clip ) {
_clip.ToEndFrame();
if ( clip ) {
clip.ToEndFrame();
}
break;
default:
@@ -170,10 +211,10 @@ namespace FlashTools {
}
void UpdateTimer(float dt) {
var frame_rate = _clip ? _clip.frameRate : 1.0f;
_timer += frame_rate * rateScale * dt;
while ( _timer > 1.0f ) {
_timer -= 1.0f;
var frame_rate = clip ? clip.frameRate : 1.0f;
_tickTimer += frame_rate * rateScale * dt;
while ( _tickTimer > 1.0f ) {
_tickTimer -= 1.0f;
TimerTick();
}
}
@@ -198,9 +239,9 @@ namespace FlashTools {
bool NextClipFrame() {
switch ( playMode ) {
case PlayModes.Forward:
return _clip ? _clip.ToNextFrame() : false;
return clip ? clip.ToNextFrame() : false;
case PlayModes.Backward:
return _clip ? _clip.ToPrevFrame() : false;
return clip ? clip.ToPrevFrame() : false;
default:
throw new UnityException(string.Format(
"SwfClipController. Incorrect play mode: {0}",
@@ -216,22 +257,22 @@ namespace FlashTools {
void Awake() {
_clip = GetComponent<SwfClip>();
if ( autoPlay ) {
Play();
if ( autoPlay && Application.isPlaying ) {
Play(false);
}
}
void OnEnable() {
var swf_manager = SwfManager.GetInstance(true);
if ( swf_manager ) {
swf_manager.AddSwfClipController(this);
swf_manager.AddController(this);
}
}
void OnDisable() {
var swf_manager = SwfManager.GetInstance(false);
if ( swf_manager ) {
swf_manager.RemoveSwfClipController(this);
swf_manager.RemoveController(this);
}
}
}

View File

@@ -1,12 +1,18 @@
using UnityEngine;
using FlashTools.Internal;
using System.Collections.Generic;
namespace FlashTools {
[ExecuteInEditMode, DisallowMultipleComponent]
public class SwfManager : MonoBehaviour {
SwfAssocList<SwfClip> _clips = new SwfAssocList<SwfClip>();
SwfAssocList<SwfClipController> _controllers = new SwfAssocList<SwfClipController>();
SwfList<SwfClipController> _safeUpdates = new SwfList<SwfClipController>();
SwfAssocList<SwfClip> _clips = new SwfAssocList<SwfClip>();
SwfAssocList<SwfClipController> _controllers = new SwfAssocList<SwfClipController>();
bool _isPaused = false;
float _rateScale = 1.0f;
HashSet<string> _groupPauses = new HashSet<string>();
Dictionary<string, float> _groupRateScales = new Dictionary<string, float>();
// ---------------------------------------------------------------------
//
@@ -26,46 +32,116 @@ namespace FlashTools {
return _instance;
}
// ---------------------------------------------------------------------
//
// Properties
//
// ---------------------------------------------------------------------
public int clipCount {
get { return _clips.Count; }
}
public int controllerCount {
get { return _controllers.Count; }
}
public bool isPaused {
get { return _isPaused; }
set { _isPaused = value; }
}
public bool isPlaying {
get { return !_isPaused; }
set { _isPaused = !value; }
}
public float rateScale {
get { return _rateScale; }
set { _rateScale = Mathf.Clamp(value, 0.0f, float.MaxValue); }
}
// ---------------------------------------------------------------------
//
// Functions
//
// ---------------------------------------------------------------------
public void Pause() {
isPaused = true;
}
public void Resume() {
isPlaying = true;
}
public void PauseGroup(string group_name) {
if ( !string.IsNullOrEmpty(group_name) ) {
_groupPauses.Add(group_name);
}
}
public void ResumeGroup(string group_name) {
if ( !string.IsNullOrEmpty(group_name) ) {
_groupPauses.Remove(group_name);
}
}
public bool IsGroupPaused(string group_name) {
return _groupPauses.Contains(group_name);
}
public bool IsGroupPlaying(string group_name) {
return !IsGroupPaused(group_name);
}
public void SetGroupRateScale(string group_name, float rate_scale) {
if ( !string.IsNullOrEmpty(group_name) ) {
_groupRateScales[group_name] = Mathf.Clamp(rate_scale, 0.0f, float.MaxValue);
}
}
public float GetGroupRateScale(string group_name) {
float rate_scale;
return _groupRateScales.TryGetValue(group_name, out rate_scale)
? rate_scale
: 1.0f;
}
// ---------------------------------------------------------------------
//
// Internal
//
// ---------------------------------------------------------------------
public int AllClipCount {
get { return _clips.Count; }
}
public void AddSwfClip(SwfClip clip) {
public void AddClip(SwfClip clip) {
_clips.Add(clip);
}
public void RemoveSwfClip(SwfClip clip) {
public void RemoveClip(SwfClip clip) {
_clips.Remove(clip);
}
public int AllClipControllerCount {
get { return _controllers.Count; }
public void GetAllClips(SwfList<SwfClip> clips) {
_clips.AssignTo(clips);
}
public void AddSwfClipController(SwfClipController controller) {
public void AddController(SwfClipController controller) {
_controllers.Add(controller);
}
public void RemoveSwfClipController(SwfClipController controller) {
public void RemoveController(SwfClipController controller) {
_controllers.Remove(controller);
}
// ---------------------------------------------------------------------
//
// Private
//
// ---------------------------------------------------------------------
public void GetAllControllers(SwfList<SwfClipController> controllers) {
_controllers.AssignTo(controllers);
}
void GrabEnabledClips() {
var all_clips = FindObjectsOfType<SwfClip>();
for ( int i = 0, e = all_clips.Length; i < e; ++i ) {
var clip = all_clips[i];
var clips = FindObjectsOfType<SwfClip>();
for ( int i = 0, e = clips.Length; i < e; ++i ) {
var clip = clips[i];
if ( clip.enabled ) {
_clips.Add(clip);
}
@@ -73,9 +149,9 @@ namespace FlashTools {
}
void GrabEnabledControllers() {
var all_controllers = FindObjectsOfType<SwfClipController>();
for ( int i = 0, e = all_controllers.Length; i < e; ++i ) {
var controller = all_controllers[i];
var controllers = FindObjectsOfType<SwfClipController>();
for ( int i = 0, e = controllers.Length; i < e; ++i ) {
var controller = controllers[i];
if ( controller.enabled ) {
_controllers.Add(controller);
}
@@ -90,10 +166,29 @@ namespace FlashTools {
_controllers.Clear();
}
void UpdateControllers() {
var dt = Time.deltaTime;
for ( int i = 0, e = _controllers.Count; i < e; ++i ) {
_controllers[i].InternalUpdate(dt);
void UpdateControllers(float dt) {
_controllers.AssignTo(_safeUpdates);
for ( int i = 0, e = _safeUpdates.Count; i < e; ++i ) {
var ctrl = _safeUpdates[i];
if ( ctrl ) {
var group_name = ctrl.groupName;
if ( string.IsNullOrEmpty(group_name) ) {
ctrl.InternalUpdate(dt);
} else if ( IsGroupPlaying(group_name) ) {
var group_rate_scale = GetGroupRateScale(group_name);
ctrl.InternalUpdate(group_rate_scale * dt);
}
}
}
_safeUpdates.Clear();
}
void LateUpdateClips() {
for ( int i = 0, e = _clips.Count; i < e; ++i ) {
var clip = _clips[i];
if ( clip ) {
clip.InternalLateUpdate();
}
}
}
@@ -114,7 +209,14 @@ namespace FlashTools {
}
void Update() {
UpdateControllers();
if ( isPlaying ) {
var dt = Time.deltaTime;
UpdateControllers(rateScale * dt);
}
}
void LateUpdate() {
LateUpdateClips();
}
}
}

View File

@@ -27,23 +27,23 @@ if (!Function.prototype.bind) {
(function () {
"use strict";
//
// ft
//
var ft = {
profile_mode : false,
verbose_mode : true,
verbose_mode : false,
optimize_static_items : true,
optimize_single_graphics : true
};
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));
@@ -52,7 +52,7 @@ if (!Function.prototype.bind) {
ft.clear_output = function () {
fl.outputPanel.clear();
};
ft.assert = function (expr, format) {
if (!expr) {
if (format === undefined) {
@@ -63,7 +63,7 @@ if (!Function.prototype.bind) {
}
}
};
ft.type_assert = function (item, type) {
var type_is_string = (typeof type === 'string');
ft.assert(
@@ -73,13 +73,13 @@ if (!Function.prototype.bind) {
typeof item,
type_is_string ? type : type.constructor.name);
};
ft.type_assert_if_defined = function (item, type) {
if (item !== undefined) {
ft.type_assert(item, type);
}
};
ft.profile_function = function (func, msg) {
ft.type_assert(func, Function);
ft.type_assert(msg, 'string');
@@ -91,16 +91,17 @@ if (!Function.prototype.bind) {
}
var stack_index = ft.profile_function_stack.length;
ft.profile_function_stack.push({
msg : msg,
level : ft.profile_function_level,
time : 0});
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 info = ft.profile_function_stack[i];
var ident = "--";
for (var j = 0; j < info.level; ++j) {
ident += "--";
@@ -112,7 +113,7 @@ if (!Function.prototype.bind) {
ft.profile_function_stack = [];
}
};
ft.get_call_function_time = function (func) {
ft.type_assert(func, Function);
var b_time = Date.now();
@@ -120,31 +121,31 @@ if (!Function.prototype.bind) {
func();
} finally {
var e_time = Date.now();
return (e_time - b_time)/1000;
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, '&amp;' )
.replace(/\&/g, '&amp;')
.replace(/\"/g, '&quot;')
.replace(/\'/g, '&apos;')
.replace(/</g, '&lt;' )
.replace(/>/g, '&gt;' );
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
};
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);
@@ -154,7 +155,7 @@ if (!Function.prototype.bind) {
}
return acc;
};
ft.array_foldr = function (arr, func, acc) {
ft.type_assert(arr, Array);
ft.type_assert(func, Function);
@@ -164,20 +165,20 @@ if (!Function.prototype.bind) {
}
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) ) {
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);
@@ -189,7 +190,7 @@ if (!Function.prototype.bind) {
}
}
};
ft.array_reverse_foreach = function (arr, func, filter) {
ft.type_assert(arr, Array);
ft.type_assert(func, Function);
@@ -201,32 +202,32 @@ if (!Function.prototype.bind) {
}
}
};
ft.gen_unique_name = function() {
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.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.prepare_all_bitmaps(doc); }, "Prepare all bitmaps");
ft.profile_function(function() { ftdoc.export_swf(doc); }, "Export swf");
};
ftdoc.prepare_folders = function (doc) {
ft.type_assert(doc, Document);
var export_folder = ftdoc.get_export_folder(doc);
@@ -235,85 +236,98 @@ if (!Function.prototype.bind) {
.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.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_static_items) {
ft.profile_function(function() {
ft.profile_function(function () {
ftlib.optimize_static_items(doc, doc.library);
}, "Optimize static items");
}
if (ft.optimize_single_graphics) {
ft.profile_function(function() {
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);
@@ -326,44 +340,49 @@ if (!Function.prototype.bind) {
}
}, 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) {
ftlib.edit_all_symbol_items(doc, library, function (item) {
fttim.unlock(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();
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);
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) {
}, function (item) {
return ftlib.is_symbol_item(item) && fttim.is_static(item.timeline);
});
ftlib.edit_all_symbol_items(doc, library, function(item) {
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);
@@ -371,101 +390,172 @@ if (!Function.prototype.bind) {
ft.type_assert(new_item_name, 'string');
ft.type_assert(first_frame, 'number');
if (!library.itemExists(new_item_name)) {
library.addNewItem("graphic", new_item_name);
if (library.editItem(new_item_name)) {
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;
doc.convertSelectionToBitmap();
}
doc.exitEditMode();
}
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;
doc.convertSelectionToBitmap();
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) {
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.unlock = function (timeline) {
ft.type_assert(timeline, Timeline);
ft.array_foreach(timeline.layers, function(layer) {
layer.locked = false;
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.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 ) {
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) {
ft.array_foreach(frame.elements, function (elem) {
if (replaces.hasOwnProperty(elem.libraryItem.name)) {
doc.selectNone();
doc.selection = [elem];
@@ -475,72 +565,74 @@ if (!Function.prototype.bind) {
}, fttim.is_keyframe);
});
};
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;
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;
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;
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);
}
doc.selectNone();
doc.selection = [elem];
doc.swapElement(lib_item_cache_name);
doc.selection[0].firstFrame = 0;
doc.exitEditMode();
}
}, function(elem) {
}, function (elem) {
return fttim.is_symbol_graphic_single_frame_instance(elem) && !fttim.is_static(elem.libraryItem.timeline);
});
}, fttim.is_keyframe);
});
};
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)
? fttim.is_symbol_graphic_single_frame_instance(elem) || fttim.is_static(elem.libraryItem.timeline)
: acc3;
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) {
ft.array_reverse_foreach(timeline.layers, function (layer, layer_index) {
timeline.setSelectedLayers(layer_index);
ft.array_foreach(layer.frames, function(frame, frame_index) {
ft.array_foreach(layer.frames, function (frame, frame_index) {
frame.convertToFrameByFrameAnimation();
}, function (frame, frame_index) {
return fttim.is_keyframe(frame, frame_index) && fttim.is_shape_frame(frame);
});
});
var any_rasterize = false;
ft.array_reverse_foreach(timeline.layers, function(layer, layer_index) {
ft.array_reverse_foreach(timeline.layers, function (layer, layer_index) {
timeline.setSelectedLayers(layer_index);
ft.array_foreach(layer.frames, function(frame, frame_index) {
ft.array_foreach(layer.frames, function (frame, frame_index) {
timeline.currentFrame = frame_index;
timeline.setSelectedFrames(frame_index, frame_index + 1, true);
doc.selectNone();
@@ -556,11 +648,11 @@ if (!Function.prototype.bind) {
ft.trace_fmt("Rasterize vector shapes in '{0}'", timeline.name);
}
};
//
// main
//
(function () {
ft.clear_output();
fl.showIdleMessage(false);
@@ -573,10 +665,10 @@ if (!Function.prototype.bind) {
ft.trace_fmt("!!!Document!!!: '{0}' conversion error: '{1}'", doc.name, e);
}
});
ft.profile_function(function() {
ft.profile_function(function () {
ft.array_foreach(fl.documents, function (doc) {
if ( doc.canRevert() ) {
fl.revertDocument(document);
if (doc.canRevert()) {
fl.revertDocument(doc);
}
});
}, "Revert documents");

View File

@@ -64,12 +64,14 @@ PlayerSettings:
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0
xboxEnablePIXSampling: 0
xboxEnableEnableRenderThreadRunsJobs: 0
n3dsDisableStereoscopicView: 0
n3dsEnableSharedListOpt: 1
n3dsEnableVSync: 0
uiUse16BitDepthBuffer: 0
ignoreAlphaClear: 0
xboxOneResolution: 0
xboxOneMonoLoggingLevel: 0
ps3SplashScreen: {fileID: 0}
videoMemoryForVertexBuffers: 0
psp2PowerMode: 0
@@ -258,6 +260,7 @@ PlayerSettings:
ps4NPtitleDatPath:
ps4RemotePlayKeyAssignment: -1
ps4RemotePlayKeyMappingDir:
ps4PlayTogetherPlayerCount: 0
ps4EnterButtonAssignment: 1
ps4ApplicationParam1: 0
ps4ApplicationParam2: 0
@@ -284,6 +287,8 @@ PlayerSettings:
ps4attribMoveSupport: 0
ps4attrib3DSupport: 0
ps4attribShareSupport: 0
ps4attribExclusiveVR: 0
ps4disableAutoHideSplash: 0
ps4IncludedModules: []
monoEnv:
psp2Splashimage: {fileID: 0}

View File

@@ -1,2 +1,2 @@
m_EditorVersion: 5.3.5f1
m_EditorVersion: 5.3.6f1
m_StandardAssetsVersion: 0

View File

@@ -1,6 +1,10 @@
<Properties StartupItem="Assembly-CSharp.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="Unity.Instance.Unity Editor" />
<MonoDevelop.Ide.Workbench />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/FlashTools/Scripts/Internal/Editor/Postprocessors/SwfPostprocessor.cs">
<Files>
<File FileName="Assets/FlashTools/Scripts/Internal/Editor/Postprocessors/SwfPostprocessor.cs" Line="189" Column="45" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>