Add temp var to Media condition indicating which source matched
Some checks failed
debian-build / build (push) Has been cancelled
Check locale / ubuntu64 (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled

This commit is contained in:
WarmUpTill
2025-08-07 21:09:04 +02:00
committed by WarmUpTill
parent 4cae420ade
commit 3e8d6e103a
2 changed files with 20 additions and 2 deletions

View File

@@ -185,6 +185,12 @@ void MacroConditionMedia::SetupTempVars()
MacroCondition::SetupTempVars();
if (_sourceType != SourceType::SOURCE) {
AddTempvar(
"source",
obs_module_text(
"AdvSceneSwitcher.tempVar.media.source"),
obs_module_text(
"AdvSceneSwitcher.tempVar.media.source.description"));
return;
}
@@ -351,13 +357,23 @@ bool MacroConditionMedia::CheckCondition()
switch (_sourceType) {
case SourceType::ANY:
for (auto &source : _sourceGroup) {
match = match || source.CheckCondition();
const bool matched = source.CheckCondition();
if (matched) {
SetTempVarValue("source",
source.GetSource().ToString());
}
match = match || matched;
}
break;
case SourceType::ALL: {
bool res = true;
for (auto &source : _sourceGroup) {
res = res && source.CheckCondition();
const bool matched = source.CheckCondition();
if (matched) {
SetTempVarValue("source",
source.GetSource().ToString());
}
res = res && matched;
}
match = res;
break;