Skip to content

Commit

Permalink
Handling -PassThru in filters
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed May 29, 2023
1 parent 16bb7ed commit efaf5b1
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 14 deletions.
13 changes: 9 additions & 4 deletions Commands/Filters/Set-OBSColorFilter.ps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ function Set-OBSColorFilter
.EXAMPLE
Show-OBS -Uri .\Assets\obs-powershell-animated-icon.svg |
Set-OBSColorFilter -Opacity .5
.EXAMPLE
Show-OBS -Uri
#>
[inherit(Command={
Import-Module ..\..\obs-powershell.psd1 -Global
Expand Down Expand Up @@ -155,8 +153,15 @@ function Set-OBSColorFilter
filterSettings = $myParameterData
}

if ($PassThru) {
$addSplat.Passthru = $true
if ($MyParameters["PassThru"]) {
$addSplat.Passthru = $MyParameters["PassThru"]
if ($MyInvocation.InvocationName -like 'Add-*') {
Add-OBSSourceFilter @addSplat
} else {
$addSplat.Remove('FilterKind')
Set-OBSSourceFilterSettings @addSplat
}
return
}

# Add the input.
Expand Down
13 changes: 12 additions & 1 deletion Commands/Filters/Set-OBSGainFilter.ps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,18 @@ function Set-OBSGainFilter
SourceName = $myParameters["SourceName"]
filterKind = "gain_filter"
filterSettings = [Ordered]@{db=$Gain}
}
}

if ($MyParameters["PassThru"]) {
$addSplat.Passthru = $MyParameters["PassThru"]
if ($MyInvocation.InvocationName -like 'Add-*') {
Add-OBSSourceFilter @addSplat
} else {
$addSplat.Remove('FilterKind')
Set-OBSSourceFilterSettings @addSplat
}
return
}

# Add the input.
$outputAddedResult = Add-OBSSourceFilter @addSplat *>&1
Expand Down
13 changes: 12 additions & 1 deletion Commands/Filters/Set-OBSRenderDelayFilter.ps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,18 @@ function Set-OBSRenderDelayFilter
SourceName = $myParameters["SourceName"]
filterKind = "gpu_delay"
filterSettings = $myParameterData
}
}

if ($MyParameters["PassThru"]) {
$addSplat.Passthru = $MyParameters["PassThru"]
if ($MyInvocation.InvocationName -like 'Add-*') {
Add-OBSSourceFilter @addSplat
} else {
$addSplat.Remove('FilterKind')
Set-OBSSourceFilterSettings @addSplat
}
return
}

# Add the input.
$outputAddedResult = Add-OBSSourceFilter @addSplat *>&1
Expand Down
13 changes: 9 additions & 4 deletions Commands/Filters/Set-OBSScrollFilter.ps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,15 @@ function Set-OBSScrollFilter
filterSettings = $myParameterData
}

# If -SceneItemEnabled was passed,
if ($myParameters.Contains('SceneItemEnabled')) {
# propagate it to Add-OBSInput.
$addSplat.SceneItemEnabled = $myParameters['SceneItemEnabled'] -as [bool]
if ($MyParameters["PassThru"]) {
$addSplat.Passthru = $MyParameters["PassThru"]
if ($MyInvocation.InvocationName -like 'Add-*') {
Add-OBSSourceFilter @addSplat
} else {
$addSplat.Remove('FilterKind')
Set-OBSSourceFilterSettings @addSplat
}
return
}

# Add the input.
Expand Down
13 changes: 9 additions & 4 deletions Commands/Filters/Set-OBSSharpnessFilter.ps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,15 @@ function Set-OBSSharpnessFilter
filterSettings = $myParameterData
}

# If -SceneItemEnabled was passed,
if ($myParameters.Contains('SceneItemEnabled')) {
# propagate it to Add-OBSInput.
$addSplat.SceneItemEnabled = $myParameters['SceneItemEnabled'] -as [bool]
if ($MyParameters["PassThru"]) {
$addSplat.Passthru = $MyParameters["PassThru"]
if ($MyInvocation.InvocationName -like 'Add-*') {
Add-OBSSourceFilter @addSplat
} else {
$addSplat.Remove('FilterKind')
Set-OBSSourceFilterSettings @addSplat
}
return
}

# Add the input.
Expand Down

0 comments on commit efaf5b1

Please sign in to comment.