Tip: strip images from GLTF models with jq
Been ignoring these warnings for a while and finally got around to doing something about them:
WARNING[Main]: Irrlicht: example.gltf: embedded images are not supported
Root cause: https://docs.luanti.org/for-creators/warnings/#gltf
The docs say to use gltfutil to resolve, which is not available in my system's repositories. But jq is. To fix with jq:
file=example.gltf
jq -c 'del(.images)|del(.textures[].source)' "$file" > "$file.new" && mv "$file.new" "$file"
(This is Linux/BASH syntax, I don't know windows)
If you use git and can arrange to have the above command run against all your GLTF files with a build command like e.g. make models, then you can add the following to a pre-commit hook to ensure that images are always stripped from GLTF files whenever a GLTF file is committed to the repository. Just make sure to replace make models with whatever command you set up to process all your GLTF files.
if git diff --cached --name-status | grep -q "^[AM].*gltf"; then
echo "Updating GLTF files..."
make models
git diff --cached --name-status | grep "^[AM].*gltf" | while read M file; do
git add "$file"
done
fi
Or if using git with no build tool, I guess you could do something like this, I have not tested this code but maybe it works:
git diff --cached --name-status | grep "^[AM].*gltf" | while read M file; do
echo "Updating GLTF file: $file"
jq -c 'del(.images)|del(.textures[].source)' "$file" > "$file.new" && mv "$file.new" "$file"
git add "$file"
done