sequenceEditor is mod-aware now.
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using IjwFramework.Collections;
|
||||
using System;
|
||||
|
||||
namespace OpenRa.FileFormats
|
||||
{
|
||||
@@ -64,6 +65,23 @@ namespace OpenRa.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
public static void MountTemporaryEx(string name)
|
||||
{
|
||||
name = name.ToLowerInvariant();
|
||||
var optional = name.StartsWith("~");
|
||||
if (optional) name = name.Substring(1);
|
||||
|
||||
var a = name.EndsWith(".mix")
|
||||
? (Action)(() => FileSystem.MountTemporary(new Package(name)))
|
||||
: () => FileSystem.MountTemporary(new Folder(name));
|
||||
|
||||
if (optional)
|
||||
try { a(); }
|
||||
catch { }
|
||||
else
|
||||
a();
|
||||
}
|
||||
|
||||
public static void UnmountTemporaryPackages()
|
||||
{
|
||||
mountedFolders.RemoveAll(f => temporaryMounts.Contains(f));
|
||||
|
||||
@@ -40,16 +40,9 @@ namespace OpenRa
|
||||
FileSystem.UnmountTemporaryPackages();
|
||||
Timer.Time("reset: {0}");
|
||||
|
||||
foreach (var dir in manifest.Folders)
|
||||
FileSystem.MountTemporary(new Folder(dir));
|
||||
|
||||
foreach (var pkg in manifest.Packages)
|
||||
if (pkg.StartsWith( "~")) // this package is optional.
|
||||
try { FileSystem.MountTemporary(new Package(pkg.Substring(1))); }
|
||||
catch { }
|
||||
else
|
||||
FileSystem.MountTemporary(new Package(pkg));
|
||||
|
||||
foreach (var dir in manifest.Folders) FileSystem.MountTemporaryEx(dir);
|
||||
foreach (var pkg in manifest.Packages) FileSystem.MountTemporaryEx(pkg);
|
||||
|
||||
Timer.Time("mount temporary packages: {0}");
|
||||
}
|
||||
|
||||
@@ -87,7 +80,6 @@ namespace OpenRa
|
||||
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
|
||||
Timer.Time( "ChromeProv, SeqProv, viewport: {0}" );
|
||||
|
||||
|
||||
skipMakeAnims = true;
|
||||
foreach (var treeReference in Game.world.Map.Trees)
|
||||
world.CreateActor(treeReference.Image, new int2(treeReference.Location), null);
|
||||
|
||||
@@ -69,24 +69,28 @@ namespace SequenceEditor
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
FileSystem.MountDefaultPackages();
|
||||
try
|
||||
{
|
||||
FileSystem.MountAftermathPackages();
|
||||
}
|
||||
catch( FileNotFoundException ){}
|
||||
|
||||
XmlFilename = args.FirstOrDefault( x => x.EndsWith(".xml") ) ?? "sequences.xml";
|
||||
if (args.Length != 3)
|
||||
{
|
||||
MessageBox.Show( "usage: SequenceEditor mod[,mod]* sequences-file.xml palette.pal");
|
||||
return;
|
||||
}
|
||||
|
||||
var mods = args[0].Split(',');
|
||||
var manifest = new Manifest(mods);
|
||||
|
||||
foreach (var folder in manifest.Folders) FileSystem.MountTemporaryEx(folder);
|
||||
foreach (var pkg in manifest.Packages) FileSystem.MountTemporaryEx(pkg);
|
||||
|
||||
XmlFilename = args[1];
|
||||
Doc = new XmlDocument();
|
||||
Doc.Load(XmlFilename);
|
||||
|
||||
var tempPal = new Palette(FileSystem.Open("temperat.pal"));
|
||||
Pal = tempPal; //new Palette(tempPal, new ShroudPaletteRemap());
|
||||
var tempPal = new Palette(FileSystem.Open(args[2]));
|
||||
Pal = tempPal;
|
||||
|
||||
UnitName = args.FirstOrDefault( x => !x.EndsWith(".xml") );
|
||||
if (UnitName == null)
|
||||
UnitName = GetTextForm.GetString("Unit to edit?", "e1");
|
||||
if (UnitName == null)
|
||||
UnitName = GetTextForm.GetString("Unit to edit?", "e1");
|
||||
if (string.IsNullOrEmpty(UnitName))
|
||||
return;
|
||||
|
||||
LoadAndResolve(UnitName);
|
||||
@@ -95,10 +99,7 @@ namespace SequenceEditor
|
||||
foreach (XmlElement e in Doc.SelectNodes(xpath))
|
||||
{
|
||||
if (e.HasAttribute("src"))
|
||||
{
|
||||
var src = e.GetAttribute("src");
|
||||
LoadAndResolve(src);
|
||||
}
|
||||
LoadAndResolve(e.GetAttribute("src"));
|
||||
Sequences[e.GetAttribute("name")] = new Sequence(e);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user