Skip to content

Commit

Permalink
feat: OBS.Beat.Angle ( Fixes #194 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Feb 14, 2024
1 parent 4c5282d commit cc6ff86
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
41 changes: 17 additions & 24 deletions Build/obs--shaders.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
param()


#region Build Condition
$logOutput = git log -n 1
foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
if ($myAttribute -is [ValidatePattern]) {
if ($myAttribute.RegexPattern) {
if ($env:GITHUB_STEP_SUMMARY) {
"* Validating Build Pattern (``$($myAttribute.RegexPattern)``) against $($logOutput.CommitMessage,$logOutput -join [Environment]::Newline)" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
Expand All @@ -27,14 +28,21 @@ foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
(-not $myRegex.IsMatch("$logOutput"))
) {
if ($env:GITHUB_STEP_SUMMARY) {
"* SKIPPING SHADER BUILD because $($logOutput) did not match ($($myAttribute.RegexPattern))" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
"* skipping $($MyInvocation.MyCommand.Name) because $($logOutput) did not match ($($myAttribute.RegexPattern))" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
Write-Warning "Skipping $($MyInvocation.MyCommand) :The last commit did not match $($myRegex)"
return
}
}

if ($myAttribute -is [ValidateScript]) {
elseif ($myAttribute -is [ValidateScript])
{
if ($env:GITHUB_STEP_SUMMARY) {
"* Validating Build Against Script:
~~~PowerShell
$($myAttribute.ScriptBlock)
~~~
" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
$validationOutput = . $myAttribute.ScriptBlock $logOutput
if (-not $validationOutput) {
if ($env:GITHUB_STEP_SUMMARY) {
Expand All @@ -48,6 +56,7 @@ foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
}
}
}
#endregion Build Condition

if ($env:GITHUB_STEP_SUMMARY) {
@"
Expand Down Expand Up @@ -369,29 +378,13 @@ switch -regex ($myVerb) {
$NewPipeScriptSplat.Alias = "Set-$ShaderNoun", "Add-$ShaderNoun"
$NewPipeScriptSplat.OutputPath = (Join-Path $ShaderCommandsPath "Get-$ShaderNoun.ps1")
$NewPipeScriptSplat.Process = $ShaderProcess
<#
$generatingJobs += Start-ThreadJob -ScriptBlock {
param($PipeScriptPath, $NewPipeScriptSplat)
Import-Module $pipeScriptPath
New-PipeScript @NewPipeScriptSplat
} -ArgumentList "$(Get-Module PipeScript | Split-Path | Join-Path -ChildPath PipeScript.psd1)",
$NewPipeScriptSplat
#>
New-PipeScript @NewPipeScriptSplat
<#$generatedFunction = New-PipeScript -FunctionName "Get-$ShaderNoun" -Parameter $ShaderParameters -Alias "Set-$ShaderNoun",
"Add-$ShaderNoun" -outputPath (Join-Path $ShaderCommandsPath "Get-$ShaderNoun.ps1") -Process $ShaderProcess
$generatedFunction
$null = $null #>
}

<#
do {
$generatingJobs | Receive-Job
$generatingJobStates = @($generatingJobs | Select-Object -ExpandProperty State -Unique | Sort-Object)
Start-Sleep -Seconds 1
} while (($generatingJobStates -match '(?>NotStarted|Running)'))
#>
if (Test-Path "obs-shaderfilter") {
Remove-Item -Recurse -Force -Path "obs-shaderfilter"
}


trap [Exception] {
if ($env:GITHUB_STEP_SUMMARY) {
Expand Down
13 changes: 10 additions & 3 deletions Build/obs-powershell.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ param()
#region Build Condition
$logOutput = git log -n 1
foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
if ($myAttribute -is [ValidatePattern]) {
if ($myAttribute.RegexPattern) {
if ($env:GITHUB_STEP_SUMMARY) {
"* Validating Build Pattern (``$($myAttribute.RegexPattern)``) against $($logOutput.CommitMessage,$logOutput -join [Environment]::Newline)" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
Expand All @@ -24,8 +24,15 @@ foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
return
}
}

if ($myAttribute -is [ValidateScript]) {
elseif ($myAttribute -is [ValidateScript])
{
if ($env:GITHUB_STEP_SUMMARY) {
"* Validating Build Against Script:
~~~PowerShell
$($myAttribute.ScriptBlock)
~~~
" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
$validationOutput = . $myAttribute.ScriptBlock $logOutput
if (-not $validationOutput) {
if ($env:GITHUB_STEP_SUMMARY) {
Expand Down
9 changes: 9 additions & 0 deletions Types/OBS.Beat/get_Angle.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<#
.SYNOPSIS
Gets the Beat Angle
.DESCRIPTION
Gets the Angle of the Beat.
If we imagine that as the beat is moving, we are rotating around a circle, this should be the angle at any given moment.
#>
$this.BeatCount * 180/[Math]::PI

0 comments on commit cc6ff86

Please sign in to comment.