Skip to content

Commit a1089b0

Browse files
author
James Brundage
committed
Add-OBS*Source Commands: Supporting -SceneItemEnabled (Fixes #70)
1 parent 0191579 commit a1089b0

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

Commands/Sources/Add-OBSBrowserSource.ps.ps1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,21 @@ function Add-OBSBrowserSource
158158
Remove-OBSInput -InputName { $_.SourceName }
159159
}
160160

161+
162+
$addObsInputParams = [Ordered]@{
163+
sceneName = $myParameters["Scene"]
164+
inputKind = "browser_source"
165+
inputSettings = $myParameterData
166+
inputName = $Name
167+
}
168+
# If -SceneItemEnabled was passed,
169+
if ($myParameters.Contains('SceneItemEnabled')) {
170+
# propagate it to Add-OBSInput.
171+
$addObsInputParams.SceneItemEnabled = $myParameters['SceneItemEnabled'] -as [bool]
172+
}
173+
161174
$outputAddedResult =
162-
Add-OBSInput -sceneName $myParameters["Scene"] -inputKind "browser_source" -inputSettings $myParameterData -inputName $Name
175+
Add-OBSInput @addObsInputParams
163176

164177
if ($outputAddedResult) {
165178
Get-OBSSceneItem -sceneName $myParameters["Scene"] |

Commands/Sources/Add-OBSColorSource.ps.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ function Add-OBSColorSource
113113
Remove-OBSInput -InputName { $_.SourceName }
114114
}
115115

116+
117+
# If -SceneItemEnabled was passed,
118+
if ($myParameters.Contains('SceneItemEnabled')) {
119+
# propagate it to Add-OBSInput.
120+
$addObsInputParams.SceneItemEnabled = $myParameters['SceneItemEnabled'] -as [bool]
121+
}
122+
116123
$outputAddedResult = Add-OBSInput @addObsInputParams
117124
if ($outputAddedResult) {
118125
Get-OBSSceneItem -sceneName $myParameters["Scene"] |

Commands/Sources/Add-OBSDisplaySource.ps.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ function Add-OBSDisplaySource
9999
Where-Object SourceName -eq $myParameters["Name"] |
100100
Remove-OBSInput -InputName { $_.SourceName }
101101
}
102-
102+
103+
# If -SceneItemEnabled was passed,
104+
if ($myParameters.Contains('SceneItemEnabled')) {
105+
# propagate it to Add-OBSInput.
106+
$addSplat.SceneItemEnabled = $myParameters['SceneItemEnabled'] -as [bool]
107+
}
103108

104109
$outputAddedResult = Add-OBSInput @addObsInputParams
105110
if ($outputAddedResult) {

0 commit comments

Comments
 (0)