mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-19 00:27:23 -05:00
The condition type was able to miss transition starts of very fast conditions (e.g. Cut) when the selection "Any transition" was made. In that case no signal handler was installed (as the condition type might change) and only the transition scenes were compared at the time of the condition check. If that moment where the transition scenes differ was missed no transition start was recognized. Additionally, the "Transitioning to" and "Transitioning from" checks faced a similar issue, if the scene transition was happening so fast, that the condition check was not performed during the time of the transition.
99 lines
2.4 KiB
C++
99 lines
2.4 KiB
C++
#pragma once
|
|
#include "macro-condition-edit.hpp"
|
|
#include "duration-control.hpp"
|
|
#include "transition-selection.hpp"
|
|
#include "scene-selection.hpp"
|
|
|
|
#include <obs-frontend-api.h>
|
|
|
|
namespace advss {
|
|
|
|
class MacroConditionTransition : public MacroCondition {
|
|
public:
|
|
MacroConditionTransition(Macro *m);
|
|
~MacroConditionTransition();
|
|
bool CheckCondition();
|
|
bool Save(obs_data_t *obj) const;
|
|
bool Load(obs_data_t *obj);
|
|
std::string GetShortDesc() const;
|
|
std::string GetId() const { return id; };
|
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
|
{
|
|
return std::make_shared<MacroConditionTransition>(m);
|
|
}
|
|
void ConnectToTransitionSignals();
|
|
|
|
enum class Condition {
|
|
CURRENT,
|
|
DURATION,
|
|
STARTED = 50,
|
|
ENDED,
|
|
VIDEO_ENDED,
|
|
TRANSITION_SOURCE = 100,
|
|
TRANSITION_TARGET,
|
|
};
|
|
Condition _condition = Condition::CURRENT;
|
|
TransitionSelection _transition;
|
|
SceneSelection _scene;
|
|
Duration _duration;
|
|
|
|
private:
|
|
static void TransitionStarted(void *data, calldata_t *);
|
|
static void TransitionEnded(void *data, calldata_t *);
|
|
static void TransitionVideoEnded(void *data, calldata_t *);
|
|
static void HandleFrontendEvent(enum obs_frontend_event event, void *);
|
|
|
|
std::vector<OBSSignal> _signals;
|
|
|
|
std::mutex _mutex;
|
|
std::vector<OBSWeakSource> _transitionStartScenes;
|
|
std::vector<OBSWeakSource> _transitionEndScenes;
|
|
|
|
bool _started = false;
|
|
bool _ended = false;
|
|
bool _videoEnded = false;
|
|
|
|
static bool _registered;
|
|
static const std::string id;
|
|
};
|
|
|
|
class MacroConditionTransitionEdit : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MacroConditionTransitionEdit(
|
|
QWidget *parent,
|
|
std::shared_ptr<MacroConditionTransition> cond = nullptr);
|
|
void UpdateEntryData();
|
|
static QWidget *Create(QWidget *parent,
|
|
std::shared_ptr<MacroCondition> cond)
|
|
{
|
|
return new MacroConditionTransitionEdit(
|
|
parent,
|
|
std::dynamic_pointer_cast<MacroConditionTransition>(
|
|
cond));
|
|
}
|
|
|
|
private slots:
|
|
void ConditionChanged(int cond);
|
|
void TransitionChanged(const TransitionSelection &);
|
|
void SceneChanged(const SceneSelection &);
|
|
void DurationChanged(const Duration &seconds);
|
|
signals:
|
|
void HeaderInfoChanged(const QString &);
|
|
|
|
protected:
|
|
QComboBox *_conditions;
|
|
TransitionSelectionWidget *_transitions;
|
|
SceneSelectionWidget *_scenes;
|
|
DurationSelection *_duration;
|
|
QLabel *_durationSuffix;
|
|
std::shared_ptr<MacroConditionTransition> _entryData;
|
|
|
|
private:
|
|
void SetWidgetVisibility();
|
|
bool _loading = true;
|
|
};
|
|
|
|
} // namespace advss
|