Skip to content

Commit e8080e3

Browse files
committed
Allow retrieving param values
1 parent 04084ba commit e8080e3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

inox2d/src/params.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@ impl ParamCtx {
320320
}
321321
}
322322

323+
pub fn get(&self, param_name: &str) -> Result<Vec2, SetParamError> {
324+
if let Some(value) = self.values.get(param_name) {
325+
Ok(*value)
326+
} else {
327+
Err(SetParamError::NoParameterNamed(param_name.to_string()))
328+
}
329+
}
330+
323331
/// Modify components as specified by all params. Must be called ONCE per frame.
324332
pub(crate) fn apply(&self, params: &HashMap<String, Param>, nodes: &InoxNodeTree, comps: &mut World) {
325333
// a correct implementation should not care about the order of `.apply()`

0 commit comments

Comments
 (0)