mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 22:14:30 +00:00
cms: preserve every numeric token when reading Cube domains
Adapt the strict-token correction from storytold/lightcraft#3464, original commit 77bb537552d59142814eaa65cfea4626c33d6dfc, to the existing shared Cube reader.
This commit is contained in:
committed by
Dylan M. Taylor
parent
9b5b517b42
commit
17db8defc2
@@ -176,7 +176,7 @@ pub fn parse_cube(text: &str) -> Result<LutFile, LutError> {
|
||||
let mut it = line.split_whitespace();
|
||||
let key = it.next().unwrap_or("");
|
||||
let nums = |it: std::str::SplitWhitespace<'_>| -> Result<[f32; 3], LutError> {
|
||||
let v: Vec<f32> = it.filter_map(|s| s.parse().ok()).collect();
|
||||
let v: Vec<f32> = it.map(|s| s.parse().ok()).collect::<Option<_>>().ok_or_else(|| LutError(format!("bad line `{line}`")))?;
|
||||
if v.len() == 3 { Ok([v[0], v[1], v[2]]) } else { err(format!("bad line `{line}`")) }
|
||||
};
|
||||
match key {
|
||||
|
||||
Reference in New Issue
Block a user