OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-tps / scripts / screenshot.sh

20 lines · bash ref:
#!/bin/bash
# Trigger a screenshot of the Godot editor's 3D viewport via TCP.
# Usage: ./scripts/screenshot.sh
# Requires: editor_screenshot plugin enabled in Godot editor.

PORT=6008
RESULT=$(echo "screenshot" | nc -w 3 127.0.0.1 $PORT 2>/dev/null)

if [ -z "$RESULT" ]; then
    echo "Failed — is Godot editor running with editor_screenshot plugin enabled?"
    exit 1
fi

if [[ "$RESULT" == ERROR* ]]; then
    echo "$RESULT"
    exit 1
fi

echo "$RESULT"