add tmp->png conversion to utility
This commit is contained in:
@@ -171,7 +171,6 @@ namespace OpenRA.Editor
|
|||||||
BorderStyle = BorderStyle.FixedSingle
|
BorderStyle = BorderStyle.FixedSingle
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ibox.Click += (_, e) => surface1.SetTool(new ActorTool(template));
|
ibox.Click += (_, e) => surface1.SetTool(new ActorTool(template));
|
||||||
|
|
||||||
actorPalette.Controls.Add(ibox);
|
actorPalette.Controls.Add(ibox);
|
||||||
|
|||||||
@@ -105,6 +105,35 @@ namespace OpenRA.Utility
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ConvertTmpToPng(string[] args)
|
||||||
|
{
|
||||||
|
var mods = args[1].Split(',');
|
||||||
|
var theater = args[2];
|
||||||
|
var templateNames = args.Skip(3);
|
||||||
|
|
||||||
|
var manifest = new Manifest(mods);
|
||||||
|
FileSystem.LoadFromManifest(manifest);
|
||||||
|
|
||||||
|
var tileset = manifest.TileSets.Select( a => new TileSet(a) )
|
||||||
|
.FirstOrDefault( ts => ts.Name == theater );
|
||||||
|
|
||||||
|
if (tileset == null)
|
||||||
|
throw new InvalidOperationException("No theater named '{0}'".F(theater));
|
||||||
|
|
||||||
|
tileset.LoadTiles();
|
||||||
|
var palette = new Palette(FileSystem.Open(tileset.Palette), true);
|
||||||
|
|
||||||
|
foreach( var templateName in templateNames )
|
||||||
|
{
|
||||||
|
var template = tileset.Templates.FirstOrDefault(tt => tt.Value.Image == templateName);
|
||||||
|
if (template.Value == null)
|
||||||
|
throw new InvalidOperationException("No such template '{0}'".F(templateName));
|
||||||
|
|
||||||
|
using( var image = tileset.RenderTemplate(template.Value.Id, palette) )
|
||||||
|
image.Save( Path.ChangeExtension( templateName, ".png" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void ConvertFormat2ToFormat80(string[] args)
|
public static void ConvertFormat2ToFormat80(string[] args)
|
||||||
{
|
{
|
||||||
var src = args[1];
|
var src = args[1];
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace OpenRA.Utility
|
|||||||
{ "--png", Command.ConvertShpToPng },
|
{ "--png", Command.ConvertShpToPng },
|
||||||
{ "--fromd2", Command.ConvertFormat2ToFormat80 },
|
{ "--fromd2", Command.ConvertFormat2ToFormat80 },
|
||||||
{ "--extract", Command.ExtractFiles },
|
{ "--extract", Command.ExtractFiles },
|
||||||
|
{ "--tmp-png", Command.ConvertTmpToPng },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (args.Length == 0) { PrintUsage(); return; }
|
if (args.Length == 0) { PrintUsage(); return; }
|
||||||
@@ -55,6 +56,7 @@ namespace OpenRA.Utility
|
|||||||
Console.WriteLine(" --shp PNGFILE FRAMEWIDTH Convert a PNG containing one or more frames to a SHP");
|
Console.WriteLine(" --shp PNGFILE FRAMEWIDTH Convert a PNG containing one or more frames to a SHP");
|
||||||
Console.WriteLine(" --png SHPFILE PALETTE [--transparent] Convert a SHP to a PNG containing all of its frames, optionally setting up transparency");
|
Console.WriteLine(" --png SHPFILE PALETTE [--transparent] Convert a SHP to a PNG containing all of its frames, optionally setting up transparency");
|
||||||
Console.WriteLine(" --extract MOD[,MOD]* FILES Extract files from mod packages");
|
Console.WriteLine(" --extract MOD[,MOD]* FILES Extract files from mod packages");
|
||||||
|
Console.WriteLine(" --tmp-png MOD[,MOD]* THEATER FILES Extract terrain tiles to PNG");
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetNamedArg(string[] args, string arg)
|
static string GetNamedArg(string[] args, string arg)
|
||||||
|
|||||||
Reference in New Issue
Block a user