void StartBatchImport(DirectoryInfo dirInfo, Palette palette) { IEnumerable <FileInfo> files = IOTools.GetFilesByExtensions(dirInfo, extensions); foreach (FileInfo f in files) { // relative pfad angabe string currentSpritePath = f.FullName.Substring(Application.dataPath.Length - "Assets".Length); Debug.Log("Found " + currentSpritePath); Sprite currentSprite = null; TextureImporter spriteImporter = null; spriteImporter = TextureImporter.GetAtPath(currentSpritePath) as TextureImporter; if (spriteImporter == null) { Debug.LogError(currentSpritePath + " TextureImporter == null "); continue; // skip this character } else { currentSprite = AssetDatabase.LoadAssetAtPath(spriteImporter.assetPath, typeof(Sprite)) as Sprite; // PerformMetaSlice previewPosition.y--; SpriteImport.ImportCharacter(currentSprite, palette, true, previewPosition); } } }
private void OnGUI_SingleAutoImport() { if (GUILayout.Button("Import")) { SpriteImport.ImportCharacter(rawSpritesheet, palette, fShowCreatedSprites, previewPosition); previewPosition.y -= 1.5f; } fShowCreatedSprites = GUILayout.Toggle(fShowCreatedSprites, "Show created Sprites"); previewPosition = EditorGUILayout.Vector3Field("World Position", previewPosition); }