Example #1
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            Import _import = new Import();

            _import.PropertyChanged += new PropertyChangedEventHandler(_import_PropertyChanged);

            try
            {
                AMT_MODEL? model     = null;
                IConverter converter = null;

                string fileType = Path.GetExtension(txtFilePath.Text).ToUpper();

                switch (fileType)
                {
                case ".DAE":
                    converter = new COLLADAConverter();
                    model     = converter.Convert(txtFilePath.Text, _import);
                    break;
                }

                //adiciona as animacoes q estao na interface
                AddAnimations(ref model);

                //se fez a conversao entao ele grava o arquivo amt
                if (model.HasValue)
                {
                    string fileName = Path.GetFileNameWithoutExtension(txtFilePath.Text);
                    fileName += ".amt";
                    AMTExport export = new AMTExport();
                    export.Export(model.Value, txtDestination.Text + "\\" + fileName, _import);

                    MessageBox.Show("Arquivo gerado com sucesso.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public static void ExportCOLLADAOption()
        {
            if (Selection.activeGameObject != null)
            {
                string filePath = EditorUtility.SaveFilePanel("Export To COLLADA", "", Selection.activeGameObject.name, "dae");

                if (!string.IsNullOrWhiteSpace(filePath))
                {
                    COLLADAConverter.ConvertToCOLLADA(Selection.activeGameObject, filePath);

                    if (!string.IsNullOrEmpty(Globals.GetFbxConverterPath()))
                    {
                        string fbxPath = $"{Path.GetDirectoryName(filePath)}\\{Path.GetFileNameWithoutExtension(filePath)}.fbx";

                        System.Diagnostics.Process.Start(Globals.GetFbxConverterPath(), $"{filePath} {fbxPath} /sffCOLLADA /dffFBX");
                    } //if
                } //if
                else
                    Debug.Log("No path selected.");
            } //if
            else
                Debug.Log("No objects selected.");
        } //ImportFMDLOption