Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions modeling-cmds/src/def_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,24 @@
pub animated: bool,
}

/// Looks along the normal of the specified face (if it is planar!), and fits the view to it.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]

Check warning on line 1430 in modeling-cmds/src/def_enum.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/def_enum.rs#L1429-L1430

Added lines #L1429 - L1430 were not covered by tests
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
pub struct OrientToFace {
/// Which face to orient camera to. If the face is not planar, no action will occur.
pub face_id: Uuid,
/// How much to pad the view frame by, as a fraction of the face bounding box size.
/// Negative padding will crop the view of the face proportionally.
/// e.g. padding = 0.2 means the view will span 120% of the face bounding box,
/// and padding = -0.2 means the view will span 80% of the face bounding box.
#[serde(default)]
pub padding: f32,
/// Whether or not to animate the camera movement. (Animation is currently not supported.)
#[serde(default)]
pub animated: bool,
}

/// Fit the view to the scene with an isometric view.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
Expand Down
7 changes: 7 additions & 0 deletions modeling-cmds/src/ok_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,13 @@ define_ok_modeling_cmd_response_enum! {
pub settings: CameraSettings
}

/// The response from the `OrientToFace` command.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
pub struct OrientToFace {
/// Camera settings
pub settings: CameraSettings
}

/// The response from the `ViewIsometric` command.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
pub struct ViewIsometric {
Expand Down
5 changes: 5 additions & 0 deletions modeling-cmds/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,11 @@
Self { settings }
}
}
impl From<CameraSettings> for crate::output::OrientToFace {
fn from(settings: CameraSettings) -> Self {
Self { settings }
}

Check warning on line 757 in modeling-cmds/src/shared.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/shared.rs#L755-L757

Added lines #L755 - L757 were not covered by tests
}
impl From<CameraSettings> for crate::output::ViewIsometric {
fn from(settings: CameraSettings) -> Self {
Self { settings }
Expand Down