예제 #1
0
        private void Convert()
        {
            string       skeletonfile = string.Empty;
            OgreSkeleton skeleton     = null;

            zmd.Clear();

            if (!string.IsNullOrEmpty(ZMDFile))
            {
                zmd.Load(ZMDFile);
                skeleton     = new OgreSkeleton(zmd);
                skeletonfile = Path.ChangeExtension(Path.GetFileName(ZMDFile), ".skeleton");
            }

            zms.Clear();
            for (int i = 0; i < ZMSFiles.Count; i++)
            {
                zms.Add(new ZMS(ZMSFiles[i]));
                OgreMesh mesh = new OgreMesh(zms[i]);

                if (!string.IsNullOrEmpty(ZMDFile) && zms[i].BonesCount > 0)
                {
                    XmlElement   xmlmesh         = mesh.XMLDoc.DocumentElement;
                    XmlNode      xmlskeletonlink = mesh.XMLDoc.CreateNode(XmlNodeType.Element, "skeletonlink", null);
                    XmlAttribute xmlskeletonname = mesh.XMLDoc.CreateAttribute("name");
                    xmlskeletonname.Value = skeletonfile;
                    xmlskeletonlink.Attributes.Append(xmlskeletonname);
                    xmlmesh.AppendChild(xmlskeletonlink);
                }

                mesh.XMLDoc.Save(Path.ChangeExtension(ZMSFiles[i], ".mesh.xml"));
            }

            if (!string.IsNullOrEmpty(ZMDFile))
            {
                zmo.Clear();
                if ((zmd.Bone.Count > 0) && (ZMOFiles.Count > 0))
                {
                    for (int i = 0; i < ZMOFiles.Count; i++)
                    {
                        zmo.Add(new ZMO(ZMOFiles[i], zmd));
                        OgreAnimation ogreanim = new OgreAnimation(zmd, zmo[i], skeleton.XMLDoc, Path.GetFileNameWithoutExtension(ZMOFiles[i]));
                    }
                }
                skeleton.XMLDoc.Save(Path.ChangeExtension(ZMDFile, ".skeleton.xml"));
            }
        }
예제 #2
0
        private static void Main(string[] args)
        {
#if DEBUG
            //larva
            //ZMSFiles.Clear();
            //zms.Clear();
            //zmo.Clear();
            //zmd.Clear();
            //ProcessFileList(new List<string>() {
            //@"D:\Projects\3D\ROSE\PENGUIN07_BONE.ZMD",
            //@"D:\Projects\3D\ROSE\BODY07.ZMS",
            //@"D:\Projects\3D\ROSE\HEAD07.ZMS",
            //@"D:\Projects\3D\ROSE\PENGUIN07_WALK.ZMO",
            //@"D:\Projects\3D\ROSE\PENGUIN07_RUN.ZMO",
            //@"D:\Projects\3D\ROSE\PENGUIN07_WARNING.ZMO",
            //@"D:\Projects\3D\ROSE\PENGUIN07_STATUS_SKILL01.ZMO",
            //@"D:\Projects\3D\ROSE\PENGUIN07_HIT.ZMO",
            //@"D:\Projects\3D\ROSE\PENGUIN07_DIE.ZMO",
            //});
            //sceneExporter = new SceneExporter("PENGUIN", zms, zmd, zmo);
            //sceneExporter.ExportScene(@"E:\Godot\Projects\ROSE\scenes\PENGUIN.escn", ZMSFiles);

            //larva
            //ZMSFiles.Clear();
            //zms.Clear();
            //zmo.Clear();
            //zmd.Clear();
            //ProcessFileList(new List<string>() {
            //@"D:\Projects\3D\ROSE\LARVA1_BONE.ZMD",
            //  @"D:\Projects\3D\ROSE\LARVA1.ZMS",
            //@"D:\Projects\3D\ROSE\LARVA_ATTACK.ZMO",
            // @"D:\Projects\3D\ROSE\LARVA_WALK.ZMO",
            //@"D:\Projects\3D\ROSE\LARVA_WARNING.ZMO",
            //});
            //sceneExporter = new SceneExporter("Larva", zms, zmd, zmo);
            //sceneExporter.ExportScene(@"E:\Godot\Projects\ROSE\scenes\larva_exported.escn", ZMSFiles);

            // exported
            //ZMSFiles.Clear();
            //zms.Clear();
            //zmo.Clear();
            //zmd.Clear();
            //ProcessFileList(new List<string>() {
            //    @"D:\Projects\3D\ROSE\EXPORTED_BONE.ZMD",
            //    @"D:\Projects\3D\ROSE\EXPORTED.ZMS",
            //});
            //sceneExporter = new SceneExporter("Exported", zms, zmd, zmo);
            //sceneExporter.ExportScene(@"E:\Godot\Projects\ROSE\scenes\exported_exported.escn", ZMSFiles);

            // akines
            //ZMSFiles.Clear();
            //zms.Clear();
            //zmo.Clear();
            //zmd.Clear();
            //ProcessFileList(new List<string>() {
            //    @"D:\Projects\3D\ROSE\AKINES_BODY01.ZMS",
            //    @"D:\Projects\3D\ROSE\AKINES_HEAD01.ZMS",
            //    @"D:\Projects\3D\ROSE\AKINES_BONE.ZMD",
            //    @"D:\Projects\3D\ROSE\AKINES_STOP1.ZMO",
            //});
            //sceneExporter = new SceneExporter("Akines", zms, zmd, zmo);
            //sceneExporter.ExportScene(@"E:\Godot\Projects\ROSE\scenes\akines.escn", ZMSFiles);

            //ZMSFiles.Clear();
            //zms.Clear();
            //zmo.Clear();
            //zmd.Clear();
            //ProcessFileList(new List<string>()
            //{
            //    @"/home/user/Projects/Rose/3DDATA/Cowboy/BODY01.ZMS",
            //    @"/home/user/Projects/Rose/3DDATA/Cowboy/HEAD01.ZMS",
            //    @"/home/user/Projects/Rose/3DDATA/Cowboy/COWBOY_BONE.ZMD",
            //});
            //sceneExporter = new SceneExporter("Cowboy", zms, zmd, zmo);
            //sceneExporter.ExportScene(@"/home/user/Downloads/Godot/Projects/Rose/scenes/Cowboy.escn", ZMSFiles);


            ZMSFiles.Clear();
            zms.Clear();
            zmo.Clear();
            zmd.Clear();
            ProcessFileList(new List <string>()
            {
                @"/home/user/Projects/Rose/3DDATA/Larva/LARVA1.ZMS",
                @"/home/user/Projects/Rose/3DDATA/Larva/LARVA1_BONE.ZMD",
                @"/home/user/Projects/Rose/3DDATA/Larva/LARVA_WALK.ZMO",
                @"/home/user/Projects/Rose/3DDATA/Larva/LARVA_WARNING.ZMO",
                @"/home/user/Projects/Rose/3DDATA/Larva/LARVA_ATTACK.ZMO",
            });
            sceneExporter = new SceneExporter("Larva", zms, zmd, zmo);
            sceneExporter.ExportScene(@"/home/user/Downloads/Godot/Projects/Rose/scenes/LarvaAnimated.escn", ZMSFiles);

            ZMSFiles.Clear();
            zms.Clear();
            zmo.Clear();
            zmd.Clear();
            ProcessFileList(new List <string>()
            {
                @"/home/user/Projects/Rose/3DDATA/Penguin/PENGUIN07_BONE.ZMD",
                @"/home/user/Projects/Rose/3DDATA/Penguin/BODY07.ZMS",
                @"/home/user/Projects/Rose/3DDATA/Penguin/HEAD07.ZMS",
                @"/home/user/Projects/Rose/3DDATA/Penguin/PENGUIN07_ACTION_SKILL01.ZMO",
                @"/home/user/Projects/Rose/3DDATA/Penguin/PENGUIN07_ATTACK.ZMO",
                @"/home/user/Projects/Rose/3DDATA/Penguin/PENGUIN07_RUN.ZMO",
                @"/home/user/Projects/Rose/3DDATA/Penguin/PENGUIN07_WALK.ZMO",
                @"/home/user/Projects/Rose/3DDATA/Penguin/PENGUIN07_WARNING.ZMO",
            });
            sceneExporter = new SceneExporter("Penguin", zms, zmd, zmo);
            sceneExporter.ExportScene(@"/home/user/Downloads/Godot/Projects/Rose/scenes/PenguinAnimated.escn", ZMSFiles);
#else
            ProcessFileList(args.ToList());
            sceneExporter = new SceneExporter("Mesh", zms, zmd, zmo, ZMSFiles);
            sceneExporter.ExportScene(@"export.escn");
#endif

            // The [.escn] file format is identical to the TSCN file format, but is used to indicate to Godot that the file has been exported from another program
            // and should not be edited by the user from within Godot.
        }