mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2026-03-22 12:55:32 +07:00
little undo fix
This commit is contained in:
@@ -145,7 +145,7 @@ Camera:
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 256
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -66,7 +66,6 @@ namespace FlashTools {
|
||||
public bool Visible = true;
|
||||
public FlashAnimLoopingType LoopingType = FlashAnimLoopingType.SingleFrame;
|
||||
public int LoopingFirstFrame = 0;
|
||||
// TODO: color_mode, filters
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace FlashTools.Internal {
|
||||
if ( asset.Atlas ) {
|
||||
AssetDatabase.DeleteAsset(
|
||||
AssetDatabase.GetAssetPath(asset.Atlas));
|
||||
asset.Atlas = null;
|
||||
}
|
||||
AssetDatabase.ImportAsset(
|
||||
AssetDatabase.GetAssetPath(asset),
|
||||
@@ -37,13 +38,17 @@ namespace FlashTools.Internal {
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public static void CreateFlashAnimPrefab(FlashAnimAsset asset) {
|
||||
var prefab_path = Path.ChangeExtension(AssetDatabase.GetAssetPath(asset), ".prefab");
|
||||
var flash_anim_go = CreateFlashAnimOnScene(asset);
|
||||
PrefabUtility.CreatePrefab(prefab_path, flash_anim_go);
|
||||
GameObject.DestroyImmediate(flash_anim_go, true);
|
||||
var prefab_path = Path.ChangeExtension(
|
||||
AssetDatabase.GetAssetPath(asset),
|
||||
".prefab");
|
||||
var flash_anim_go = CreateFlashAnimOnScene(asset, false);
|
||||
if ( flash_anim_go ) {
|
||||
PrefabUtility.CreatePrefab(prefab_path, flash_anim_go);
|
||||
GameObject.DestroyImmediate(flash_anim_go, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static GameObject CreateFlashAnimOnScene(FlashAnimAsset asset) {
|
||||
public static GameObject CreateFlashAnimOnScene(FlashAnimAsset asset, bool undo) {
|
||||
var anim_go = new GameObject("FlashAnim");
|
||||
try {
|
||||
CreateFlashAnim(asset, anim_go);
|
||||
@@ -75,7 +80,7 @@ namespace FlashTools.Internal {
|
||||
CreateFlashAnimPrefab(_asset);
|
||||
}
|
||||
if ( GUILayout.Button("Create animation on scene") ) {
|
||||
CreateFlashAnimOnScene(_asset);
|
||||
CreateFlashAnimOnScene(_asset, true);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
@@ -26,18 +26,25 @@ namespace FlashTools.Internal {
|
||||
try {
|
||||
if ( !fa_asset.Atlas ) {
|
||||
if ( !MarkAllBitmapsReadable(fa_asset_path, fa_asset) ) {
|
||||
AssetDatabase.ImportAsset(fa_asset_path, ImportAssetOptions.ForceUncompressedImport);
|
||||
AssetDatabase.ImportAsset(
|
||||
fa_asset_path,
|
||||
ImportAssetOptions.ForceUncompressedImport);
|
||||
return;
|
||||
}
|
||||
RemoveDuplicatedBitmaps(fa_asset_path, fa_asset);
|
||||
if ( !PackBitmapsAtlas(fa_asset_path, fa_asset) ) {
|
||||
AssetDatabase.ImportAsset(fa_asset_path, ImportAssetOptions.ForceUncompressedImport);
|
||||
AssetDatabase.ImportAsset(
|
||||
fa_asset_path,
|
||||
ImportAssetOptions.ForceUncompressedImport);
|
||||
return;
|
||||
}
|
||||
ConfigureBitmapsAtlas(fa_asset_path, fa_asset);
|
||||
FlashAnimAssetEditor.CreateFlashAnimPrefab(fa_asset);
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Debug.LogErrorFormat("Postprocess flash anim asset error: {0}", e.Message);
|
||||
Debug.LogErrorFormat(
|
||||
"Postprocess flash anim asset error: {0}",
|
||||
e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user