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."); } } }
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."); } } }
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(); }
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(); }
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(); }
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."); } }
public static AsepriteAnimation New(string path, string initTag) { return(ASEImporter.Import(path, initTag)); }