mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-13 20:58:34 -05:00
Add ResolveVariables()
Settings will be set to fixed values based on the values of the variables used.
This commit is contained in:
@@ -165,4 +165,9 @@ void Duration::SetUnit(Unit u)
|
||||
_value = _value * (prevMultiplier / newMultiplier);
|
||||
}
|
||||
|
||||
void Duration::ResolveVariables()
|
||||
{
|
||||
_value.ResolveVariables();
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
||||
@@ -34,8 +34,10 @@ public:
|
||||
// Only use this function if you intend to convert old settings formats
|
||||
EXPORT void SetUnit(Unit u);
|
||||
|
||||
EXPORT void ResolveVariables();
|
||||
|
||||
private:
|
||||
NumberVariable<double> _value = 0.;
|
||||
DoubleVariable _value = 0.;
|
||||
Unit _unit = Unit::SECONDS;
|
||||
std::chrono::high_resolution_clock::time_point _startTime;
|
||||
|
||||
|
||||
@@ -181,6 +181,12 @@ std::string SceneSelection::ToString(bool resolve) const
|
||||
return "";
|
||||
}
|
||||
|
||||
void SceneSelection::ResolveVariables()
|
||||
{
|
||||
_scene = GetScene();
|
||||
_type = Type::SCENE;
|
||||
}
|
||||
|
||||
SceneSelection SceneSelectionWidget::CurrentSelection()
|
||||
{
|
||||
SceneSelection s;
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
EXPORT Type GetType() const { return _type; }
|
||||
EXPORT OBSWeakSource GetScene(bool advance = true) const;
|
||||
EXPORT std::string ToString(bool resolve = false) const;
|
||||
EXPORT void ResolveVariables();
|
||||
|
||||
private:
|
||||
OBSWeakSource _scene;
|
||||
|
||||
@@ -88,6 +88,11 @@ void SourceSelection::SetSource(OBSWeakSource source)
|
||||
_source = source;
|
||||
}
|
||||
|
||||
void SourceSelection::ResolveVariables()
|
||||
{
|
||||
SetSource(GetSource());
|
||||
}
|
||||
|
||||
std::string SourceSelection::ToString(bool resolve) const
|
||||
{
|
||||
switch (_type) {
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
EXPORT Type GetType() const { return _type; }
|
||||
EXPORT OBSWeakSource GetSource() const;
|
||||
EXPORT void SetSource(OBSWeakSource);
|
||||
EXPORT void ResolveVariables();
|
||||
EXPORT std::string ToString(bool resolve = false) const;
|
||||
|
||||
EXPORT bool operator==(const SourceSelection &) const;
|
||||
|
||||
Reference in New Issue
Block a user