UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
/******************************************************************************
|
|
|
|
Copyright (C) 2016 by Hugh Bailey <obs.jim@gmail.com>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QWidgetAction>
|
|
|
|
#include <QToolTip>
|
2016-02-27 02:50:04 -08:00
|
|
|
#include <QMessageBox>
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
#include <util/dstr.hpp>
|
|
|
|
#include "window-basic-main.hpp"
|
|
|
|
#include "display-helpers.hpp"
|
2016-02-27 02:50:04 -08:00
|
|
|
#include "window-namedialog.hpp"
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
#include "menu-button.hpp"
|
|
|
|
#include "qt-wrappers.hpp"
|
|
|
|
|
2018-05-28 18:24:30 -07:00
|
|
|
#include "obs-hotkey.h"
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(OBSScene);
|
|
|
|
Q_DECLARE_METATYPE(OBSSource);
|
|
|
|
Q_DECLARE_METATYPE(QuickTransition);
|
|
|
|
|
|
|
|
static inline QString MakeQuickTransitionText(QuickTransition *qt)
|
|
|
|
{
|
2019-10-23 14:11:14 -07:00
|
|
|
QString name;
|
|
|
|
|
|
|
|
if (!qt->fadeToBlack)
|
|
|
|
name = QT_UTF8(obs_source_get_name(qt->source));
|
|
|
|
else
|
|
|
|
name = QTStr("FadeToBlack");
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
if (!obs_transition_fixed(qt->source))
|
|
|
|
name += QString(" (%1ms)").arg(QString::number(qt->duration));
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::InitDefaultTransitions()
|
|
|
|
{
|
|
|
|
std::vector<OBSSource> transitions;
|
|
|
|
size_t idx = 0;
|
|
|
|
const char *id;
|
|
|
|
|
|
|
|
/* automatically add transitions that have no configuration (things
|
|
|
|
* such as cut/fade/etc) */
|
|
|
|
while (obs_enum_transition_types(idx++, &id)) {
|
|
|
|
if (!obs_is_source_configurable(id)) {
|
|
|
|
const char *name = obs_source_get_display_name(id);
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
obs_source_t *tr =
|
|
|
|
obs_source_create_private(id, name, NULL);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
InitTransition(tr);
|
|
|
|
transitions.emplace_back(tr);
|
|
|
|
|
|
|
|
if (strcmp(id, "fade_transition") == 0)
|
|
|
|
fadeTransition = tr;
|
|
|
|
|
|
|
|
obs_source_release(tr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (OBSSource &tr : transitions) {
|
|
|
|
ui->transitions->addItem(QT_UTF8(obs_source_get_name(tr)),
|
2019-06-22 22:13:45 -07:00
|
|
|
QVariant::fromValue(OBSSource(tr)));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::AddQuickTransitionHotkey(QuickTransition *qt)
|
|
|
|
{
|
|
|
|
DStr hotkeyId;
|
|
|
|
QString hotkeyName;
|
|
|
|
|
|
|
|
dstr_printf(hotkeyId, "OBSBasic.QuickTransition.%d", qt->id);
|
|
|
|
hotkeyName = QTStr("QuickTransitions.HotkeyName")
|
2019-06-22 22:13:45 -07:00
|
|
|
.arg(MakeQuickTransitionText(qt));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto quickTransition = [](void *data, obs_hotkey_id, obs_hotkey_t *,
|
|
|
|
bool pressed) {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
int id = (int)(uintptr_t)data;
|
|
|
|
OBSBasic *main =
|
2019-06-22 22:13:45 -07:00
|
|
|
reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
if (pressed)
|
|
|
|
QMetaObject::invokeMethod(main,
|
2019-06-22 22:13:45 -07:00
|
|
|
"TriggerQuickTransition",
|
|
|
|
Qt::QueuedConnection,
|
|
|
|
Q_ARG(int, id));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
qt->hotkey = obs_hotkey_register_frontend(hotkeyId->array,
|
2019-06-22 22:13:45 -07:00
|
|
|
QT_TO_UTF8(hotkeyName),
|
|
|
|
quickTransition,
|
|
|
|
(void *)(uintptr_t)qt->id);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
2018-05-28 18:24:30 -07:00
|
|
|
void QuickTransition::SourceRenamed(void *param, calldata_t *data)
|
|
|
|
{
|
2019-06-22 22:13:45 -07:00
|
|
|
QuickTransition *qt = reinterpret_cast<QuickTransition *>(param);
|
2018-05-28 18:24:30 -07:00
|
|
|
|
|
|
|
QString hotkeyName = QTStr("QuickTransitions.HotkeyName")
|
2019-06-22 22:13:45 -07:00
|
|
|
.arg(MakeQuickTransitionText(qt));
|
2018-05-28 18:24:30 -07:00
|
|
|
|
|
|
|
obs_hotkey_set_description(qt->hotkey, QT_TO_UTF8(hotkeyName));
|
|
|
|
|
|
|
|
UNUSED_PARAMETER(data);
|
|
|
|
}
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
void OBSBasic::TriggerQuickTransition(int id)
|
|
|
|
{
|
|
|
|
QuickTransition *qt = GetQuickTransition(id);
|
|
|
|
|
|
|
|
if (qt && previewProgramMode) {
|
|
|
|
OBSScene scene = GetCurrentScene();
|
|
|
|
obs_source_t *source = obs_scene_get_source(scene);
|
|
|
|
|
2019-10-24 17:52:26 -07:00
|
|
|
if (GetCurrentTransition() != qt->source) {
|
|
|
|
OverrideTransition(qt->source);
|
|
|
|
overridingTransition = true;
|
|
|
|
}
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
2019-10-09 02:01:55 -07:00
|
|
|
TransitionToScene(source, false, true, qt->duration,
|
2019-10-24 17:52:26 -07:00
|
|
|
qt->fadeToBlack);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::RemoveQuickTransitionHotkey(QuickTransition *qt)
|
|
|
|
{
|
|
|
|
obs_hotkey_unregister(qt->hotkey);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::InitTransition(obs_source_t *transition)
|
|
|
|
{
|
2019-06-22 22:13:45 -07:00
|
|
|
auto onTransitionStop = [](void *data, calldata_t *) {
|
|
|
|
OBSBasic *window = (OBSBasic *)data;
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
QMetaObject::invokeMethod(window, "TransitionStopped",
|
2019-06-22 22:13:45 -07:00
|
|
|
Qt::QueuedConnection);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto onTransitionFullStop = [](void *data, calldata_t *) {
|
|
|
|
OBSBasic *window = (OBSBasic *)data;
|
2017-11-30 05:05:50 -08:00
|
|
|
QMetaObject::invokeMethod(window, "TransitionFullyStopped",
|
2019-06-22 22:13:45 -07:00
|
|
|
Qt::QueuedConnection);
|
2017-11-30 05:05:50 -08:00
|
|
|
};
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
signal_handler_t *handler = obs_source_get_signal_handler(transition);
|
|
|
|
signal_handler_connect(handler, "transition_video_stop",
|
2019-06-22 22:13:45 -07:00
|
|
|
onTransitionStop, this);
|
|
|
|
signal_handler_connect(handler, "transition_stop", onTransitionFullStop,
|
|
|
|
this);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline OBSSource GetTransitionComboItem(QComboBox *combo, int idx)
|
|
|
|
{
|
|
|
|
return combo->itemData(idx).value<OBSSource>();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::CreateDefaultQuickTransitions()
|
|
|
|
{
|
|
|
|
/* non-configurable transitions are always available, so add them
|
|
|
|
* to the "default quick transitions" list */
|
2019-06-22 22:13:45 -07:00
|
|
|
quickTransitions.emplace_back(GetTransitionComboItem(ui->transitions,
|
|
|
|
0),
|
|
|
|
300, quickTransitionIdCounter++);
|
|
|
|
quickTransitions.emplace_back(GetTransitionComboItem(ui->transitions,
|
|
|
|
1),
|
|
|
|
300, quickTransitionIdCounter++);
|
2019-10-23 14:11:14 -07:00
|
|
|
quickTransitions.emplace_back(GetTransitionComboItem(ui->transitions,
|
|
|
|
1),
|
|
|
|
300, quickTransitionIdCounter++, true);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::LoadQuickTransitions(obs_data_array_t *array)
|
|
|
|
{
|
|
|
|
size_t count = obs_data_array_count(array);
|
|
|
|
|
|
|
|
quickTransitionIdCounter = 1;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < count; i++) {
|
|
|
|
obs_data_t *data = obs_data_array_item(array, i);
|
|
|
|
obs_data_array_t *hotkeys = obs_data_get_array(data, "hotkeys");
|
|
|
|
const char *name = obs_data_get_string(data, "name");
|
|
|
|
int duration = obs_data_get_int(data, "duration");
|
|
|
|
int id = obs_data_get_int(data, "id");
|
2019-10-23 14:11:14 -07:00
|
|
|
bool toBlack = obs_data_get_bool(data, "fade_to_black");
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
if (id) {
|
|
|
|
obs_source_t *source = FindTransition(name);
|
2016-03-01 15:16:23 -08:00
|
|
|
if (source) {
|
|
|
|
quickTransitions.emplace_back(source, duration,
|
2019-10-23 14:11:14 -07:00
|
|
|
id, toBlack);
|
2016-03-01 15:16:23 -08:00
|
|
|
|
|
|
|
if (quickTransitionIdCounter <= id)
|
|
|
|
quickTransitionIdCounter = id + 1;
|
|
|
|
|
|
|
|
int idx = (int)quickTransitions.size() - 1;
|
2019-06-22 22:13:45 -07:00
|
|
|
AddQuickTransitionHotkey(
|
|
|
|
&quickTransitions[idx]);
|
2016-03-01 15:16:23 -08:00
|
|
|
obs_hotkey_load(quickTransitions[idx].hotkey,
|
|
|
|
hotkeys);
|
|
|
|
}
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
obs_data_release(data);
|
|
|
|
obs_data_array_release(hotkeys);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_data_array_t *OBSBasic::SaveQuickTransitions()
|
|
|
|
{
|
|
|
|
obs_data_array_t *array = obs_data_array_create();
|
|
|
|
|
|
|
|
for (QuickTransition &qt : quickTransitions) {
|
|
|
|
obs_data_t *data = obs_data_create();
|
|
|
|
obs_data_array_t *hotkeys = obs_hotkey_save(qt.hotkey);
|
|
|
|
|
|
|
|
obs_data_set_string(data, "name",
|
2019-06-22 22:13:45 -07:00
|
|
|
obs_source_get_name(qt.source));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
obs_data_set_int(data, "duration", qt.duration);
|
|
|
|
obs_data_set_array(data, "hotkeys", hotkeys);
|
|
|
|
obs_data_set_int(data, "id", qt.id);
|
2019-10-23 14:11:14 -07:00
|
|
|
obs_data_set_bool(data, "fade_to_black", qt.fadeToBlack);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
obs_data_array_push_back(array, data);
|
|
|
|
|
|
|
|
obs_data_release(data);
|
|
|
|
obs_data_array_release(hotkeys);
|
|
|
|
}
|
|
|
|
|
|
|
|
return array;
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_source_t *OBSBasic::FindTransition(const char *name)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < ui->transitions->count(); i++) {
|
2019-06-22 22:13:45 -07:00
|
|
|
OBSSource tr = ui->transitions->itemData(i).value<OBSSource>();
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
const char *trName = obs_source_get_name(tr);
|
|
|
|
if (strcmp(trName, name) == 0)
|
|
|
|
return tr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-10-09 02:01:55 -07:00
|
|
|
void OBSBasic::TransitionToScene(OBSScene scene, bool force)
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
{
|
|
|
|
obs_source_t *source = obs_scene_get_source(scene);
|
2019-10-09 02:01:55 -07:00
|
|
|
TransitionToScene(source, force);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::TransitionStopped()
|
|
|
|
{
|
|
|
|
if (swapScenesMode) {
|
|
|
|
OBSSource scene = OBSGetStrongRef(swapScene);
|
|
|
|
if (scene)
|
|
|
|
SetCurrentScene(scene);
|
|
|
|
}
|
|
|
|
|
2020-02-04 04:06:45 -08:00
|
|
|
EnableTransitionWidgets(true);
|
|
|
|
|
2017-02-22 03:08:37 -08:00
|
|
|
if (api) {
|
2016-08-28 14:24:14 -07:00
|
|
|
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_STOPPED);
|
2017-02-22 03:08:37 -08:00
|
|
|
api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
|
|
|
}
|
2016-08-28 14:24:14 -07:00
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
swapScene = nullptr;
|
|
|
|
}
|
|
|
|
|
2019-10-24 17:52:26 -07:00
|
|
|
void OBSBasic::OverrideTransition(OBSSource transition)
|
2017-11-30 05:05:50 -08:00
|
|
|
{
|
|
|
|
obs_source_t *oldTransition = obs_get_output_source(0);
|
|
|
|
|
|
|
|
if (transition != oldTransition) {
|
|
|
|
obs_transition_swap_begin(transition, oldTransition);
|
|
|
|
obs_set_output_source(0, transition);
|
|
|
|
obs_transition_swap_end(transition, oldTransition);
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_source_release(oldTransition);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::TransitionFullyStopped()
|
|
|
|
{
|
|
|
|
if (overridingTransition) {
|
|
|
|
OverrideTransition(GetCurrentTransition());
|
|
|
|
overridingTransition = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-09 02:01:55 -07:00
|
|
|
void OBSBasic::TransitionToScene(OBSSource source, bool force,
|
2019-10-24 17:52:26 -07:00
|
|
|
bool quickTransition, int quickDuration,
|
2019-12-27 16:41:10 -08:00
|
|
|
bool black, bool manual)
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
{
|
|
|
|
obs_scene_t *scene = obs_scene_from_source(source);
|
|
|
|
bool usingPreviewProgram = IsPreviewProgramMode();
|
|
|
|
if (!scene)
|
|
|
|
return;
|
|
|
|
|
|
|
|
OBSWeakSource lastProgramScene;
|
2018-05-25 01:16:40 -07:00
|
|
|
|
2017-11-28 03:37:19 -08:00
|
|
|
if (usingPreviewProgram) {
|
2019-12-27 16:41:10 -08:00
|
|
|
if (!tBarActive)
|
|
|
|
lastProgramScene = programScene;
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
programScene = OBSGetWeakRef(source);
|
|
|
|
|
2019-10-09 02:01:55 -07:00
|
|
|
if (swapScenesMode && !force && !black) {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
OBSSource newScene = OBSGetStrongRef(lastProgramScene);
|
|
|
|
|
|
|
|
if (!sceneDuplicationMode && newScene == source)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (newScene && newScene != GetCurrentSceneSource())
|
|
|
|
swapScene = lastProgramScene;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-02 16:36:01 -08:00
|
|
|
if (usingPreviewProgram && sceneDuplicationMode) {
|
2019-06-22 22:13:45 -07:00
|
|
|
scene = obs_scene_duplicate(
|
2019-08-31 13:15:25 -07:00
|
|
|
scene, obs_source_get_name(obs_scene_get_source(scene)),
|
2019-06-22 22:13:45 -07:00
|
|
|
editPropertiesMode ? OBS_SCENE_DUP_PRIVATE_COPY
|
|
|
|
: OBS_SCENE_DUP_PRIVATE_REFS);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
source = obs_scene_get_source(scene);
|
|
|
|
}
|
|
|
|
|
2017-11-30 05:05:50 -08:00
|
|
|
OBSSource transition = obs_get_output_source(0);
|
|
|
|
obs_source_release(transition);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
2019-12-27 16:41:10 -08:00
|
|
|
float t = obs_transition_get_time(transition);
|
2020-01-13 20:40:03 -08:00
|
|
|
bool stillTransitioning = t < 1.0f && t > 0.0f;
|
2018-05-25 01:16:40 -07:00
|
|
|
|
|
|
|
// If actively transitioning, block new transitions from starting
|
|
|
|
if (usingPreviewProgram && stillTransitioning)
|
|
|
|
goto cleanup;
|
|
|
|
|
2017-02-22 03:08:37 -08:00
|
|
|
if (force) {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
obs_transition_set(transition, source);
|
2017-02-22 03:08:37 -08:00
|
|
|
if (api)
|
|
|
|
api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED);
|
|
|
|
} else {
|
2017-11-30 05:05:50 -08:00
|
|
|
int duration = ui->transitionDuration->value();
|
|
|
|
|
2020-03-05 06:58:21 -08:00
|
|
|
/* check for scene override */
|
|
|
|
OBSSource trOverride = GetOverrideTransition(source);
|
2017-11-30 05:05:50 -08:00
|
|
|
|
2020-03-05 06:58:21 -08:00
|
|
|
if (trOverride && !overridingTransition && !quickTransition) {
|
2020-03-05 14:42:25 -08:00
|
|
|
transition = trOverride;
|
2020-03-05 06:58:21 -08:00
|
|
|
duration = GetOverrideTransitionDuration(source);
|
|
|
|
OverrideTransition(trOverride);
|
|
|
|
overridingTransition = true;
|
2017-11-30 05:05:50 -08:00
|
|
|
}
|
|
|
|
|
2019-10-23 14:11:14 -07:00
|
|
|
if (black && !prevFTBSource) {
|
|
|
|
source = nullptr;
|
|
|
|
prevFTBSource =
|
|
|
|
obs_transition_get_active_source(transition);
|
|
|
|
obs_source_release(prevFTBSource);
|
|
|
|
} else if (black && prevFTBSource) {
|
|
|
|
source = prevFTBSource;
|
|
|
|
prevFTBSource = nullptr;
|
|
|
|
} else if (!black) {
|
|
|
|
prevFTBSource = nullptr;
|
|
|
|
}
|
|
|
|
|
2019-10-24 17:52:26 -07:00
|
|
|
if (quickTransition)
|
|
|
|
duration = quickDuration;
|
|
|
|
|
2019-12-27 16:41:10 -08:00
|
|
|
enum obs_transition_mode mode =
|
|
|
|
manual ? OBS_TRANSITION_MODE_MANUAL
|
|
|
|
: OBS_TRANSITION_MODE_AUTO;
|
|
|
|
|
2020-01-13 20:40:03 -08:00
|
|
|
EnableTransitionWidgets(false);
|
|
|
|
|
2019-12-27 16:41:10 -08:00
|
|
|
bool success = obs_transition_start(transition, mode, duration,
|
|
|
|
source);
|
|
|
|
|
2017-11-30 09:49:02 -08:00
|
|
|
if (!success)
|
|
|
|
TransitionFullyStopped();
|
2017-02-22 03:08:37 -08:00
|
|
|
}
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
2018-05-25 01:16:40 -07:00
|
|
|
cleanup:
|
2018-01-04 18:43:12 -08:00
|
|
|
if (usingPreviewProgram && sceneDuplicationMode)
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
obs_scene_release(scene);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void SetComboTransition(QComboBox *combo, obs_source_t *tr)
|
|
|
|
{
|
|
|
|
int idx = combo->findData(QVariant::fromValue<OBSSource>(tr));
|
|
|
|
if (idx != -1) {
|
|
|
|
combo->blockSignals(true);
|
|
|
|
combo->setCurrentIndex(idx);
|
|
|
|
combo->blockSignals(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-06 04:52:30 -07:00
|
|
|
void OBSBasic::SetTransition(OBSSource transition)
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
{
|
|
|
|
obs_source_t *oldTransition = obs_get_output_source(0);
|
|
|
|
|
|
|
|
if (oldTransition && transition) {
|
|
|
|
obs_transition_swap_begin(transition, oldTransition);
|
|
|
|
if (transition != GetCurrentTransition())
|
|
|
|
SetComboTransition(ui->transitions, transition);
|
|
|
|
obs_set_output_source(0, transition);
|
|
|
|
obs_transition_swap_end(transition, oldTransition);
|
|
|
|
} else {
|
|
|
|
obs_set_output_source(0, transition);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oldTransition)
|
|
|
|
obs_source_release(oldTransition);
|
|
|
|
|
|
|
|
bool fixed = transition ? obs_transition_fixed(transition) : false;
|
|
|
|
ui->transitionDurationLabel->setVisible(!fixed);
|
|
|
|
ui->transitionDuration->setVisible(!fixed);
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
bool configurable = obs_source_configurable(transition);
|
|
|
|
ui->transitionRemove->setEnabled(configurable);
|
|
|
|
ui->transitionProps->setEnabled(configurable);
|
2016-08-28 14:24:14 -07:00
|
|
|
|
|
|
|
if (api)
|
|
|
|
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_CHANGED);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
OBSSource OBSBasic::GetCurrentTransition()
|
|
|
|
{
|
|
|
|
return ui->transitions->currentData().value<OBSSource>();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::on_transitions_currentIndexChanged(int)
|
|
|
|
{
|
|
|
|
OBSSource transition = GetCurrentTransition();
|
|
|
|
SetTransition(transition);
|
|
|
|
}
|
|
|
|
|
2016-02-27 02:50:04 -08:00
|
|
|
void OBSBasic::AddTransition()
|
|
|
|
{
|
2019-06-22 22:13:45 -07:00
|
|
|
QAction *action = reinterpret_cast<QAction *>(sender());
|
2016-02-27 02:50:04 -08:00
|
|
|
QString idStr = action->property("id").toString();
|
|
|
|
|
|
|
|
string name;
|
2019-06-22 22:13:45 -07:00
|
|
|
QString placeHolderText =
|
|
|
|
QT_UTF8(obs_source_get_display_name(QT_TO_UTF8(idStr)));
|
2016-02-27 02:50:04 -08:00
|
|
|
QString format = placeHolderText + " (%1)";
|
|
|
|
obs_source_t *source = nullptr;
|
|
|
|
int i = 1;
|
|
|
|
|
|
|
|
while ((source = FindTransition(QT_TO_UTF8(placeHolderText)))) {
|
|
|
|
placeHolderText = format.arg(++i);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool accepted = NameDialog::AskForName(this,
|
2019-06-22 22:13:45 -07:00
|
|
|
QTStr("TransitionNameDlg.Title"),
|
|
|
|
QTStr("TransitionNameDlg.Text"),
|
|
|
|
name, placeHolderText);
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
if (accepted) {
|
|
|
|
if (name.empty()) {
|
2019-03-30 07:44:44 -07:00
|
|
|
OBSMessageBox::warning(this,
|
2019-06-22 22:13:45 -07:00
|
|
|
QTStr("NoNameEntered.Title"),
|
|
|
|
QTStr("NoNameEntered.Text"));
|
2016-02-27 02:50:04 -08:00
|
|
|
AddTransition();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
source = FindTransition(name.c_str());
|
|
|
|
if (source) {
|
2019-06-22 22:13:45 -07:00
|
|
|
OBSMessageBox::warning(this, QTStr("NameExists.Title"),
|
|
|
|
QTStr("NameExists.Text"));
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
AddTransition();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
source = obs_source_create_private(QT_TO_UTF8(idStr),
|
2019-06-22 22:13:45 -07:00
|
|
|
name.c_str(), NULL);
|
2016-02-27 02:50:04 -08:00
|
|
|
InitTransition(source);
|
2019-06-22 22:13:45 -07:00
|
|
|
ui->transitions->addItem(
|
|
|
|
QT_UTF8(name.c_str()),
|
|
|
|
QVariant::fromValue(OBSSource(source)));
|
2016-02-27 02:50:04 -08:00
|
|
|
ui->transitions->setCurrentIndex(ui->transitions->count() - 1);
|
|
|
|
CreatePropertiesWindow(source);
|
|
|
|
obs_source_release(source);
|
2016-08-28 14:24:14 -07:00
|
|
|
|
|
|
|
if (api)
|
2019-06-22 22:13:45 -07:00
|
|
|
api->on_event(
|
|
|
|
OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
2017-05-14 23:06:11 -07:00
|
|
|
|
|
|
|
ClearQuickTransitionWidgets();
|
|
|
|
RefreshQuickTransitions();
|
2016-02-27 02:50:04 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::on_transitionAdd_clicked()
|
|
|
|
{
|
|
|
|
bool foundConfigurableTransitions = false;
|
|
|
|
QMenu menu(this);
|
|
|
|
size_t idx = 0;
|
|
|
|
const char *id;
|
|
|
|
|
|
|
|
while (obs_enum_transition_types(idx++, &id)) {
|
|
|
|
if (obs_is_source_configurable(id)) {
|
|
|
|
const char *name = obs_source_get_display_name(id);
|
|
|
|
QAction *action = new QAction(name, this);
|
|
|
|
action->setProperty("id", id);
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
connect(action, SIGNAL(triggered()), this,
|
|
|
|
SLOT(AddTransition()));
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
menu.addAction(action);
|
|
|
|
foundConfigurableTransitions = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (foundConfigurableTransitions)
|
|
|
|
menu.exec(QCursor::pos());
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::on_transitionRemove_clicked()
|
|
|
|
{
|
|
|
|
OBSSource tr = GetCurrentTransition();
|
|
|
|
|
|
|
|
if (!tr || !obs_source_configurable(tr) || !QueryRemoveSource(tr))
|
|
|
|
return;
|
|
|
|
|
|
|
|
int idx = ui->transitions->findData(QVariant::fromValue<OBSSource>(tr));
|
|
|
|
if (idx == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (size_t i = quickTransitions.size(); i > 0; i--) {
|
|
|
|
QuickTransition &qt = quickTransitions[i - 1];
|
|
|
|
if (qt.source == tr) {
|
|
|
|
if (qt.button)
|
|
|
|
qt.button->deleteLater();
|
|
|
|
RemoveQuickTransitionHotkey(&qt);
|
2019-06-22 22:13:45 -07:00
|
|
|
quickTransitions.erase(quickTransitions.begin() + i -
|
|
|
|
1);
|
2016-02-27 02:50:04 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->transitions->removeItem(idx);
|
2016-08-28 14:24:14 -07:00
|
|
|
|
|
|
|
if (api)
|
|
|
|
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
2017-05-14 23:06:11 -07:00
|
|
|
|
|
|
|
ClearQuickTransitionWidgets();
|
|
|
|
RefreshQuickTransitions();
|
2016-02-27 02:50:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::RenameTransition()
|
|
|
|
{
|
2019-06-22 22:13:45 -07:00
|
|
|
QAction *action = reinterpret_cast<QAction *>(sender());
|
2016-02-27 02:50:04 -08:00
|
|
|
QVariant variant = action->property("transition");
|
|
|
|
obs_source_t *transition = variant.value<OBSSource>();
|
|
|
|
|
|
|
|
string name;
|
|
|
|
QString placeHolderText = QT_UTF8(obs_source_get_name(transition));
|
|
|
|
obs_source_t *source = nullptr;
|
|
|
|
|
|
|
|
bool accepted = NameDialog::AskForName(this,
|
2019-06-22 22:13:45 -07:00
|
|
|
QTStr("TransitionNameDlg.Title"),
|
|
|
|
QTStr("TransitionNameDlg.Text"),
|
|
|
|
name, placeHolderText);
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
if (accepted) {
|
|
|
|
if (name.empty()) {
|
2019-03-30 07:44:44 -07:00
|
|
|
OBSMessageBox::warning(this,
|
2019-06-22 22:13:45 -07:00
|
|
|
QTStr("NoNameEntered.Title"),
|
|
|
|
QTStr("NoNameEntered.Text"));
|
2016-02-27 02:50:04 -08:00
|
|
|
RenameTransition();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
source = FindTransition(name.c_str());
|
|
|
|
if (source) {
|
2019-06-22 22:13:45 -07:00
|
|
|
OBSMessageBox::warning(this, QTStr("NameExists.Title"),
|
|
|
|
QTStr("NameExists.Text"));
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
RenameTransition();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_source_set_name(transition, name.c_str());
|
|
|
|
int idx = ui->transitions->findData(variant);
|
2017-05-14 23:06:11 -07:00
|
|
|
if (idx != -1) {
|
2019-06-22 22:13:45 -07:00
|
|
|
ui->transitions->setItemText(idx,
|
|
|
|
QT_UTF8(name.c_str()));
|
2018-06-11 00:42:57 -07:00
|
|
|
|
|
|
|
if (api)
|
2019-06-22 22:13:45 -07:00
|
|
|
api->on_event(
|
|
|
|
OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
|
2018-06-11 00:42:57 -07:00
|
|
|
|
2017-05-14 23:06:11 -07:00
|
|
|
ClearQuickTransitionWidgets();
|
|
|
|
RefreshQuickTransitions();
|
|
|
|
}
|
2016-02-27 02:50:04 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
void OBSBasic::on_transitionProps_clicked()
|
|
|
|
{
|
2016-02-27 02:50:04 -08:00
|
|
|
OBSSource source = GetCurrentTransition();
|
|
|
|
|
|
|
|
if (!obs_source_configurable(source))
|
|
|
|
return;
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto properties = [&]() { CreatePropertiesWindow(source); };
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
QMenu menu(this);
|
|
|
|
|
2016-05-07 00:08:11 -07:00
|
|
|
QAction *action = new QAction(QTStr("Rename"), &menu);
|
2016-02-27 02:50:04 -08:00
|
|
|
connect(action, SIGNAL(triggered()), this, SLOT(RenameTransition()));
|
|
|
|
action->setProperty("transition", QVariant::fromValue(source));
|
|
|
|
menu.addAction(action);
|
|
|
|
|
2016-05-07 00:08:11 -07:00
|
|
|
action = new QAction(QTStr("Properties"), &menu);
|
2016-02-27 02:50:04 -08:00
|
|
|
connect(action, &QAction::triggered, properties);
|
|
|
|
menu.addAction(action);
|
|
|
|
|
|
|
|
menu.exec(QCursor::pos());
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
2019-08-30 05:31:14 -07:00
|
|
|
void OBSBasic::on_transitionDuration_valueChanged(int value)
|
|
|
|
{
|
|
|
|
if (api) {
|
|
|
|
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_DURATION_CHANGED);
|
|
|
|
}
|
|
|
|
|
|
|
|
UNUSED_PARAMETER(value);
|
|
|
|
}
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
QuickTransition *OBSBasic::GetQuickTransition(int id)
|
|
|
|
{
|
|
|
|
for (QuickTransition &qt : quickTransitions) {
|
|
|
|
if (qt.id == id)
|
|
|
|
return &qt;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int OBSBasic::GetQuickTransitionIdx(int id)
|
|
|
|
{
|
|
|
|
for (int idx = 0; idx < (int)quickTransitions.size(); idx++) {
|
|
|
|
QuickTransition &qt = quickTransitions[idx];
|
|
|
|
|
|
|
|
if (qt.id == id)
|
|
|
|
return idx;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-09 02:01:55 -07:00
|
|
|
void OBSBasic::SetCurrentScene(obs_scene_t *scene, bool force)
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
{
|
|
|
|
obs_source_t *source = obs_scene_get_source(scene);
|
2019-10-09 02:01:55 -07:00
|
|
|
SetCurrentScene(source, force);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
template<typename T> static T GetOBSRef(QListWidgetItem *item)
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
{
|
|
|
|
return item->data(static_cast<int>(QtDataRole::OBSRef)).value<T>();
|
|
|
|
}
|
|
|
|
|
2019-10-09 02:01:55 -07:00
|
|
|
void OBSBasic::SetCurrentScene(OBSSource scene, bool force)
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
{
|
2019-10-09 02:01:55 -07:00
|
|
|
if (!IsPreviewProgramMode()) {
|
|
|
|
TransitionToScene(scene, force);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
} else {
|
|
|
|
OBSSource actualLastScene = OBSGetStrongRef(lastScene);
|
|
|
|
if (actualLastScene != scene) {
|
|
|
|
if (scene)
|
|
|
|
obs_source_inc_showing(scene);
|
|
|
|
if (actualLastScene)
|
|
|
|
obs_source_dec_showing(actualLastScene);
|
|
|
|
lastScene = OBSGetWeakRef(scene);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (obs_scene_get_source(GetCurrentScene()) != scene) {
|
|
|
|
for (int i = 0; i < ui->scenes->count(); i++) {
|
|
|
|
QListWidgetItem *item = ui->scenes->item(i);
|
|
|
|
OBSScene itemScene = GetOBSRef<OBSScene>(item);
|
|
|
|
obs_source_t *source = obs_scene_get_source(itemScene);
|
|
|
|
|
|
|
|
if (source == scene) {
|
|
|
|
ui->scenes->blockSignals(true);
|
|
|
|
ui->scenes->setCurrentItem(item);
|
|
|
|
ui->scenes->blockSignals(false);
|
2018-03-04 12:07:13 -08:00
|
|
|
if (api)
|
2019-06-22 22:13:45 -07:00
|
|
|
api->on_event(
|
|
|
|
OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateSceneSelection(scene);
|
2016-08-05 18:43:04 -07:00
|
|
|
|
|
|
|
bool userSwitched = (!force && !disableSaving);
|
|
|
|
blog(LOG_INFO, "%s to scene '%s'",
|
2019-06-22 22:13:45 -07:00
|
|
|
userSwitched ? "User switched" : "Switched",
|
|
|
|
obs_source_get_name(scene));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::CreateProgramDisplay()
|
|
|
|
{
|
|
|
|
program = new OBSQTDisplay();
|
2019-02-28 13:29:41 -08:00
|
|
|
|
2017-11-08 19:38:44 -08:00
|
|
|
program->setContextMenuPolicy(Qt::CustomContextMenu);
|
2019-06-22 22:13:45 -07:00
|
|
|
connect(program.data(), &QWidget::customContextMenuRequested, this,
|
|
|
|
&OBSBasic::on_program_customContextMenuRequested);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
auto displayResize = [this]() {
|
|
|
|
struct obs_video_info ovi;
|
|
|
|
|
|
|
|
if (obs_get_video_info(&ovi))
|
|
|
|
ResizeProgram(ovi.base_width, ovi.base_height);
|
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
connect(program.data(), &OBSQTDisplay::DisplayResized, displayResize);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto addDisplay = [this](OBSQTDisplay *window) {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
obs_display_add_draw_callback(window->GetDisplay(),
|
2019-06-22 22:13:45 -07:00
|
|
|
OBSBasic::RenderProgram, this);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
struct obs_video_info ovi;
|
|
|
|
if (obs_get_video_info(&ovi))
|
|
|
|
ResizeProgram(ovi.base_width, ovi.base_height);
|
|
|
|
};
|
|
|
|
|
2016-01-29 11:58:45 -08:00
|
|
|
connect(program.data(), &OBSQTDisplay::DisplayCreated, addDisplay);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
program->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::TransitionClicked()
|
|
|
|
{
|
|
|
|
if (previewProgramMode)
|
|
|
|
TransitionToScene(GetCurrentScene());
|
|
|
|
}
|
|
|
|
|
2019-12-27 16:41:10 -08:00
|
|
|
#define T_BAR_PRECISION 1024
|
|
|
|
#define T_BAR_PRECISION_F ((float)T_BAR_PRECISION)
|
|
|
|
#define T_BAR_CLAMP (T_BAR_PRECISION / 10)
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
void OBSBasic::CreateProgramOptions()
|
|
|
|
{
|
|
|
|
programOptions = new QWidget();
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout();
|
|
|
|
layout->setSpacing(4);
|
|
|
|
|
|
|
|
QPushButton *configTransitions = new QPushButton();
|
|
|
|
configTransitions->setMaximumSize(22, 22);
|
|
|
|
configTransitions->setProperty("themeID", "configIconSmall");
|
|
|
|
configTransitions->setFlat(true);
|
|
|
|
|
|
|
|
QHBoxLayout *mainButtonLayout = new QHBoxLayout();
|
|
|
|
mainButtonLayout->setSpacing(2);
|
|
|
|
|
2018-05-25 01:16:40 -07:00
|
|
|
transitionButton = new QPushButton(QTStr("Transition"));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
QHBoxLayout *quickTransitions = new QHBoxLayout();
|
|
|
|
quickTransitions->setSpacing(2);
|
|
|
|
|
|
|
|
QPushButton *addQuickTransition = new QPushButton();
|
|
|
|
addQuickTransition->setMaximumSize(22, 22);
|
|
|
|
addQuickTransition->setProperty("themeID", "addIconSmall");
|
|
|
|
addQuickTransition->setFlat(true);
|
|
|
|
|
|
|
|
QLabel *quickTransitionsLabel = new QLabel(QTStr("QuickTransitions"));
|
|
|
|
|
|
|
|
quickTransitions->addWidget(quickTransitionsLabel);
|
|
|
|
quickTransitions->addWidget(addQuickTransition);
|
|
|
|
|
|
|
|
mainButtonLayout->addWidget(transitionButton);
|
|
|
|
mainButtonLayout->addWidget(configTransitions);
|
|
|
|
|
2019-12-27 16:41:10 -08:00
|
|
|
tBar = new QSlider(Qt::Horizontal);
|
|
|
|
tBar->setMinimum(0);
|
|
|
|
tBar->setMaximum(T_BAR_PRECISION - 1);
|
|
|
|
|
|
|
|
tBar->setProperty("themeID", "tBarSlider");
|
|
|
|
|
|
|
|
connect(tBar, SIGNAL(sliderMoved(int)), this, SLOT(TBarChanged(int)));
|
|
|
|
connect(tBar, SIGNAL(sliderReleased()), this, SLOT(TBarReleased()));
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
layout->addStretch(0);
|
|
|
|
layout->addLayout(mainButtonLayout);
|
|
|
|
layout->addLayout(quickTransitions);
|
2019-12-27 16:41:10 -08:00
|
|
|
layout->addWidget(tBar);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
layout->addStretch(0);
|
|
|
|
|
|
|
|
programOptions->setLayout(layout);
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto onAdd = [this]() {
|
2018-07-31 21:11:31 -07:00
|
|
|
QScopedPointer<QMenu> menu(CreateTransitionMenu(this, nullptr));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
menu->exec(QCursor::pos());
|
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto onConfig = [this]() {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
QMenu menu(this);
|
|
|
|
QAction *action;
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto toggleEditProperties = [this]() {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
editPropertiesMode = !editPropertiesMode;
|
|
|
|
|
|
|
|
OBSSource actualScene = OBSGetStrongRef(programScene);
|
|
|
|
if (actualScene)
|
|
|
|
TransitionToScene(actualScene, true);
|
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto toggleSwapScenesMode = [this]() {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
swapScenesMode = !swapScenesMode;
|
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto toggleSceneDuplication = [this]() {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
sceneDuplicationMode = !sceneDuplicationMode;
|
|
|
|
|
|
|
|
OBSSource actualScene = OBSGetStrongRef(programScene);
|
|
|
|
if (actualScene)
|
|
|
|
TransitionToScene(actualScene, true);
|
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto showToolTip = [&]() {
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
QAction *act = menu.activeAction();
|
|
|
|
QToolTip::showText(QCursor::pos(), act->toolTip(),
|
2019-06-22 22:13:45 -07:00
|
|
|
&menu, menu.actionGeometry(act));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
action = menu.addAction(
|
|
|
|
QTStr("QuickTransitions.DuplicateScene"));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
action->setToolTip(QTStr("QuickTransitions.DuplicateSceneTT"));
|
|
|
|
action->setCheckable(true);
|
|
|
|
action->setChecked(sceneDuplicationMode);
|
|
|
|
connect(action, &QAction::triggered, toggleSceneDuplication);
|
|
|
|
connect(action, &QAction::hovered, showToolTip);
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
action = menu.addAction(
|
|
|
|
QTStr("QuickTransitions.EditProperties"));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
action->setToolTip(QTStr("QuickTransitions.EditPropertiesTT"));
|
|
|
|
action->setCheckable(true);
|
|
|
|
action->setChecked(editPropertiesMode);
|
|
|
|
action->setEnabled(sceneDuplicationMode);
|
|
|
|
connect(action, &QAction::triggered, toggleEditProperties);
|
|
|
|
connect(action, &QAction::hovered, showToolTip);
|
|
|
|
|
|
|
|
action = menu.addAction(QTStr("QuickTransitions.SwapScenes"));
|
|
|
|
action->setToolTip(QTStr("QuickTransitions.SwapScenesTT"));
|
|
|
|
action->setCheckable(true);
|
|
|
|
action->setChecked(swapScenesMode);
|
|
|
|
connect(action, &QAction::triggered, toggleSwapScenesMode);
|
|
|
|
connect(action, &QAction::hovered, showToolTip);
|
|
|
|
|
|
|
|
menu.exec(QCursor::pos());
|
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
connect(transitionButton.data(), &QAbstractButton::clicked, this,
|
|
|
|
&OBSBasic::TransitionClicked);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
connect(addQuickTransition, &QAbstractButton::clicked, onAdd);
|
|
|
|
connect(configTransitions, &QAbstractButton::clicked, onConfig);
|
|
|
|
}
|
|
|
|
|
2019-12-27 16:41:10 -08:00
|
|
|
void OBSBasic::TBarReleased()
|
|
|
|
{
|
|
|
|
int val = tBar->value();
|
|
|
|
|
2020-01-21 14:05:00 -08:00
|
|
|
OBSSource transition = obs_get_output_source(0);
|
|
|
|
obs_source_release(transition);
|
|
|
|
|
2019-12-27 16:41:10 -08:00
|
|
|
if ((tBar->maximum() - val) <= T_BAR_CLAMP) {
|
2020-01-21 14:05:00 -08:00
|
|
|
obs_transition_set_manual_time(transition, 1.0f);
|
2019-12-27 16:41:10 -08:00
|
|
|
tBar->blockSignals(true);
|
|
|
|
tBar->setValue(0);
|
|
|
|
tBar->blockSignals(false);
|
|
|
|
tBarActive = false;
|
2020-01-13 20:40:03 -08:00
|
|
|
EnableTransitionWidgets(true);
|
2019-12-27 16:41:10 -08:00
|
|
|
|
|
|
|
} else if (val <= T_BAR_CLAMP) {
|
2020-01-21 14:05:00 -08:00
|
|
|
obs_transition_set_manual_time(transition, 0.0f);
|
|
|
|
TransitionFullyStopped();
|
2019-12-27 16:41:10 -08:00
|
|
|
tBar->blockSignals(true);
|
|
|
|
tBar->setValue(0);
|
|
|
|
tBar->blockSignals(false);
|
2020-01-13 20:40:03 -08:00
|
|
|
tBarActive = false;
|
|
|
|
EnableTransitionWidgets(true);
|
2019-12-27 16:41:10 -08:00
|
|
|
}
|
2020-03-05 06:58:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool ValidTBarTransition(OBSSource transition)
|
|
|
|
{
|
|
|
|
if (!transition)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QString id = QT_UTF8(obs_source_get_id(transition));
|
2019-12-27 16:41:10 -08:00
|
|
|
|
2020-03-05 06:58:21 -08:00
|
|
|
if (id == "cut_transition" || id == "obs_stinger_transition")
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2019-12-27 16:41:10 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::TBarChanged(int value)
|
|
|
|
{
|
2020-01-21 14:05:00 -08:00
|
|
|
OBSSource transition = obs_get_output_source(0);
|
|
|
|
obs_source_release(transition);
|
|
|
|
|
2020-03-05 06:58:21 -08:00
|
|
|
if (!tBarActive) {
|
|
|
|
OBSSource sceneSource = GetCurrentSceneSource();
|
|
|
|
OBSSource tBarTr = GetOverrideTransition(sceneSource);
|
|
|
|
|
|
|
|
if (!ValidTBarTransition(tBarTr)) {
|
|
|
|
tBarTr = GetCurrentTransition();
|
|
|
|
|
|
|
|
if (!ValidTBarTransition(tBarTr))
|
|
|
|
tBarTr = FindTransition(
|
|
|
|
obs_source_get_display_name(
|
|
|
|
"fade_transition"));
|
|
|
|
|
|
|
|
OverrideTransition(tBarTr);
|
|
|
|
overridingTransition = true;
|
|
|
|
|
|
|
|
transition = tBarTr;
|
|
|
|
}
|
|
|
|
|
2020-01-21 14:05:00 -08:00
|
|
|
obs_transition_set_manual_torque(transition, 8.0f, 0.05f);
|
2020-03-05 06:58:21 -08:00
|
|
|
TransitionToScene(sceneSource, false, false, false, 0, true);
|
2019-12-27 16:41:10 -08:00
|
|
|
tBarActive = true;
|
|
|
|
}
|
|
|
|
|
2020-01-21 14:05:00 -08:00
|
|
|
obs_transition_set_manual_time(transition,
|
2019-12-27 16:41:10 -08:00
|
|
|
(float)value / T_BAR_PRECISION_F);
|
|
|
|
}
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
void OBSBasic::on_modeSwitch_clicked()
|
|
|
|
{
|
|
|
|
SetPreviewProgramMode(!IsPreviewProgramMode());
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ResetQuickTransitionText(QuickTransition *qt)
|
|
|
|
{
|
|
|
|
qt->button->setText(MakeQuickTransitionText(qt));
|
|
|
|
}
|
|
|
|
|
2017-11-30 05:05:50 -08:00
|
|
|
QMenu *OBSBasic::CreatePerSceneTransitionMenu()
|
|
|
|
{
|
|
|
|
OBSSource scene = GetCurrentSceneSource();
|
|
|
|
QMenu *menu = new QMenu(QTStr("TransitionOverride"));
|
|
|
|
QAction *action;
|
|
|
|
|
|
|
|
OBSData data = obs_source_get_private_settings(scene);
|
|
|
|
obs_data_release(data);
|
|
|
|
|
|
|
|
obs_data_set_default_int(data, "transition_duration", 300);
|
|
|
|
|
|
|
|
const char *curTransition = obs_data_get_string(data, "transition");
|
|
|
|
int curDuration = (int)obs_data_get_int(data, "transition_duration");
|
|
|
|
|
|
|
|
QSpinBox *duration = new QSpinBox(menu);
|
|
|
|
duration->setMinimum(50);
|
|
|
|
duration->setSuffix("ms");
|
|
|
|
duration->setMaximum(20000);
|
|
|
|
duration->setSingleStep(50);
|
|
|
|
duration->setValue(curDuration);
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto setTransition = [this](QAction *action) {
|
2017-11-30 05:05:50 -08:00
|
|
|
int idx = action->property("transition_index").toInt();
|
|
|
|
OBSSource scene = GetCurrentSceneSource();
|
|
|
|
OBSData data = obs_source_get_private_settings(scene);
|
|
|
|
obs_data_release(data);
|
|
|
|
|
|
|
|
if (idx == -1) {
|
|
|
|
obs_data_set_string(data, "transition", "");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
OBSSource tr = GetTransitionComboItem(ui->transitions, idx);
|
|
|
|
const char *name = obs_source_get_name(tr);
|
|
|
|
|
|
|
|
obs_data_set_string(data, "transition", name);
|
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
auto setDuration = [this](int duration) {
|
2017-11-30 05:05:50 -08:00
|
|
|
OBSSource scene = GetCurrentSceneSource();
|
|
|
|
OBSData data = obs_source_get_private_settings(scene);
|
|
|
|
obs_data_release(data);
|
|
|
|
|
|
|
|
obs_data_set_int(data, "transition_duration", duration);
|
|
|
|
};
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
connect(duration, (void (QSpinBox::*)(int)) & QSpinBox::valueChanged,
|
|
|
|
setDuration);
|
2017-11-30 05:05:50 -08:00
|
|
|
|
|
|
|
for (int i = -1; i < ui->transitions->count(); i++) {
|
|
|
|
const char *name = "";
|
|
|
|
|
|
|
|
if (i >= 0) {
|
|
|
|
OBSSource tr;
|
|
|
|
tr = GetTransitionComboItem(ui->transitions, i);
|
|
|
|
name = obs_source_get_name(tr);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool match = (name && strcmp(name, curTransition) == 0);
|
|
|
|
|
|
|
|
if (!name || !*name)
|
|
|
|
name = Str("None");
|
|
|
|
|
|
|
|
action = menu->addAction(QT_UTF8(name));
|
|
|
|
action->setProperty("transition_index", i);
|
|
|
|
action->setCheckable(true);
|
|
|
|
action->setChecked(match);
|
|
|
|
|
|
|
|
connect(action, &QAction::triggered,
|
2019-06-22 22:13:45 -07:00
|
|
|
std::bind(setTransition, action));
|
2017-11-30 05:05:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
QWidgetAction *durationAction = new QWidgetAction(menu);
|
|
|
|
durationAction->setDefaultWidget(duration);
|
|
|
|
|
|
|
|
menu->addSeparator();
|
|
|
|
menu->addAction(durationAction);
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
QMenu *OBSBasic::CreateTransitionMenu(QWidget *parent, QuickTransition *qt)
|
|
|
|
{
|
|
|
|
QMenu *menu = new QMenu(parent);
|
|
|
|
QAction *action;
|
2019-10-23 14:11:14 -07:00
|
|
|
OBSSource tr;
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
if (qt) {
|
|
|
|
action = menu->addAction(QTStr("Remove"));
|
|
|
|
action->setProperty("id", qt->id);
|
2019-06-22 22:13:45 -07:00
|
|
|
connect(action, &QAction::triggered, this,
|
|
|
|
&OBSBasic::QuickTransitionRemoveClicked);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
menu->addSeparator();
|
|
|
|
}
|
|
|
|
|
|
|
|
QSpinBox *duration = new QSpinBox(menu);
|
|
|
|
if (qt)
|
|
|
|
duration->setProperty("id", qt->id);
|
|
|
|
duration->setMinimum(50);
|
|
|
|
duration->setSuffix("ms");
|
|
|
|
duration->setMaximum(20000);
|
|
|
|
duration->setSingleStep(50);
|
|
|
|
duration->setValue(qt ? qt->duration : 300);
|
|
|
|
|
|
|
|
if (qt) {
|
2019-06-22 22:13:45 -07:00
|
|
|
connect(duration,
|
|
|
|
(void (QSpinBox::*)(int)) & QSpinBox::valueChanged,
|
|
|
|
this, &OBSBasic::QuickTransitionChangeDuration);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
2019-10-23 14:11:14 -07:00
|
|
|
tr = GetTransitionComboItem(ui->transitions, 1);
|
|
|
|
|
|
|
|
action = menu->addAction(QTStr("FadeToBlack"));
|
|
|
|
action->setProperty("transition_index", 1);
|
|
|
|
action->setProperty("fadeToBlack", true);
|
|
|
|
|
|
|
|
if (qt) {
|
|
|
|
action->setProperty("id", qt->id);
|
|
|
|
connect(action, &QAction::triggered, this,
|
|
|
|
&OBSBasic::QuickTransitionChange);
|
|
|
|
} else {
|
|
|
|
action->setProperty("duration",
|
|
|
|
QVariant::fromValue<QWidget *>(duration));
|
|
|
|
connect(action, &QAction::triggered, this,
|
|
|
|
&OBSBasic::AddQuickTransition);
|
|
|
|
}
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
for (int i = 0; i < ui->transitions->count(); i++) {
|
2019-10-23 14:11:14 -07:00
|
|
|
tr = GetTransitionComboItem(ui->transitions, i);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
action = menu->addAction(obs_source_get_name(tr));
|
|
|
|
action->setProperty("transition_index", i);
|
|
|
|
|
|
|
|
if (qt) {
|
|
|
|
action->setProperty("id", qt->id);
|
|
|
|
connect(action, &QAction::triggered, this,
|
2019-06-22 22:13:45 -07:00
|
|
|
&OBSBasic::QuickTransitionChange);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
} else {
|
2019-06-22 22:13:45 -07:00
|
|
|
action->setProperty(
|
|
|
|
"duration",
|
|
|
|
QVariant::fromValue<QWidget *>(duration));
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
connect(action, &QAction::triggered, this,
|
2019-06-22 22:13:45 -07:00
|
|
|
&OBSBasic::AddQuickTransition);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QWidgetAction *durationAction = new QWidgetAction(menu);
|
|
|
|
durationAction->setDefaultWidget(duration);
|
|
|
|
|
|
|
|
menu->addSeparator();
|
|
|
|
menu->addAction(durationAction);
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::AddQuickTransitionId(int id)
|
|
|
|
{
|
|
|
|
QuickTransition *qt = GetQuickTransition(id);
|
|
|
|
if (!qt)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* --------------------------------- */
|
|
|
|
|
|
|
|
QPushButton *button = new MenuButton();
|
|
|
|
button->setProperty("id", id);
|
|
|
|
|
|
|
|
qt->button = button;
|
|
|
|
ResetQuickTransitionText(qt);
|
|
|
|
|
|
|
|
/* --------------------------------- */
|
|
|
|
|
|
|
|
QMenu *buttonMenu = CreateTransitionMenu(button, qt);
|
|
|
|
|
|
|
|
/* --------------------------------- */
|
|
|
|
|
|
|
|
button->setMenu(buttonMenu);
|
2019-06-22 22:13:45 -07:00
|
|
|
connect(button, &QAbstractButton::clicked, this,
|
|
|
|
&OBSBasic::QuickTransitionClicked);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
QVBoxLayout *programLayout =
|
2019-06-22 22:13:45 -07:00
|
|
|
reinterpret_cast<QVBoxLayout *>(programOptions->layout());
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
int idx = 3;
|
|
|
|
for (;; idx++) {
|
|
|
|
QLayoutItem *item = programLayout->itemAt(idx);
|
|
|
|
if (!item)
|
|
|
|
break;
|
|
|
|
|
|
|
|
QWidget *widget = item->widget();
|
|
|
|
if (!widget || !widget->property("id").isValid())
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
programLayout->insertWidget(idx, button);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::AddQuickTransition()
|
|
|
|
{
|
|
|
|
int trIdx = sender()->property("transition_index").toInt();
|
2019-06-22 22:13:45 -07:00
|
|
|
QSpinBox *duration = sender()->property("duration").value<QSpinBox *>();
|
2019-10-23 14:11:14 -07:00
|
|
|
bool toBlack = sender()->property("fadeToBlack").value<bool>();
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
OBSSource transition = GetTransitionComboItem(ui->transitions, trIdx);
|
|
|
|
int id = quickTransitionIdCounter++;
|
|
|
|
|
2019-10-23 14:11:14 -07:00
|
|
|
quickTransitions.emplace_back(transition, duration->value(), id,
|
|
|
|
toBlack);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
AddQuickTransitionId(id);
|
|
|
|
|
|
|
|
int idx = (int)quickTransitions.size() - 1;
|
|
|
|
AddQuickTransitionHotkey(&quickTransitions[idx]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::ClearQuickTransitions()
|
|
|
|
{
|
|
|
|
for (QuickTransition &qt : quickTransitions)
|
|
|
|
RemoveQuickTransitionHotkey(&qt);
|
|
|
|
quickTransitions.clear();
|
|
|
|
|
|
|
|
if (!programOptions)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QVBoxLayout *programLayout =
|
2019-06-22 22:13:45 -07:00
|
|
|
reinterpret_cast<QVBoxLayout *>(programOptions->layout());
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
for (int idx = 0;; idx++) {
|
|
|
|
QLayoutItem *item = programLayout->itemAt(idx);
|
|
|
|
if (!item)
|
|
|
|
break;
|
|
|
|
|
|
|
|
QWidget *widget = item->widget();
|
|
|
|
if (!widget)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
int id = widget->property("id").toInt();
|
|
|
|
if (id != 0) {
|
|
|
|
delete widget;
|
|
|
|
idx--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::QuickTransitionClicked()
|
|
|
|
{
|
|
|
|
int id = sender()->property("id").toInt();
|
|
|
|
TriggerQuickTransition(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::QuickTransitionChange()
|
|
|
|
{
|
|
|
|
int id = sender()->property("id").toInt();
|
|
|
|
int trIdx = sender()->property("transition_index").toInt();
|
|
|
|
QuickTransition *qt = GetQuickTransition(id);
|
|
|
|
|
|
|
|
if (qt) {
|
|
|
|
qt->source = GetTransitionComboItem(ui->transitions, trIdx);
|
|
|
|
ResetQuickTransitionText(qt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::QuickTransitionChangeDuration(int value)
|
|
|
|
{
|
|
|
|
int id = sender()->property("id").toInt();
|
|
|
|
QuickTransition *qt = GetQuickTransition(id);
|
|
|
|
|
|
|
|
if (qt) {
|
|
|
|
qt->duration = value;
|
|
|
|
ResetQuickTransitionText(qt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::QuickTransitionRemoveClicked()
|
|
|
|
{
|
|
|
|
int id = sender()->property("id").toInt();
|
|
|
|
int idx = GetQuickTransitionIdx(id);
|
|
|
|
if (idx == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QuickTransition &qt = quickTransitions[idx];
|
|
|
|
|
|
|
|
if (qt.button)
|
|
|
|
qt.button->deleteLater();
|
|
|
|
|
|
|
|
RemoveQuickTransitionHotkey(&qt);
|
|
|
|
quickTransitions.erase(quickTransitions.begin() + idx);
|
|
|
|
}
|
|
|
|
|
2017-05-14 23:06:11 -07:00
|
|
|
void OBSBasic::ClearQuickTransitionWidgets()
|
|
|
|
{
|
|
|
|
if (!IsPreviewProgramMode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
QVBoxLayout *programLayout =
|
2019-06-22 22:13:45 -07:00
|
|
|
reinterpret_cast<QVBoxLayout *>(programOptions->layout());
|
2017-05-14 23:06:11 -07:00
|
|
|
|
|
|
|
for (int idx = 0;; idx++) {
|
|
|
|
QLayoutItem *item = programLayout->itemAt(idx);
|
|
|
|
if (!item)
|
|
|
|
break;
|
|
|
|
|
|
|
|
QWidget *widget = item->widget();
|
|
|
|
if (!widget)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
int id = widget->property("id").toInt();
|
|
|
|
if (id != 0) {
|
|
|
|
delete widget;
|
|
|
|
idx--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
void OBSBasic::RefreshQuickTransitions()
|
|
|
|
{
|
|
|
|
if (!IsPreviewProgramMode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (QuickTransition &qt : quickTransitions)
|
|
|
|
AddQuickTransitionId(qt.id);
|
|
|
|
}
|
|
|
|
|
2020-01-13 20:40:03 -08:00
|
|
|
void OBSBasic::EnableTransitionWidgets(bool enable)
|
2018-05-25 01:16:40 -07:00
|
|
|
{
|
2020-01-13 20:40:03 -08:00
|
|
|
ui->transitions->setEnabled(enable);
|
2018-05-25 01:16:40 -07:00
|
|
|
|
|
|
|
if (!IsPreviewProgramMode())
|
|
|
|
return;
|
|
|
|
|
|
|
|
QVBoxLayout *programLayout =
|
2019-06-22 22:13:45 -07:00
|
|
|
reinterpret_cast<QVBoxLayout *>(programOptions->layout());
|
2018-05-25 01:16:40 -07:00
|
|
|
|
|
|
|
for (int idx = 0;; idx++) {
|
|
|
|
QLayoutItem *item = programLayout->itemAt(idx);
|
|
|
|
if (!item)
|
|
|
|
break;
|
|
|
|
|
2020-01-13 20:40:03 -08:00
|
|
|
QPushButton *button =
|
|
|
|
qobject_cast<QPushButton *>(item->widget());
|
|
|
|
if (!button)
|
2018-05-25 01:16:40 -07:00
|
|
|
continue;
|
|
|
|
|
2020-01-13 20:40:03 -08:00
|
|
|
button->setEnabled(enable);
|
2018-05-25 01:16:40 -07:00
|
|
|
}
|
2020-01-13 20:40:03 -08:00
|
|
|
|
|
|
|
if (transitionButton)
|
|
|
|
transitionButton->setEnabled(enable);
|
2018-05-25 01:16:40 -07:00
|
|
|
}
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
void OBSBasic::SetPreviewProgramMode(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsPreviewProgramMode() == enabled)
|
|
|
|
return;
|
|
|
|
|
2019-02-28 13:29:41 -08:00
|
|
|
ui->previewLabel->setHidden(!enabled);
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
ui->modeSwitch->setChecked(enabled);
|
|
|
|
os_atomic_set_bool(&previewProgramMode, enabled);
|
|
|
|
|
|
|
|
if (IsPreviewProgramMode()) {
|
|
|
|
if (!previewEnabled)
|
|
|
|
EnablePreviewDisplay(true);
|
|
|
|
|
|
|
|
CreateProgramDisplay();
|
|
|
|
CreateProgramOptions();
|
|
|
|
|
|
|
|
OBSScene curScene = GetCurrentScene();
|
|
|
|
|
2016-02-04 10:11:50 -08:00
|
|
|
obs_scene_t *dup;
|
|
|
|
if (sceneDuplicationMode) {
|
2019-06-22 22:13:45 -07:00
|
|
|
dup = obs_scene_duplicate(
|
2019-08-31 13:15:25 -07:00
|
|
|
curScene,
|
|
|
|
obs_source_get_name(
|
|
|
|
obs_scene_get_source(curScene)),
|
2019-06-22 22:13:45 -07:00
|
|
|
editPropertiesMode
|
|
|
|
? OBS_SCENE_DUP_PRIVATE_COPY
|
|
|
|
: OBS_SCENE_DUP_PRIVATE_REFS);
|
2016-02-04 10:11:50 -08:00
|
|
|
} else {
|
|
|
|
dup = curScene;
|
|
|
|
obs_scene_addref(dup);
|
|
|
|
}
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
obs_source_t *transition = obs_get_output_source(0);
|
|
|
|
obs_source_t *dup_source = obs_scene_get_source(dup);
|
|
|
|
obs_transition_set(transition, dup_source);
|
|
|
|
obs_source_release(transition);
|
|
|
|
obs_scene_release(dup);
|
|
|
|
|
|
|
|
if (curScene) {
|
|
|
|
obs_source_t *source = obs_scene_get_source(curScene);
|
|
|
|
obs_source_inc_showing(source);
|
|
|
|
lastScene = OBSGetWeakRef(source);
|
|
|
|
programScene = OBSGetWeakRef(source);
|
|
|
|
}
|
|
|
|
|
|
|
|
RefreshQuickTransitions();
|
|
|
|
|
2020-03-21 04:19:29 -07:00
|
|
|
programLabel = new QLabel(QTStr("StudioMode.Program"), this);
|
2019-04-22 01:08:35 -07:00
|
|
|
programLabel->setSizePolicy(QSizePolicy::Preferred,
|
2019-06-22 22:13:45 -07:00
|
|
|
QSizePolicy::Preferred);
|
2019-04-22 01:08:35 -07:00
|
|
|
programLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
2019-02-28 13:29:41 -08:00
|
|
|
programLabel->setProperty("themeID", "previewProgramLabels");
|
|
|
|
|
|
|
|
programWidget = new QWidget();
|
|
|
|
programLayout = new QVBoxLayout();
|
|
|
|
|
|
|
|
programLayout->setContentsMargins(0, 0, 0, 0);
|
2019-04-22 01:08:35 -07:00
|
|
|
programLayout->setSpacing(0);
|
2019-02-28 13:29:41 -08:00
|
|
|
|
|
|
|
programLayout->addWidget(programLabel);
|
|
|
|
programLayout->addWidget(program);
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
bool labels = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"StudioModeLabels");
|
2019-02-28 13:29:41 -08:00
|
|
|
|
|
|
|
programLabel->setHidden(!labels);
|
|
|
|
|
|
|
|
programWidget->setLayout(programLayout);
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
ui->previewLayout->addWidget(programOptions);
|
2019-02-28 13:29:41 -08:00
|
|
|
ui->previewLayout->addWidget(programWidget);
|
2019-06-22 22:13:45 -07:00
|
|
|
ui->previewLayout->setAlignment(programOptions,
|
|
|
|
Qt::AlignCenter);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
2017-05-03 14:17:52 -07:00
|
|
|
if (api)
|
|
|
|
api->on_event(OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED);
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
blog(LOG_INFO, "Switched to Preview/Program mode");
|
|
|
|
blog(LOG_INFO, "-----------------------------"
|
2019-06-22 22:13:45 -07:00
|
|
|
"-------------------");
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
} else {
|
|
|
|
OBSSource actualProgramScene = OBSGetStrongRef(programScene);
|
|
|
|
if (!actualProgramScene)
|
|
|
|
actualProgramScene = GetCurrentSceneSource();
|
|
|
|
else
|
2017-11-30 09:49:02 -08:00
|
|
|
SetCurrentScene(actualProgramScene, true);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
TransitionToScene(actualProgramScene, true);
|
|
|
|
|
|
|
|
delete programOptions;
|
|
|
|
delete program;
|
2019-02-28 13:29:41 -08:00
|
|
|
delete programLabel;
|
|
|
|
delete programWidget;
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
if (lastScene) {
|
|
|
|
OBSSource actualLastScene = OBSGetStrongRef(lastScene);
|
|
|
|
if (actualLastScene)
|
|
|
|
obs_source_dec_showing(actualLastScene);
|
|
|
|
lastScene = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
programScene = nullptr;
|
|
|
|
swapScene = nullptr;
|
|
|
|
|
|
|
|
for (QuickTransition &qt : quickTransitions)
|
|
|
|
qt.button = nullptr;
|
|
|
|
|
|
|
|
if (!previewEnabled)
|
|
|
|
EnablePreviewDisplay(false);
|
|
|
|
|
2020-01-29 00:04:45 -08:00
|
|
|
ui->transitions->setEnabled(true);
|
2020-03-14 16:28:06 -07:00
|
|
|
tBarActive = false;
|
2020-01-29 00:04:45 -08:00
|
|
|
|
2017-05-03 14:17:52 -07:00
|
|
|
if (api)
|
|
|
|
api->on_event(OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED);
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
blog(LOG_INFO, "Switched to regular Preview mode");
|
|
|
|
blog(LOG_INFO, "-----------------------------"
|
2019-06-22 22:13:45 -07:00
|
|
|
"-------------------");
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
}
|
|
|
|
|
2017-11-08 20:44:22 -08:00
|
|
|
ResetUI();
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
UpdateTitleBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::RenderProgram(void *data, uint32_t cx, uint32_t cy)
|
|
|
|
{
|
2019-04-02 23:23:37 -07:00
|
|
|
GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_DEFAULT, "RenderProgram");
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
OBSBasic *window = static_cast<OBSBasic *>(data);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
obs_video_info ovi;
|
|
|
|
|
|
|
|
obs_get_video_info(&ovi);
|
|
|
|
|
|
|
|
window->programCX = int(window->programScale * float(ovi.base_width));
|
|
|
|
window->programCY = int(window->programScale * float(ovi.base_height));
|
|
|
|
|
|
|
|
gs_viewport_push();
|
|
|
|
gs_projection_push();
|
|
|
|
|
|
|
|
/* --------------------------------------- */
|
|
|
|
|
|
|
|
gs_ortho(0.0f, float(ovi.base_width), 0.0f, float(ovi.base_height),
|
2019-06-22 22:13:45 -07:00
|
|
|
-100.0f, 100.0f);
|
|
|
|
gs_set_viewport(window->programX, window->programY, window->programCX,
|
|
|
|
window->programCY);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
2019-07-18 08:44:09 -07:00
|
|
|
obs_render_main_texture_src_color_only();
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
gs_load_vertexbuffer(nullptr);
|
|
|
|
|
|
|
|
/* --------------------------------------- */
|
|
|
|
|
|
|
|
gs_projection_pop();
|
|
|
|
gs_viewport_pop();
|
|
|
|
|
2019-04-02 23:23:37 -07:00
|
|
|
GS_DEBUG_MARKER_END();
|
|
|
|
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
UNUSED_PARAMETER(cx);
|
|
|
|
UNUSED_PARAMETER(cy);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::ResizeProgram(uint32_t cx, uint32_t cy)
|
|
|
|
{
|
|
|
|
QSize targetSize;
|
|
|
|
|
|
|
|
/* resize program panel to fix to the top section of the window */
|
|
|
|
targetSize = GetPixelSize(program);
|
|
|
|
GetScaleAndCenterPos(int(cx), int(cy),
|
2019-06-22 22:13:45 -07:00
|
|
|
targetSize.width() - PREVIEW_EDGE_SIZE * 2,
|
|
|
|
targetSize.height() - PREVIEW_EDGE_SIZE * 2,
|
|
|
|
programX, programY, programScale);
|
UI: Implement transitions and preview/program mode
Implements transitions, and introduces "Studio Mode" which allows live
editing of the same or different scenes while preserving what's
currently being displayed.
Studio Mode offers a number of new features:
- The ability to edit different scenes or the same scene without
modifying what's currently being displayed (of course)
- The ability to set up "quick transitions" with a desired transition
and duration that can be assigned hotkeys
- The option to create full copies of all sources in the program scene
to allow editing of source properties of the same scene live without
modifying the output, or (by default) just use references. (Note
however that certain sources cannot be duplicated, such as capture
sources, media sources, and device sources)
- Swap Mode (enabled by default) which swaps the program scene with
the preview scene when a transition completes
Currently, only non-configurable transitions (transitions without
properties) are listed, and the only transitions available as of this
writing are fade and cut. In future versions more transitions will be
added, such as swipe, stingers, and many other various sort of
transitions, and the UI will support being able to add/configure/remove
those sort of configurable transitions.
2016-01-23 11:19:29 -08:00
|
|
|
|
|
|
|
programX += float(PREVIEW_EDGE_SIZE);
|
|
|
|
programY += float(PREVIEW_EDGE_SIZE);
|
|
|
|
}
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
obs_data_array_t *OBSBasic::SaveTransitions()
|
|
|
|
{
|
|
|
|
obs_data_array_t *transitions = obs_data_array_create();
|
|
|
|
|
|
|
|
for (int i = 0; i < ui->transitions->count(); i++) {
|
|
|
|
OBSSource tr = ui->transitions->itemData(i).value<OBSSource>();
|
|
|
|
if (!obs_source_configurable(tr))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
obs_data_t *sourceData = obs_data_create();
|
|
|
|
obs_data_t *settings = obs_source_get_settings(tr);
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
obs_data_set_string(sourceData, "name",
|
|
|
|
obs_source_get_name(tr));
|
2016-02-27 02:50:04 -08:00
|
|
|
obs_data_set_string(sourceData, "id", obs_obj_get_id(tr));
|
|
|
|
obs_data_set_obj(sourceData, "settings", settings);
|
|
|
|
|
|
|
|
obs_data_array_push_back(transitions, sourceData);
|
|
|
|
|
|
|
|
obs_data_release(settings);
|
|
|
|
obs_data_release(sourceData);
|
|
|
|
}
|
|
|
|
|
|
|
|
return transitions;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasic::LoadTransitions(obs_data_array_t *transitions)
|
|
|
|
{
|
|
|
|
size_t count = obs_data_array_count(transitions);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < count; i++) {
|
|
|
|
obs_data_t *item = obs_data_array_item(transitions, i);
|
|
|
|
const char *name = obs_data_get_string(item, "name");
|
|
|
|
const char *id = obs_data_get_string(item, "id");
|
|
|
|
obs_data_t *settings = obs_data_get_obj(item, "settings");
|
|
|
|
|
2019-06-22 22:13:45 -07:00
|
|
|
obs_source_t *source =
|
|
|
|
obs_source_create_private(id, name, settings);
|
2016-04-03 21:46:17 -07:00
|
|
|
if (!obs_obj_invalid(source)) {
|
|
|
|
InitTransition(source);
|
2019-06-22 22:13:45 -07:00
|
|
|
ui->transitions->addItem(
|
|
|
|
QT_UTF8(name),
|
|
|
|
QVariant::fromValue(OBSSource(source)));
|
2016-04-03 21:46:17 -07:00
|
|
|
ui->transitions->setCurrentIndex(
|
2019-06-22 22:13:45 -07:00
|
|
|
ui->transitions->count() - 1);
|
2016-04-03 21:46:17 -07:00
|
|
|
}
|
2016-02-27 02:50:04 -08:00
|
|
|
|
|
|
|
obs_data_release(settings);
|
|
|
|
obs_data_release(item);
|
2016-04-03 21:46:17 -07:00
|
|
|
obs_source_release(source);
|
2016-02-27 02:50:04 -08:00
|
|
|
}
|
|
|
|
}
|
2020-03-05 06:58:21 -08:00
|
|
|
|
|
|
|
OBSSource OBSBasic::GetOverrideTransition(OBSSource source)
|
|
|
|
{
|
|
|
|
if (!source)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
OBSData data = obs_source_get_private_settings(source);
|
|
|
|
obs_data_release(data);
|
|
|
|
|
|
|
|
const char *trOverrideName = obs_data_get_string(data, "transition");
|
|
|
|
|
|
|
|
OBSSource trOverride = nullptr;
|
|
|
|
|
|
|
|
if (trOverrideName && *trOverrideName)
|
|
|
|
trOverride = FindTransition(trOverrideName);
|
|
|
|
|
|
|
|
return trOverride;
|
|
|
|
}
|
|
|
|
|
|
|
|
int OBSBasic::GetOverrideTransitionDuration(OBSSource source)
|
|
|
|
{
|
|
|
|
if (!source)
|
|
|
|
return 300;
|
|
|
|
|
|
|
|
OBSData data = obs_source_get_private_settings(source);
|
|
|
|
obs_data_release(data);
|
|
|
|
obs_data_set_default_int(data, "transition_duration", 300);
|
|
|
|
|
|
|
|
return (int)obs_data_get_int(data, "transition_duration");
|
|
|
|
}
|