From 76c759c8f495f45f322215e8b8791ab95daba0a4 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Sat, 3 Jun 2023 13:24:47 +0200 Subject: [PATCH] Display different message if whole image matches pattern The "pattern is highlighted in red" message does not make sense in this case as there is no room to display the red border around the match. --- data/locale/en-US.ini | 1 + src/macro-external/video/preview-dialog.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index d45487c3..2851e558 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -232,6 +232,7 @@ AdvSceneSwitcher.condition.video.screenshotFail="Failed to get screenshot of sou AdvSceneSwitcher.condition.video.screenshotEmpty="Screenshot is empty - Is the source visible?" AdvSceneSwitcher.condition.video.patternMatchFail="Pattern was not found!" AdvSceneSwitcher.condition.video.patternMatchSuccess="Pattern is highlighted in red" +AdvSceneSwitcher.condition.video.patternMatchSuccessFullImage="Full image matches the pattern" AdvSceneSwitcher.condition.video.objectMatchFail="Object was not found!" AdvSceneSwitcher.condition.video.objectMatchSuccess="Object is highlighted in red" AdvSceneSwitcher.condition.video.ocrMatchSuccess="Detected text:\n\n%1" diff --git a/src/macro-external/video/preview-dialog.cpp b/src/macro-external/video/preview-dialog.cpp index 96016650..5a00a391 100644 --- a/src/macro-external/video/preview-dialog.cpp +++ b/src/macro-external/video/preview-dialog.cpp @@ -307,6 +307,9 @@ void PreviewImage::MarkMatch(QImage &screenshot, if (result.total() == 0 || countNonZero(result) == 0) { emit StatusUpdate(obs_module_text( "AdvSceneSwitcher.condition.video.patternMatchFail")); + } else if (result.cols == 1 && result.rows == 1) { + emit StatusUpdate(obs_module_text( + "AdvSceneSwitcher.condition.video.patternMatchSuccessFullImage")); } else { emit StatusUpdate(obs_module_text( "AdvSceneSwitcher.condition.video.patternMatchSuccess"));