/// <summary> /// インポート完了後処理 /// </summary> private void OnPostprocessImpl(AssetImporter assetImporter, string assetPath) { var settings = SettingsIO.NestedLoad(assetPath); if (settings == null) { return; } for (int i = 0; i < settings.settings.Count; i++) { var setting = settings.settings [i]; var importer = GetImporterInstance(setting.Type); if (importer == null) { Debug.LogError("IAssetImporterExtensionを継承していないImporterが定義されています"); continue; } if (CanExecute(assetImporter, importer)) { var properties = setting.properties.Where(o => o.isEnabled).ToArray(); importer.OnPostprocess(assetPath, properties); } } }
/// <summary> /// 全アセットインポート完了後処理 /// </summary> private static void OnPostprocessAllAssetsImpl(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { for (int n = 0; n < importedAssets.Length; n++) { var assetPath = importedAssets [n]; var settings = SettingsIO.NestedLoad(assetPath); if (settings == null) { return; } for (int i = 0; i < settings.settings.Count; i++) { var setting = settings.settings [i]; var importer = GetImporterInstance(setting.Type); if (importer == null) { Debug.LogError("IAssetImporterExtensionを継承していないImporterが定義されています"); continue; } var properties = setting.properties.Where(o => o.isEnabled).ToArray(); importer.OnPostprocess(assetPath, properties); } } for (int n = 0; n < deletedAssets.Length; n++) { var assetPath = deletedAssets [n]; var settings = SettingsIO.NestedLoad(assetPath); if (settings == null) { return; } for (int i = 0; i < settings.settings.Count; i++) { var setting = settings.settings [i]; var importer = GetImporterInstance(setting.Type); if (importer == null) { Debug.LogError("IAssetImporterExtensionを継承していないImporterが定義されています"); continue; } var properties = setting.properties.Where(o => o.isEnabled).ToArray(); importer.OnRemoveprocess(assetPath, properties); } } }
private Settings LoadParentSettings(string selectPath) { var directoryPath = ""; if (Directory.Exists(selectPath)) { directoryPath = selectPath; } else { directoryPath = Path.GetDirectoryName(selectPath); } directoryPath = Path.GetDirectoryName(directoryPath); return(SettingsIO.NestedLoad(directoryPath)); }