public override IEnumerable <ObjectUrl> GetInputFiles() { for (int i = 0; i < ImageToTextureIndex.Values.Distinct().Count(); i++) { yield return(new ObjectUrl(UrlType.Internal, SpriteSheetAsset.BuildTextureUrl(Url, i))); } }
protected override Task <ResultStatus> DoCommandOverride(ICommandContext commandContext) { var assetManager = new AssetManager(); var imageGroupData = new SpriteSheet { Sprites = new List <Graphics.Sprite>() }; // add the sprite data to the sprite list. foreach (var image in AssetParameters.SheetAsset.Sprites) { var newImage = new Graphics.Sprite { Name = image.Name, Region = image.TextureRegion, IsTransparent = AssetParameters.SheetAsset.Alpha != AlphaFormat.None, // todo analyze texture region texture data to auto-determine alpha? Orientation = image.Orientation, Center = image.Center + (image.CenterFromMiddle ? new Vector2(image.TextureRegion.Width, image.TextureRegion.Height) / 2 : Vector2.Zero), Borders = image.Borders, PixelsPerUnit = new Vector2(image.PixelsPerUnit) }; int imageIndex; if (ImageToTextureIndex.TryGetValue(image, out imageIndex)) { newImage.Texture = AttachedReferenceManager.CreateSerializableVersion <Texture>(Guid.Empty, SpriteSheetAsset.BuildTextureUrl(Url, ImageToTextureIndex[image])); } else { commandContext.Logger.Warning("Image '{0}' has an invalid image source file '{1}', resulting texture will be null.", image.Name, image.Source); } imageGroupData.Sprites.Add(newImage); } // save the imageData into the data base assetManager.Save(Url, imageGroupData); return(Task.FromResult(ResultStatus.Successful)); }