Last active
November 30, 2022 13:10
-
-
Save pwillard/290b156dbe8134db699613a096944e49 to your computer and use it in GitHub Desktop.
Blender Persona Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Powershell 7 | |
# Quick and Dirty tool to manage alternate Blender personas by | |
# swapping out Startup.blend files. | |
# | |
# The general idea is tha you have a config BACKUP folder where you keep a | |
# master copy of the general startup and your special startup files. | |
# | |
# For example... I have one Blend file that starts up without default cube and is setup | |
# for Millimeters... (for making 3d printing models) and it saves me the time of messing | |
# with UNITS and such. | |
# | |
# Example: My current settings folder in Windows 10 is: | |
# C:\Users\Willard\AppData\Roaming\Blender Foundation\Blender\2.93\config | |
# | |
# You WILL need to make edits to personalize this script | |
# * Menu options... | |
# * ConfigFolder | |
# | |
# Curts startup | |
# Video: https://youtu.be/C6U0grlIJso | |
# File: https://curtisjamesholt.gumroad.com/l/curts_defaults | |
# | |
Clear-host | |
Write-Host "Blend Persona" -ForegroundColor Green | |
Write-Host "=============" -ForegroundColor Green | |
Write-Host "" | |
#C:\Program Files\Blender Foundation\Blender 3.3 | |
$ConfigFolder = "C:\Users\Willard\AppData\Roaming\Blender Foundation\Blender\3.3\config" | |
$BackupFolder = Join-Path $ConfigFolder "backup" | |
# Personas | |
$Standard = Join-Path $BackupFolder startup.blend | |
$3dprint = Join-Path $BackupFolder 3dprint.blend | |
$curts = Join-Path $BackupFolder curts.blend | |
# Default | |
$Dest = Join-Path $ConfigFolder startup.blend | |
If (Test-Path $BackupFolder) { | |
Write-Host "" | |
# You can comment these out... | |
# Write-Host "$BackupFolder exists." -ForegroundColor Red | |
# Write-Host "Skipping folder creation." -ForegroundColor DarkGreen | |
# Write-Host "" | |
} | |
Else { | |
Write-Host "The folder '$BackupFolder' doesn't exist. " -ForegroundColor red | |
Write-Host "This folder will be used for storing startup file backups." -ForegroundColor DarkGreen | |
Write-Host "" | |
Write-Host "Creating it now." -ForegroundColor DarkGreen | |
Write-Host "" | |
New-Item -Path "$BackupFolder" -ItemType Directory | |
Write-Host "" | |
Copy-Item -Path $Dest -Destination $Standard -Force | |
Write-Host "" | |
Write-Host "The folder $BackupFolder has been created." -ForegroundColor DarkGreen | |
Write-Host "" | |
Write-Host "Note:" | |
Write-Host "" | |
Write-Host " A copy of your current startup file is now in the backup folder." -ForegroundColor DarkGreen | |
Write-Host " You will need to place copies of your optional blend files into the" -ForegroundColor DarkGreen | |
Write-Host " backup folder for this script to work properly." -ForegroundColor DarkGreen | |
Write-Host " You also need to create menu items for each additional alternate file." -ForegroundColor DarkGreen | |
Exit 0 | |
} | |
Write-Host "" | |
Write-Host "========================================" | |
Write-Host " Blender Persona Selection" | |
Write-Host "========================================" | |
Write-Host "" | |
Write-Host " S = Standard" | |
Write-Host " P = 3DPrint" | |
Write-Host " C = Curts" | |
Write-Host " X = Exit" | |
Write-Host "" | |
function Get-Persona | |
{ | |
$choice=Read-Host "Choose a Default Startup File" | |
$Persona = Switch ($choice) | |
{ | |
S {$Standard} | |
P {$3dPrint} | |
C {$curts} | |
X {exit} | |
} | |
return $Persona | |
} | |
# Ask the questions | |
$result = Get-Persona | |
# Perform the startup file replacement from backups | |
Copy-Item -Path $Result -Destination $Dest -Force | |
Write-Host "Update Completed." | |
Read-Host -Prompt "Press any key to start a Blender session with the new settings" | |
# Open Blender with the selected persona | |
start-process -FilePath "C:\Program Files\Blender Foundation\Blender 3.3\blender.exe" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment