mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-10 04:49:28 -05:00
GenerateInfo
This commit is contained in:
@@ -29,46 +29,74 @@ namespace UniVRM10
|
||||
}
|
||||
#endif
|
||||
|
||||
struct GenerateInfo
|
||||
{
|
||||
public string JsonSchema;
|
||||
public string FormatDir;
|
||||
public string SerializerDir;
|
||||
|
||||
public GenerateInfo(string jsonSchema, string formatDir, string serializerDir)
|
||||
{
|
||||
JsonSchema = jsonSchema;
|
||||
FormatDir = formatDir;
|
||||
SerializerDir = serializerDir;
|
||||
}
|
||||
}
|
||||
|
||||
static void Run(bool debug)
|
||||
{
|
||||
var projectRoot = new DirectoryInfo(Path.GetFullPath(Path.Combine(Application.dataPath, "../")));
|
||||
|
||||
var gltf = new FileInfo(Path.Combine(projectRoot.FullName, "glTF/specification/2.0/schema/glTF.schema.json"));
|
||||
|
||||
var args = new string[]
|
||||
var args = new GenerateInfo[]
|
||||
{
|
||||
// VRMC_vrm
|
||||
"vrm-specification/specification/VRMC_vrm-1.0_draft/schema/VRMC_vrm.schema.json",
|
||||
"Assets/VRM10/Runtime/Format/Vrm", // format
|
||||
"Assets/VRM10/Runtime/Format/Vrm", // serializer
|
||||
// VRMC_hdr_emissiveMultiplier
|
||||
"vrm-specification/specification/VRMC_materials_hdr_emissiveMultiplier-1.0_draft/schema/VRMC_materials_hdr_emissiveMultiplier.json",
|
||||
"Assets/VRMShaders/VRM10/Format/Runtime/EmissiveMultiplier", // format
|
||||
"Assets/VRM10/Runtime/Format/EmissiveMultiplier", // serializer
|
||||
new GenerateInfo(
|
||||
"vrm-specification/specification/VRMC_materials_hdr_emissiveMultiplier-1.0_draft/schema/VRMC_materials_hdr_emissiveMultiplier.json",
|
||||
"Assets/VRMShaders/VRM10/Format/Runtime/EmissiveMultiplier",
|
||||
"Assets/VRM10/Runtime/Format/EmissiveMultiplier"
|
||||
),
|
||||
|
||||
// VRMC_vrm
|
||||
new GenerateInfo(
|
||||
"vrm-specification/specification/VRMC_vrm-1.0_draft/schema/VRMC_vrm.schema.json",
|
||||
"Assets/VRM10/Runtime/Format/Vrm",
|
||||
"Assets/VRM10/Runtime/Format/Vrm"
|
||||
),
|
||||
|
||||
// VRMC_materials_mtoon
|
||||
"vrm-specification/specification/VRMC_materials_mtoon-1.0_draft/schema/VRMC_materials_mtoon.schema.json",
|
||||
"Assets/VRMShaders/VRM10/Format/Runtime/MaterialsMToon", // format
|
||||
"Assets/VRM10/Runtime/Format/MaterialsMToon", // serializer
|
||||
new GenerateInfo(
|
||||
"vrm-specification/specification/VRMC_materials_mtoon-1.0_draft/schema/VRMC_materials_mtoon.schema.json",
|
||||
"Assets/VRMShaders/VRM10/Format/Runtime/MaterialsMToon",
|
||||
"Assets/VRM10/Runtime/Format/MaterialsMToon"
|
||||
),
|
||||
|
||||
// VRMC_springBone
|
||||
"vrm-specification/specification/VRMC_springBone-1.0_draft/schema/VRMC_springBone.schema.json",
|
||||
"Assets/VRM10/Runtime/Format/SpringBone", // format
|
||||
"Assets/VRM10/Runtime/Format/SpringBone", // serializer
|
||||
new GenerateInfo(
|
||||
"vrm-specification/specification/VRMC_springBone-1.0_draft/schema/VRMC_springBone.schema.json",
|
||||
"Assets/VRM10/Runtime/Format/SpringBone",
|
||||
"Assets/VRM10/Runtime/Format/SpringBone"
|
||||
),
|
||||
|
||||
// VRMC_node_constraint
|
||||
"vrm-specification/specification/VRMC_node_constraint-1.0_draft/schema/VRMC_node_constraint.schema.json",
|
||||
"Assets/VRM10/Runtime/Format/Constraints", // format
|
||||
"Assets/VRM10/Runtime/Format/Constraints", // serializer
|
||||
new GenerateInfo(
|
||||
"vrm-specification/specification/VRMC_node_constraint-1.0_draft/schema/VRMC_node_constraint.schema.json",
|
||||
"Assets/VRM10/Runtime/Format/Constraints",
|
||||
"Assets/VRM10/Runtime/Format/Constraints"
|
||||
),
|
||||
};
|
||||
|
||||
for (int i = 0; i < args.Length; i += 3)
|
||||
foreach (var arg in args)
|
||||
{
|
||||
var extensionSchemaPath = new FileInfo(Path.Combine(projectRoot.FullName, args[i]));
|
||||
var extensionSchemaPath = new FileInfo(Path.Combine(projectRoot.FullName, arg.JsonSchema));
|
||||
var parser = new UniGLTF.JsonSchema.JsonSchemaParser(gltf.Directory, extensionSchemaPath.Directory);
|
||||
var extensionSchema = parser.Load(extensionSchemaPath, "");
|
||||
|
||||
var formatDst = new DirectoryInfo(Path.Combine(projectRoot.FullName, args[i + 1]));
|
||||
var formatDst = new DirectoryInfo(Path.Combine(projectRoot.FullName, arg.FormatDir));
|
||||
Debug.Log($"Format.g Dir: {formatDst}");
|
||||
|
||||
var serializerDst = new DirectoryInfo(Path.Combine(projectRoot.FullName, args[i + 2]));
|
||||
|
||||
var serializerDst = new DirectoryInfo(Path.Combine(projectRoot.FullName, arg.SerializerDir));
|
||||
Debug.Log($"Serializer/Deserializer.g Dir: {serializerDst}");
|
||||
|
||||
if (debug)
|
||||
|
||||
Reference in New Issue
Block a user