Compare commits

...

8 Commits

14 changed files with 62 additions and 69 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 55c438c941e894f25bb2b0527ee72f7c
timeCreated: 1486989506
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,3 +1,16 @@
-------------------
-- Version 1.3.4 --
-------------------
Fix CS6 export problem
Fix unity postprocessor problems
-------------------
-- Version 1.3.3 --
-------------------
Fix undefined unusedItems in CS6
------------------- -------------------
-- Version 1.3.2 -- -- Version 1.3.2 --
------------------- -------------------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -297,12 +297,14 @@
ftdoc.remove_unused_items = function (doc) { ftdoc.remove_unused_items = function (doc) {
ft.type_assert(doc, Document); ft.type_assert(doc, Document);
var unused_items = doc.library.unusedItems; var unused_items = doc.library.unusedItems;
if (unused_items && unused_items !== undefined) {
ft.array_reverse_foreach(unused_items, function(item) { ft.array_reverse_foreach(unused_items, function(item) {
if (ft.verbose_mode) { if (ft.verbose_mode) {
ft.trace_fmt("Remove unused item: {0}", item.name); ft.trace_fmt("Remove unused item: {0}", item.name);
} }
doc.library.deleteItem(item.name); doc.library.deleteItem(item.name);
}); });
}
}; };
ftdoc.unlock_all_timelines = function (doc) { ftdoc.unlock_all_timelines = function (doc) {
@@ -683,7 +685,7 @@
ft.array_foreach(layer.frames, function (frame, frame_index) { ft.array_foreach(layer.frames, function (frame, frame_index) {
ft.array_foreach(frame.elements, function (elem) { ft.array_foreach(frame.elements, function (elem) {
var elem_filters = elem.filters; var elem_filters = elem.filters;
if (Array.isArray(elem_filters)) { if (elem_filters && elem_filters !== undefined) {
ft.array_foreach(elem_filters, function (elem_filter, filter_index) { ft.array_foreach(elem_filters, function (elem_filter, filter_index) {
elem_filter.blurX *= scale; elem_filter.blurX *= scale;
elem_filter.blurY *= scale; elem_filter.blurY *= scale;

View File

@@ -42,8 +42,9 @@ namespace FTEditor.Editors {
} }
static void ReconvertAsset(SwfAsset asset) { static void ReconvertAsset(SwfAsset asset) {
AssetDatabase.ImportAsset( asset.Atlas = null;
AssetDatabase.GetAssetPath(asset)); EditorUtility.SetDirty(asset);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(asset));
} }
// //

View File

@@ -11,7 +11,6 @@ using FTRuntime;
namespace FTEditor.Postprocessors { namespace FTEditor.Postprocessors {
class SwfAssetPostprocessor : AssetPostprocessor { class SwfAssetPostprocessor : AssetPostprocessor {
static SwfEditorUtils.ProgressBar _progressBar = new SwfEditorUtils.ProgressBar(); static SwfEditorUtils.ProgressBar _progressBar = new SwfEditorUtils.ProgressBar();
static Queue<SwfAsset> _assetsForProcess = new Queue<SwfAsset>();
static void OnPostprocessAllAssets( static void OnPostprocessAllAssets(
string[] imported_assets, string[] imported_assets,
@@ -25,27 +24,16 @@ namespace FTEditor.Postprocessors {
.Select(p => AssetDatabase.LoadAssetAtPath<SwfAsset>(p)) .Select(p => AssetDatabase.LoadAssetAtPath<SwfAsset>(p))
.Where(p => !!p); .Where(p => !!p);
foreach ( var asset in assets ) { foreach ( var asset in assets ) {
if ( !_assetsForProcess.Contains(asset) ) { EditorApplication.delayCall += () => {
_assetsForProcess.Enqueue(asset); SwfAssetProcess(asset);
}
}
if ( _assetsForProcess.Count > 0 ) {
EditorApplication.update += ProcessAfterImport;
}
}
static void ProcessAfterImport() {
EditorApplication.update -= ProcessAfterImport;
if ( _assetsForProcess.Count > 0 ) {
while ( _assetsForProcess.Count > 0 ) {
SwfAssetProcess(_assetsForProcess.Dequeue());
}
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
};
} }
} }
static void SwfAssetProcess(SwfAsset asset) { static void SwfAssetProcess(SwfAsset asset) {
try { try {
if ( !asset.Atlas ) {
_progressBar.UpdateTitle(asset.name); _progressBar.UpdateTitle(asset.name);
var new_data = ConfigureBitmaps( var new_data = ConfigureBitmaps(
asset, asset,
@@ -54,9 +42,9 @@ namespace FTEditor.Postprocessors {
asset.Atlas = LoadAssetAtlas(asset); asset.Atlas = LoadAssetAtlas(asset);
if ( asset.Atlas ) { if ( asset.Atlas ) {
ConfigureAtlas(asset); ConfigureAtlas(asset);
ConfigureClips( ConfigureClips(asset, new_data);
asset, }
SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data)); EditorUtility.SetDirty(asset);
} }
} catch ( Exception e ) { } catch ( Exception e ) {
Debug.LogErrorFormat( Debug.LogErrorFormat(
@@ -140,7 +128,6 @@ namespace FTEditor.Postprocessors {
File.WriteAllBytes(atlas_path, atlas_info.Atlas.EncodeToPNG()); File.WriteAllBytes(atlas_path, atlas_info.Atlas.EncodeToPNG());
GameObject.DestroyImmediate(atlas_info.Atlas, true); GameObject.DestroyImmediate(atlas_info.Atlas, true);
_progressBar.UpdateProgress("import atlas", 0.75f); _progressBar.UpdateProgress("import atlas", 0.75f);
//AssetDatabase.Refresh();
AssetDatabase.ImportAsset(atlas_path); AssetDatabase.ImportAsset(atlas_path);
return atlas_info.Rects; return atlas_info.Rects;
} }
@@ -325,8 +312,8 @@ namespace FTEditor.Postprocessors {
var asset_atlas = AssetDatabase.LoadAssetAtPath<Sprite>(AssetDatabase.GetAssetPath(asset.Atlas)); var asset_atlas = AssetDatabase.LoadAssetAtPath<Sprite>(AssetDatabase.GetAssetPath(asset.Atlas));
clip_asset.Name = symbol.Name; clip_asset.Name = symbol.Name;
clip_asset.Sprite = asset_atlas; clip_asset.Sprite = asset_atlas;
clip_asset.AssetGUID = asset_guid;
clip_asset.FrameRate = data.FrameRate; clip_asset.FrameRate = data.FrameRate;
clip_asset.AssetGUID = asset_guid;
clip_asset.Sequences = LoadClipSequences(asset, data, symbol); clip_asset.Sequences = LoadClipSequences(asset, data, symbol);
EditorUtility.SetDirty(clip_asset); EditorUtility.SetDirty(clip_asset);
} }

View File

@@ -15,7 +15,6 @@ using FTSwfTools.SwfTypes;
namespace FTEditor.Postprocessors { namespace FTEditor.Postprocessors {
class SwfPostprocessor : AssetPostprocessor { class SwfPostprocessor : AssetPostprocessor {
static SwfEditorUtils.ProgressBar _progressBar = new SwfEditorUtils.ProgressBar(); static SwfEditorUtils.ProgressBar _progressBar = new SwfEditorUtils.ProgressBar();
static Queue<string> _assetsForProcess = new Queue<string>();
static void OnPostprocessAllAssets( static void OnPostprocessAllAssets(
string[] imported_assets, string[] imported_assets,
@@ -33,23 +32,11 @@ namespace FTEditor.Postprocessors {
EditorUtility.DisplayDialog(title, message, "Ok"); EditorUtility.DisplayDialog(title, message, "Ok");
} else { } else {
foreach ( var swf_path in swf_paths ) { foreach ( var swf_path in swf_paths ) {
if ( !_assetsForProcess.Contains(swf_path) ) { EditorApplication.delayCall += () => {
_assetsForProcess.Enqueue(swf_path); SwfFileProcess(swf_path);
}
}
if ( _assetsForProcess.Count > 0 ) {
EditorApplication.update += ProcessAfterImport;
}
}
}
static void ProcessAfterImport() {
EditorApplication.update -= ProcessAfterImport;
if ( _assetsForProcess.Count > 0 ) {
while ( _assetsForProcess.Count > 0 ) {
SwfFileProcess(_assetsForProcess.Dequeue());
}
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
};
}
} }
} }
@@ -70,6 +57,8 @@ namespace FTEditor.Postprocessors {
_progressBar.UpdateTitle(Path.GetFileName(swf_path)); _progressBar.UpdateTitle(Path.GetFileName(swf_path));
var new_data = LoadSwfAssetData(swf_path); var new_data = LoadSwfAssetData(swf_path);
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data); swf_asset.Data = SwfEditorUtils.CompressAsset(new_data);
swf_asset.Atlas = null;
EditorUtility.SetDirty(swf_asset);
return true; return true;
} catch ( Exception e ) { } catch ( Exception e ) {
Debug.LogErrorFormat( Debug.LogErrorFormat(

View File

@@ -157,7 +157,6 @@ namespace FTEditor {
asset = ScriptableObject.CreateInstance<T>(); asset = ScriptableObject.CreateInstance<T>();
if ( act(asset, true) ) { if ( act(asset, true) ) {
AssetDatabase.CreateAsset(asset, asset_path); AssetDatabase.CreateAsset(asset, asset_path);
AssetDatabase.ImportAsset(asset_path);
} else { } else {
ScriptableObject.DestroyImmediate(asset); ScriptableObject.DestroyImmediate(asset);
} }

View File

@@ -3,9 +3,6 @@ using FTRuntime.Internal;
using System.Collections.Generic; using System.Collections.Generic;
namespace FTRuntime { namespace FTRuntime {
#if UNITY_5_5_OR_NEWER
[PreferBinarySerialization]
#endif
public class SwfAsset : ScriptableObject { public class SwfAsset : ScriptableObject {
[HideInInspector] [HideInInspector]
public byte[] Data; public byte[] Data;

View File

@@ -3,9 +3,6 @@ using FTRuntime.Internal;
using System.Collections.Generic; using System.Collections.Generic;
namespace FTRuntime { namespace FTRuntime {
#if UNITY_5_5_OR_NEWER
[PreferBinarySerialization]
#endif
public class SwfClipAsset : ScriptableObject { public class SwfClipAsset : ScriptableObject {
[System.Serializable] [System.Serializable]
public class SubMeshData { public class SubMeshData {