versioned name handling more accurate
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -533,6 +533,7 @@ if ($null -ne $flatColorsMoveLog -and $flatColorsMoveLog.Count -gt 0) {
|
||||
$blendFileParentDir = Split-Path -Path $textureFolderPath -Parent
|
||||
|
||||
# Find matching blend files
|
||||
# Match logic: blendfile folder name (e.g., "Beth") should appear in blend file name (e.g., "AM_Beth_v3.2.blend")
|
||||
$blendFileMappings = @()
|
||||
if ($null -ne $blendfileFolders -and $blendfileFolders.Count -gt 0) {
|
||||
# Get blendfile folder names
|
||||
@@ -543,20 +544,20 @@ if ($null -ne $blendfileFolders -and $blendfileFolders.Count -gt 0) {
|
||||
|
||||
if ($null -ne $blendFiles -and $blendFiles.Count -gt 0) {
|
||||
foreach ($blendFile in $blendFiles) {
|
||||
# Extract prefix from blend file name (e.g., "Chan_v4.3.blend" -> "Chan")
|
||||
$blendFileName = $blendFile.BaseName
|
||||
$parts = $blendFileName.Split('_', 2)
|
||||
|
||||
if ($parts.Length -ge 1) {
|
||||
$prefix = $parts[0]
|
||||
|
||||
# Check if prefix matches any blendfile folder name
|
||||
if ($blendfileFolderNames -contains $prefix) {
|
||||
# Check if any blendfile folder name appears in the blend file name
|
||||
foreach ($folderName in $blendfileFolderNames) {
|
||||
# Match folder name when surrounded by underscores, dots, hyphens, or at start/end
|
||||
# This avoids partial matches (e.g., "Beth" in "Bethany") while allowing "Beth" in "AM_Beth_v3.2"
|
||||
$escapedFolderName = [regex]::Escape($folderName)
|
||||
if ($blendFileName -match "(^|[._-])$escapedFolderName([._-]|$)") {
|
||||
$blendFileMappings += [PSCustomObject]@{
|
||||
BlendFile = [System.IO.Path]::GetFullPath($blendFile.FullName)
|
||||
BlendfileFolder = $prefix
|
||||
BlendfileFolder = $folderName
|
||||
}
|
||||
Write-Host "Found matching blend file: $($blendFile.Name) -> $prefix" -ForegroundColor Gray
|
||||
Write-Host "Found matching blend file: $($blendFile.Name) -> $folderName" -ForegroundColor Gray
|
||||
break # Only match once per blend file
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user