Add support for transition duration in switchScene() (#178)

This commit is contained in:
WarmUpTill
2021-05-12 10:50:50 -07:00
committed by GitHub
parent 8b8e479098
commit 6bf122d0e8
6 changed files with 85 additions and 73 deletions

View File

@@ -287,17 +287,11 @@ bool isInFocus(const QString &executable);
* Sceneswitch helper
******************************************************************************/
void setNextTransition(OBSWeakSource &targetScene, obs_source_t *currentSource,
OBSWeakSource &transition,
bool transitionOverrideOverride,
bool adjustActiveTransitionType, transitionData &td);
void overwriteTransitionOverride(obs_weak_source_t *sceneWs,
obs_source_t *transition, int duration,
transitionData &td);
void setNextTransition(sceneSwitchInfo &ssi, obs_source_t *currentSource,
transitionData &td);
void overwriteTransitionOverride(sceneSwitchInfo ssi, transitionData &td);
void restoreTransitionOverride(obs_source_t *scene, transitionData td);
void switchScene(OBSWeakSource &scene, OBSWeakSource &transition,
bool transitionOverrideOverride,
bool adjustActiveTransitionType, bool verbose);
void switchScene(sceneSwitchInfo ssi);
/******************************************************************************
* Main SwitcherData

View File

@@ -22,6 +22,8 @@ using websocketpp::connection_hdl;
typedef websocketpp::server<websocketpp::config::asio> server;
typedef websocketpp::client<websocketpp::config::asio_client> client;
struct sceneSwitchInfo;
class NetworkConfig {
public:
NetworkConfig();
@@ -51,7 +53,7 @@ public:
virtual ~WSServer();
void start(quint16 port, bool lockToIPv4);
void stop();
void sendMessage(OBSWeakSource scene, OBSWeakSource transition);
void sendMessage(sceneSwitchInfo sceneSwitch);
QThreadPool *threadPool() { return &_threadPool; }
private:

View File

@@ -41,6 +41,13 @@ enum class AutoStartEvent {
RECORINDG_OR_STREAMING,
};
typedef struct sceneSwitchInfo {
OBSWeakSource scene;
OBSWeakSource transition;
int duration = 0;
} sceneSwitchInfo;
typedef struct transitionData {
std::string name = "";
int duration = 0;
@@ -64,7 +71,7 @@ struct SwitcherData {
bool verbose = false;
bool disableHints = false;
bool showFrame = false;
bool tansitionOverrideOverride = false;
bool transitionOverrideOverride = false;
bool adjustActiveTransitionType = true;
int interval = default_interval;