mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-16 14:11:19 +07:00
fix bug with big multiple reimport
This commit is contained in:
@@ -42,7 +42,11 @@ namespace FTEditor.Editors {
|
||||
}
|
||||
|
||||
static void ReconvertAsset(SwfAsset asset) {
|
||||
asset.Atlas = null;
|
||||
if ( asset.Atlas ) {
|
||||
AssetDatabase.DeleteAsset(
|
||||
AssetDatabase.GetAssetPath(asset.Atlas));
|
||||
asset.Atlas = null;
|
||||
}
|
||||
EditorUtility.SetDirty(asset);
|
||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(asset));
|
||||
}
|
||||
|
||||
@@ -18,15 +18,15 @@ namespace FTEditor.Postprocessors {
|
||||
string[] moved_assets,
|
||||
string[] moved_from_asset_paths)
|
||||
{
|
||||
var asset_paths = imported_assets
|
||||
.Where(p => Path.GetExtension(p).ToLower().Equals(".asset"));
|
||||
var assets = asset_paths
|
||||
var assets = imported_assets
|
||||
.Where(p => Path.GetExtension(p).ToLower().Equals(".asset"))
|
||||
.Select(p => AssetDatabase.LoadAssetAtPath<SwfAsset>(p))
|
||||
.Where(p => !!p);
|
||||
foreach ( var asset in assets ) {
|
||||
var asset_copy = asset;
|
||||
.Where(p => p && !p.Atlas);
|
||||
if ( assets.Any() ) {
|
||||
EditorApplication.delayCall += () => {
|
||||
SwfAssetProcess(asset_copy);
|
||||
foreach ( var asset in assets ) {
|
||||
SwfAssetProcess(asset);
|
||||
}
|
||||
AssetDatabase.SaveAssets();
|
||||
};
|
||||
}
|
||||
@@ -34,18 +34,19 @@ namespace FTEditor.Postprocessors {
|
||||
|
||||
static void SwfAssetProcess(SwfAsset asset) {
|
||||
try {
|
||||
if ( !asset.Atlas ) {
|
||||
EditorUtility.SetDirty(asset);
|
||||
asset.Atlas = LoadAssetAtlas(asset);
|
||||
if ( asset.Atlas ) {
|
||||
ConfigureAtlas(asset);
|
||||
ConfigureClips(
|
||||
asset,
|
||||
SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data));
|
||||
} else {
|
||||
_progressBar.UpdateTitle(asset.name);
|
||||
var new_data = ConfigureBitmaps(
|
||||
asset,
|
||||
SwfEditorUtils.DecompressAsset<SwfAssetData>(asset.Data));
|
||||
asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
asset.Atlas = LoadAssetAtlas(asset);
|
||||
if ( asset.Atlas ) {
|
||||
ConfigureAtlas(asset);
|
||||
ConfigureClips(asset, new_data);
|
||||
}
|
||||
EditorUtility.SetDirty(asset);
|
||||
asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Debug.LogErrorFormat(
|
||||
|
||||
@@ -24,17 +24,18 @@ namespace FTEditor.Postprocessors {
|
||||
{
|
||||
var swf_paths = imported_assets
|
||||
.Where(p => Path.GetExtension(p).ToLower().Equals(".swf"));
|
||||
if ( swf_paths.Any() && SwfEditorUtils.IsDemoEnded ) {
|
||||
var title = "Demo version";
|
||||
var message =
|
||||
"This demo is for evaluation purpose only. " +
|
||||
"It means that you can't have more than 5 animation assets in the project.";
|
||||
EditorUtility.DisplayDialog(title, message, "Ok");
|
||||
} else {
|
||||
foreach ( var swf_path in swf_paths ) {
|
||||
var swf_path_copy = swf_path;
|
||||
if ( swf_paths.Any() ) {
|
||||
if ( SwfEditorUtils.IsDemoEnded ) {
|
||||
var title = "Demo version";
|
||||
var message =
|
||||
"This demo is for evaluation purpose only. " +
|
||||
"It means that you can't have more than 5 animation assets in the project.";
|
||||
EditorUtility.DisplayDialog(title, message, "Ok");
|
||||
} else {
|
||||
EditorApplication.delayCall += () => {
|
||||
SwfFileProcess(swf_path_copy);
|
||||
foreach ( var swf_path in swf_paths ) {
|
||||
SwfFileProcess(swf_path);
|
||||
}
|
||||
AssetDatabase.SaveAssets();
|
||||
};
|
||||
}
|
||||
@@ -62,7 +63,11 @@ namespace FTEditor.Postprocessors {
|
||||
var new_data = LoadSwfAssetData(swf_path);
|
||||
swf_asset.Data = SwfEditorUtils.CompressAsset(new_data);
|
||||
swf_asset.Hash = swf_hash;
|
||||
swf_asset.Atlas = null;
|
||||
if ( swf_asset.Atlas ) {
|
||||
AssetDatabase.DeleteAsset(
|
||||
AssetDatabase.GetAssetPath(swf_asset.Atlas));
|
||||
swf_asset.Atlas = null;
|
||||
}
|
||||
EditorUtility.SetDirty(swf_asset);
|
||||
return true;
|
||||
} catch ( Exception e ) {
|
||||
|
||||
@@ -318,7 +318,11 @@ namespace FTEditor {
|
||||
Tools_FlashTools_ReimportAllSwfFiles();
|
||||
var swf_assets = GetAllSwfAssets();
|
||||
foreach ( var swf_asset in swf_assets ) {
|
||||
swf_asset.Atlas = null;
|
||||
if ( swf_asset.Atlas ) {
|
||||
AssetDatabase.DeleteAsset(
|
||||
AssetDatabase.GetAssetPath(swf_asset.Atlas));
|
||||
swf_asset.Atlas = null;
|
||||
}
|
||||
EditorUtility.SetDirty(swf_asset);
|
||||
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(swf_asset));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user