Renamed Obj to BodyTemplate

This commit is contained in:
2026-06-13 21:30:02 +02:00
parent 659ddb7a10
commit 24926d01d3
6 changed files with 46 additions and 45 deletions

View File

@@ -7,7 +7,7 @@ using System.IO;
namespace _2DGAMELIB namespace _2DGAMELIB
{ {
[Serializable] [Serializable]
public class Obj public class BodyTemplate
{ {
public string Tag = ""; public string Tag = "";
@@ -189,7 +189,7 @@ namespace _2DGAMELIB
} }
} }
public Obj SetDefaultR() public BodyTemplate SetDefaultR()
{ {
foreach (VariantGrid value in Difss.Values) foreach (VariantGrid value in Difss.Values)
{ {
@@ -198,7 +198,7 @@ namespace _2DGAMELIB
return this; return this;
} }
public Obj() public BodyTemplate()
{ {
} }

View File

@@ -31,19 +31,19 @@ namespace _2DGAMELIB
["四足下腕"] = "四足LowerArm", ["四足下腕"] = "四足LowerArm",
}; };
public static void MigrateKeys(this Obj obj) public static void MigrateKeys(this BodyTemplate BodyTemplate)
{ {
var newDict = new OrderedDictionary<string, VariantGrid>(); var newDict = new OrderedDictionary<string, VariantGrid>();
foreach (var key in obj.Keys) foreach (var key in BodyTemplate.Keys)
{ {
var newKey = KeyMap.TryGetValue(key, out var mapped) ? mapped : key; var newKey = KeyMap.TryGetValue(key, out var mapped) ? mapped : key;
var difs = obj.Difss[key]; var difs = BodyTemplate.Difss[key];
newDict.Add(newKey, difs); newDict.Add(newKey, difs);
} }
obj.Difss = newDict; BodyTemplate.Difss = newDict;
} }
} }

View File

@@ -156,16 +156,16 @@ namespace _2DGAMELIB
GetMinMaxY(ShapePart, ref MM[1].Y, ref MM[0].Y); GetMinMaxY(ShapePart, ref MM[1].Y, ref MM[0].Y);
} }
public static Obj ObjLoad(this byte[] bd) public static BodyTemplate ObjLoad(this byte[] bd)
{ {
return bd.Load<byte[]>().ToDeserialObject<Obj>().SetDefaultR(); return bd.Load<byte[]>().ToDeserialObject<BodyTemplate>().SetDefaultR();
} }
public static Obj? ObjLoadRaw(this byte[] bd) public static BodyTemplate? ObjLoadRaw(this byte[] bd)
{ {
try try
{ {
return bd.Load<byte[]>().ToDeserialObject<Obj>(); return bd.Load<byte[]>().ToDeserialObject<BodyTemplate>();
} }
catch catch
{ {

View File

@@ -21,7 +21,8 @@ namespace _2DGAMELIB
.Add("_2DGAMELIB.Out", typeof(CurveOutline)) .Add("_2DGAMELIB.Out", typeof(CurveOutline))
.Add("_2DGAMELIB.Joi", typeof(JointPoint)) .Add("_2DGAMELIB.Joi", typeof(JointPoint))
.Add("_2DGAMELIB.Dif", typeof(MorphVariant)) .Add("_2DGAMELIB.Dif", typeof(MorphVariant))
.Add("_2DGAMELIB.Difs", typeof(VariantGrid)); .Add("_2DGAMELIB.Difs", typeof(VariantGrid))
.Add("_2DGAMELIB.Obj", typeof(BodyTemplate));
private static BinaryFormatter NewFormatter() private static BinaryFormatter NewFormatter()
{ {

View File

@@ -239,7 +239,7 @@ class Program
foreach (var (name, data) in resources) foreach (var (name, data) in resources)
{ {
Console.Write($"Loading {name}... "); Console.Write($"Loading {name}... ");
Obj? obj; BodyTemplate? obj;
try try
{ {
obj = data.ObjLoadRaw(); obj = data.ObjLoadRaw();
@@ -558,12 +558,12 @@ class Program
return result; return result;
} }
static JObject ExportObj(Obj obj) static JObject ExportObj(BodyTemplate BodyTemplate)
{ {
var keys = obj.Difss.Keys.Cast<string>().ToList(); var keys = BodyTemplate.Difss.Keys.Cast<string>().ToList();
var result = new JObject var result = new JObject
{ {
["Tag"] = obj.Tag ?? "", ["Tag"] = BodyTemplate.Tag ?? "",
["KeyCount"] = keys.Count, ["KeyCount"] = keys.Count,
["Keys"] = JArray.FromObject(keys), ["Keys"] = JArray.FromObject(keys),
["Difss"] = new JObject() ["Difss"] = new JObject()
@@ -571,7 +571,7 @@ class Program
foreach (var key in keys) foreach (var key in keys)
{ {
result["Difss"][key] = ExportDifs(obj.Difss[key]); result["Difss"][key] = ExportDifs(BodyTemplate.Difss[key]);
} }
return result; return result;

View File

@@ -16,33 +16,33 @@ namespace SlaveMatrix
{ {
public static class Sta public static class Sta
{ {
public static Obj ; //胴体 public static BodyTemplate ; //胴体
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static Obj ; public static BodyTemplate ;
public static double MaxAre; public static double MaxAre;
@@ -1090,14 +1090,14 @@ namespace SlaveMatrix
//胴体.SaveExMod("C:\\Users\\adel4\\Documents\\胴体"); //胴体.SaveExMod("C:\\Users\\adel4\\Documents\\胴体");
//Ser.ToJson(胴体, "C:\\Users\\adel4\\Documents\\胴体.json"); //Ser.ToJson(胴体, "C:\\Users\\adel4\\Documents\\胴体.json");
//胴体 = Ser.UnJson<Obj>("C:\\Users\\adel4\\Documents\\胴体.json"); //胴体 = Ser.UnJson<BodyTemplate>("C:\\Users\\adel4\\Documents\\胴体.json");
obj = Resources..ObjLoad(); obj = Resources..ObjLoad();
obj.MigrateKeys(); obj.MigrateKeys();
= obj; = obj;
//肩左.SaveExMod("C:\\Users\\dave\\Documents\\肩左"); //肩左.SaveExMod("C:\\Users\\dave\\Documents\\肩左");
//Ser.ToJson(肩左, "C:\\Users\\dave\\Documents\\肩左.json"); //Ser.ToJson(肩左, "C:\\Users\\dave\\Documents\\肩左.json");
//肩左 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\肩左.json"); //肩左 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\肩左.json");
obj = Resources..ObjLoad(); obj = Resources..ObjLoad();
@@ -1105,64 +1105,64 @@ namespace SlaveMatrix
= obj; = obj;
//腕左.SaveExMod("C:\\Users\\dave\\Documents\\腕左"); //腕左.SaveExMod("C:\\Users\\dave\\Documents\\腕左");
//Ser.ToJson(腕左, "C:\\Users\\dave\\Documents\\腕左.json"); //Ser.ToJson(腕左, "C:\\Users\\dave\\Documents\\腕左.json");
//腕左 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\腕左.json"); //腕左 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\腕左.json");
obj = Resources..ObjLoad(); obj = Resources..ObjLoad();
obj.MigrateKeys(); obj.MigrateKeys();
= obj; = obj;
//脚左.SaveExMod("C:\\Users\\dave\\Documents\\脚左"); //脚左.SaveExMod("C:\\Users\\dave\\Documents\\脚左");
//Ser.ToJson(脚左, "C:\\Users\\dave\\Documents\\脚左.json"); //Ser.ToJson(脚左, "C:\\Users\\dave\\Documents\\脚左.json");
//脚左 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\脚左.json"); //脚左 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\脚左.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//尻尾.SaveExMod("C:\\Users\\dave\\Documents\\尻尾"); //尻尾.SaveExMod("C:\\Users\\dave\\Documents\\尻尾");
//Ser.ToJson(尻尾, "C:\\Users\\dave\\Documents\\尻尾.json"); //Ser.ToJson(尻尾, "C:\\Users\\dave\\Documents\\尻尾.json");
//尻尾 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\尻尾.json"); //尻尾 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\尻尾.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//半身.SaveExMod("C:\\Users\\dave\\Documents\\半身"); //半身.SaveExMod("C:\\Users\\dave\\Documents\\半身");
//Ser.ToJson(半身, "C:\\Users\\dave\\Documents\\半身.json"); //Ser.ToJson(半身, "C:\\Users\\dave\\Documents\\半身.json");
//半身 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\半身.json"); //半身 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\半身.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//肢左.SaveExMod("C:\\Users\\dave\\Documents\\肢左"); //肢左.SaveExMod("C:\\Users\\dave\\Documents\\肢左");
//Ser.ToJson(肢左, "C:\\Users\\dave\\Documents\\肢左.json"); //Ser.ToJson(肢左, "C:\\Users\\dave\\Documents\\肢左.json");
//肢左 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\肢左.json"); //肢左 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\肢左.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//肢中.SaveExMod("C:\\Users\\dave\\Documents\\肢中"); //肢中.SaveExMod("C:\\Users\\dave\\Documents\\肢中");
//Ser.ToJson(肢中, "C:\\Users\\dave\\Documents\\肢中.json"); //Ser.ToJson(肢中, "C:\\Users\\dave\\Documents\\肢中.json");
//肢中 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\肢中.json"); //肢中 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\肢中.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//性器.SaveExMod("C:\\Users\\dave\\Documents\\性器"); //性器.SaveExMod("C:\\Users\\dave\\Documents\\性器");
//Ser.ToJson(性器, "C:\\Users\\dave\\Documents\\性器.json"); //Ser.ToJson(性器, "C:\\Users\\dave\\Documents\\性器.json");
//性器 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\性器.json"); //性器 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\性器.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//性器付.SaveExMod("C:\\Users\\dave\\Documents\\性器付"); //性器付.SaveExMod("C:\\Users\\dave\\Documents\\性器付");
//Ser.ToJson(性器付, "C:\\Users\\dave\\Documents\\性器付.json"); //Ser.ToJson(性器付, "C:\\Users\\dave\\Documents\\性器付.json");
//性器付 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\性器付.json"); //性器付 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\性器付.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//スタンプ.SaveExMod("C:\\Users\\dave\\Documents\\スタンプ"); //スタンプ.SaveExMod("C:\\Users\\dave\\Documents\\スタンプ");
//Ser.ToJson(スタンプ, "C:\\Users\\dave\\Documents\\スタンプ.json"); //Ser.ToJson(スタンプ, "C:\\Users\\dave\\Documents\\スタンプ.json");
//スタンプ = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\スタンプ.json"); //スタンプ = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\スタンプ.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//カーソル.SaveExMod("C:\\Users\\dave\\Documents\\カーソル"); //カーソル.SaveExMod("C:\\Users\\dave\\Documents\\カーソル");
//Ser.ToJson(カーソル, "C:\\Users\\dave\\Documents\\カーソル.json"); //Ser.ToJson(カーソル, "C:\\Users\\dave\\Documents\\カーソル.json");
//カーソル = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\カーソル.json"); //カーソル = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\カーソル.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//その他.SaveExMod("C:\\Users\\dave\\Documents\\その他"); //その他.SaveExMod("C:\\Users\\dave\\Documents\\その他");
//Ser.ToJson(その他, "C:\\Users\\dave\\Documents\\その他.json"); //Ser.ToJson(その他, "C:\\Users\\dave\\Documents\\その他.json");
//その他 = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\その他.json"); //その他 = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\その他.json");
= Resources..ObjLoad(); = Resources..ObjLoad();
//タイル.SaveExMod("C:\\Users\\dave\\Documents\\タイル"); //タイル.SaveExMod("C:\\Users\\dave\\Documents\\タイル");
//Ser.ToJson(タイル, "C:\\Users\\dave\\Documents\\タイル.json"); //Ser.ToJson(タイル, "C:\\Users\\dave\\Documents\\タイル.json");
//タイル = Ser.UnJson<Obj>("C:\\Users\\dave\\Documents\\タイル.json"); //タイル = Ser.UnJson<BodyTemplate>("C:\\Users\\dave\\Documents\\タイル.json");
MaxAre = 0.0584246154149664; MaxAre = 0.0584246154149664;
Elet = typeof(Ele); Elet = typeof(Ele);