File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,45 @@ $this |
1717
1818 </Script >
1919 </ScriptMethod >
20+ <ScriptMethod >
21+ <Name >Crop</Name >
22+ <Script >
23+ $cropTable = [Ordered]@{
24+ cropBottom = 0
25+ cropLeft = 0
26+ cropRight = 0
27+ cropTop = 0
28+ }
29+
30+ $MatchingKey = [Regex]::new("(?> $(
31+ @($cropTable.Keys -join '|'
32+ '|'
33+ $cropTable.Keys -replace '^crop' -join '|') -join ''
34+ ))", 'IgnoreCase')
35+
36+
37+ $currentKey = ''
38+ foreach ($arg in $args) {
39+ if ($arg -is [Collections.IDictionary]) {
40+ foreach ($keyValue in $arg.GetEnumerator()) {
41+ if ($keyValue.Key -match $MatchingKey) {
42+ $cropTable[$matches.0 -replace '^crop' -replace '^', 'crop'] = $keyValue.Value
43+ }
44+ }
45+ }
46+ if ($arg -is [string] -and $arg -match $MatchingKey) {
47+ $currentKey = $matches.0 -replace '^crop' -replace '^', 'crop'
48+ }
49+ if ($arg -is [int] -and $currentKey) {
50+ $cropTable[$currentKey] = $arg
51+ $currentKey = ''
52+ }
53+ }
54+
55+ $this | Set-OBSSceneItemTransform -SceneItemTransform $cropTable
56+
57+ </Script >
58+ </ScriptMethod >
2059 <ScriptMethod >
2160 <Name >Delete</Name >
2261 <Script >
You can’t perform that action at this time.
0 commit comments