Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("| First time converting might take a while since it is downloading + loading the listfile..");
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine("Loading listfile...");
            Listfile.Initialize();

            // var printHelp = false;

            // foreach (var arg in args)
            // {
            //     if (arg[0] == '-')
            //     {
            //         switch (arg.ToLower())
            //         {
            //             case "-nomodel": AdtModels = false; break;
            //             case "-nowater": AdtWater = false; break;
            //             case "-fixhelm": FixHelm = true; break;
            //             default: printHelp = true; break;
            //         }
            //     }
            // }

            // Print help if there are no files to convert.
            // printHelp |= FilesToConvert.Count == 0;
            //
            // if (printHelp)
            //     PrintHelp();

            string     m2        = "nzoth - Copy.m2";
            IConverter converter = new M2(m2, FixHelm);

            if (converter.Fix())
            {
                converter.Save();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Maya calls this method to have the translator write out a file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="options"></param>
        /// <param name="mode"></param>
        public override void writer(MFileObject file, string options, FileAccessMode mode)
        {
            if (mode == FileAccessMode.kExportActiveAccessMode)
            {
                throw new NotImplementedException("Exporting only selection is not supported yet. Use \"Export All\" instead");
            }
            var expansion = ParseOptions(options);

            MGlobal.displayInfo("Exporting to M2 " + expansion + "..");

            // Name is fileName without .m2 extension
            var wowModel = new M2 {
                Name = file.rawName.Substring(0, file.rawName.Length - 3)
            };

            MayaToM2.ExtractModel(wowModel);

            using (var writer = new BinaryWriter(new FileStream(file.expandedFullName, FileMode.Create, FileAccess.Write)))
            {
                wowModel.Save(writer, expansion);
            }
            MGlobal.displayInfo("Done.");
        }