예제 #1
0
        public override ActionResult DoAction()
        {
            string res = null;

            List <ProBuilderMesh> meshes = m_ExportRecursive ? MeshSelection.deep.ToList() : MeshSelection.topInternal;

            if (meshes == null || !meshes.Any())
            {
                return(new ActionResult(ActionResult.Status.Canceled, "No ProBuilder Mesh"));
            }

            if (m_ExportFormat == ExportFormat.Obj)
            {
                res = ExportObj.ExportWithFileDialog(meshes,
                                                     m_ExportAsGroup,
                                                     m_ObjQuads,
                                                     new ObjOptions()
                {
                    handedness         = m_ObjExportRightHanded ? ObjOptions.Handedness.Right : ObjOptions.Handedness.Left,
                    copyTextures       = m_ObjExportCopyTextures,
                    applyTransforms    = m_ExportAsGroup || m_ObjApplyTransform.value,
                    vertexColors       = m_ObjExportVertexColors,
                    textureOffsetScale = m_ObjTextureOffsetScale
                });
            }
            else if (m_ExportFormat == ExportFormat.Stl)
            {
                res = ExportStlAscii.ExportWithFileDialog(meshes.Select(x => x.gameObject).ToArray(), m_StlExportFormat);
            }
            else if (m_ExportFormat == ExportFormat.Ply)
            {
                res = ExportPly.ExportWithFileDialog(meshes, m_ExportAsGroup, new PlyOptions()
                {
                    isRightHanded   = m_PlyExportIsRightHanded,
                    applyTransforms = m_PlyApplyTransform,
                    quads           = m_PlyQuads,
                    ngons           = m_PlyNGons
                });
            }
            else if (m_ExportFormat == ExportFormat.Asset || m_ExportFormat == ExportFormat.Prefab)
            {
                res = ExportAsset.ExportWithFileDialog(meshes, ExportAsset.s_ExportAssetOptions.value);
            }

            if (string.IsNullOrEmpty(res))
            {
                return(new ActionResult(ActionResult.Status.Canceled, "Canceled"));
            }

            PingExportedModel(res);

            return(new ActionResult(ActionResult.Status.Success, "Exported " + m_ExportFormat.value));
        }
예제 #2
0
        protected override ActionResult PerformActionImplementation()
        {
            var res = ExportStlAscii.ExportWithFileDialog(Selection.gameObjects, FileType.Binary);

            if (string.IsNullOrEmpty(res))
            {
                return(new ActionResult(ActionResult.Status.Canceled, "User Canceled"));
            }

            Export.PingExportedModel(res);

            return(new ActionResult(ActionResult.Status.Success, "Export STL"));
        }