mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-10-25 10:02:41 -05:00
Enable tracking variable usage
This commit is contained in:
@@ -116,8 +116,7 @@ bool MacroActionScreenshot::Save(obs_data_t *obj) const
|
||||
obs_data_set_int(obj, "saveType", static_cast<int>(_saveType));
|
||||
obs_data_set_int(obj, "targetType", static_cast<int>(_targetType));
|
||||
_path.Save(obj, "savePath");
|
||||
obs_data_set_string(obj, "variable",
|
||||
GetWeakVariableName(_variable).c_str());
|
||||
_variable.Save(obj, "variable");
|
||||
obs_data_set_int(obj, "version", 1);
|
||||
return true;
|
||||
}
|
||||
@@ -131,7 +130,7 @@ bool MacroActionScreenshot::Load(obs_data_t *obj)
|
||||
_targetType =
|
||||
static_cast<TargetType>(obs_data_get_int(obj, "targetType"));
|
||||
_path.Load(obj, "savePath");
|
||||
_variable = GetWeakVariableByName(obs_data_get_string(obj, "variable"));
|
||||
_variable.Load(obj, "variable");
|
||||
|
||||
// TODO: Remove fallback for older versions
|
||||
if (!obs_data_has_user_value(obj, "version")) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "scene-selection.hpp"
|
||||
#include "screenshot-helper.hpp"
|
||||
#include "source-selection.hpp"
|
||||
#include "variable-ref.hpp"
|
||||
#include "variable.hpp"
|
||||
|
||||
#include <QComboBox>
|
||||
@@ -31,7 +32,7 @@ public:
|
||||
SceneSelection _scene;
|
||||
SourceSelection _source;
|
||||
StringVariable _path = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||
std::weak_ptr<Variable> _variable;
|
||||
VariableRef _variable;
|
||||
|
||||
private:
|
||||
void FrontendScreenshot(OBSWeakSource &) const;
|
||||
|
||||
@@ -176,8 +176,7 @@ bool MacroActionWait::Save(obs_data_t *obj) const
|
||||
obs_data_set_int(obj, "version", 1);
|
||||
_duration.Save(obj);
|
||||
_duration2.Save(obj, "duration2");
|
||||
obs_data_set_string(obj, "variableName",
|
||||
GetWeakVariableName(_variable).c_str());
|
||||
_variable.Save(obj, "variableName");
|
||||
obs_data_set_int(obj, "condition", static_cast<int>(_condition));
|
||||
_strValue.Save(obj, "strValue");
|
||||
_numValue.Save(obj, "numValue");
|
||||
@@ -200,8 +199,7 @@ bool MacroActionWait::Load(obs_data_t *obj)
|
||||
obs_data_get_int(obj, "displayUnit2")));
|
||||
}
|
||||
_duration.Load(obj);
|
||||
_variable =
|
||||
GetWeakVariableByName(obs_data_get_string(obj, "variableName"));
|
||||
_variable.Load(obj, "variableName");
|
||||
_condition = static_cast<Condition>(obs_data_get_int(obj, "condition"));
|
||||
_strValue.Load(obj, "strValue");
|
||||
_numValue.Load(obj, "numValue");
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "macro-action-edit.hpp"
|
||||
#include "duration-control.hpp"
|
||||
#include "regex-config.hpp"
|
||||
#include "variable-ref.hpp"
|
||||
#include "variable-spinbox.hpp"
|
||||
#include "variable-text-edit.hpp"
|
||||
#include "variable.hpp"
|
||||
@@ -44,7 +45,7 @@ public:
|
||||
LESS_THAN,
|
||||
GREATER_THAN,
|
||||
};
|
||||
std::weak_ptr<Variable> _variable;
|
||||
VariableRef _variable;
|
||||
Condition _condition = Condition::EQUALS;
|
||||
StringVariable _strValue = "";
|
||||
DoubleVariable _numValue = 0.0;
|
||||
|
||||
@@ -20,15 +20,9 @@ void FilterSelection::Save(obs_data_t *obj, const char *name) const
|
||||
_filter ? GetWeakSourceName(_filter).c_str()
|
||||
: _filterName.c_str());
|
||||
break;
|
||||
case Type::VARIABLE: {
|
||||
auto var = _variable.lock();
|
||||
if (!var) {
|
||||
break;
|
||||
}
|
||||
obs_data_set_string(data, nameSaveName.data(),
|
||||
var->Name().c_str());
|
||||
case Type::VARIABLE:
|
||||
_variable.Save(data, nameSaveName.data());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "source-selection.hpp"
|
||||
#include "filter-combo-box.hpp"
|
||||
#include "variable-ref.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
@@ -32,7 +33,7 @@ private:
|
||||
// Storing the name separately as depending on the source selection
|
||||
// the filter source might not be available at the moment.
|
||||
std::string _filterName = "";
|
||||
std::weak_ptr<Variable> _variable;
|
||||
VariableRef _variable;
|
||||
Type _type = Type::SOURCE;
|
||||
friend class FilterSelectionWidget;
|
||||
};
|
||||
|
||||
@@ -205,14 +205,9 @@ void SceneItemSelection::Save(obs_data_t *obj, const char *name) const
|
||||
obs_data_set_string(data, itemSaveName.data(),
|
||||
GetWeakSourceName(_source).c_str());
|
||||
break;
|
||||
case SceneItemSelection::Type::VARIABLE_NAME: {
|
||||
auto var = _variable.lock();
|
||||
if (var) {
|
||||
obs_data_set_string(data, itemSaveName.data(),
|
||||
var->Name().c_str());
|
||||
}
|
||||
case SceneItemSelection::Type::VARIABLE_NAME:
|
||||
_variable.Save(data, itemSaveName.data());
|
||||
break;
|
||||
}
|
||||
case SceneItemSelection::Type::SOURCE_NAME_PATTERN:
|
||||
_pattern.Save(data, patternSaveName.data());
|
||||
_regex.Save(data);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "filter-combo-box.hpp"
|
||||
#include "variable-spinbox.hpp"
|
||||
#include "variable-line-edit.hpp"
|
||||
#include "variable-ref.hpp"
|
||||
#include "variable-string.hpp"
|
||||
#include "regex-config.hpp"
|
||||
|
||||
@@ -77,7 +78,7 @@ private:
|
||||
Type _type = Type::SOURCE_NAME;
|
||||
|
||||
OBSWeakSource _source;
|
||||
std::weak_ptr<Variable> _variable;
|
||||
VariableRef _variable;
|
||||
IntVariable _index = 1;
|
||||
IntVariable _indexEnd = 1;
|
||||
NameConflictSelection _nameConflictSelectionType =
|
||||
|
||||
@@ -1292,8 +1292,7 @@ bool MacroActionTwitch::Save(obs_data_t *obj) const
|
||||
obs_data_set_int(obj, "pollEndStatus",
|
||||
static_cast<int>(_pollEndStatus));
|
||||
_pointsReward.Save(obj);
|
||||
obs_data_set_string(obj, "rewardVariable",
|
||||
GetWeakVariableName(_rewardVariable).c_str());
|
||||
_rewardVariable.Save(obj, "rewardVariable");
|
||||
obs_data_set_bool(obj, "useVariableForRewardSelection",
|
||||
_useVariableForRewardSelection);
|
||||
|
||||
@@ -1334,8 +1333,7 @@ bool MacroActionTwitch::Load(obs_data_t *obj)
|
||||
_pollEndStatus = static_cast<PollEndStatus>(
|
||||
obs_data_get_int(obj, "pollEndStatus"));
|
||||
_pointsReward.Load(obj);
|
||||
_rewardVariable = GetWeakVariableByName(
|
||||
obs_data_get_string(obj, "rewardVariable"));
|
||||
_rewardVariable.Load(obj, "rewardVariable");
|
||||
_useVariableForRewardSelection =
|
||||
obs_data_get_bool(obj, "useVariableForRewardSelection");
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "tag-selection.hpp"
|
||||
|
||||
#include <variable-line-edit.hpp>
|
||||
#include <variable-ref.hpp>
|
||||
#include <variable-text-edit.hpp>
|
||||
#include <duration-control.hpp>
|
||||
#include <duration.hpp>
|
||||
@@ -197,7 +198,7 @@ public:
|
||||
DoubleVariable _userId = 0;
|
||||
StringVariable _banReason = "";
|
||||
TwitchPointsReward _pointsReward;
|
||||
std::weak_ptr<Variable> _rewardVariable;
|
||||
VariableRef _rewardVariable;
|
||||
bool _useVariableForRewardSelection = false;
|
||||
StringVariable _pollTitle = "Poll question";
|
||||
StringVariable _pollChoices = "Choice 1\nChoice 2";
|
||||
|
||||
Reference in New Issue
Block a user