UI: Don't transition if already transitioning (studio mode)
Closes obsproject/obs-studio#1304
This commit is contained in:
parent
e55579e63d
commit
8b98568bbc
@ -254,6 +254,12 @@ void OBSBasic::TransitionStopped()
|
|||||||
OBSSource scene = OBSGetStrongRef(swapScene);
|
OBSSource scene = OBSGetStrongRef(swapScene);
|
||||||
if (scene)
|
if (scene)
|
||||||
SetCurrentScene(scene);
|
SetCurrentScene(scene);
|
||||||
|
|
||||||
|
// Make sure we re-enable the transition button
|
||||||
|
if (transitionButton)
|
||||||
|
transitionButton->setEnabled(true);
|
||||||
|
|
||||||
|
EnableQuickTransitionWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (api) {
|
if (api) {
|
||||||
@ -294,7 +300,7 @@ void OBSBasic::TransitionToScene(OBSSource source, bool force, bool direct,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
OBSWeakSource lastProgramScene;
|
OBSWeakSource lastProgramScene;
|
||||||
|
|
||||||
if (usingPreviewProgram) {
|
if (usingPreviewProgram) {
|
||||||
lastProgramScene = programScene;
|
lastProgramScene = programScene;
|
||||||
programScene = OBSGetWeakRef(source);
|
programScene = OBSGetWeakRef(source);
|
||||||
@ -321,6 +327,12 @@ void OBSBasic::TransitionToScene(OBSSource source, bool force, bool direct,
|
|||||||
OBSSource transition = obs_get_output_source(0);
|
OBSSource transition = obs_get_output_source(0);
|
||||||
obs_source_release(transition);
|
obs_source_release(transition);
|
||||||
|
|
||||||
|
bool stillTransitioning = obs_transition_get_time(transition) < 1.0f;
|
||||||
|
|
||||||
|
// If actively transitioning, block new transitions from starting
|
||||||
|
if (usingPreviewProgram && stillTransitioning)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
obs_transition_set(transition, source);
|
obs_transition_set(transition, source);
|
||||||
if (api)
|
if (api)
|
||||||
@ -355,6 +367,15 @@ void OBSBasic::TransitionToScene(OBSSource source, bool force, bool direct,
|
|||||||
TransitionFullyStopped();
|
TransitionFullyStopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If transition has begun, disable Transition button
|
||||||
|
if (usingPreviewProgram && stillTransitioning) {
|
||||||
|
if (transitionButton)
|
||||||
|
transitionButton->setEnabled(false);
|
||||||
|
|
||||||
|
DisableQuickTransitionWidgets();
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
if (usingPreviewProgram && sceneDuplicationMode)
|
if (usingPreviewProgram && sceneDuplicationMode)
|
||||||
obs_scene_release(scene);
|
obs_scene_release(scene);
|
||||||
}
|
}
|
||||||
@ -725,7 +746,7 @@ void OBSBasic::CreateProgramOptions()
|
|||||||
QHBoxLayout *mainButtonLayout = new QHBoxLayout();
|
QHBoxLayout *mainButtonLayout = new QHBoxLayout();
|
||||||
mainButtonLayout->setSpacing(2);
|
mainButtonLayout->setSpacing(2);
|
||||||
|
|
||||||
QPushButton *transitionButton = new QPushButton(QTStr("Transition"));
|
transitionButton = new QPushButton(QTStr("Transition"));
|
||||||
QHBoxLayout *quickTransitions = new QHBoxLayout();
|
QHBoxLayout *quickTransitions = new QHBoxLayout();
|
||||||
quickTransitions->setSpacing(2);
|
quickTransitions->setSpacing(2);
|
||||||
|
|
||||||
@ -809,7 +830,7 @@ void OBSBasic::CreateProgramOptions()
|
|||||||
menu.exec(QCursor::pos());
|
menu.exec(QCursor::pos());
|
||||||
};
|
};
|
||||||
|
|
||||||
connect(transitionButton, &QAbstractButton::clicked,
|
connect(transitionButton.data(), &QAbstractButton::clicked,
|
||||||
this, &OBSBasic::TransitionClicked);
|
this, &OBSBasic::TransitionClicked);
|
||||||
connect(addQuickTransition, &QAbstractButton::clicked, onAdd);
|
connect(addQuickTransition, &QAbstractButton::clicked, onAdd);
|
||||||
connect(configTransitions, &QAbstractButton::clicked, onConfig);
|
connect(configTransitions, &QAbstractButton::clicked, onConfig);
|
||||||
@ -1124,6 +1145,48 @@ void OBSBasic::RefreshQuickTransitions()
|
|||||||
AddQuickTransitionId(qt.id);
|
AddQuickTransitionId(qt.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OBSBasic::DisableQuickTransitionWidgets()
|
||||||
|
{
|
||||||
|
if (!IsPreviewProgramMode())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QVBoxLayout *programLayout =
|
||||||
|
reinterpret_cast<QVBoxLayout*>(programOptions->layout());
|
||||||
|
|
||||||
|
for (int idx = 0;; idx++) {
|
||||||
|
QLayoutItem *item = programLayout->itemAt(idx);
|
||||||
|
if (!item)
|
||||||
|
break;
|
||||||
|
|
||||||
|
QWidget *widget = item->widget();
|
||||||
|
if (!widget)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
widget->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OBSBasic::EnableQuickTransitionWidgets()
|
||||||
|
{
|
||||||
|
if (!IsPreviewProgramMode())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QVBoxLayout *programLayout =
|
||||||
|
reinterpret_cast<QVBoxLayout*>(programOptions->layout());
|
||||||
|
|
||||||
|
for (int idx = 0;; idx++) {
|
||||||
|
QLayoutItem *item = programLayout->itemAt(idx);
|
||||||
|
if (!item)
|
||||||
|
break;
|
||||||
|
|
||||||
|
QWidget *widget = item->widget();
|
||||||
|
if (!widget)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
widget->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OBSBasic::SetPreviewProgramMode(bool enabled)
|
void OBSBasic::SetPreviewProgramMode(bool enabled)
|
||||||
{
|
{
|
||||||
if (IsPreviewProgramMode() == enabled)
|
if (IsPreviewProgramMode() == enabled)
|
||||||
|
@ -186,6 +186,7 @@ private:
|
|||||||
|
|
||||||
QPointer<QMenu> startStreamMenu;
|
QPointer<QMenu> startStreamMenu;
|
||||||
|
|
||||||
|
QPointer<QPushButton> transitionButton;
|
||||||
QPointer<QPushButton> replayBufferButton;
|
QPointer<QPushButton> replayBufferButton;
|
||||||
|
|
||||||
QScopedPointer<QSystemTrayIcon> trayIcon;
|
QScopedPointer<QSystemTrayIcon> trayIcon;
|
||||||
@ -310,6 +311,8 @@ private:
|
|||||||
obs_data_array_t *SaveQuickTransitions();
|
obs_data_array_t *SaveQuickTransitions();
|
||||||
void ClearQuickTransitionWidgets();
|
void ClearQuickTransitionWidgets();
|
||||||
void RefreshQuickTransitions();
|
void RefreshQuickTransitions();
|
||||||
|
void DisableQuickTransitionWidgets();
|
||||||
|
void EnableQuickTransitionWidgets();
|
||||||
void CreateDefaultQuickTransitions();
|
void CreateDefaultQuickTransitions();
|
||||||
|
|
||||||
QMenu *CreatePerSceneTransitionMenu();
|
QMenu *CreatePerSceneTransitionMenu();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user