Doc comments for the functions this PR touches

This commit is contained in:
vangel76
2026-11-07 19:49:24 +01:00
parent 78acc6e1b1
commit 3ab35d0ff6
3 changed files with 12 additions and 0 deletions
+1
View File
@@ -1457,6 +1457,7 @@ fn convert_one_expr(s: &mut Session, cid: ItemId, lid: LayerId, uid: Uid) -> Res
})
}
/// Returns the command specs for the property commands (get, set, keyframes, expressions and the rest).
pub fn specs() -> Vec<CommandSpec> {
vec![
query!("prop.get", "Get Property", "{layer?, path|prop, time? (comp s)}", get),
+7
View File
@@ -126,6 +126,8 @@ struct Parser<'a> {
}
impl Parser<'_> {
/// Reads a sum or difference of terms, left to right.
/// Returns `None` on a syntax error or a non-finite result.
fn expr(&mut self) -> Option<f64> {
let mut v = self.term()?;
while let Some(&op) = self.chars.peek() {
@@ -144,6 +146,8 @@ impl Parser<'_> {
Some(v)
}
/// Reads a product or quotient of factors, left to right.
/// Returns `None` on a syntax error, a division by zero or a non-finite result.
fn term(&mut self) -> Option<f64> {
let mut v = self.factor()?;
while let Some(&op) = self.chars.peek() {
@@ -162,6 +166,8 @@ impl Parser<'_> {
Some(v)
}
/// Reads a signed factor, a bracketed expression or a number.
/// Nesting deeper than `MAX_DEPTH` gives `None`.
fn factor(&mut self) -> Option<f64> {
let c = *self.chars.peek()?;
match c {
@@ -239,6 +245,7 @@ impl Parser<'_> {
mod tests {
use super::calc as eval;
/// Evaluates `text` with no current value, so a leading operator has nothing to apply to.
fn abs(text: &str) -> Option<f64> {
eval(text, None)
}
@@ -260,6 +260,7 @@ fn value_mask(app: &mut EffectcraftApp, ui: &mut egui::Ui, cx: &PropCx, value: &
}
}
/// Draws an angle property's value cell as revolutions plus degrees and queues a set action when it is edited.
fn value_angle(app: &mut EffectcraftApp, ui: &mut egui::Ui, cx: &PropCx, value: &Value, actions: &mut Actions) {
let Value::Scalar(v) = value else {
return;
@@ -275,6 +276,7 @@ fn value_angle(app: &mut EffectcraftApp, ui: &mut egui::Ui, cx: &PropCx, value:
cx.twirl_open(app, ui);
}
/// Draws a single-number property's value cell with its range, unit suffix and scrub speed, and queues a set action when it is edited.
fn value_scalar(app: &mut EffectcraftApp, ui: &mut egui::Ui, cx: &PropCx, value: &Value, actions: &mut Actions) {
let Value::Scalar(v) = value else {
return;
@@ -308,6 +310,8 @@ fn value_scalar(app: &mut EffectcraftApp, ui: &mut egui::Ui, cx: &PropCx, value:
}
}
/// Draws one numeric cell per component of a point or vector property, with the pick crosshair for points.
/// Returns the cell rectangles.
fn value_vector(app: &mut EffectcraftApp, ui: &mut egui::Ui, cx: &PropCx, value: &Value, actions: &mut Actions) -> Vec<Rect> {
let mut dims = vec![];
let PropCx { t, uid, cy, vx, layer, prop, .. } = *cx;