diff --git a/crates/engine/src/cmd/prop.rs b/crates/engine/src/cmd/prop.rs index 028fdb0dd..dec791b88 100644 --- a/crates/engine/src/cmd/prop.rs +++ b/crates/engine/src/cmd/prop.rs @@ -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 { vec![ query!("prop.get", "Get Property", "{layer?, path|prop, time? (comp s)}", get), diff --git a/crates/ui-egui/src/num_math.rs b/crates/ui-egui/src/num_math.rs index 3e329c9e4..68225511c 100644 --- a/crates/ui-egui/src/num_math.rs +++ b/crates/ui-egui/src/num_math.rs @@ -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 { 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 { 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 { 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 { eval(text, None) } diff --git a/crates/ui-egui/src/panels/effect_controls/rows.rs b/crates/ui-egui/src/panels/effect_controls/rows.rs index e2634d6b8..b21021bb3 100644 --- a/crates/ui-egui/src/panels/effect_controls/rows.rs +++ b/crates/ui-egui/src/panels/effect_controls/rows.rs @@ -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 { let mut dims = vec![]; let PropCx { t, uid, cy, vx, layer, prop, .. } = *cx;