115 lines
5.4 KiB
Bash
Executable File
115 lines
5.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Render the demo-map screenshots used for visual review into <repo>/Screenshots/demo/.
|
|
#
|
|
# Usage: Tools/review/render_screenshots.sh [--verify]
|
|
#
|
|
# Only the **demo map** is captured: the review staging map exists to hold the
|
|
# hero/camera list, not to produce review screenshots. Everything here is what a
|
|
# player actually sees when the demo runs.
|
|
#
|
|
# --verify run Tools/review/visual_loop.py --verify afterwards and fail if a shot
|
|
# does not show the content its expectation describes
|
|
#
|
|
# The PNGs are committed (see Screenshots/README.md): a reviewer must see exactly
|
|
# what the build rendered.
|
|
set -euo pipefail
|
|
|
|
# This script lives in Tools/review, so the repository root is two levels up.
|
|
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
ENGINE="${UE_ENGINE_DIR:-/run/media/system/DATA/Engines/UE_5.8.4}"
|
|
PROJ="$REPO/Game/GigLine/GigLine.uproject"
|
|
VERIFY="no"
|
|
[ "${1:-}" = "--verify" ] && VERIFY="yes"
|
|
|
|
# Tools are grouped by discipline now: Unreal commandlets under Tools/unreal, review helpers under
|
|
# Tools/review. The script name alone is no longer enough to find one, so each call names its folder.
|
|
run_cmdlet() {
|
|
local script="$1" label="$2" folder="${3:-unreal}"
|
|
echo "== $label =="
|
|
( cd "$ENGINE" && ./Engine/Binaries/Linux/UnrealEditor-Cmd "$PROJ" \
|
|
-run=pythonscript -script="$REPO/Tools/$folder/$script" \
|
|
-nullrhi -unattended -nopause -stdout )
|
|
}
|
|
|
|
# Order matters. The demo builder rebuilds the site materials, so any actor staged
|
|
# by another tool must be (re)staged after it or it keeps a reference to a material
|
|
# that no longer exists - that is how 604 actors ended up untextured once.
|
|
run_cmdlet ue_build_demo_map.py "1/7 rebuild the demo map (materials, site, frontage)"
|
|
run_cmdlet ue_apply_facade_kit.py "2/7 assemble the facade kit"
|
|
run_cmdlet ue_stage_theatre_trim.py "3/7 stage the theatre trim"
|
|
run_cmdlet ue_audit_scene.py "4/7 audit the scene (materials, placement, labels)"
|
|
run_cmdlet ue_build_review_map.py "5/7 stage the demo shot cameras"
|
|
tail -3 /tmp/ue-review-map-result.txt 2>/dev/null || true
|
|
|
|
echo "== 6a/7 capture the review map (asset staging) =="
|
|
# The ReviewMap stages the models on their own - imported assets, camera angles and the
|
|
# lighting comparison - which is a different question from "does the game map look right".
|
|
# Its shots collect into Screenshots/review/ so the two reviews stay separate.
|
|
rm -rf "$REPO"/Game/GigLine/Saved/Screenshots/* 2>/dev/null || true
|
|
mkdir -p "$REPO/Game/GigLine/Saved/Screenshots/LinuxEditor"
|
|
"$ENGINE/Engine/Binaries/Linux/UnrealEditor-Cmd" "$PROJ" /Game/Test/ReviewMap \
|
|
-game -windowed -ResX=1920 -ResY=1080 -nopause -nosplash -stdout
|
|
|
|
echo "== 6b/7 collect the review-map screenshots =="
|
|
mkdir -p "$REPO/Screenshots/review"
|
|
rm -f "$REPO"/Screenshots/review/review-*.png
|
|
found_review=0
|
|
for src in \
|
|
"$REPO/Game/GigLine/Saved/Screenshots"/*/review-*.png \
|
|
"$REPO/Game/GigLine/Saved/Screenshots"/*/*/review-*.png \
|
|
"$HOME/.config/Epic/GigLine/Saved/Screenshots"/*/review-*.png; do
|
|
[ -e "$src" ] || continue
|
|
case "$(basename "$src")" in
|
|
*demo-*) : ;;
|
|
*) cp -f "$src" "$REPO/Screenshots/review/"; found_review=1 ;;
|
|
esac
|
|
done
|
|
[ "$found_review" = "1" ] || echo "WARN: no review-map screenshots found"
|
|
ls -1 "$REPO/Screenshots/review" 2>/dev/null | head -20
|
|
|
|
echo "== 6c/7 capture the demo map =="
|
|
# Clear the engine's screenshot folder first. The collect step below copies every
|
|
# review-*.png it finds in Saved/, so without this a shot retired from the camera list
|
|
# keeps coming back as a stale file - that is how a removed walk shot reappeared with
|
|
# byte-identical content after a run that never captured it.
|
|
rm -rf "$REPO"/Game/GigLine/Saved/Screenshots/* "$HOME"/.config/Epic/GigLine/Saved/Screenshots/* 2>/dev/null || true
|
|
# Recreate the folder: the engine writes into it and does not recreate a deleted
|
|
# directory, which silently produced zero captures in the run that removed it.
|
|
mkdir -p "$REPO/Game/GigLine/Saved/Screenshots/LinuxEditor"
|
|
# The engine path is absolute: this step runs from the repo, not from $ENGINE, and a
|
|
# bare ./Engine/... failed with "No such file or directory" while every commandlet
|
|
# above succeeded through run_cmdlet's cd.
|
|
"$ENGINE/Engine/Binaries/Linux/UnrealEditor-Cmd" "$PROJ" /Game/Hollywood/DemoMap \
|
|
-game -windowed -ResX=1920 -ResY=1080 -nopause -nosplash -thirdperson -stdout
|
|
|
|
echo "== 6d/7 collect the demo screenshots =="
|
|
mkdir -p "$REPO/Screenshots/demo"
|
|
rm -f "$REPO"/Screenshots/demo/review-*.png
|
|
found=0
|
|
for src in \
|
|
"$REPO/Game/GigLine/Saved/Screenshots"/*/review-*.png \
|
|
"$REPO/Game/GigLine/Saved/Screenshots"/*/*/review-*.png \
|
|
"$HOME/.config/Epic/GigLine/Saved/Screenshots"/*/review-*.png; do
|
|
[ -e "$src" ] || continue
|
|
case "$(basename "$src")" in
|
|
*demo-*) cp -f "$src" "$REPO/Screenshots/demo/"; found=1 ;;
|
|
esac
|
|
done
|
|
[ "$found" = "1" ] || { echo "ERROR: no demo screenshots found"; exit 1; }
|
|
ls -1 "$REPO/Screenshots/demo"
|
|
|
|
|
|
# The scene audit is a gate: a wrong-material or misplaced actor is exactly the
|
|
# kind of failure that still renders plausibly.
|
|
if grep -q "failure(s) ==" /tmp/gigline/scene-audit.txt 2>/dev/null; then
|
|
grep -E "FAIL|failure\(s\)" /tmp/gigline/scene-audit.txt | tail -5
|
|
grep -q "== 0 failure(s) ==" /tmp/gigline/scene-audit.txt || {
|
|
echo "ERROR: scene audit failed — see /tmp/gigline/scene-audit.txt"; exit 1; }
|
|
fi
|
|
|
|
if [ "$VERIFY" = "yes" ]; then
|
|
echo "== verify: does each shot show what it should? =="
|
|
cd "$REPO"
|
|
python3 Tools/review/visual_loop.py --verify
|
|
fi
|