diff --git a/src/backend/integrations/builtin/obs/effects/toggle-obs-source-filter.ts b/src/backend/integrations/builtin/obs/effects/toggle-obs-source-filter.ts index 07003ed2e..bb5d114b4 100644 --- a/src/backend/integrations/builtin/obs/effects/toggle-obs-source-filter.ts +++ b/src/backend/integrations/builtin/obs/effects/toggle-obs-source-filter.ts @@ -30,7 +30,29 @@ export const ToggleSourceFilterEffectType: EffectType = categories: ["common"] }, optionsTemplate: ` - + +
+

Warning! + Cannot find {{missingSources.length}} sources in this effect. Ensure the correct profile or scene collection is loaded in OBS, and OBS is running. +

+
+
+ +
+
+
+ Source: {{filterName.sourceName}}, + Name: {{filterName.filterName}}, + Action: {{getMissingActionDisplay(filterName.action)}} +
+
+ +
+
+
+
+ +
Filter @@ -76,13 +98,15 @@ export const ToggleSourceFilterEffectType: EffectType = $scope.searchText = ""; + $scope.missingSources = []; + if ($scope.effect.selectedFilters == null) { $scope.effect.selectedFilters = []; } $scope.filterIsSelected = (sourceName: string, filterName: string) => { return $scope.effect.selectedFilters.some( - (s) => s.sourceName === sourceName && s.filterName === filterName + s => s.sourceName === sourceName && s.filterName === filterName ); }; @@ -92,7 +116,7 @@ export const ToggleSourceFilterEffectType: EffectType = ) => { if ($scope.filterIsSelected(sourceName, filterName)) { $scope.effect.selectedFilters = $scope.effect.selectedFilters.filter( - (s) => !(s.sourceName === sourceName && s.filterName === filterName) + s => !(s.sourceName === sourceName && s.filterName === filterName) ); } else { $scope.effect.selectedFilters.push({ @@ -109,7 +133,7 @@ export const ToggleSourceFilterEffectType: EffectType = action: "toggle" | boolean ) => { const selectedFilter = $scope.effect.selectedFilters.find( - (s) => s.sourceName === sourceName && s.filterName === filterName + s => s.sourceName === sourceName && s.filterName === filterName ); if (selectedFilter != null) { selectedFilter.action = action; @@ -121,8 +145,11 @@ export const ToggleSourceFilterEffectType: EffectType = filterName: string ) => { const selectedFilter = $scope.effect.selectedFilters.find( - (s) => s.sourceName === sourceName && s.filterName === filterName + s => s.sourceName === sourceName && s.filterName === filterName ); + + $scope.missingSources = $scope.missingSources.filter(item => item !== selectedFilter); + if (selectedFilter == null) { return ""; } @@ -136,11 +163,27 @@ export const ToggleSourceFilterEffectType: EffectType = return "Disable"; }; + $scope.getMissingActionDisplay = ( + selectedFilter: unknown + ) => { + console.log(selectedFilter); + if (selectedFilter == null) { + return ""; + } + if (selectedFilter === "toggle") { + return "Toggle"; + } + if (selectedFilter === true) { + return "Enable"; + } + return "Disable"; + }; + const capitalizeWords = (input: string) => input .split(" ") .map( - (w) => w[0].toLocaleUpperCase() + w.substr(1).toLocaleLowerCase() + w => w[0].toLocaleUpperCase() + w.substr(1).toLocaleLowerCase() ) .join(" "); @@ -153,12 +196,25 @@ export const ToggleSourceFilterEffectType: EffectType = $scope.searchText = searchText; } $scope.sourceListFiltered = ($scope.sourceList as Array).filter((source: OBSSource) => { - return source.filters.some(filter => { + return source.filters.some((filter) => { return filter.name.toLowerCase().includes(searchText.toLowerCase()); }); }); }; + $scope.deleteSceneAtIndex = (index: number) => { + $scope.effect.selectedFilters = $scope.effect.selectedFilters.filter( + item => item !== $scope.missingSources [index] + ); + $scope.missingSources.splice(index, 1); + }; + + $scope.getStoredData = () => { + for (const filterName of $scope.effect.selectedFilters) { + $scope.missingSources.push(filterName); + } + }; + $scope.getSourceList = () => { $scope.isObsConfigured = backendCommunicator.fireEventSync("obs-is-configured"); @@ -171,6 +227,7 @@ export const ToggleSourceFilterEffectType: EffectType = }; $scope.getSourceList(); + $scope.getStoredData(); }, optionsValidator: () => { return []; diff --git a/src/backend/integrations/builtin/obs/effects/toggle-obs-source-muted.ts b/src/backend/integrations/builtin/obs/effects/toggle-obs-source-muted.ts index 3da2998d2..7c45bb60b 100644 --- a/src/backend/integrations/builtin/obs/effects/toggle-obs-source-muted.ts +++ b/src/backend/integrations/builtin/obs/effects/toggle-obs-source-muted.ts @@ -25,7 +25,27 @@ export const ToggleSourceMutedEffectType: EffectType = categories: ["common"] }, optionsTemplate: ` - + +
+

Warning! + Cannot find {{missingSources.length}} sources in this effect. Ensure the correct profile or scene collection is loaded in OBS, and OBS is running. +

+
+
+ +
+
+
+ Source: {{sourceList.sourceName}} +
+
+ +
+
+
+
+ +
@@ -61,20 +81,22 @@ export const ToggleSourceMutedEffectType: EffectType = $scope.sourceList = null; + $scope.missingSources = []; + if ($scope.effect.selectedSources == null) { $scope.effect.selectedSources = []; } $scope.sourceIsSelected = (sourceName: string) => { return $scope.effect.selectedSources.some( - (s) => s.sourceName === sourceName + s => s.sourceName === sourceName ); }; $scope.toggleSourceSelected = (sourceName: string) => { if ($scope.sourceIsSelected(sourceName)) { $scope.effect.selectedSources = $scope.effect.selectedSources.filter( - (s) => !(s.sourceName === sourceName) + s => !(s.sourceName === sourceName) ); } else { $scope.effect.selectedSources.push({ @@ -89,7 +111,7 @@ export const ToggleSourceMutedEffectType: EffectType = action: "toggle" | boolean ) => { const selectedSource = $scope.effect.selectedSources.find( - (s) => s.sourceName === sourceName + s => s.sourceName === sourceName ); if (selectedSource != null) { selectedSource.action = action; @@ -98,8 +120,11 @@ export const ToggleSourceMutedEffectType: EffectType = $scope.getSourceActionDisplay = (sourceName: string) => { const selectedSource = $scope.effect.selectedSources.find( - (s) => s.sourceName === sourceName + s => s.sourceName === sourceName ); + + $scope.missingSources = $scope.missingSources.filter(item => item !== selectedSource); + if (selectedSource == null) { return ""; } @@ -117,7 +142,7 @@ export const ToggleSourceMutedEffectType: EffectType = input .split(" ") .map( - (w) => w[0].toLocaleUpperCase() + w.substr(1).toLocaleLowerCase() + w => w[0].toLocaleUpperCase() + w.substr(1).toLocaleLowerCase() ) .join(" "); @@ -125,6 +150,19 @@ export const ToggleSourceMutedEffectType: EffectType = return capitalizeWords((type ?? "").replace(/_/, " ")); }; + $scope.deleteSceneAtIndex = (index: number) => { + $scope.effect.selectedSources = $scope.effect.selectedSources.filter( + item => item !== $scope.missingSources [index] + ); + $scope.missingSources.splice(index, 1); + }; + + $scope.getStoredData = () => { + for (const sceneName of $scope.effect.selectedSources) { + $scope.missingSources.push(sceneName); + } + }; + $scope.getSourceList = () => { $scope.isObsConfigured = backendCommunicator.fireEventSync("obs-is-configured"); @@ -136,6 +174,7 @@ export const ToggleSourceMutedEffectType: EffectType = }; $scope.getSourceList(); + $scope.getStoredData(); }, optionsValidator: () => { return []; diff --git a/src/backend/integrations/builtin/obs/effects/toggle-obs-source-visibility.ts b/src/backend/integrations/builtin/obs/effects/toggle-obs-source-visibility.ts index a55466ac7..36dcec9c8 100644 --- a/src/backend/integrations/builtin/obs/effects/toggle-obs-source-visibility.ts +++ b/src/backend/integrations/builtin/obs/effects/toggle-obs-source-visibility.ts @@ -12,6 +12,7 @@ type EffectProperties = { sceneName: string; sourceId: number; groupName?: string; + sourceName?: string; action: SourceAction; }>; }; @@ -31,7 +32,30 @@ export const ToggleSourceVisibilityEffectType: Firebot.EffectType + +
+

Warning! + Cannot find {{missingSources.length}} sources in this effect. Ensure the correct profile or scene collection is loaded in OBS, and OBS is running. +

+
+
+ +
+
+
+ Scene: {{sceneName.sceneName}}, + Name: {{sceneName.sourceName || 'Unknown'}}, + Id: {{sceneName.sourceId}}, + Action: {{getMissingActionDisplay(sceneName.action)}} +
+
+ +
+
+
+
+ +
Filter @@ -48,7 +72,7 @@ export const ToggleSourceVisibilityEffectType: Firebot.EffectType{{sceneName}}
@@ -78,6 +102,8 @@ export const ToggleSourceVisibilityEffectType: Firebot.EffectType { return $scope.effect.selectedSources.some( - (s) => s.sceneName === sceneName && s.sourceId === sourceId + s => s.sceneName === sceneName && s.sourceId === sourceId ); }; - $scope.toggleSourceSelected = (sceneName: string, sourceId: number, groupName: string) => { + $scope.toggleSourceSelected = (sceneName: string, sourceId: number, groupName: string, sourceName: string) => { if ($scope.sourceIsSelected(sceneName, sourceId)) { $scope.effect.selectedSources = $scope.effect.selectedSources.filter( - (s) => !(s.sceneName === sceneName && s.sourceId === sourceId) + s => !(s.sceneName === sceneName && s.sourceId === sourceId) ); } else { $scope.effect.selectedSources.push({ sceneName, sourceId, groupName, + sourceName, action: true }); } @@ -130,7 +157,7 @@ export const ToggleSourceVisibilityEffectType: Firebot.EffectType { const selectedSource = $scope.effect.selectedSources.find( - (s) => s.sceneName === sceneName && s.sourceId === sourceId + s => s.sceneName === sceneName && s.sourceId === sourceId ); if (selectedSource != null) { selectedSource.action = action; @@ -139,8 +166,11 @@ export const ToggleSourceVisibilityEffectType: Firebot.EffectType { const selectedSource = $scope.effect.selectedSources.find( - (s) => s.sceneName === sceneName && s.sourceId === sourceId + s => s.sceneName === sceneName && s.sourceId === sourceId ); + + $scope.missingSources = $scope.missingSources.filter(item => item !== selectedSource); + if (selectedSource == null) { return ""; } @@ -154,6 +184,34 @@ export const ToggleSourceVisibilityEffectType: Firebot.EffectType { + if (selectedFilter == null) { + return ""; + } + if (selectedFilter === "toggle") { + return "Toggle"; + } + if (selectedFilter === true) { + return "Enable"; + } + return "Disable"; + }; + + $scope.deleteSceneAtIndex = (index: number) => { + $scope.effect.selectedSources = $scope.effect.selectedSources.filter( + item => item !== $scope.missingSources [index] + ); + $scope.missingSources.splice(index, 1); + }; + + $scope.getStoredData = () => { + for (const sceneName of $scope.effect.selectedSources) { + $scope.missingSources.push(sceneName); + } + }; + $scope.getSourceData = () => { $scope.isObsConfigured = backendCommunicator.fireEventSync("obs-is-configured"); @@ -165,6 +223,7 @@ export const ToggleSourceVisibilityEffectType: Firebot.EffectType { return [];