26 lines
1.0 KiB
PowerShell
26 lines
1.0 KiB
PowerShell
param(
|
|
[string]$Source,
|
|
[string]$Destination,
|
|
[switch]$Overwrite
|
|
)
|
|
|
|
$Blender = "E:\Program Files\Blender Foundation\Blender 5.2\blender.exe"
|
|
$Script = Join-Path $PSScriptRoot "convert_glb_to_fbx.py"
|
|
|
|
if ([string]::IsNullOrWhiteSpace($Source)) {
|
|
$AssetRoot = Join-Path (Split-Path $PSScriptRoot -Parent) "docs\asset"
|
|
$Source = Get-ChildItem -LiteralPath $AssetRoot -Directory |
|
|
Where-Object { @(Get-ChildItem -LiteralPath $_.FullName -Recurse -File -Filter "*.glb").Count -gt 0 } |
|
|
Select-Object -First 1 -ExpandProperty FullName
|
|
}
|
|
if ([string]::IsNullOrWhiteSpace($Destination)) { $Destination = "$Source`_fbx" }
|
|
|
|
if (-not (Test-Path -LiteralPath $Blender)) { throw "Blender was not found: $Blender" }
|
|
if (-not (Test-Path -LiteralPath $Source)) { throw "Source folder was not found: $Source" }
|
|
|
|
$Arguments = @("--background", "--python", $Script, "--", "--source", $Source, "--destination", $Destination)
|
|
if ($Overwrite) { $Arguments += "--overwrite" }
|
|
|
|
& $Blender @Arguments
|
|
exit $LASTEXITCODE
|