Skip to content
Draft
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
52 changes: 44 additions & 8 deletions modeling-cmds/openapi/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -7373,6 +7373,46 @@
"type"
]
},
{
"description": "A general exact curve segment. Start at the current path \"pen\" and end at the final control point. In the first pass this is used for non-rational open-uniform spline curves.",
"type": "object",
"properties": {
"degree": {
"description": "Degree of the curve.",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"points": {
"description": "Ordered control points for the curve. The final 3D point becomes the new path \"pen\" position.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Point4d"
}
},
"rational": {
"description": "Whether to use the homogeneous `w` component as a rational weight.",
"type": "boolean"
},
"relative": {
"description": "Whether or not this curve is a relative offset",
"type": "boolean"
},
"type": {
"type": "string",
"enum": [
"curve"
]
}
},
"required": [
"degree",
"points",
"rational",
"relative",
"type"
]
},
{
"description": "Adds a tangent arc from current pen position with the given radius and angle.",
"type": "object",
Expand Down Expand Up @@ -7733,20 +7773,16 @@
"type": "object",
"properties": {
"w": {
"type": "number",
"format": "float"
"$ref": "#/components/schemas/LengthUnit"
},
"x": {
"type": "number",
"format": "float"
"$ref": "#/components/schemas/LengthUnit"
},
"y": {
"type": "number",
"format": "float"
"$ref": "#/components/schemas/LengthUnit"
},
"z": {
"type": "number",
"format": "float"
"$ref": "#/components/schemas/LengthUnit"
}
},
"required": [
Expand Down
2 changes: 1 addition & 1 deletion modeling-cmds/src/def_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ define_modeling_cmd_enum! {
/// The default color to use for highlight
#[serde(default)]
pub highlight_color: Option<Color>,
/// The default color to use for selection
/// The default color to use for selection
#[serde(default)]
pub selection_color: Option<Color>,
}
Expand Down
16 changes: 15 additions & 1 deletion modeling-cmds/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ pub enum CameraDragInteractionType {

/// A segment of a path.
/// Paths are composed of many segments.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq)]
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case", tag = "type")]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
Expand Down Expand Up @@ -662,6 +662,20 @@ pub enum PathSegment {
///Whether or not this bezier is a relative offset
relative: bool,
},
/// A general exact curve segment.
/// Start at the current path "pen" and end at the final control point.
/// In the first pass this is used for non-rational open-uniform spline curves.
Curve {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please call this Spline or BSpline or something of that nature. Curve is too abstract.

/// Degree of the curve.
degree: u32,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The knot vector isn't customisable here but that can come later.

/// Whether to use the homogeneous `w` component as a rational weight.
rational: bool,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can infer this from the control points instead.

/// Ordered control points for the curve.
/// The final 3D point becomes the new path "pen" position.
points: Vec<Point4d<LengthUnit>>,
///Whether or not this curve is a relative offset
relative: bool,
},
/// Adds a tangent arc from current pen position with the given radius and angle.
TangentialArc {
/// Radius of the arc.
Expand Down
Loading