commit 9feb1bb9348e4c114e4cd21f6a089c4313726eb2 Author: Raincloud Date: Sun Jan 11 21:39:06 2026 -0700 init diff --git a/.config/GetStructDir.ps1 b/.config/GetStructDir.ps1 new file mode 100644 index 0000000..08be8d6 --- /dev/null +++ b/.config/GetStructDir.ps1 @@ -0,0 +1,68 @@ +# Simple helper script to get structDir from project config.json +# Reads config.json from .config folder in project root + +param( + [string]$ProjectRoot +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +if ([string]::IsNullOrWhiteSpace($ProjectRoot)) { + # Try to determine project root from script location + if ($PSScriptRoot) { + $ProjectRoot = Split-Path -Parent $PSScriptRoot + } + elseif ($MyInvocation.MyCommand.Path) { + $ProjectRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) + } + else { + Write-Error "Unable to determine project root. Please provide -ProjectRoot parameter." + exit 1 + } +} + +$configPath = Join-Path -Path $ProjectRoot -ChildPath '.config\config.json' + +if (-not (Test-Path -LiteralPath $configPath -PathType Leaf)) { + Write-Error "config.json not found at: $configPath" + exit 1 +} + +try { + $config = Get-Content -LiteralPath $configPath -Raw -ErrorAction Stop | ConvertFrom-Json + + if ($config.PSObject.Properties.Name -contains 'structDir') { + $structDir = $config.structDir + if ($null -ne $structDir -and ($structDir -isnot [string] -or $structDir.Trim().Length -gt 0)) { + # If it's an absolute path, resolve it + if ([System.IO.Path]::IsPathRooted($structDir)) { + $resolved = Resolve-Path -LiteralPath $structDir -ErrorAction SilentlyContinue + if ($null -ne $resolved) { + Write-Output $resolved.Path + exit 0 + } + Write-Output $structDir + exit 0 + } + # Relative path - resolve relative to config location + $candidate = Join-Path -Path (Split-Path -Parent $configPath) -ChildPath $structDir + $resolvedCandidate = Resolve-Path -LiteralPath $candidate -ErrorAction SilentlyContinue + if ($null -ne $resolvedCandidate) { + Write-Output $resolvedCandidate.Path + exit 0 + } + Write-Output $candidate + exit 0 + } + } + + # Default: return the directory containing config.json (project root) + Write-Output $ProjectRoot + exit 0 +} +catch { + Write-Error "Failed to read or parse config.json: $($_.Exception.Message)" + exit 1 +} + diff --git a/.config/config.json b/.config/config.json new file mode 100644 index 0000000..ff6cb79 --- /dev/null +++ b/.config/config.json @@ -0,0 +1,7 @@ +{ + "dailyFormat": "YYYY-MM-DD", + "structDir": "D:\\0 ProjectStructure", + "zipper": "7z", + "compression": 0, + "Max7zInst": 0 +} \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c2a0aa3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,117 @@ +# Git LFS attributes configuration +# All listed file types will be tracked by Git LFS + +# Video files +*.avi filter=lfs diff=lfs merge=lfs -text +*.mkv filter=lfs diff=lfs merge=lfs -text +*.mov filter=lfs diff=lfs merge=lfs -text +*.MOV filter=lfs diff=lfs merge=lfs -text +*.mp4 filter=lfs diff=lfs merge=lfs -text +*.webm filter=lfs diff=lfs merge=lfs -text + +# Image files +*.bmp filter=lfs diff=lfs merge=lfs -text +*.exr filter=lfs diff=lfs merge=lfs -text +*.gif filter=lfs diff=lfs merge=lfs -text +*.hdr filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.jpeg filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.tga filter=lfs diff=lfs merge=lfs -text +*.tif filter=lfs diff=lfs merge=lfs -text +*.tiff filter=lfs diff=lfs merge=lfs -text +*.webp filter=lfs diff=lfs merge=lfs -text + +# 3D/CG files +*.3ds filter=lfs diff=lfs merge=lfs -text +*.abc filter=lfs diff=lfs merge=lfs -text +*.blend filter=lfs diff=lfs merge=lfs -text +*.blend1 filter=lfs diff=lfs merge=lfs -text +*.blend2 filter=lfs diff=lfs merge=lfs -text +*.bvh filter=lfs diff=lfs merge=lfs -text +*.bvh.gz filter=lfs diff=lfs merge=lfs -text +*.c4d filter=lfs diff=lfs merge=lfs -text +*.dae filter=lfs diff=lfs merge=lfs -text +*.fbx filter=lfs diff=lfs merge=lfs -text +*.fbxkey filter=lfs diff=lfs merge=lfs -text +*.ma filter=lfs diff=lfs merge=lfs -text +*.max filter=lfs diff=lfs merge=lfs -text +*.mb filter=lfs diff=lfs merge=lfs -text +*.obj filter=lfs diff=lfs merge=lfs -text +*.usd filter=lfs diff=lfs merge=lfs -text +*.usdz filter=lfs diff=lfs merge=lfs -text +*.vdb filter=lfs diff=lfs merge=lfs -text +*.bphys filter=lfs diff=lfs merge=lfs -text +*.bobj filter=lfs diff=lfs merge=lfs -text +*.bvel filter=lfs diff=lfs merge=lfs -text +*.bpointcache filter=lfs diff=lfs merge=lfs -text +*.blob filter=lfs diff=lfs merge=lfs -text +*.unitypackage filter=lfs diff=lfs merge=lfs -text + +# Houdini files +*.hiplc filter=lfs diff=lfs merge=lfs -text +*.bgeo filter=lfs diff=lfs merge=lfs -text +*.bgeo.sc filter=lfs diff=lfs merge=lfs -text + +# Flip Fluids cache files +*.data filter=lfs diff=lfs merge=lfs -text +*.sqlite3 filter=lfs diff=lfs merge=lfs -text +*.ffp3 filter=lfs diff=lfs merge=lfs -text + +# Substance files +*.sbs filter=lfs diff=lfs merge=lfs -text +*.sbsar filter=lfs diff=lfs merge=lfs -text +*.spp filter=lfs diff=lfs merge=lfs -text + +# Audio files +*.mp3 filter=lfs diff=lfs merge=lfs -text +*.wav filter=lfs diff=lfs merge=lfs -text +*.m4a filter=lfs diff=lfs merge=lfs -text +*.aac filter=lfs diff=lfs merge=lfs -text +*.ogg filter=lfs diff=lfs merge=lfs -text +*.flac filter=lfs diff=lfs merge=lfs -text + +# Archive/Compression files +*.7z filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text + +# Documents +*.docx filter=lfs diff=lfs merge=lfs -text +*.xlsx filter=lfs diff=lfs merge=lfs -text +*.eps filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text + +# Adobe files +*.aegraphic filter=lfs diff=lfs merge=lfs -text +*.aep filter=lfs diff=lfs merge=lfs -text +*.prel filter=lfs diff=lfs merge=lfs -text +*.prin filter=lfs diff=lfs merge=lfs -text +*.prmf filter=lfs diff=lfs merge=lfs -text +*.prproj filter=lfs diff=lfs merge=lfs -text +*.ai filter=lfs diff=lfs merge=lfs -text +*.psd filter=lfs diff=lfs merge=lfs -text + +# Davinci Resolve files +*.dpx filter=lfs diff=lfs merge=lfs -text +*.drp filter=lfs diff=lfs merge=lfs -text + +# Data files +*.h5 filter=lfs diff=lfs merge=lfs -text +*.hdf5 filter=lfs diff=lfs merge=lfs -text + +# Other +*.uni filter=lfs diff=lfs merge=lfs -text +*.pdn filter=lfs diff=lfs merge=lfs -text +*.pur filter=lfs diff=lfs merge=lfs -text +*.db filter=lfs diff=lfs merge=lfs -text + +# Python files +*.npz filter=lfs diff=lfs merge=lfs -text + +# Adobe Alternatives +*.xcf filter=lfs diff=lfs merge=lfs -text +*.af filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d08d660 --- /dev/null +++ b/.gitignore @@ -0,0 +1,127 @@ +# Blender Studio Git Management - .gitignore + +# Blender auto-save files +*.blend1 +*.blend2 +*.blend3 +*.blend4 +*.blend5 +*.blend6 +*.blend7 +*.blend8 +*.blend9 +*.blend10 +*.blend11 +*.blend12 +*.blend13 +*.blend14 +*.blend15 +*.blend16 +*.blend17 +*.blend18 +*.blend19 +*.blend20 +*.blend21 +*.blend22 +*.blend23 +*.blend24 +*.blend25 +*.blend26 +*.blend27 +*.blend28 +*.blend29 +*.blend30 +*.blend31 +*.blend32 + +# Blender cache and temporary files +*.swp +*.swo +*~ +*.tmp +*.temp +BL_proxy/ + +# OS generated files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +desktop.ini + +# Editor files +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Large media files (uncomment if you want to exclude rendered outputs) +# *.mp4 +# *.avi +# *.mov +# *.png +# *.jpg +# *.jpeg +# *.exr +# *.hdr +# *.tiff +# *.tga + +# Audio files (uncomment if excluding) +# *.wav +# *.mp3 +# *.aac +# *.ogg + +# Log files +*.log + +# Python cache +__pycache__/ +*.pyc +*.pyo +*.pyd +.Python + +# Node modules (if using any web tools) +node_modules/ + +# Environment files +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Backup files +*.bak +*.backup +*.old + +# Temporary files +temp/ +tmp/ +cache/ + +Renders/** +!Renders/_zipped/ +!Renders/_zipped/** +!Renders/**/ +!Renders/**/*.bat +!Renders/**/*.log +seq/ + +# Premiere +*.prlock +Adobe Premiere Pro Video Previews/ +Adobe Premiere Pro Audio Previews/ +Adobe Premiere Pro (Beta) Video Previews/ +Adobe Premiere Pro (Beta) Audio Previews/ +footage/ +plates/ + +RnR/ \ No newline at end of file diff --git a/Assets/ElevenLabs/NewDaily.bat b/Assets/ElevenLabs/NewDaily.bat new file mode 100644 index 0000000..ec6596b --- /dev/null +++ b/Assets/ElevenLabs/NewDaily.bat @@ -0,0 +1,16 @@ +@echo off +setlocal + +:: Get current date in YYYY-MM-DD format +for /f "tokens=2-4 delims=/ " %%a in ('date /t') do ( + set mm=%%a + set dd=%%b + set yy=%%c +) +set yyyy=20%yy:~-2% + +:: Create daily folder +mkdir "%yyyy%-%mm%-%dd%" +echo Daily folder created: %yyyy%-%mm%-%dd% + +pause diff --git a/Renders/ConfigLoader.ps1 b/Renders/ConfigLoader.ps1 new file mode 100644 index 0000000..d7908b7 --- /dev/null +++ b/Renders/ConfigLoader.ps1 @@ -0,0 +1,442 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory=$false)] + [string]$ProjectPath +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$script:LoaderRoot = Split-Path -Parent $MyInvocation.MyCommand.Path +$script:ConfigPath = Join-Path -Path $script:LoaderRoot -ChildPath 'config.json' +$script:ConfigCache = $null + +function Get-ProjectStructureConfig { + if ($null -ne $script:ConfigCache) { + return $script:ConfigCache + } + + if (Test-Path -LiteralPath $script:ConfigPath) { + try { + $raw = Get-Content -LiteralPath $script:ConfigPath -Raw -ErrorAction Stop + if ($raw.Trim().Length -gt 0) { + $script:ConfigCache = $raw | ConvertFrom-Json + return $script:ConfigCache + } + } + catch { + Write-Warning "Failed to parse config.json: $($_.Exception.Message)" + } + } + + $script:ConfigCache = [pscustomobject]@{} + return $script:ConfigCache +} + +function Get-ConfigValue { + param( + [Parameter(Mandatory)] [string]$Name, + $Default = $null + ) + + $config = Get-ProjectStructureConfig + if ($config.PSObject.Properties.Name -contains $Name) { + $value = $config.$Name + if ($null -ne $value -and ($value -isnot [string] -or $value.Trim().Length -gt 0)) { + return $value + } + } + + return $Default +} + +function Get-StructDirectory { + # When script is run directly (not dot-sourced), always use script's directory for portability + if ($MyInvocation.InvocationName -ne '.') { + return $script:LoaderRoot + } + + $value = Get-ConfigValue -Name 'structDir' + if ($null -eq $value -or [string]::IsNullOrWhiteSpace($value)) { + return $script:LoaderRoot + } + + if ([System.IO.Path]::IsPathRooted($value)) { + $resolved = Resolve-Path -LiteralPath $value -ErrorAction SilentlyContinue + if ($null -ne $resolved) { return $resolved.Path } + return $value + } + + $candidate = Join-Path -Path $script:LoaderRoot -ChildPath $value + $resolvedCandidate = Resolve-Path -LiteralPath $candidate -ErrorAction SilentlyContinue + if ($null -ne $resolvedCandidate) { return $resolvedCandidate.Path } + return $candidate +} + +function Get-ProjectsRoot { + $value = Get-ConfigValue -Name 'projectsRoot' + if ($null -eq $value -or [string]::IsNullOrWhiteSpace($value)) { + $structDir = Get-StructDirectory + $parent = Split-Path -Parent $structDir + if ($null -eq $parent -or $parent.Length -eq 0 -or $parent -eq $structDir) { + return $structDir + } + return $parent + } + + if ([System.IO.Path]::IsPathRooted($value)) { + $resolved = Resolve-Path -LiteralPath $value -ErrorAction SilentlyContinue + if ($null -ne $resolved) { return $resolved.Path } + return $value + } + + $candidate = Join-Path -Path $script:LoaderRoot -ChildPath $value + $resolvedCandidate = Resolve-Path -LiteralPath $candidate -ErrorAction SilentlyContinue + if ($null -ne $resolvedCandidate) { return $resolvedCandidate.Path } + return $candidate +} + +function Get-ProjectPathFromUser { + param( + [string]$Prompt = "Paste the project path to deploy in" + ) + + do { + $inputPath = Read-Host -Prompt $Prompt + if ([string]::IsNullOrWhiteSpace($inputPath)) { + Write-Warning "Path cannot be empty. Please try again." + continue + } + + # Remove quotes if present + $inputPath = $inputPath.Trim('"', "'") + + # Try to resolve the path + try { + if (Test-Path -LiteralPath $inputPath -PathType Container) { + $resolved = Resolve-Path -LiteralPath $inputPath -ErrorAction Stop + return $resolved.Path + } + else { + Write-Warning "Path does not exist or is not a directory: $inputPath" + $retry = Read-Host "Try again? (Y/N)" + if ($retry -notmatch '^[Yy]') { + return $null + } + } + } + catch { + Write-Warning "Invalid path: $($_.Exception.Message)" + $retry = Read-Host "Try again? (Y/N)" + if ($retry -notmatch '^[Yy]') { + return $null + } + } + } while ($true) +} + +function Use-IsoDailyFormat { + $dailyFormat = Get-ConfigValue -Name 'dailyFormat' -Default $true + + # Handle backward compatibility with boolean values + if ($dailyFormat -is [bool]) { + return $dailyFormat + } + + # Handle string values + if ($dailyFormat -is [string]) { + $formatStr = $dailyFormat.Trim() + # ISO format contains YYYY-MM-DD pattern + if ($formatStr -match 'YYYY-MM-DD' -or $formatStr -match '\d{4}-\d{2}-\d{2}') { + return $true + } + # daily_YYMMDD or other formats are not ISO + return $false + } + + # Default to false (not ISO format) for unknown types + return $false +} + +function Use-7Zip { + $zipper = Get-ConfigValue -Name 'zipper' -Default $true + + # Handle backward compatibility with boolean values + if ($zipper -is [bool]) { + return $zipper + } + + # Handle string values + if ($zipper -is [string]) { + $zipperStr = $zipper.Trim().ToLower() + return ($zipperStr -eq '7z') + } + + # Default to false (use zip) for unknown types + return $false +} + +function Get-ZipCompressionLevel { + $value = Get-ConfigValue -Name 'compression' -Default 9 + if ($value -is [string]) { + $parsed = 0 + if ([int]::TryParse($value, [ref]$parsed)) { + $value = $parsed + } + } + + if ($value -isnot [int]) { + return 9 + } + + return [Math]::Min(9, [Math]::Max(0, $value)) +} + +function Update-ConfigStructDir { + param( + [Parameter(Mandatory)] [string]$StructDir + ) + + $config = Get-ProjectStructureConfig + $config.structDir = $StructDir + + try { + $json = $config | ConvertTo-Json -Depth 10 + Set-Content -LiteralPath $script:ConfigPath -Value $json -NoNewline -ErrorAction Stop + $script:ConfigCache = $config + } + catch { + Write-Warning "Failed to update config.json: $($_.Exception.Message)" + } +} + +# If script is run directly (not dot-sourced), prompt for project path and deploy +# When dot-sourced, InvocationName is '.'; when run directly, it's the script path or name +if ($MyInvocation.InvocationName -ne '.') { + # Update config.json to use script's directory as structDir for portability + Update-ConfigStructDir -StructDir $script:LoaderRoot + + # Use provided ProjectPath parameter, or prompt user if not provided + if ([string]::IsNullOrWhiteSpace($ProjectPath)) { + $projectPath = Get-ProjectPathFromUser + } + else { + # Remove quotes if present and resolve the provided path + $ProjectPath = $ProjectPath.Trim('"', "'") + try { + if (Test-Path -LiteralPath $ProjectPath -PathType Container) { + $projectPath = (Resolve-Path -LiteralPath $ProjectPath -ErrorAction Stop).Path + } + else { + Write-Error "Project path does not exist or is not a directory: $ProjectPath" + exit 1 + } + } + catch { + Write-Error "Unable to resolve project directory: $($_.Exception.Message)" + exit 1 + } + } + + if ($null -ne $projectPath) { + # Deploy batch files and config to the project + $structDir = Get-StructDirectory + if (-not (Test-Path -LiteralPath $structDir -PathType Container)) { + Write-Error "Configured structDir not found: $structDir" + exit 1 + } + + try { + $resolvedProject = (Resolve-Path -LiteralPath $projectPath -ErrorAction Stop).Path + } + catch { + Write-Error "Unable to resolve project directory: $($_.Exception.Message)" + exit 1 + } + + if (-not (Test-Path -LiteralPath $resolvedProject -PathType Container)) { + Write-Error "Project path is not a directory: $resolvedProject" + exit 1 + } + + Write-Host "`nDeploying to: $resolvedProject" -ForegroundColor Cyan + Write-Host "Struct directory: $structDir" -ForegroundColor Cyan + + $specs = @( + @{ Name = 'UpdateSequences.bat'; Source = Join-Path -Path $structDir -ChildPath 'UpdateSequences.bat' }, + @{ Name = 'UpdateAllSequences.bat'; Source = Join-Path -Path $structDir -ChildPath 'UpdateAllSequences.bat' }, + @{ Name = 'ZipSeqArchv.bat'; Source = Join-Path -Path $structDir -ChildPath 'ZipSeqArchv.bat' }, + @{ Name = 'UnzipSeqArchv.bat'; Source = Join-Path -Path $structDir -ChildPath 'UnzipSeqArchv.bat' }, + @{ Name = 'NewDaily.bat'; Source = Join-Path -Path $structDir -ChildPath 'NewDaily.bat' }, + @{ Name = '.gitattributes'; Source = Join-Path -Path $structDir -ChildPath 'components\gitattributes' }, + @{ Name = '.gitignore'; Source = Join-Path -Path $structDir -ChildPath 'components\gitignore' } + ) + + # Config files to deploy to projectroot\.config\ + $configAssets = @( + @{ Name = 'config.json'; Source = Join-Path -Path $structDir -ChildPath 'config.json' }, + @{ Name = 'GetStructDir.ps1'; Source = Join-Path -Path $structDir -ChildPath 'GetStructDir.ps1' } + ) + + foreach ($spec in $specs) { + if (-not (Test-Path -LiteralPath $spec.Source -PathType Leaf)) { + Write-Error "Source file not found: $($spec.Source)" + exit 1 + } + } + + foreach ($asset in $configAssets) { + if (-not (Test-Path -LiteralPath $asset.Source -PathType Leaf)) { + Write-Error "Config asset not found: $($asset.Source)" + exit 1 + } + } + + # Ensure .config directory exists in project root and is hidden + $projectConfigDir = Join-Path -Path $resolvedProject -ChildPath '.config' + if (-not (Test-Path -LiteralPath $projectConfigDir -PathType Container)) { + New-Item -Path $projectConfigDir -ItemType Directory -Force | Out-Null + Write-Host "Created .config directory: $projectConfigDir" -ForegroundColor Cyan + } + # Set hidden attribute on .config directory + $folder = Get-Item -LiteralPath $projectConfigDir -Force + $folder.Attributes = $folder.Attributes -bor [System.IO.FileAttributes]::Hidden + + $touchedDirs = @{} + $summary = @() + + foreach ($spec in $specs) { + Write-Host "`n=== Updating $($spec.Name) ===" -ForegroundColor Magenta + + $targets = Get-ChildItem -LiteralPath $resolvedProject -Recurse -Filter $spec.Name -File -Force -ErrorAction SilentlyContinue + $targets = $targets | Where-Object { $_.FullName -ne $spec.Source } + + if (-not $targets) { + Write-Host "No targets found." -ForegroundColor Yellow + $summary += [pscustomobject]@{ + Name = $spec.Name + Updated = 0 + Failed = 0 + Skipped = 0 + Total = 0 + } + continue + } + + $updated = 0 + $failed = 0 + + foreach ($target in $targets) { + try { + Copy-Item -Path $spec.Source -Destination $target.FullName -Force + # Set hidden attribute for .gitattributes and .gitignore files + if ($spec.Name -eq '.gitattributes' -or $spec.Name -eq '.gitignore') { + $file = Get-Item -LiteralPath $target.FullName -Force + $file.Attributes = $file.Attributes -bor [System.IO.FileAttributes]::Hidden + } + Write-Host "[OK] $($target.FullName)" -ForegroundColor Green + $updated++ + + $targetDir = $target.Directory.FullName + if (-not $touchedDirs.ContainsKey($targetDir)) { + $touchedDirs[$targetDir] = $true + } + } + catch { + Write-Host "[FAIL] $($target.FullName)" -ForegroundColor Red + Write-Host " $($_.Exception.Message)" -ForegroundColor DarkRed + $failed++ + } + } + + $summary += [pscustomobject]@{ + Name = $spec.Name + Updated = $updated + Failed = $failed + Skipped = 0 + Total = @($targets).Count + } + } + + Write-Host "`n=== Summary ===" -ForegroundColor Cyan + foreach ($item in $summary) { + Write-Host ("{0,-22} Updated: {1,3} Failed: {2,3} Total: {3,3}" -f $item.Name, $item.Updated, $item.Failed, $item.Total) + } + + if (($summary | Measure-Object -Property Failed -Sum).Sum -gt 0) { + Write-Host "Completed with errors." -ForegroundColor Yellow + exit 1 + } + + Write-Host "All batch files refreshed successfully." -ForegroundColor Green + + # Deploy ZipSeqArchv.bat and UnzipSeqArchv.bat to \Renders + Write-Host "`n=== Deploying ZipSeqArchv.bat and UnzipSeqArchv.bat to \Renders ===" -ForegroundColor Magenta + $rendersDir = Join-Path -Path $resolvedProject -ChildPath 'Renders' + if (-not (Test-Path -LiteralPath $rendersDir -PathType Container)) { + New-Item -Path $rendersDir -ItemType Directory -Force | Out-Null + Write-Host "Created Renders directory: $rendersDir" -ForegroundColor Cyan + } + $zipFiles = @( + @{ Name = 'ZipSeqArchv.bat'; Source = Join-Path -Path $structDir -ChildPath 'ZipSeqArchv.bat' }, + @{ Name = 'UnzipSeqArchv.bat'; Source = Join-Path -Path $structDir -ChildPath 'UnzipSeqArchv.bat' } + ) + foreach ($zipFile in $zipFiles) { + $targetPath = Join-Path -Path $rendersDir -ChildPath $zipFile.Name + try { + Copy-Item -Path $zipFile.Source -Destination $targetPath -Force + Write-Host "[OK] $targetPath" -ForegroundColor Green + } + catch { + Write-Host "[FAIL] $targetPath" -ForegroundColor Red + Write-Host " $($_.Exception.Message)" -ForegroundColor DarkRed + exit 1 + } + } + + # Deploy .gitattributes and .gitignore to project root if they don't exist + Write-Host "`n=== Deploying .gitattributes and .gitignore to project root ===" -ForegroundColor Magenta + $gitFiles = @( + @{ Name = '.gitattributes'; Source = Join-Path -Path $structDir -ChildPath 'components\gitattributes' }, + @{ Name = '.gitignore'; Source = Join-Path -Path $structDir -ChildPath 'components\gitignore' } + ) + foreach ($gitFile in $gitFiles) { + $targetPath = Join-Path -Path $resolvedProject -ChildPath $gitFile.Name + try { + Copy-Item -Path $gitFile.Source -Destination $targetPath -Force + # Set hidden attribute on the file + $file = Get-Item -LiteralPath $targetPath -Force + $file.Attributes = $file.Attributes -bor [System.IO.FileAttributes]::Hidden + Write-Host "[OK] $targetPath" -ForegroundColor Green + } + catch { + Write-Host "[FAIL] $targetPath" -ForegroundColor Red + Write-Host " $($_.Exception.Message)" -ForegroundColor DarkRed + exit 1 + } + } + + # Deploy config files to projectroot\.config\ + Write-Host "`n=== Deploying config files to .config\ ===" -ForegroundColor Magenta + foreach ($asset in $configAssets) { + $targetPath = Join-Path -Path $projectConfigDir -ChildPath $asset.Name + try { + Copy-Item -Path $asset.Source -Destination $targetPath -Force + Write-Host "[OK] $targetPath" -ForegroundColor Green + } + catch { + Write-Host "[FAIL] $targetPath" -ForegroundColor Red + Write-Host " $($_.Exception.Message)" -ForegroundColor DarkRed + exit 1 + } + } + + Write-Host "`nConfig files deployed successfully." -ForegroundColor Green + Write-Host "Deployment completed successfully." -ForegroundColor Green + exit 0 + } + else { + Write-Host "No project path provided." -ForegroundColor Yellow + exit 1 + } +} diff --git a/Renders/UnzipSeqArchv.bat b/Renders/UnzipSeqArchv.bat new file mode 100644 index 0000000..acfcc33 --- /dev/null +++ b/Renders/UnzipSeqArchv.bat @@ -0,0 +1,42 @@ +@echo off +setlocal EnableExtensions EnableDelayedExpansion + +set "REN_DIR=%~dp0" +for %%I in ("%REN_DIR%..") do set "PROJ_ROOT=%%~fI" + +set "CONFIG_DIR=%PROJ_ROOT%\.config" +set "CONFIG_PATH=%CONFIG_DIR%\config.json" +set "GET_STRUCT_DIR=%CONFIG_DIR%\GetStructDir.ps1" + +if not exist "%CONFIG_PATH%" ( + echo [ERROR] config.json not found at %CONFIG_PATH% + echo Please run ConfigLoader.ps1 to deploy helper files. + exit /b 1 +) + +if not exist "%GET_STRUCT_DIR%" ( + echo [ERROR] GetStructDir.ps1 not found at %GET_STRUCT_DIR% + echo Please run ConfigLoader.ps1 to deploy helper files. + exit /b 1 +) + +for /f "usebackq delims=" %%I in (`powershell -NoProfile -ExecutionPolicy Bypass -Command ^ + "Set-StrictMode -Version Latest; $structDir = & '%GET_STRUCT_DIR%' -ProjectRoot '%PROJ_ROOT%'; if (-not $structDir) { throw \"Failed to get structDir from GetStructDir.ps1\" }; $pyPath = Join-Path $structDir 'zip_sequences.py'; if (-not (Test-Path -LiteralPath $pyPath)) { throw \"zip_sequences.py not found at $pyPath\" }; Write-Output $pyPath"`) do set "PY_SCRIPT=%%I" + +if not defined PY_SCRIPT ( + echo [ERROR] Unable to resolve zip_sequences.py path from config. + exit /b 1 +) + +pushd "%PROJ_ROOT%" >nul 2>&1 + +python "%PY_SCRIPT%" --mode expand --verbose %* +set "ERR=!ERRORLEVEL!" + +if not "!ERR!"=="0" ( + echo Failed to expand render sequence archives (exit code !ERR!). +) + +popd >nul 2>&1 +exit /b !ERR! + diff --git a/Renders/UpdateSequences.bat b/Renders/UpdateSequences.bat new file mode 100644 index 0000000..260c0a6 --- /dev/null +++ b/Renders/UpdateSequences.bat @@ -0,0 +1,64 @@ +@echo off +setlocal EnableExtensions + +set "script_dir=%~dp0" +set "current_dir=%CD%" +set "PROJ_ROOT=" + +REM First, check project level (one directory up from current) - most common case +for %%I in ("%current_dir%..") do set "project_level=%%~fI" +set "project_config=%project_level%\.config\config.json" +if exist "%project_config%" ( + set "PROJ_ROOT=%project_level%" +) + +REM If not found at project level, search up from current working directory +if not defined PROJ_ROOT ( + for /f "usebackq delims=" %%I in (`powershell -NoProfile -ExecutionPolicy Bypass -Command "Set-StrictMode -Version Latest; $dir = '%current_dir%'; $found = $null; while ($dir -and -not $found) { $configPath = Join-Path $dir '.config\config.json'; if (Test-Path -LiteralPath $configPath) { $found = $dir; break }; $parent = Split-Path -Parent $dir; if ($parent -eq $dir) { break }; $dir = $parent }; if ($found) { Write-Output $found } else { Write-Output '' }"`) do set "PROJ_ROOT=%%I" +) + +REM If still not found, try searching from script location +if not defined PROJ_ROOT ( + for /f "usebackq delims=" %%I in (`powershell -NoProfile -ExecutionPolicy Bypass -Command "Set-StrictMode -Version Latest; $dir = '%script_dir%'; $found = $null; while ($dir -and -not $found) { $configPath = Join-Path $dir '.config\config.json'; if (Test-Path -LiteralPath $configPath) { $found = $dir; break }; $parent = Split-Path -Parent $dir; if ($parent -eq $dir) { break }; $dir = $parent }; if ($found) { Write-Output $found } else { Write-Output '' }"`) do set "PROJ_ROOT=%%I" +) + +REM Fallback: try original logic (script in 3 ProjectStructure) +if not defined PROJ_ROOT ( + for %%I in ("%script_dir%..\..") do set "PROJ_ROOT=%%~fI" +) + +set "CONFIG_DIR=%PROJ_ROOT%\.config" +set "CONFIG_PATH=%CONFIG_DIR%\config.json" + +if not exist "%CONFIG_PATH%" ( + echo [ERROR] config.json not found at %CONFIG_PATH% + if defined project_config ( + echo Also checked: %project_config% + ) + echo Please run ConfigLoader.ps1 to deploy helper files. + exit /b 1 +) + +set "GET_STRUCT_DIR=%CONFIG_DIR%\GetStructDir.ps1" + +if not exist "%GET_STRUCT_DIR%" ( + echo [ERROR] GetStructDir.ps1 not found at %GET_STRUCT_DIR% + echo Please run ConfigLoader.ps1 to deploy helper files. + exit /b 1 +) + +for /f "usebackq delims=" %%I in (`powershell -NoProfile -ExecutionPolicy Bypass -Command ^ + "Set-StrictMode -Version Latest; $structDir = & '%GET_STRUCT_DIR%' -ProjectRoot '%PROJ_ROOT%'; if (-not $structDir) { throw \"Failed to get structDir from GetStructDir.ps1\" }; $ps1Path = Join-Path $structDir 'UpdateSequences.ps1'; if (-not (Test-Path -LiteralPath $ps1Path)) { throw \"UpdateSequences.ps1 not found at $ps1Path\" }; Write-Output $ps1Path"`) do set "ps1=%%I" + +if not defined ps1 ( + echo [ERROR] Unable to resolve UpdateSequences.ps1 path from config. + exit /b 1 +) + +echo Running PowerShell update script... +powershell -NoProfile -ExecutionPolicy Bypass -File "%ps1%" +set "rc=%errorlevel%" +echo PowerShell exited with RC=%rc% +echo Done. +pause >nul +exit /b %rc% diff --git a/Renders/ZipSeqArchv.bat b/Renders/ZipSeqArchv.bat new file mode 100644 index 0000000..2fa85ec --- /dev/null +++ b/Renders/ZipSeqArchv.bat @@ -0,0 +1,44 @@ +@echo off +setlocal EnableExtensions EnableDelayedExpansion + +set "REN_DIR=%~dp0" +for %%I in ("%REN_DIR%..") do set "PROJ_ROOT=%%~fI" + +set "CONFIG_DIR=%PROJ_ROOT%\.config" +set "CONFIG_PATH=%CONFIG_DIR%\config.json" +set "GET_STRUCT_DIR=%CONFIG_DIR%\GetStructDir.ps1" + +if not exist "%CONFIG_PATH%" ( + echo [ERROR] config.json not found at %CONFIG_PATH% + echo Please run ConfigLoader.ps1 to deploy helper files. + exit /b 1 +) + +if not exist "%GET_STRUCT_DIR%" ( + echo [ERROR] GetStructDir.ps1 not found at %GET_STRUCT_DIR% + echo Please run ConfigLoader.ps1 to deploy helper files. + exit /b 1 +) + +for /f "usebackq delims=" %%I in (`powershell -NoProfile -ExecutionPolicy Bypass -Command ^ + "Set-StrictMode -Version Latest; $structDir = & '%GET_STRUCT_DIR%' -ProjectRoot '%PROJ_ROOT%'; if (-not $structDir) { throw \"Failed to get structDir from GetStructDir.ps1\" }; $pyPath = Join-Path $structDir 'zip_sequences.py'; if (-not (Test-Path -LiteralPath $pyPath)) { throw \"zip_sequences.py not found at $pyPath\" }; Write-Output $pyPath"`) do set "PY_SCRIPT=%%~I" + +if not defined PY_SCRIPT ( + echo [ERROR] Unable to resolve zip_sequences.py path from config. + exit /b 1 +) + +pushd "%PROJ_ROOT%" >nul 2>&1 + +python "%PY_SCRIPT%" --verbose %* +set "ERR=!ERRORLEVEL!" + +popd >nul 2>&1 + +if !ERR! NEQ 0 ( + echo Failed to update render sequence archives ^(exit code !ERR!^). + exit /b !ERR! +) + +exit /b 0 + diff --git a/Renders/config.json b/Renders/config.json new file mode 100644 index 0000000..ff6cb79 --- /dev/null +++ b/Renders/config.json @@ -0,0 +1,7 @@ +{ + "dailyFormat": "YYYY-MM-DD", + "structDir": "D:\\0 ProjectStructure", + "zipper": "7z", + "compression": 0, + "Max7zInst": 0 +} \ No newline at end of file