Fix --dump-sequence-sheets utility command.
Also formats output filenames to specify indexed sprite channels.
This commit is contained in:
@@ -35,11 +35,14 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var palette = new ImmutablePalette(args[1], new[] { 0 }, Array.Empty<int>());
|
||||
|
||||
SequenceProvider sequences;
|
||||
var mapPackage = new Folder(Platform.EngineDir).OpenPackage(args[2], modData.ModFiles);
|
||||
if (mapPackage != null)
|
||||
if (!modData.DefaultSequences.TryGetValue(args[2], out sequences))
|
||||
{
|
||||
var mapPackage = new Folder(Platform.EngineDir).OpenPackage(args[2], modData.ModFiles);
|
||||
if (mapPackage == null)
|
||||
throw new InvalidOperationException($"{args[2]} is not a valid tileset or map path");
|
||||
|
||||
sequences = new Map(modData, mapPackage).Sequences;
|
||||
else if (!modData.DefaultSequences.TryGetValue(args[2], out sequences))
|
||||
throw new InvalidOperationException($"{args[2]} is not a valid tileset or map path");
|
||||
}
|
||||
|
||||
sequences.Preload();
|
||||
|
||||
@@ -50,14 +53,14 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
var max = s == sb.Current ? (int)sb.CurrentChannel + 1 : 4;
|
||||
for (var i = 0; i < max; i++)
|
||||
s.AsPng((TextureChannel)ChannelMasks[i], palette).Save($"{count++}.png");
|
||||
s.AsPng((TextureChannel)ChannelMasks[i], palette).Save($"{count}.{i}.png");
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
sb = sequences.SpriteCache.SheetBuilders[SheetType.BGRA];
|
||||
foreach (var s in sb.AllSheets)
|
||||
s.AsPng().Save($"{count++}.png");
|
||||
|
||||
Console.WriteLine("Saved [0..{0}].png", count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user