Compare commits

..

5 Commits
1.15 ... 1.15.2

Author SHA1 Message Date
WarmUpTill
1474509cb9 Fix extended sequence abort when using non-instant transitions 2021-07-30 00:47:40 +02:00
WarmUpTill
87aa8d3b40 Remove code used for backwards compatibility 2021-07-29 15:16:29 -07:00
WarmUpTill
d3e8b76fa6 Do not apply MouseWheelWidgetAdjustmentGuard to QScrollBars
Without this change, it will be annoying to interact with expanded
QComboBoxes and there should be no danger of accidentally modifying
macro settings by interacting with QScrollBars
2021-07-29 15:16:19 -07:00
WarmUpTill
99c9b1a4a2 Fix macro video condition save
Logic, collapsed state and time constraint were not saved for video
condition.
2021-07-24 23:47:24 -07:00
WarmUpTill
8c0aad4c96 Add note to network tab
The requirement of the scene names having to match extactly was not made
clear and caused some confusion.
2021-07-24 23:31:35 -07:00
10 changed files with 29 additions and 87 deletions

View File

@@ -457,6 +457,7 @@ AdvSceneSwitcher.videoTab.help="<html><head/><body><p>This tab will allow you to
; Network Tab
AdvSceneSwitcher.networkTab.title="Network"
AdvSceneSwitcher.networkTab.description="This tab will allow you to remotely control the active scene of another OBS instance.\nPlease note that the scene names have to match exactly on all OBS instances."
AdvSceneSwitcher.networkTab.warning="Running the server outside of a local network will allow third parties to read the active scene."
AdvSceneSwitcher.networkTab.DisabledWarning="This functionality unfortunately had to be disabled on macOS due to library incompatibilities when running the obs-websocket plugin in parallel."
AdvSceneSwitcher.networkTab.server="Start server (Sends scene switch messages to all connected clients)"

View File

@@ -3716,6 +3716,13 @@
<string>AdvSceneSwitcher.networkTab.title</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_30">
<item>
<widget class="QLabel" name="networkTabDescription">
<property name="text">
<string>AdvSceneSwitcher.networkTab.description</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="networkTabWarningLabel">
<property name="text">

View File

@@ -35,8 +35,7 @@ struct SceneSequenceSwitch : SceneSwitcherEntry {
bool reduce();
SceneSequenceSwitch *extend();
bool checkMatch(OBSWeakSource currentScene, int &linger,
SceneSequenceSwitch *root = nullptr);
bool checkMatch(int &linger, SceneSequenceSwitch *root = nullptr);
bool checkDurationMatchInterruptible();
void prepareUninterruptibleMatch(int &linger);
void advanceActiveSequence();

View File

@@ -10,12 +10,6 @@ bool MacroConditionCursor::_registered = MacroConditionFactory::Register(
{MacroConditionCursor::Create, MacroConditionCursorEdit::Create,
"AdvSceneSwitcher.condition.cursor"});
// TODO: Remove in future version - just added for backwards compatibility
static const std::string idOld = "region";
static bool oldRegisterd = MacroConditionFactory::Register(
idOld, {MacroConditionCursor::Create, MacroConditionCursorEdit::Create,
"AdvSceneSwitcher.condition.cursor"});
static std::map<CursorCondition, std::string> cursorConditionTypes = {
{CursorCondition::REGION,
"AdvSceneSwitcher.condition.cursor.type.region"},

View File

@@ -10,12 +10,6 @@ bool MacroConditionMacro::_registered = MacroConditionFactory::Register(
{MacroConditionMacro::Create, MacroConditionMacroEdit::Create,
"AdvSceneSwitcher.condition.macro"});
// TODO: Remove in future version - just added for backward compatibility
static std::string idOld = "counter";
static bool oldRegisterd = MacroConditionFactory::Register(
idOld, {MacroConditionMacro::Create, MacroConditionMacroEdit::Create,
"AdvSceneSwitcher.condition.macro"});
static std::map<MacroConditionMacroType, std::string> macroConditionTypes = {
{MacroConditionMacroType::COUNT,
"AdvSceneSwitcher.condition.macro.type.count"},

View File

@@ -10,12 +10,6 @@ bool MacroConditionTimer::_registered = MacroConditionFactory::Register(
{MacroConditionTimer::Create, MacroConditionTimerEdit::Create,
"AdvSceneSwitcher.condition.timer", false});
// TODO: Remove in future version - just added for backward compatibility
static const std::string idOld = "interval";
static bool oldRegisterd = MacroConditionFactory::Register(
idOld, {MacroConditionTimer::Create, MacroConditionTimerEdit::Create,
"AdvSceneSwitcher.condition.timer", false});
bool MacroConditionTimer::CheckCondition()
{
if (_duration.DurationReached()) {

View File

@@ -64,6 +64,7 @@ bool MacroConditionVideo::Save(obs_data_t *obj)
bool MacroConditionVideo::Load(obs_data_t *obj)
{
MacroCondition::Load(obj);
const char *videoSourceName = obs_data_get_string(obj, "videoSource");
_videoSource = GetWeakSourceByName(videoSourceName);
_condition =

View File

@@ -5,6 +5,7 @@
#include <obs.hpp>
#include <QEvent>
#include <QLabel>
#include <QScrollBar>
bool MacroSegment::Save(obs_data_t *obj)
{
@@ -136,6 +137,11 @@ void MacroSegmentEdit::SetFocusPolicyOfWidgets()
QList<QWidget *> widgets = this->findChildren<QWidget *>();
for (auto w : widgets) {
w->setFocusPolicy(Qt::StrongFocus);
// Ignore QScrollBar as there is no danger of accidentally modifying anything
// and long expanded QComboBox would be difficult to interact with otherwise.
if (qobject_cast<QScrollBar *>(w)) {
continue;
}
w->installEventFilter(new MouseWheelWidgetAdjustmentGuard(w));
}
}

View File

@@ -454,71 +454,8 @@ void SwitcherData::saveMacros(obs_data_t *obj)
obs_data_array_release(macroArray);
}
// Temporary helper functions to convert old settings format to new one
static std::unordered_map<int, std::string> actionIntToActionString = {
{2, "audio"}, {4, "recording"}, {5, "replay_buffer"}, {6, "run"},
{3, "streaming"}, {0, "scene_switch"}, {1, "wait"},
};
static void replaceActionIds(obs_data_t *obj)
{
obs_data_array_t *actions = obs_data_get_array(obj, "actions");
size_t count = obs_data_array_count(actions);
for (size_t i = 0; i < count; i++) {
obs_data_t *array_obj = obs_data_array_item(actions, i);
auto oldId = obs_data_get_int(array_obj, "id");
obs_data_set_string(array_obj, "id",
actionIntToActionString[oldId].c_str());
obs_data_release(array_obj);
}
obs_data_array_release(actions);
}
static std::unordered_map<int, std::string> conditionIntToConditionString = {
{3, "audio"}, {4, "file"}, {10, "idle"}, {5, "media"},
{11, "plugin_state"}, {9, "process"}, {8, "recording"}, {2, "region"},
{0, "scene"}, {7, "streaming"}, {6, "video"}, {1, "window"},
};
static void replaceConditionIds(obs_data_t *obj)
{
obs_data_array_t *conditions = obs_data_get_array(obj, "conditions");
size_t count = obs_data_array_count(conditions);
for (size_t i = 0; i < count; i++) {
obs_data_t *array_obj = obs_data_array_item(conditions, i);
auto oldId = obs_data_get_int(array_obj, "id");
obs_data_set_string(
array_obj, "id",
conditionIntToConditionString[oldId].c_str());
obs_data_release(array_obj);
}
obs_data_array_release(conditions);
}
static void convertOldMacroIdsToString(obs_data_t *obj)
{
obs_data_array_t *macroArray = obs_data_get_array(obj, "macros");
size_t count = obs_data_array_count(macroArray);
for (size_t i = 0; i < count; i++) {
obs_data_t *array_obj = obs_data_array_item(macroArray, i);
replaceActionIds(array_obj);
replaceConditionIds(array_obj);
obs_data_release(array_obj);
}
obs_data_array_release(macroArray);
}
void SwitcherData::loadMacros(obs_data_t *obj)
{
// TODO: Remove conversion helper in future version
std::string previousVersion = obs_data_get_string(obj, "version");
if (previousVersion == "2ce0b35921be892c987c7dbb5fc90db38f15f0a6") {
convertOldMacroIdsToString(obj);
}
macros.clear();
obs_data_array_t *macroArray = obs_data_get_array(obj, "macros");

View File

@@ -203,7 +203,7 @@ bool SwitcherData::checkSceneSequence(OBSWeakSource &scene,
continue;
}
bool matched = s.checkMatch(currentScene, linger);
bool matched = s.checkMatch(linger);
if (!match && matched) {
match = matched;
@@ -395,8 +395,7 @@ SceneSequenceSwitch *SceneSequenceSwitch::extend()
return extendedSequence.get();
}
bool SceneSequenceSwitch::checkMatch(OBSWeakSource currentScene, int &linger,
SceneSequenceSwitch *root)
bool SceneSequenceSwitch::checkMatch(int &linger, SceneSequenceSwitch *root)
{
if (!initialized()) {
if (root) {
@@ -407,8 +406,18 @@ bool SceneSequenceSwitch::checkMatch(OBSWeakSource currentScene, int &linger,
bool match = false;
// We cannot rely on switcher->currentScene for this information.
// Depending on the transition length the frontend event for the scene
// change of the previous element in the sequence might not yet have
// been received, which would lead to the sequencence being aborted.
// Thus we have to use obs_frontend_get_current_scene() here.
auto sceneSource = obs_frontend_get_current_scene();
auto currentScene = obs_source_get_weak_source(sceneSource);
obs_weak_source_release(currentScene);
obs_source_release(sceneSource);
if (activeSequence) {
return activeSequence->checkMatch(currentScene, linger, this);
return activeSequence->checkMatch(linger, this);
}
if (startScene == currentScene) {