示例#1
0
        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[]
            {
                // 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_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
                // 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
                // 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
            };

            for (int i = 0; i < args.Length; i += 3)
            {
                var extensionSchemaPath = new FileInfo(Path.Combine(projectRoot.FullName, args[i]));
                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]));
                Debug.Log($"Format.g Dir: {formatDst}");

                var serializerDst = new DirectoryInfo(Path.Combine(projectRoot.FullName, args[i + 2]));
                Debug.Log($"Serializer/Deserializer.g Dir: {serializerDst}");

                if (debug)
                {
                    Debug.Log(extensionSchema.Dump());
                }
                else
                {
                    GenerateUniGLTFSerialization.Generator.GenerateTo(extensionSchema, formatDst, serializerDst);
                }
            }
        }
示例#2
0
        public static void Main()
        {
            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[]
            {
                // VRMC_vrm
                "vrm-specification/specification/VRMC_vrm-1.0_draft/schema/VRMC_vrm.schema.json",
                "Assets/VRM10/Runtime/Format/Vrm", // dst
                // VRMC_constraints
                "vrm-specification/specification/VRMC_constraints-1.0_draft/schema/VRMC_constraints.schema.json",
                "Assets/VRM10/Runtime/Format/Constraints", // dst
                //
                "vrm-specification/specification/VRMC_materials_mtoon-1.0_draft/schema/VRMC_materials_mtoon.schema.json",
                "Assets/VRM10/Runtime/Format/MaterialsMToon", // dst
                //
                "vrm-specification/specification/VRMC_node_collider_1.0_draft/schema/VRMC_node_collider.json",
                "Assets/VRM10/Runtime/Format/NodeCollider", // dst
                //
                "vrm-specification/specification/VRMC_springBone-1.0_draft/schema/VRMC_springBone.schema.json",
                "Assets/VRM10/Runtime/Format/SpringBone", // dst
            };

            for (int i = 0; i < args.Length; i += 2)
            {
                var extensionSchemaPath = new FileInfo(Path.Combine(projectRoot.FullName, args[i]));
                var parser          = new UniGLTF.JsonSchema.JsonSchemaParser(gltf.Directory, extensionSchemaPath.Directory);
                var extensionSchema = parser.Load(extensionSchemaPath, "");
                // extensionSchema.Dump();

                var dst = new DirectoryInfo(Path.Combine(projectRoot.FullName, args[i + 1]));
                Debug.Log(dst);
                GenerateUniGLTFSerialization.Generator.GenerateTo(extensionSchema, dst, clearFolder: true);
            }
        }
示例#3
0
        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 GenerateInfo[]
            {
                // VRMC_hdr_emissiveMultiplier
                new GenerateInfo(
                    "vrm-specification/specification/VRMC_materials_hdr_emissiveMultiplier-1.0_draft/schema/VRMC_materials_hdr_emissiveMultiplier.json",
                    "Assets/UniGLTF/Runtime/UniGLTF/Format/ExtensionsAndExtras/EmissiveMultiplier"
                    ),

                // VRMC_vrm
                new GenerateInfo(
                    "vrm-specification/specification/VRMC_vrm-1.0_draft/schema/VRMC_vrm.schema.json",
                    "Assets/VRM10/Runtime/Format/Vrm"
                    ),

                // VRMC_materials_mtoon
                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
                new GenerateInfo(
                    "vrm-specification/specification/VRMC_springBone-1.0_draft/schema/VRMC_springBone.schema.json",
                    "Assets/VRM10/Runtime/Format/SpringBone"
                    ),

                // VRMC_node_constraint
                new GenerateInfo(
                    "vrm-specification/specification/VRMC_node_constraint-1.0_draft/schema/VRMC_node_constraint.schema.json",
                    "Assets/VRM10/Runtime/Format/Constraints"
                    ),
            };

            foreach (var arg in args)
            {
                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, arg.FormatDir));
                Debug.Log($"Format.g Dir: {formatDst}");

                var serializerDst = new DirectoryInfo(Path.Combine(projectRoot.FullName, arg.SerializerDir));
                Debug.Log($"Serializer/Deserializer.g Dir: {serializerDst}");

                if (debug)
                {
                    Debug.Log(extensionSchema.Dump());
                }
                else
                {
                    GenerateUniGLTFSerialization.Generator.GenerateTo(extensionSchema, formatDst, serializerDst);
                }
            }
        }