diff --git a/modeling-cmds/src/format/step.rs b/modeling-cmds/src/format/step.rs index 7636137c..5e0781ce 100644 --- a/modeling-cmds/src/format/step.rs +++ b/modeling-cmds/src/format/step.rs @@ -1,8 +1,9 @@ -use crate::coord; use parse_display::{Display, FromStr}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use crate::coord; + /// Options for exporting STEP format. #[derive(Clone, Debug, Deserialize, Eq, Hash, JsonSchema, PartialEq, Serialize)] #[serde(rename = "StepExportOptions")] diff --git a/modeling-cmds/src/shared.rs b/modeling-cmds/src/shared.rs index a39880b5..3a46e124 100644 --- a/modeling-cmds/src/shared.rs +++ b/modeling-cmds/src/shared.rs @@ -603,3 +603,59 @@ pub struct ExportFile { /// The contents of the file, base64 encoded. pub contents: crate::base64::Base64Data, } + +/// The valid types of output file formats. +#[derive( + Display, + FromStr, + Copy, + AsExpression, + FromSqlRow, + Eq, + PartialEq, + Debug, + JsonSchema, + Deserialize, + Serialize, + Clone, + Ord, + PartialOrd, + Sequence, +)] +#[diesel(sql_type = Text)] +#[serde(rename_all = "lowercase")] +#[display(style = "lowercase")] +pub enum FileExportFormat { + /// Autodesk Filmbox (FBX) format. + Fbx, + /// Binary glTF 2.0. + /// + /// This is a single binary with .glb extension. + /// + /// This is better if you want a compressed format as opposed to the human readable + /// glTF that lacks compression. + Glb, + /// glTF 2.0. + /// Embedded glTF 2.0 (pretty printed). + /// + /// Single JSON file with .gltf extension binary data encoded as + /// base64 data URIs. + /// + /// The JSON contents are pretty printed. + /// + /// It is human readable, single file, and you can view the + /// diff easily in a git commit. + Gltf, + /// The OBJ file format. + /// It may or may not have an an attached material (mtl // mtllib) within the file, + /// but we interact with it as if it does not. + Obj, + /// The PLY file format. + Ply, + /// The STEP file format. + Step, + /// The STL file format. + Stl, +} + +impl_string_enum_sql! {FileExportFormat}