mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-15 03:04:49 +08:00
YTD and embedded texture editing in YtdForm, Fixed texture sorting by hash when importing XML
This commit is contained in:
@@ -99,7 +99,6 @@ namespace CodeWalker.GameFiles
|
||||
public void ReadXml(XmlNode node, string ddsfolder)
|
||||
{
|
||||
var textures = new List<Texture>();
|
||||
var texturehashes = new List<uint>();
|
||||
|
||||
var inodes = node.SelectNodes("Item");
|
||||
if (inodes != null)
|
||||
@@ -109,15 +108,10 @@ namespace CodeWalker.GameFiles
|
||||
var tex = new Texture();
|
||||
tex.ReadXml(inode, ddsfolder);
|
||||
textures.Add(tex);
|
||||
texturehashes.Add(tex.NameHash);
|
||||
}
|
||||
}
|
||||
|
||||
TextureNameHashes = new ResourceSimpleList64_uint();
|
||||
TextureNameHashes.data_items = texturehashes.ToArray();
|
||||
Textures = new ResourcePointerList64<Texture>();
|
||||
Textures.data_items = textures.ToArray();
|
||||
BuildDict();
|
||||
BuildFromTextureList(textures);
|
||||
}
|
||||
public static void WriteXmlNode(TextureDictionary d, StringBuilder sb, int indent, string ddsfolder, string name = "TextureDictionary")
|
||||
{
|
||||
@@ -175,6 +169,23 @@ namespace CodeWalker.GameFiles
|
||||
Dict = dict;
|
||||
}
|
||||
|
||||
public void BuildFromTextureList(List<Texture> textures)
|
||||
{
|
||||
textures.Sort((a, b) => a.NameHash.CompareTo(b.NameHash));
|
||||
|
||||
var texturehashes = new List<uint>();
|
||||
foreach (var tex in textures)
|
||||
{
|
||||
texturehashes.Add(tex.NameHash);
|
||||
}
|
||||
|
||||
TextureNameHashes = new ResourceSimpleList64_uint();
|
||||
TextureNameHashes.data_items = texturehashes.ToArray();
|
||||
Textures = new ResourcePointerList64<Texture>();
|
||||
Textures.data_items = textures.ToArray();
|
||||
BuildDict();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))] public class TextureBase : ResourceSystemBlock
|
||||
|
||||
Reference in New Issue
Block a user