diff --git a/data/locale/de-DE.ini b/data/locale/de-DE.ini index 83a9d0f9..5e4a4d4a 100644 --- a/data/locale/de-DE.ini +++ b/data/locale/de-DE.ini @@ -215,6 +215,7 @@ AdvSceneSwitcher.videoTab.condition.match="genau übereinstimmt mit" AdvSceneSwitcher.videoTab.condition.match.tooltip="Eine genaue Übereinstimmung setzt voraus, dass sowohl Zielquelle als auch das Bild die gleiche Auflösung besitzen.\nZusätzlich muss jeder einzelne Pixel zwischen beiden Bildquellen übereinstimmen weshalb Bildformate, welche das Bild komprimieren (z. B. .JPG) nicht zu empfehlen sind." AdvSceneSwitcher.videoTab.condition.differ="nicht übereinstimmt mit" AdvSceneSwitcher.videoTab.condition.hasNotChanged="sich nicht verändert" +AdvSceneSwitcher.videoTab.condition.hasNotChanged="sich verändert" AdvSceneSwitcher.videoTab.ignoreInactiveSource="außer Video Quelle ist inaktiv" AdvSceneSwitcher.videoTab.entry="Wenn {{videoSources}} {{condition}} {{filePath}} {{browseButton}} für {{duration}} wechsle zu {{scenes}} mit {{transitions}} {{ignoreInactiveSource}}" AdvSceneSwitcher.videoTab.help="

Dieser Tab ermöglicht es basierend auf der Videoausgabe von Quellen scenen zu wechseln.
Für eine noch bessere Implementierung dieser Funktionalität siehe Pixel Match Switcher.

Klicke auf das markierte Plus Symbol, um einen neuen Eintrag hinzuzufügen..

" diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index 3d065f7f..471be4d3 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -215,6 +215,7 @@ AdvSceneSwitcher.videoTab.condition.match="exactly matches" AdvSceneSwitcher.videoTab.condition.match.tooltip="An exact match requires the target and the source image to be of the same resolution.\nAdditionally every single pixel needs to match, which is why use of image formats which use compression (e.g. .JPG) is not recommended!" AdvSceneSwitcher.videoTab.condition.differ="does not match" AdvSceneSwitcher.videoTab.condition.hasNotChanged="has not changed" +AdvSceneSwitcher.videoTab.condition.hasChanged="has changed" AdvSceneSwitcher.videoTab.ignoreInactiveSource="unless source is inactive" AdvSceneSwitcher.videoTab.entry="When {{videoSources}} {{condition}} {{filePath}} {{browseButton}} for {{duration}} switch to {{scenes}} using {{transitions}} {{ignoreInactiveSource}}" AdvSceneSwitcher.videoTab.help="

This tab will allow you to switch scenes based on the current video output of selected sources.
Make sure to check out Pixel Match Switcher for an even better implementation of this functionality.

Click on the highlighted plus symbol to continue.

" diff --git a/src/headers/switch-video.hpp b/src/headers/switch-video.hpp index f313028f..8740294a 100644 --- a/src/headers/switch-video.hpp +++ b/src/headers/switch-video.hpp @@ -10,6 +10,7 @@ enum class videoSwitchType { MATCH, DIFFER, HAS_NOT_CHANGED, + HAS_CHANGED, }; class AdvSSScreenshotObj { diff --git a/src/switch-video.cpp b/src/switch-video.cpp index 949ab9b1..667cb1d9 100644 --- a/src/switch-video.cpp +++ b/src/switch-video.cpp @@ -355,6 +355,11 @@ void VideoSwitch::save(obs_data_t *obj) obs_data_set_bool(obj, "ignoreInactiveSource", ignoreInactiveSource); } +bool requiresFileInput(videoSwitchType t) +{ + return t == videoSwitchType::MATCH || t == videoSwitchType::DIFFER; +} + void VideoSwitch::load(obs_data_t *obj) { SceneSwitcherEntry::load(obj); @@ -367,7 +372,7 @@ void VideoSwitch::load(obs_data_t *obj) file = obs_data_get_string(obj, "filePath"); ignoreInactiveSource = obs_data_get_bool(obj, "ignoreInactiveSource"); - if (condition != videoSwitchType::HAS_NOT_CHANGED) { + if (requiresFileInput(condition)) { (void)loadImageFromFile(); } } @@ -423,6 +428,10 @@ bool VideoSwitch::checkMatch() conditionMatch = screenshotData->image == matchImage; break; + case videoSwitchType::HAS_CHANGED: + conditionMatch = screenshotData->image != + matchImage; + break; default: break; } @@ -444,7 +453,7 @@ bool VideoSwitch::checkMatch() match = true; } - if (condition == videoSwitchType::HAS_NOT_CHANGED) { + if (!requiresFileInput(condition)) { matchImage = std::move(screenshotData->image); } previousTime = std::move(screenshotData->time); @@ -480,6 +489,8 @@ static inline void populateConditionSelection(QComboBox *list) obs_module_text("AdvSceneSwitcher.videoTab.condition.differ")); list->addItem(obs_module_text( "AdvSceneSwitcher.videoTab.condition.hasNotChanged")); + list->addItem(obs_module_text( + "AdvSceneSwitcher.videoTab.condition.hasChanged")); } VideoSwitchWidget::VideoSwitchWidget(QWidget *parent, VideoSwitch *s) @@ -530,7 +541,7 @@ VideoSwitchWidget::VideoSwitchWidget(QWidget *parent, VideoSwitch *s) filePath->setText(QString::fromStdString(s->file)); ignoreInactiveSource->setChecked(s->ignoreInactiveSource); - if (s->condition == videoSwitchType::HAS_NOT_CHANGED) { + if (!requiresFileInput(s->condition)) { filePath->hide(); browseButton->hide(); } @@ -582,8 +593,7 @@ void VideoSwitchWidget::swapSwitchData(VideoSwitchWidget *s1, void VideoSwitchWidget::UpdatePreviewTooltip() { - if (!switchData || - switchData->condition == videoSwitchType::HAS_NOT_CHANGED) { + if (!switchData || !requiresFileInput(switchData->condition)) { return; } @@ -627,12 +637,12 @@ void VideoSwitchWidget::ConditionChanged(int cond) std::lock_guard lock(switcher->m); switchData->condition = static_cast(cond); - if (switchData->condition == videoSwitchType::HAS_NOT_CHANGED) { - filePath->hide(); - browseButton->hide(); - } else { + if (requiresFileInput(switchData->condition)) { filePath->show(); browseButton->show(); + } else { + filePath->hide(); + browseButton->hide(); } // Reload image data to avoid incorrect matches.