From cc6ff8615fe076f31f252ad1d06d775ed49dcdcc Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Tue, 13 Feb 2024 23:04:44 -0800 Subject: [PATCH] feat: OBS.Beat.Angle ( Fixes #194 ) --- Build/obs--shaders.build.ps1 | 41 ++++++++++++++-------------------- Build/obs-powershell.build.ps1 | 13 ++++++++--- Types/OBS.Beat/get_Angle.ps1 | 9 ++++++++ 3 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 Types/OBS.Beat/get_Angle.ps1 diff --git a/Build/obs--shaders.build.ps1 b/Build/obs--shaders.build.ps1 index 574e8aa33..994f5b3de 100644 --- a/Build/obs--shaders.build.ps1 +++ b/Build/obs--shaders.build.ps1 @@ -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 } @@ -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) { @@ -48,6 +56,7 @@ foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) { } } } +#endregion Build Condition if ($env:GITHUB_STEP_SUMMARY) { @" @@ -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) { diff --git a/Build/obs-powershell.build.ps1 b/Build/obs-powershell.build.ps1 index fe54f8714..a6d67bf3d 100644 --- a/Build/obs-powershell.build.ps1 +++ b/Build/obs-powershell.build.ps1 @@ -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 } @@ -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) { diff --git a/Types/OBS.Beat/get_Angle.ps1 b/Types/OBS.Beat/get_Angle.ps1 new file mode 100644 index 000000000..5987f46fc --- /dev/null +++ b/Types/OBS.Beat/get_Angle.ps1 @@ -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 \ No newline at end of file