mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-22 01:57:31 -05:00
Allow specifying transition when reading scenes from file. (#128)
The transition can be specified on the second line of the file. For example: Scene 1 Slide
This commit is contained in:
parent
326617aad7
commit
28fbff1adc
|
|
@ -124,24 +124,31 @@ void SwitcherData::checkSwitchInfoFromFile(bool &match, OBSWeakSource &scene,
|
|||
}
|
||||
|
||||
QFile file(QString::fromStdString(fileIO.readPath));
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
QTextStream in(&file);
|
||||
QString sceneStr = in.readLine();
|
||||
obs_source_t *sceneRead =
|
||||
obs_get_source_by_name(sceneStr.toUtf8().constData());
|
||||
if (sceneRead) {
|
||||
obs_weak_source_t *sceneReadWs =
|
||||
obs_source_get_weak_source(sceneRead);
|
||||
|
||||
match = true;
|
||||
scene = sceneReadWs;
|
||||
transition = nullptr;
|
||||
|
||||
obs_weak_source_release(sceneReadWs);
|
||||
obs_source_release(sceneRead);
|
||||
}
|
||||
file.close();
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream in(&file);
|
||||
|
||||
QString sceneStr = in.readLine();
|
||||
OBSWeakSource sceneRead = GetWeakSourceByQString(sceneStr);
|
||||
|
||||
QString transitionStr = in.readLine();
|
||||
OBSWeakSource transitionRead =
|
||||
GetWeakTransitionByQString(transitionStr);
|
||||
|
||||
if (sceneRead) {
|
||||
match = true;
|
||||
scene = sceneRead;
|
||||
transition = transitionRead;
|
||||
|
||||
vblog(LOG_INFO,
|
||||
"match for 'file' - read scene '%s' and transition '%s' from file '%s'",
|
||||
sceneStr.toUtf8().constData(),
|
||||
transitionStr.toUtf8().constData(),
|
||||
fileIO.readPath.c_str());
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
static size_t WriteCallback(void *contents, size_t size, size_t nmemb,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user