Compare commits

...

21 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
68 changed files with 1194 additions and 2570 deletions

View File

@@ -104,11 +104,14 @@
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\SwfTools\SwfTypes\SwfShortHeader.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\SwfTools\SwfTypes\SwfSurfaceFilters.cs" />
<Compile Include="Assets\FlashTools\Scripts\Internal\Editor\Tests\SwfUtilsTests.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="UnityEditor.Advertisements">
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll</HintPath>
</Reference>

View File

@@ -55,11 +55,14 @@
<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,10 @@
-----------------
-- Version 0.5 --
-----------------
Flash optimizer twicks
Blending modes (except Alpha and Erase)
-----------------
-- Version 0.4 --
-----------------

Binary file not shown.

View File

@@ -1,7 +1,6 @@
fileFormatVersion: 2
guid: ee7c6466110fb4e278e247d3d334450f
folderAsset: yes
timeCreated: 1456948832
guid: beb0fd4f1c9444a96b597ba9217d5b5b
timeCreated: 1475326695
licenseType: Free
DefaultImporter:
userData:

View File

@@ -145,7 +145,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 23
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,81 +0,0 @@
Shader "FlashTools/SwfMasked" {
Properties {
[PerRendererData] _MainTex("Main Texture", 2D ) = "white" {}
[PerRendererData] _Color ("Tint" , Color) = (1,1,1,1)
_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;
};
fixed4 _Color;
v2f vert(appdata_t IN) {
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
OUT.mulcolor = IN.mulcolor * _Color;
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,76 +0,0 @@
Shader "FlashTools/SwfSimple" {
Properties {
[PerRendererData] _MainTex("Main Texture", 2D ) = "white" {}
[PerRendererData] _Color ("Tint" , Color) = (1,1,1,1)
}
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;
};
fixed4 _Color;
v2f vert(appdata_t IN) {
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = IN.uv;
OUT.mulcolor = IN.mulcolor * _Color;
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

@@ -67,6 +67,10 @@ namespace FlashTools.Internal {
AllAssetsForeach(p => ApplyOverriddenSettings(p));
}
void ReconvertAllAsset() {
AllAssetsForeach(p => ReconvertAsset(p));
}
//
//
//
@@ -96,7 +100,12 @@ namespace FlashTools.Internal {
void DrawGUISettingsControls() {
var prop = SwfEditorUtils.GetPropertyByName(serializedObject, "Overridden");
if ( prop.isExpanded ) {
SwfEditorUtils.DoRightHorizontalGUI(() => {
GUILayout.BeginHorizontal();
{
if ( GUILayout.Button("Reconvert") ) {
ReconvertAllAsset();
}
GUILayout.FlexibleSpace();
var default_settings = GetDefaultSettings().Settings;
SwfEditorUtils.DoWithEnabledGUI(
_assets.Any(p => !p.Overridden.CheckEquals(default_settings)), () => {
@@ -113,7 +122,8 @@ namespace FlashTools.Internal {
ApplyAllOverriddenSettings();
}
});
});
}
GUILayout.EndHorizontal();
}
}

View File

@@ -128,16 +128,6 @@ namespace FlashTools.Internal {
});
}
void HideMaterials() {
var settings_holder = SwfSettings.GetHolder();
settings_holder.SimpleMaterial .hideFlags = HideFlags.HideInInspector;
settings_holder.IncrMaskMaterial.hideFlags = HideFlags.HideInInspector;
settings_holder.DecrMaskMaterial.hideFlags = HideFlags.HideInInspector;
foreach ( var masked_material in settings_holder.MaskedMaterials ) {
masked_material.hideFlags = HideFlags.HideInInspector;
}
}
void SetupPreviews() {
_previews.Clear();
foreach ( var clip in _clips.Where(p => !!p.clip) ) {
@@ -155,7 +145,6 @@ namespace FlashTools.Internal {
void OnEnable() {
_clips = targets.OfType<SwfClip>().ToList();
HideMaterials();
SetupPreviews();
}

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 {
@@ -253,7 +252,7 @@ namespace FlashTools.Internal {
// ---------------------------------------------------------------------
static SwfAssetData ConfigureClips(SwfAsset asset, SwfAssetData data) {
asset.Clips = asset.Clips.Where(p => !!p).ToList();
asset.Clips = asset.Clips.Where(p => !!p).Distinct().ToList();
foreach ( var symbol in data.Symbols ) {
ConfigureClip(asset, data, symbol);
}
@@ -313,11 +312,12 @@ namespace FlashTools.Internal {
}
class BakedGroup {
public SwfInstanceData.Types Type;
public int ClipDepth;
public int StartVertex;
public int TriangleCount;
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(
@@ -373,11 +373,13 @@ namespace FlashTools.Internal {
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,
BlendMode = inst.BlendMode.type,
ClipDepth = inst.ClipDepth,
StartVertex = baked_vertices.Count - 4,
TriangleCount = 0,
@@ -397,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();
@@ -457,7 +459,7 @@ namespace FlashTools.Internal {
// ---------------------------------------------------------------------
static void UpdateAssetClips(SwfAsset asset) {
var clips = Resources.FindObjectsOfTypeAll<SwfClip>();
var clips = GameObject.FindObjectsOfType<SwfClip>();
foreach ( var clip in clips ) {
if ( clip && clip.clip && asset.Clips.Contains(clip.clip) ) {
clip.UpdateAllProperties();

View File

@@ -96,79 +96,68 @@ 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.ToUMatrix();
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 = SwfMatrixData.FromUMatrix(child_matrix * bitmap_matrix.ToUMatrix()),
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(
@@ -179,8 +168,93 @@ namespace FlashTools.Internal {
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 ) {
@@ -189,6 +263,7 @@ namespace FlashTools.Internal {
ClipDepth = 0,
Bitmap = mask.Bitmap,
Matrix = mask.Matrix,
BlendMode = mask.BlendMode,
ColorTrans = mask.ColorTrans});
}
}

View File

@@ -28,7 +28,7 @@ namespace FlashTools.Internal {
}
public static void DoWithEnabledGUI(bool enabled, System.Action act) {
EditorGUI.BeginDisabledGroup(true);
EditorGUI.BeginDisabledGroup(!enabled);
try {
act();
} finally {
@@ -76,19 +76,11 @@ namespace FlashTools.Internal {
return prop;
}
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, System.Action<T> act) where T : ScriptableObject {
var asset = AssetDatabase.LoadAssetAtPath<T>(asset_path);
if ( asset ) {
act(asset);
EditorUtility.SetDirty(asset);
} else {
asset = ScriptableObject.CreateInstance<T>();
act(asset);

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;
}

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

@@ -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,10 +65,12 @@ 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
@@ -77,44 +80,45 @@ namespace FlashTools.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

@@ -105,6 +105,42 @@ namespace FlashTools {
}
}
[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 SwfVec4Data mulColor;
@@ -155,6 +191,7 @@ namespace FlashTools {
public ushort ClipDepth = 0;
public ushort Bitmap = 0;
public SwfMatrixData Matrix = SwfMatrixData.identity;
public SwfBlendModeData BlendMode = SwfBlendModeData.identity;
public SwfColorTransData ColorTrans = SwfColorTransData.identity;
}

View File

@@ -236,7 +236,7 @@ namespace FlashTools {
}
_meshRenderer.GetPropertyBlock(_curPropBlock);
_curPropBlock.SetColor(
"_Color",
"_Tint",
tint);
_curPropBlock.SetTexture(
"_MainTex",

View File

@@ -81,7 +81,7 @@ namespace FlashTools {
}
public bool isStopped {
get { return !isPlaying; }
get { return !_isPlaying; }
}
// ---------------------------------------------------------------------

View File

@@ -48,10 +48,12 @@ namespace FlashTools {
public bool isPaused {
get { return _isPaused; }
set { _isPaused = value; }
}
public bool isPlaying {
get { return !isPaused; }
get { return !_isPaused; }
set { _isPaused = !value; }
}
public float rateScale {
@@ -66,11 +68,11 @@ namespace FlashTools {
// ---------------------------------------------------------------------
public void Pause() {
_isPaused = true;
isPaused = true;
}
public void Resume() {
_isPaused = false;
isPlaying = true;
}
public void PauseGroup(string group_name) {
@@ -172,7 +174,7 @@ namespace FlashTools {
var group_name = ctrl.groupName;
if ( string.IsNullOrEmpty(group_name) ) {
ctrl.InternalUpdate(dt);
} else if ( !IsGroupPaused(group_name) ) {
} else if ( IsGroupPlaying(group_name) ) {
var group_rate_scale = GetGroupRateScale(group_name);
ctrl.InternalUpdate(group_rate_scale * dt);
}

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,21 +202,21 @@ 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");
@@ -226,7 +227,7 @@ if (!Function.prototype.bind) {
ft.profile_function(function() { ftdoc.rasterize_all_shapes(doc); }, "Rasterize all shapes");
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,9 +665,9 @@ 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() ) {
if (doc.canRevert()) {
fl.revertDocument(doc);
}
});

View File

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