コード例 #1
0
        static void DoImport(DefaultAsset[] assets)
        {
            foreach (var asset in assets)
            {
                var settings = ImportSettingsReference.LoadImportSettings(asset);
                if (!settings)
                {
                    CreateSettingsThenImport(assets);
                    return;
                }
            }

            foreach (var asset in assets)
            {
                var reference = ImportSettingsReference.LoadImportSettings(asset);
                if (reference)
                {
                    ASEImporter.Import(asset, reference.settings);
                }
                else
                {
                    Debug.LogWarning("File " + asset.name + " has empty import settings, it is ignored.");
                }
            }
        }
コード例 #2
0
        static void DoImport(DefaultAsset[] assets)
        {
            foreach (var asset in assets)
            {
                var settingsPath = GetImportSettingsPath(asset);
                var reference    = (ImportSettingsReference)AssetDatabase.LoadAssetAtPath(settingsPath, typeof(ImportSettingsReference));
                if (!reference)
                {
                    CreateSettingsThenImport(assets);
                    return;
                }
            }

            foreach (var asset in assets)
            {
                var settingsPath = GetImportSettingsPath(asset);
                var reference    = (ImportSettingsReference)AssetDatabase.LoadAssetAtPath(settingsPath, typeof(ImportSettingsReference));
                if (reference.settings)
                {
                    ASEImporter.Import(asset, reference.settings);
                }
                else
                {
                    Debug.LogWarning("File " + asset.name + " has empty import settings, it is ignored.");
                }
            }
        }
コード例 #3
0
        static void CreateSettingsThenImport(DefaultAsset[] assets)
        {
            var size = new Vector2(Screen.width, Screen.height);
            var rect = new Rect(size.x / 2, size.y / 2, 250, 200);
            var window = (CreateSettingsWindow) EditorWindow.CreateInstance(typeof(CreateSettingsWindow));
            window.position = rect;

            var paths = assets.Select(it => GetImportSettingsPath(it)).ToList();

            window._Init(paths, settings => { foreach (var asset in assets) {
            ASEImporter.Import(asset, settings);
            } });

            window.ShowPopup();
        }
コード例 #4
0
 private static void CompleteAutoImports()
 {
     EditorApplication.update = Delegate.Remove(EditorApplication.update, _importDelegate as EditorApplication.CallbackFunction) as EditorApplication.CallbackFunction;
     AssetDatabase.Refresh();
     ASEImporter.Refresh();
     foreach (var path in _autoImports)
     {
         var asset     = AssetDatabase.LoadAssetAtPath <DefaultAsset>(path);
         var reference = ImportSettingsReference.LoadImportSettings(asset);
         if (reference?.settings && reference.settings.automaticReimport)
         {
             ASEImporter.Import(asset, reference.settings);
         }
     }
     _autoImports.Clear();
 }
コード例 #5
0
ファイル: ImportMenu.cs プロジェクト: Teemodisi/MetaSpriteEx
        private static void CreateMetaDataThenImport(DefaultAsset[] assets)
        {
            var size   = new Vector2(Screen.width, Screen.height);
            var rect   = new Rect(size.x / 2, size.y / 2, 250, 200);
            var window = ScriptableObject.CreateInstance <CreateSettingsWindow>();

            window.position = rect;

            var paths = assets.Select(AssetDatabase.GetAssetPath).ToList();

            window._Init(paths, settings =>
            {
                foreach (var asset in assets)
                {
                    ASEImporter.Import(asset, settings);
                }
            });

            window.ShowPopup();
        }
コード例 #6
0
ファイル: ImportMenu.cs プロジェクト: Teemodisi/MetaSpriteEx
        private static void DoImport(DefaultAsset[] assets)
        {
            foreach (var asset in assets)
            {
                var metaData = GetMetaData(asset);
                if (metaData == null)
                {
                    CreateMetaDataThenImport(assets);
                    return;
                }

                var guid     = metaData.metaSpriteSettingsGuid;
                var settings = AssetDatabase.LoadAssetAtPath <ImportSettings>(AssetDatabase.GUIDToAssetPath(guid));
                if (settings != null)
                {
                    ASEImporter.Import(asset, settings);
                    return;
                }
                Debug.LogWarning("File " + asset.name + " has empty import metaSpriteImporterSettings, it is ignored.");
            }
        }
コード例 #7
0
 public static AsepriteAnimation New(string path, string initTag)
 {
     return(ASEImporter.Import(path, initTag));
 }