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

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) {
ft.type_assert(doc, Document);
var unused_items = doc.library.unusedItems;
ft.array_reverse_foreach(unused_items, function(item) {
if (ft.verbose_mode) {
ft.trace_fmt("Remove unused item: {0}", item.name);
}
doc.library.deleteItem(item.name);
});
if (unused_items && unused_items !== undefined) {
ft.array_reverse_foreach(unused_items, function(item) {
if (ft.verbose_mode) {
ft.trace_fmt("Remove unused item: {0}", item.name);
}
doc.library.deleteItem(item.name);
});
}
};
ftdoc.unlock_all_timelines = function (doc) {
@@ -683,7 +685,7 @@
ft.array_foreach(layer.frames, function (frame, frame_index) {
ft.array_foreach(frame.elements, function (elem) {
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) {
elem_filter.blurX *= scale;
elem_filter.blurY *= scale;

View File

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

View File

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

View File

@@ -14,8 +14,7 @@ using FTSwfTools.SwfTypes;
namespace FTEditor.Postprocessors {
class SwfPostprocessor : AssetPostprocessor {
static SwfEditorUtils.ProgressBar _progressBar = new SwfEditorUtils.ProgressBar();
static Queue<string> _assetsForProcess = new Queue<string>();
static SwfEditorUtils.ProgressBar _progressBar = new SwfEditorUtils.ProgressBar();
static void OnPostprocessAllAssets(
string[] imported_assets,
@@ -33,23 +32,11 @@ namespace FTEditor.Postprocessors {
EditorUtility.DisplayDialog(title, message, "Ok");
} else {
foreach ( var swf_path in swf_paths ) {
if ( !_assetsForProcess.Contains(swf_path) ) {
_assetsForProcess.Enqueue(swf_path);
}
EditorApplication.delayCall += () => {
SwfFileProcess(swf_path);
AssetDatabase.SaveAssets();
};
}
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();
}
}
@@ -68,8 +55,10 @@ namespace FTEditor.Postprocessors {
static bool SafeLoadSwfAsset(string swf_path, SwfAsset swf_asset) {
try {
_progressBar.UpdateTitle(Path.GetFileName(swf_path));
var new_data = LoadSwfAssetData(swf_path);
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data);
var new_data = LoadSwfAssetData(swf_path);
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data);
swf_asset.Atlas = null;
EditorUtility.SetDirty(swf_asset);
return true;
} catch ( Exception e ) {
Debug.LogErrorFormat(

View File

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

View File

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

View File

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