chore: commit untracked UE/scaffold files (repo cleanup triage 20260707)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
295
scripts/setup/create_ue5_project.sh
Executable file
295
scripts/setup/create_ue5_project.sh
Executable file
@@ -0,0 +1,295 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script Name: create_ue5_project.sh
|
||||
# Description: Create Dubai Metaverse Unreal Engine project
|
||||
# Usage: ./create_ue5_project.sh [project_name]
|
||||
# Author: Dubai Metaverse Team
|
||||
# Date: 2024
|
||||
# Version: 1.0
|
||||
#
|
||||
# Exit codes:
|
||||
# 0: Success
|
||||
# 1: General error
|
||||
# 2: Invalid arguments
|
||||
# 3: Missing dependencies
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Configuration
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
LOG_FILE="${LOG_FILE:-$PROJECT_ROOT/logs/create_project.log}"
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Logging
|
||||
log() {
|
||||
local level="${1:-INFO}"
|
||||
shift
|
||||
local message="$*"
|
||||
local timestamp=$(date +'%Y-%m-%d %H:%M:%S')
|
||||
echo "[$timestamp] [$level] $message" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
error_exit() {
|
||||
log "ERROR" "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
warning() {
|
||||
log "WARNING" "$*"
|
||||
}
|
||||
|
||||
success() {
|
||||
log "SUCCESS" "$*"
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
PROJECT_NAME="${1:-DubaiMetaverse}"
|
||||
UE_ROOT="${UE_ROOT:-$HOME/UnrealEngine}"
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: $0 [PROJECT_NAME]
|
||||
|
||||
Create Dubai Metaverse Unreal Engine project.
|
||||
|
||||
Arguments:
|
||||
PROJECT_NAME Project name (default: DubaiMetaverse)
|
||||
|
||||
Environment Variables:
|
||||
UE_ROOT Unreal Engine root directory (default: ~/UnrealEngine)
|
||||
|
||||
Examples:
|
||||
$0
|
||||
$0 DubaiMetaverse
|
||||
UE_ROOT=/opt/UnrealEngine $0
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Validate prerequisites
|
||||
validate_prerequisites() {
|
||||
log "INFO" "Validating prerequisites..."
|
||||
|
||||
# Check for Unreal Engine
|
||||
if [ ! -d "$UE_ROOT" ]; then
|
||||
error_exit "Unreal Engine not found at: $UE_ROOT"
|
||||
fi
|
||||
|
||||
local editor_path="$UE_ROOT/Engine/Binaries/Linux/UnrealEditor"
|
||||
if [ ! -f "$editor_path" ]; then
|
||||
error_exit "UnrealEditor not found at: $editor_path"
|
||||
fi
|
||||
|
||||
log "INFO" "Using Unreal Engine: $UE_ROOT"
|
||||
log "INFO" "UnrealEditor found: $editor_path"
|
||||
}
|
||||
|
||||
# Create project file
|
||||
create_project_file() {
|
||||
log "INFO" "Creating project file: ${PROJECT_NAME}.uproject"
|
||||
|
||||
local project_file="$PROJECT_ROOT/${PROJECT_NAME}.uproject"
|
||||
|
||||
cat > "$project_file" << EOF
|
||||
{
|
||||
"FileVersion": 3,
|
||||
"EngineAssociation": "5.4",
|
||||
"Category": "",
|
||||
"Description": "High-End Interactive Demo District of Dubai",
|
||||
"Modules": [
|
||||
{
|
||||
"Name": "${PROJECT_NAME}",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "Default"
|
||||
}
|
||||
],
|
||||
"Plugins": [
|
||||
{
|
||||
"Name": "ProceduralContentGeneration",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "VirtualProduction",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "MovieRenderQueue",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ModelingTools",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "GeometryScript",
|
||||
"Enabled": true
|
||||
}
|
||||
],
|
||||
"TargetPlatforms": [
|
||||
"Linux",
|
||||
"Windows"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
success "Project file created: $project_file"
|
||||
}
|
||||
|
||||
# Create Source directory structure
|
||||
create_source_structure() {
|
||||
log "INFO" "Creating Source directory structure..."
|
||||
|
||||
mkdir -p "$PROJECT_ROOT/Source/${PROJECT_NAME}"
|
||||
mkdir -p "$PROJECT_ROOT/Source/${PROJECT_NAME}/Public"
|
||||
mkdir -p "$PROJECT_ROOT/Source/${PROJECT_NAME}/Private"
|
||||
|
||||
# Create basic module files
|
||||
cat > "$PROJECT_ROOT/Source/${PROJECT_NAME}/${PROJECT_NAME}.Build.cs" << EOF
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class ${PROJECT_NAME} : ModuleRules
|
||||
{
|
||||
public ${PROJECT_NAME}(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] {
|
||||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"InputCore"
|
||||
});
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
cat > "$PROJECT_ROOT/Source/${PROJECT_NAME}/${PROJECT_NAME}.cpp" << EOF
|
||||
#include "${PROJECT_NAME}.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, ${PROJECT_NAME}, "${PROJECT_NAME}" );
|
||||
EOF
|
||||
|
||||
cat > "$PROJECT_ROOT/Source/${PROJECT_NAME}/${PROJECT_NAME}.h" << EOF
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
EOF
|
||||
|
||||
success "Source directory structure created"
|
||||
}
|
||||
|
||||
# Copy configuration files
|
||||
copy_config_files() {
|
||||
log "INFO" "Copying configuration files..."
|
||||
|
||||
mkdir -p "$PROJECT_ROOT/Config"
|
||||
|
||||
if [ -f "$PROJECT_ROOT/Config/DefaultEngine.ini" ]; then
|
||||
cp "$PROJECT_ROOT/Config/DefaultEngine.ini" "$PROJECT_ROOT/Config/DefaultEngine.ini.backup"
|
||||
log "INFO" "Backed up existing DefaultEngine.ini"
|
||||
fi
|
||||
|
||||
if [ -f "$PROJECT_ROOT/Config/DefaultEngine.ini.template" ]; then
|
||||
cp "$PROJECT_ROOT/Config/DefaultEngine.ini.template" "$PROJECT_ROOT/Config/DefaultEngine.ini"
|
||||
success "Copied DefaultEngine.ini from template"
|
||||
else
|
||||
warning "DefaultEngine.ini.template not found, using existing or creating default"
|
||||
fi
|
||||
|
||||
if [ -f "$PROJECT_ROOT/Config/DefaultGame.ini.template" ]; then
|
||||
cp "$PROJECT_ROOT/Config/DefaultGame.ini.template" "$PROJECT_ROOT/Config/DefaultGame.ini"
|
||||
success "Copied DefaultGame.ini from template"
|
||||
fi
|
||||
}
|
||||
|
||||
# Generate project files
|
||||
generate_project_files() {
|
||||
log "INFO" "Generating project files..."
|
||||
|
||||
local project_file="$PROJECT_ROOT/${PROJECT_NAME}.uproject"
|
||||
|
||||
if [ ! -f "$project_file" ]; then
|
||||
error_exit "Project file not found: $project_file"
|
||||
fi
|
||||
|
||||
# Use UnrealBuildTool to generate project files
|
||||
local ubt_path="$UE_ROOT/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.dll"
|
||||
|
||||
if [ -f "$ubt_path" ]; then
|
||||
log "INFO" "Generating project files with UnrealBuildTool..."
|
||||
dotnet "$ubt_path" -projectfiles -project="$project_file" -game -rocket -progress
|
||||
success "Project files generated"
|
||||
else
|
||||
warning "UnrealBuildTool not found, project files will be generated on first launch"
|
||||
fi
|
||||
}
|
||||
|
||||
# Create Content directory structure
|
||||
create_content_structure() {
|
||||
log "INFO" "Ensuring Content directory structure exists..."
|
||||
|
||||
# Content structure should already exist, but verify
|
||||
if [ ! -d "$PROJECT_ROOT/Content" ]; then
|
||||
log "INFO" "Content directory not found, creating..."
|
||||
mkdir -p "$PROJECT_ROOT/Content/{Maps,Assets,Blueprints,Materials,Textures,Audio}"
|
||||
fi
|
||||
|
||||
success "Content directory structure verified"
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
log "INFO" "Starting create_ue5_project.sh"
|
||||
|
||||
# Create log directory
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
# Parse arguments
|
||||
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Validate prerequisites
|
||||
validate_prerequisites
|
||||
|
||||
# Create project file
|
||||
create_project_file
|
||||
|
||||
# Create Source structure (optional, for C++ projects)
|
||||
create_source_structure
|
||||
|
||||
# Copy configuration files
|
||||
copy_config_files
|
||||
|
||||
# Create Content structure
|
||||
create_content_structure
|
||||
|
||||
# Generate project files
|
||||
generate_project_files
|
||||
|
||||
success "Project creation complete!"
|
||||
log "INFO" "Project: ${PROJECT_NAME}.uproject"
|
||||
log "INFO" "Location: $PROJECT_ROOT"
|
||||
log "INFO" ""
|
||||
log "INFO" "Next steps:"
|
||||
log "INFO" "1. Launch Unreal Editor: $UE_ROOT/Engine/Binaries/Linux/UnrealEditor $PROJECT_ROOT/${PROJECT_NAME}.uproject"
|
||||
log "INFO" "2. Configure project settings (Nanite, Lumen, World Partition)"
|
||||
log "INFO" "3. Import geospatial data"
|
||||
log "INFO" "4. Create blockout level"
|
||||
}
|
||||
|
||||
# Run main if executed directly
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user