示例#1
0
        private void ExportCurrentProject(MeshExportOptions exportOptions, string filepath)
        {
            var assimpScene = MeshConverter.PartProjectToAssimp(CurrentProject, exportOptions);

            AssimpContext.ExportFile(assimpScene, filepath,
                                     exportOptions.FileFormatID,
                                     Assimp.PostProcessSteps.FlipUVs);
            assimpScene.Clear();
        }
示例#2
0
        private void ExportSelectedPart(MeshExportOptions exportOptions, string filepath)
        {
            var partInfo    = PartWrapper.LoadPart(LDDEnvironment.Current, PartToExport.PartId, true);
            var assimpScene = MeshConverter.LddPartToAssimp(partInfo, exportOptions);

            AssimpContext.ExportFile(assimpScene, filepath,
                                     exportOptions.FileFormatID,
                                     Assimp.PostProcessSteps.FlipUVs);
            assimpScene.Clear();
        }
示例#3
0
        private void ExportPartModel()
        {
            var exportOptions = new MeshExportOptions()
            {
                IndividualComponents = RbAdvancedExport.Checked,
                IncludeBones         = ChkBones.Enabled && ChkBones.Checked,
                IncludeAltMeshes     = ChkAltMeshes.Enabled && ChkAltMeshes.Checked,
                IncludeCollisions    = ChkCollisions.Enabled && ChkCollisions.Checked,
                IncludeConnections   = ChkConnections.Enabled && ChkConnections.Checked,
                IncludeRoundEdgeData = ChkRoundEdge.Enabled && ChkRoundEdge.Checked
            };

            GetSelectedFormatInfo(out string formatID, out string formatExt);
            exportOptions.FileFormatID = formatID;

            int currentPartID;

            if (CurrentProjectRb.Checked)
            {
                currentPartID = CurrentProject.PartID;
            }
            else
            {
                currentPartID = PartToExport.PartId;
            }

            using (var sfd = new SaveFileDialog())
            {
                sfd.FileName = $"{currentPartID}.{formatExt}";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        if (CurrentProjectRb.Checked)
                        {
                            ExportCurrentProject(exportOptions, sfd.FileName);
                        }
                        else
                        {
                            ExportSelectedPart(exportOptions, sfd.FileName);
                        }

                        MessageBox.Show("Model exported");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"An error occured while exporting model:\r\n{ex.ToString()}", "Error");
                    }
                }
            }
        }