Pin Blender for CI asset processing (#58)
CI / build-and-test (push) Successful in 1m31s
CI / production-build (push) Successful in 13m8s

Reviewed-on: #58
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #58.
This commit is contained in:
2026-09-24 14:45:37 +00:00
committed by EIREXE
parent 1ba29b817b
commit 9a3a1383ff
4 changed files with 94 additions and 6 deletions
+22 -4
View File
@@ -84,10 +84,11 @@ impl AssetLoader for BlendSourceLoader {
.arg(&blend_path)
.arg("--python")
.arg(&script)
.arg("--")
.arg(&output)
.arg(&actions_path)
.output()
.arg("--")
.arg(&output)
.arg(&actions_path)
.arg(&blend_path)
.output()
.map_err(|error| io::Error::other(format!("failed to start Blender: {error}")))?;
if !result.status.success() {
return Err(io::Error::other(format!(
@@ -106,6 +107,7 @@ impl AssetLoader for BlendSourceLoader {
let mut dependencies = manifest.dependencies;
let document: serde_json::Value = serde_json::from_slice(&fs::read(&output)?)
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
validate_export(&document, &output)?;
if let Some(images) = document.get("images").and_then(serde_json::Value::as_array) {
for image in images {
if let Some(uri) = image.get("uri").and_then(serde_json::Value::as_str) {
@@ -142,6 +144,22 @@ impl AssetLoader for BlendSourceLoader {
}
}
fn validate_export(document: &serde_json::Value, output: &Path) -> io::Result<()> {
for key in ["scenes", "nodes", "meshes"] {
let count = document
.get(key)
.and_then(serde_json::Value::as_array)
.map_or(0, Vec::len);
if count == 0 {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("Blender export {} contains no {key}", output.display()),
));
}
}
Ok(())
}
async fn referenced_actions(
load_context: &mut LoadContext<'_>,
root: &Path,