Port nodes-to-script converter workflow
This commit is contained in:
parent
db0f1c5c4c
commit
07d76e18b5
7 changed files with 564 additions and 22 deletions
|
|
@ -1,13 +1,36 @@
|
|||
param(
|
||||
[string]$RepoUrl = "https://github.com/carson-katri/geometry-script.git",
|
||||
[string]$Branch = "vibegeometry/blender-5-nested-tree-groups"
|
||||
[string]$Branch = "vibegeometry/blender-5-nodes-to-script"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
if (Get-Variable -Name PSNativeCommandUseErrorActionPreference -ErrorAction SilentlyContinue) {
|
||||
$PSNativeCommandUseErrorActionPreference = $false
|
||||
}
|
||||
|
||||
$root = Resolve-Path (Join-Path $PSScriptRoot "..")
|
||||
$target = Join-Path $root "external\geometry-script"
|
||||
$patch = Join-Path $root "patches\geometry-script\0001-fix-nested-tree-group-references-on-blender-4.patch"
|
||||
$patchDir = Join-Path $root "patches\geometry-script"
|
||||
|
||||
function Test-GitPatch {
|
||||
param(
|
||||
[string]$Mode,
|
||||
[string]$PatchPath
|
||||
)
|
||||
|
||||
$previous = $ErrorActionPreference
|
||||
$ErrorActionPreference = "Continue"
|
||||
try {
|
||||
if ($Mode -eq "Reverse") {
|
||||
& git -C $target apply --reverse --check $PatchPath 2>$null
|
||||
} else {
|
||||
& git -C $target apply --check $PatchPath 2>$null
|
||||
}
|
||||
return $LASTEXITCODE -eq 0
|
||||
} finally {
|
||||
$ErrorActionPreference = $previous
|
||||
}
|
||||
}
|
||||
|
||||
if (!(Test-Path $target)) {
|
||||
New-Item -ItemType Directory -Force (Split-Path $target) | Out-Null
|
||||
|
|
@ -23,9 +46,16 @@ if ($branches) {
|
|||
git -C $target switch -c $Branch origin/main
|
||||
}
|
||||
|
||||
$alreadyApplied = git -C $target log --oneline --grep "Fix nested tree group references on Blender 4+" -1
|
||||
if (!$alreadyApplied) {
|
||||
git -C $target am $patch
|
||||
$patches = Get-ChildItem -Path $patchDir -Filter "*.patch" | Sort-Object Name
|
||||
foreach ($patch in $patches) {
|
||||
if (Test-GitPatch -Mode "Forward" -PatchPath $patch.FullName) {
|
||||
git -C $target am $patch.FullName
|
||||
continue
|
||||
}
|
||||
|
||||
if (!(Test-GitPatch -Mode "Reverse" -PatchPath $patch.FullName)) {
|
||||
throw "Patch is neither applicable nor already applied: $($patch.FullName)"
|
||||
}
|
||||
}
|
||||
|
||||
git -C $target status --short --branch
|
||||
|
|
|
|||
Loading…
Reference in a new issue