Skip to content

Commit

Permalink
Add FileExportFormat enum (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchalmers authored Dec 7, 2023
1 parent cfc1a73 commit df6e0bc
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modeling-cmds/src/format/step.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down
56 changes: 56 additions & 0 deletions modeling-cmds/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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. <https://en.wikipedia.org/wiki/FBX>
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. <https://en.wikipedia.org/wiki/Wavefront_.obj_file>
/// 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. <https://en.wikipedia.org/wiki/PLY_(file_format)>
Ply,
/// The STEP file format. <https://en.wikipedia.org/wiki/ISO_10303-21>
Step,
/// The STL file format. <https://en.wikipedia.org/wiki/STL_(file_format)>
Stl,
}

impl_string_enum_sql! {FileExportFormat}

0 comments on commit df6e0bc

Please sign in to comment.