Files
metaverseDubai/scripts/validate_assets.sh

88 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Dubai Metaverse - Asset Validation Script
# Validates asset naming conventions and structure
set -e # Exit on error
echo "=========================================="
echo "Dubai Metaverse - Asset Validation"
echo "=========================================="
echo ""
# Check if Content directory exists
if [ ! -d "Content" ]; then
echo "Error: Content directory not found"
echo "Run this script from the UE5 project root directory"
exit 1
fi
ERRORS=0
WARNINGS=0
# Function to check naming convention
check_naming() {
local file="$1"
local basename=$(basename "$file")
# Check for spaces
if [[ "$basename" == *" "* ]]; then
echo " ❌ ERROR: Contains spaces: $basename"
((ERRORS++))
return 1
fi
# Check for special characters (except underscores and hyphens)
if [[ "$basename" =~ [^a-zA-Z0-9_\-\.] ]]; then
echo " ❌ ERROR: Contains invalid characters: $basename"
((ERRORS++))
return 1
fi
# Check prefix based on extension
local ext="${basename##*.}"
case "$ext" in
uasset)
if [[ ! "$basename" =~ ^(SM_|SK_|M_|MI_|BP_|ABP_|BT_|P_|A_|SQ_|CineCamera_|DA_|WBP_|PCG_|D_|PP_) ]]; then
echo " ⚠ WARNING: Missing prefix: $basename"
((WARNINGS++))
fi
;;
*)
# Other file types - basic validation only
;;
esac
return 0
}
# Scan Content directory for assets
echo "Scanning Content directory..."
echo ""
find Content -type f -name "*.uasset" -o -name "*.umap" | while read -r file; do
check_naming "$file"
done
# Summary
echo ""
echo "=========================================="
echo "Validation Complete"
echo "=========================================="
echo ""
echo "Errors: $ERRORS"
echo "Warnings: $WARNINGS"
echo ""
if [ $ERRORS -eq 0 ] && [ $WARNINGS -eq 0 ]; then
echo "✓ All assets passed validation"
exit 0
elif [ $ERRORS -eq 0 ]; then
echo "⚠ Some warnings found, but no errors"
exit 0
else
echo "❌ Validation failed. Please fix errors before committing."
exit 1
fi