Danke Yoshi. Hat jetzt geklappt. Also relative Pfade. Doch das Problem, auch hier wird nur eine einzige mdl. erstellt bzw, zigfach überschrieben.
Hast du da vielleicht irgendeinen Pro Tipp für mich? V
Mfg EMP
Edit: Ich habe mir nun von der AI ein Script generieren lassen, welche FBX welche in einem Ordner liegen in Unterordner verschiebt welche dem Benennungsschema entsprechen. Funkioniert jedoch nur auf Windows:
<# : batch launcher - double-click this file. The PowerShell part below does the work.
@echo off
setlocal
set "SORT_DIR=%~dp0"
set "SORT_SELF=%~f0"
powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-Expression ([IO.File]::ReadAllText($env:SORT_SELF))"
echo.
pause
exit /b
#>
# Sorts the FBX files next to this script into TPF2 model editor folders.
# The model editor names the .mdl after the folder: <folder1>-<folder2>+<mdlname>.
# All LODs of one model go into one folder, so one import writes one .mdl:
# 1000_Holz_46E1_K_16m_lod0.fbx -> infrastructure-tracks+1000_Holz_46E1_K_16m\
# 1000_Holz_46E1_K_16m_lod1.fbx -> infrastructure-tracks+1000_Holz_46E1_K_16m\
# 1000_Holz_46E1_K_16m_lod2.fbx -> infrastructure-tracks+1000_Holz_46E1_K_16m\
$prefix = 'infrastructure-tracks+'
$dir = $env:SORT_DIR.TrimEnd('\')
$files = Get-ChildItem -LiteralPath $dir -Filter '*.fbx' -File
if (-not $files) {
Write-Host "No .fbx files found in $dir"
return
}
$moved = 0
$skipped = 0
$failed = 0
$folders = @{}
foreach ($f in $files) {
$model = $f.BaseName -replace '_lod\d+$', ''
$target = Join-Path $dir ($prefix + $model)
if (-not (Test-Path -LiteralPath $target)) {
New-Item -ItemType Directory -Path $target | Out-Null
}
$dest = Join-Path $target $f.Name
if (Test-Path -LiteralPath $dest) {
Write-Host "SKIP (already exists): $($prefix + $model)\$($f.Name)" -ForegroundColor Yellow
$skipped++
continue
}
try {
Move-Item -LiteralPath $f.FullName -Destination $dest -ErrorAction Stop
} catch {
Write-Host "FAILED: $($f.Name) - $($_.Exception.Message)" -ForegroundColor Red
$failed++
continue
}
$folders[$model] = 1 + [int]$folders[$model]
$moved++
}
foreach ($m in ($folders.Keys | Sort-Object)) {
Write-Host ("{0,-55} {1} file(s)" -f ($prefix + $m), $folders[$m])
}
Write-Host ""
$color = if ($failed) { 'Red' } else { 'Green' }
Write-Host "Moved $moved file(s) into $($folders.Count) folder(s), skipped $skipped, failed $failed." -ForegroundColor $color
Alles anzeigen
1. Herunterladen. In einer Datei abspeichern (z.B. erst .txt erzeugen, script reinpasten), wichtig die Dateiendung muss .cmd sein, damit das Script mit Doppelklick ausgeführt werden kann.
2. Das script muss im selben Ordner wie die FBX liegen.
3. Doppelklick die Ordner werden erstellt.
4. Alle Ordne markieren und in den Model Editor ziehen.
Wenn ihr fragen dazu habt konsultiert die AI eures Vertrauens.