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