mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-07-02 00:22:10 -05:00
Add function to access parent macro from condition or action
This commit is contained in:
parent
8a4aef0f50
commit
5d58269b02
|
|
@ -32,15 +32,16 @@ constexpr int maxMinNeighbors = 6;
|
|||
|
||||
class MacroConditionVideo : public MacroCondition {
|
||||
public:
|
||||
MacroConditionVideo(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
QImage GetMatchImage() { return _matchImage; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionVideo>();
|
||||
return std::make_shared<MacroConditionVideo>(m);
|
||||
}
|
||||
void GetScreenshot();
|
||||
bool LoadImageFromFile();
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@
|
|||
|
||||
class MacroConditionOpenVR : public MacroCondition {
|
||||
public:
|
||||
MacroConditionOpenVR(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionOpenVR>();
|
||||
return std::make_shared<MacroConditionOpenVR>(m);
|
||||
}
|
||||
|
||||
double _minX = 0, _minY = 0, _minZ = 0, _maxX = 0, _maxY = 0, _maxZ = 0;
|
||||
|
|
|
|||
|
|
@ -15,15 +15,16 @@ enum class AudioAction {
|
|||
|
||||
class MacroActionAudio : public MacroAction {
|
||||
public:
|
||||
MacroActionAudio(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionAudio>();
|
||||
return std::make_shared<MacroActionAudio>(m);
|
||||
}
|
||||
|
||||
OBSWeakSource _audioSource;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "macro.hpp"
|
||||
|
||||
struct MacroActionInfo {
|
||||
using TCreateMethod = std::shared_ptr<MacroAction> (*)();
|
||||
using TCreateMethod = std::shared_ptr<MacroAction> (*)(Macro *m);
|
||||
using TCreateWidgetMethod = QWidget *(*)(QWidget *parent,
|
||||
std::shared_ptr<MacroAction>);
|
||||
TCreateMethod _createFunc = nullptr;
|
||||
|
|
@ -14,7 +14,8 @@ class MacroActionFactory {
|
|||
public:
|
||||
MacroActionFactory() = delete;
|
||||
static bool Register(const std::string &id, MacroActionInfo);
|
||||
static std::shared_ptr<MacroAction> Create(const std::string &id);
|
||||
static std::shared_ptr<MacroAction> Create(const std::string &id,
|
||||
Macro *m);
|
||||
static QWidget *CreateWidget(const std::string &id, QWidget *parent,
|
||||
std::shared_ptr<MacroAction> action);
|
||||
static auto GetActionTypes() { return _methods; }
|
||||
|
|
|
|||
|
|
@ -11,15 +11,16 @@ enum class FileAction {
|
|||
|
||||
class MacroActionFile : public MacroAction {
|
||||
public:
|
||||
MacroActionFile(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionFile>();
|
||||
return std::make_shared<MacroActionFile>(m);
|
||||
}
|
||||
|
||||
std::string _file = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||
|
|
|
|||
|
|
@ -11,15 +11,16 @@ enum class FilterAction {
|
|||
|
||||
class MacroActionFilter : public MacroAction {
|
||||
public:
|
||||
MacroActionFilter(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionFilter>();
|
||||
return std::make_shared<MacroActionFilter>(m);
|
||||
}
|
||||
|
||||
OBSWeakSource _source;
|
||||
|
|
|
|||
|
|
@ -8,14 +8,15 @@
|
|||
|
||||
class MacroActionHotkey : public MacroAction {
|
||||
public:
|
||||
MacroActionHotkey(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionHotkey>();
|
||||
return std::make_shared<MacroActionHotkey>(m);
|
||||
}
|
||||
|
||||
OBSWeakSource _HotkeySource;
|
||||
|
|
|
|||
|
|
@ -13,15 +13,16 @@ enum class PerformMacroAction {
|
|||
|
||||
class MacroActionMacro : public MacroRefAction {
|
||||
public:
|
||||
MacroActionMacro(Macro *m) : MacroRefAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionMacro>();
|
||||
return std::make_shared<MacroActionMacro>(m);
|
||||
}
|
||||
|
||||
PerformMacroAction _action = PerformMacroAction::PAUSE;
|
||||
|
|
|
|||
|
|
@ -15,15 +15,16 @@ enum class MediaAction {
|
|||
|
||||
class MacroActionMedia : public MacroAction {
|
||||
public:
|
||||
MacroActionMedia(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionMedia>();
|
||||
return std::make_shared<MacroActionMedia>(m);
|
||||
}
|
||||
|
||||
OBSWeakSource _mediaSource;
|
||||
|
|
|
|||
|
|
@ -13,14 +13,15 @@ enum class PluginStateAction {
|
|||
|
||||
class MacroActionPluginState : public MacroAction {
|
||||
public:
|
||||
MacroActionPluginState(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionPluginState>();
|
||||
return std::make_shared<MacroActionPluginState>(m);
|
||||
}
|
||||
|
||||
PluginStateAction _action = PluginStateAction::STOP;
|
||||
|
|
|
|||
|
|
@ -4,15 +4,16 @@
|
|||
|
||||
class MacroActionPreviewScene : public MacroAction {
|
||||
public:
|
||||
MacroActionPreviewScene(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionPreviewScene>();
|
||||
return std::make_shared<MacroActionPreviewScene>(m);
|
||||
}
|
||||
|
||||
SceneSelection _scene;
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@
|
|||
|
||||
class MacroActionProfile : public MacroAction {
|
||||
public:
|
||||
MacroActionProfile(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionProfile>();
|
||||
return std::make_shared<MacroActionProfile>(m);
|
||||
}
|
||||
|
||||
std::string _profile;
|
||||
|
|
|
|||
|
|
@ -9,14 +9,15 @@
|
|||
|
||||
class MacroActionRandom : public MultiMacroRefAction {
|
||||
public:
|
||||
MacroActionRandom(Macro *m) : MultiMacroRefAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionRandom>();
|
||||
return std::make_shared<MacroActionRandom>(m);
|
||||
}
|
||||
|
||||
// TODO: add weights to each macro ...
|
||||
|
|
|
|||
|
|
@ -13,14 +13,15 @@ enum class RecordAction {
|
|||
|
||||
class MacroActionRecord : public MacroAction {
|
||||
public:
|
||||
MacroActionRecord(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionRecord>();
|
||||
return std::make_shared<MacroActionRecord>(m);
|
||||
}
|
||||
|
||||
RecordAction _action = RecordAction::STOP;
|
||||
|
|
|
|||
|
|
@ -14,14 +14,15 @@ enum class ReplayBufferAction {
|
|||
|
||||
class MacroActionReplayBuffer : public MacroAction {
|
||||
public:
|
||||
MacroActionReplayBuffer(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionReplayBuffer>();
|
||||
return std::make_shared<MacroActionReplayBuffer>(m);
|
||||
}
|
||||
|
||||
ReplayBufferAction _action = ReplayBufferAction::STOP;
|
||||
|
|
|
|||
|
|
@ -9,15 +9,16 @@
|
|||
|
||||
class MacroActionRun : public MacroAction {
|
||||
public:
|
||||
MacroActionRun(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionRun>();
|
||||
return std::make_shared<MacroActionRun>(m);
|
||||
}
|
||||
|
||||
std::string _path = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@
|
|||
|
||||
class MacroActionSceneCollection : public MacroAction {
|
||||
public:
|
||||
MacroActionSceneCollection(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSceneCollection>();
|
||||
return std::make_shared<MacroActionSceneCollection>(m);
|
||||
}
|
||||
|
||||
std::string _sceneCollection;
|
||||
|
|
|
|||
|
|
@ -15,15 +15,16 @@ enum class SceneOrderAction {
|
|||
|
||||
class MacroActionSceneOrder : public MacroAction {
|
||||
public:
|
||||
MacroActionSceneOrder(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSceneOrder>();
|
||||
return std::make_shared<MacroActionSceneOrder>(m);
|
||||
}
|
||||
|
||||
SceneSelection _scene;
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
|
||||
class MacroActionSceneSwap : public MacroAction {
|
||||
public:
|
||||
MacroActionSceneSwap(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSceneSwap>();
|
||||
return std::make_shared<MacroActionSceneSwap>(m);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
class MacroActionSwitchScene : public MacroAction {
|
||||
public:
|
||||
MacroActionSwitchScene(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
|
|
@ -15,9 +16,9 @@ public:
|
|||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSwitchScene>();
|
||||
return std::make_shared<MacroActionSwitchScene>(m);
|
||||
}
|
||||
SceneSelection _scene;
|
||||
TransitionSelection _transition;
|
||||
|
|
|
|||
|
|
@ -8,15 +8,16 @@
|
|||
|
||||
class MacroActionSceneTransform : public MacroAction {
|
||||
public:
|
||||
MacroActionSceneTransform(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSceneTransform>();
|
||||
return std::make_shared<MacroActionSceneTransform>(m);
|
||||
}
|
||||
std::string GetSettings();
|
||||
void SetSettings(std::string &);
|
||||
|
|
|
|||
|
|
@ -17,15 +17,16 @@ enum class SceneItemSourceType {
|
|||
|
||||
class MacroActionSceneVisibility : public MacroAction {
|
||||
public:
|
||||
MacroActionSceneVisibility(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSceneVisibility>();
|
||||
return std::make_shared<MacroActionSceneVisibility>(m);
|
||||
}
|
||||
|
||||
SceneSelection _scene;
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@
|
|||
|
||||
class MacroActionScreenshot : public MacroAction {
|
||||
public:
|
||||
MacroActionScreenshot(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionScreenshot>();
|
||||
return std::make_shared<MacroActionScreenshot>(m);
|
||||
}
|
||||
OBSWeakSource _source;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,15 +14,16 @@ enum class SourceAction {
|
|||
|
||||
class MacroActionSource : public MacroAction {
|
||||
public:
|
||||
MacroActionSource(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSource>();
|
||||
return std::make_shared<MacroActionSource>(m);
|
||||
}
|
||||
|
||||
OBSWeakSource _source;
|
||||
|
|
|
|||
|
|
@ -13,14 +13,15 @@ enum class StreamAction {
|
|||
|
||||
class MacroActionStream : public MacroAction {
|
||||
public:
|
||||
MacroActionStream(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionStream>();
|
||||
return std::make_shared<MacroActionStream>(m);
|
||||
}
|
||||
|
||||
StreamAction _action = StreamAction::STOP;
|
||||
|
|
|
|||
|
|
@ -5,14 +5,15 @@
|
|||
|
||||
class MacroActionSystray : public MacroAction {
|
||||
public:
|
||||
MacroActionSystray(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionSystray>();
|
||||
return std::make_shared<MacroActionSystray>(m);
|
||||
}
|
||||
|
||||
std::string _msg = "";
|
||||
|
|
|
|||
|
|
@ -15,15 +15,16 @@ enum class TimerAction {
|
|||
|
||||
class MacroActionTimer : public MacroRefAction {
|
||||
public:
|
||||
MacroActionTimer(Macro *m) : MacroRefAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionTimer>();
|
||||
return std::make_shared<MacroActionTimer>(m);
|
||||
}
|
||||
Duration _duration;
|
||||
TimerAction _actionType = TimerAction::PAUSE;
|
||||
|
|
|
|||
|
|
@ -8,15 +8,16 @@
|
|||
|
||||
class MacroActionTransition : public MacroAction {
|
||||
public:
|
||||
MacroActionTransition(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionTransition>();
|
||||
return std::make_shared<MacroActionTransition>(m);
|
||||
}
|
||||
|
||||
bool _setDuration = true;
|
||||
|
|
|
|||
|
|
@ -13,14 +13,15 @@ enum class VCamAction {
|
|||
|
||||
class MacroActionVCam : public MacroAction {
|
||||
public:
|
||||
MacroActionVCam(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
void LogAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionVCam>();
|
||||
return std::make_shared<MacroActionVCam>(m);
|
||||
}
|
||||
|
||||
VCamAction _action = VCamAction::STOP;
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ enum class WaitType {
|
|||
|
||||
class MacroActionWait : public MacroAction {
|
||||
public:
|
||||
MacroActionWait(Macro *m) : MacroAction(m) {}
|
||||
bool PerformAction();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroAction> Create()
|
||||
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroActionWait>();
|
||||
return std::make_shared<MacroActionWait>(m);
|
||||
}
|
||||
Duration _duration;
|
||||
Duration _duration2;
|
||||
|
|
|
|||
|
|
@ -15,15 +15,16 @@ enum class AudioCondition {
|
|||
|
||||
class MacroConditionAudio : public MacroCondition {
|
||||
public:
|
||||
MacroConditionAudio(Macro *m) : MacroCondition(m) {}
|
||||
~MacroConditionAudio();
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionAudio>();
|
||||
return std::make_shared<MacroConditionAudio>(m);
|
||||
}
|
||||
static void SetVolumeLevel(void *data,
|
||||
const float magnitude[MAX_AUDIO_CHANNELS],
|
||||
|
|
|
|||
|
|
@ -14,13 +14,14 @@ enum class CursorCondition {
|
|||
|
||||
class MacroConditionCursor : public MacroCondition {
|
||||
public:
|
||||
MacroConditionCursor(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionCursor>();
|
||||
return std::make_shared<MacroConditionCursor>(m);
|
||||
}
|
||||
|
||||
CursorCondition _condition = CursorCondition::REGION;
|
||||
|
|
|
|||
|
|
@ -15,14 +15,15 @@ enum class DateCondition {
|
|||
|
||||
class MacroConditionDate : public MacroCondition {
|
||||
public:
|
||||
MacroConditionDate(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionDate>();
|
||||
return std::make_shared<MacroConditionDate>(m);
|
||||
}
|
||||
|
||||
QDateTime _dateTime;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "macro.hpp"
|
||||
|
||||
struct MacroConditionInfo {
|
||||
using TCreateMethod = std::shared_ptr<MacroCondition> (*)();
|
||||
using TCreateMethod = std::shared_ptr<MacroCondition> (*)(Macro *m);
|
||||
using TCreateWidgetMethod =
|
||||
QWidget *(*)(QWidget *parent, std::shared_ptr<MacroCondition>);
|
||||
TCreateMethod _createFunc = nullptr;
|
||||
|
|
@ -15,7 +15,8 @@ class MacroConditionFactory {
|
|||
public:
|
||||
MacroConditionFactory() = delete;
|
||||
static bool Register(const std::string &, MacroConditionInfo);
|
||||
static std::shared_ptr<MacroCondition> Create(const std::string &);
|
||||
static std::shared_ptr<MacroCondition> Create(const std::string &,
|
||||
Macro *m);
|
||||
static QWidget *CreateWidget(const std::string &id, QWidget *parent,
|
||||
std::shared_ptr<MacroCondition>);
|
||||
static auto GetConditionTypes() { return _methods; }
|
||||
|
|
|
|||
|
|
@ -17,14 +17,15 @@ enum class FileType {
|
|||
|
||||
class MacroConditionFile : public MacroCondition {
|
||||
public:
|
||||
MacroConditionFile(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionFile>();
|
||||
return std::make_shared<MacroConditionFile>(m);
|
||||
}
|
||||
|
||||
std::string _file = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||
|
|
|
|||
|
|
@ -14,14 +14,15 @@ enum class FilterCondition {
|
|||
|
||||
class MacroConditionFilter : public MacroCondition {
|
||||
public:
|
||||
MacroConditionFilter(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionFilter>();
|
||||
return std::make_shared<MacroConditionFilter>(m);
|
||||
}
|
||||
|
||||
OBSWeakSource _source;
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@
|
|||
|
||||
class MacroConditionHotkey : public MacroCondition {
|
||||
public:
|
||||
MacroConditionHotkey();
|
||||
MacroConditionHotkey(Macro *m);
|
||||
~MacroConditionHotkey();
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionHotkey>();
|
||||
return std::make_shared<MacroConditionHotkey>(m);
|
||||
}
|
||||
void SetPressed() { _pressed = true; }
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@
|
|||
|
||||
class MacroConditionIdle : public MacroCondition {
|
||||
public:
|
||||
MacroConditionIdle(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionIdle>();
|
||||
return std::make_shared<MacroConditionIdle>(m);
|
||||
}
|
||||
|
||||
Duration _duration;
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@ enum class CounterCondition {
|
|||
|
||||
class MacroConditionMacro : public MacroRefCondition {
|
||||
public:
|
||||
MacroConditionMacro(Macro *m) : MacroRefCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionMacro>();
|
||||
return std::make_shared<MacroConditionMacro>(m);
|
||||
}
|
||||
|
||||
MacroConditionMacroType _type = MacroConditionMacroType::STATE;
|
||||
|
|
|
|||
|
|
@ -43,15 +43,16 @@ enum class MediaSourceType {
|
|||
|
||||
class MacroConditionMedia : public MacroCondition {
|
||||
public:
|
||||
MacroConditionMedia(Macro *m) : MacroCondition(m) {}
|
||||
~MacroConditionMedia();
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionMedia>();
|
||||
return std::make_shared<MacroConditionMedia>(m);
|
||||
}
|
||||
void ClearSignalHandler();
|
||||
void ResetSignalHandler();
|
||||
|
|
|
|||
|
|
@ -10,13 +10,14 @@ enum class PluginStateCondition {
|
|||
|
||||
class MacroConditionPluginState : public MacroCondition {
|
||||
public:
|
||||
MacroConditionPluginState(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionPluginState>();
|
||||
return std::make_shared<MacroConditionPluginState>(m);
|
||||
}
|
||||
|
||||
PluginStateCondition _condition = PluginStateCondition::SCENESWITCHED;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,15 @@
|
|||
|
||||
class MacroConditionProcess : public MacroCondition {
|
||||
public:
|
||||
MacroConditionProcess(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionProcess>();
|
||||
return std::make_shared<MacroConditionProcess>(m);
|
||||
}
|
||||
|
||||
std::string _process;
|
||||
|
|
|
|||
|
|
@ -11,13 +11,14 @@ enum class RecordState {
|
|||
|
||||
class MacroConditionRecord : public MacroCondition {
|
||||
public:
|
||||
MacroConditionRecord(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionRecord>();
|
||||
return std::make_shared<MacroConditionRecord>(m);
|
||||
}
|
||||
|
||||
RecordState _recordState = RecordState::STOP;
|
||||
|
|
|
|||
|
|
@ -13,13 +13,14 @@ enum class ReplayBufferState {
|
|||
|
||||
class MacroConditionReplayBuffer : public MacroCondition {
|
||||
public:
|
||||
MacroConditionReplayBuffer(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionReplayBuffer>();
|
||||
return std::make_shared<MacroConditionReplayBuffer>(m);
|
||||
}
|
||||
|
||||
ReplayBufferState _state = ReplayBufferState::STOP;
|
||||
|
|
|
|||
|
|
@ -14,14 +14,15 @@ enum class SceneOrderCondition {
|
|||
|
||||
class MacroConditionSceneOrder : public MacroCondition {
|
||||
public:
|
||||
MacroConditionSceneOrder(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionSceneOrder>();
|
||||
return std::make_shared<MacroConditionSceneOrder>(m);
|
||||
}
|
||||
|
||||
SceneSelection _scene;
|
||||
|
|
|
|||
|
|
@ -9,14 +9,15 @@
|
|||
|
||||
class MacroConditionSceneTransform : public MacroCondition {
|
||||
public:
|
||||
MacroConditionSceneTransform(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionSceneTransform>();
|
||||
return std::make_shared<MacroConditionSceneTransform>(m);
|
||||
}
|
||||
|
||||
SceneSelection _scene;
|
||||
|
|
|
|||
|
|
@ -12,14 +12,15 @@ enum class SceneVisibilityCondition {
|
|||
|
||||
class MacroConditionSceneVisibility : public MacroCondition {
|
||||
public:
|
||||
MacroConditionSceneVisibility(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionSceneVisibility>();
|
||||
return std::make_shared<MacroConditionSceneVisibility>(m);
|
||||
}
|
||||
|
||||
SceneSelection _scene;
|
||||
|
|
|
|||
|
|
@ -15,14 +15,15 @@ enum class SceneType {
|
|||
|
||||
class MacroConditionScene : public MacroCondition {
|
||||
public:
|
||||
MacroConditionScene(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionScene>();
|
||||
return std::make_shared<MacroConditionScene>(m);
|
||||
}
|
||||
|
||||
SceneSelection _scene;
|
||||
|
|
|
|||
|
|
@ -14,14 +14,15 @@ enum class SourceCondition {
|
|||
|
||||
class MacroConditionSource : public MacroCondition {
|
||||
public:
|
||||
MacroConditionSource(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionSource>();
|
||||
return std::make_shared<MacroConditionSource>(m);
|
||||
}
|
||||
|
||||
OBSWeakSource _source = nullptr;
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ enum class StreamState {
|
|||
|
||||
class MacroConditionStream : public MacroCondition {
|
||||
public:
|
||||
MacroConditionStream(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionStream>();
|
||||
return std::make_shared<MacroConditionStream>(m);
|
||||
}
|
||||
|
||||
StreamState _streamState = StreamState::STOP;
|
||||
|
|
|
|||
|
|
@ -13,14 +13,15 @@ enum class StudioModeCondition {
|
|||
|
||||
class MacroConditionStudioMode : public MacroCondition {
|
||||
public:
|
||||
MacroConditionStudioMode(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionStudioMode>();
|
||||
return std::make_shared<MacroConditionStudioMode>(m);
|
||||
}
|
||||
|
||||
StudioModeCondition _condition =
|
||||
|
|
|
|||
|
|
@ -17,13 +17,14 @@ enum class TimerType {
|
|||
|
||||
class MacroConditionTimer : public MacroCondition {
|
||||
public:
|
||||
MacroConditionTimer(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionTimer>();
|
||||
return std::make_shared<MacroConditionTimer>(m);
|
||||
}
|
||||
void Pause();
|
||||
void Continue();
|
||||
|
|
|
|||
|
|
@ -18,14 +18,15 @@ enum class TransitionCondition {
|
|||
|
||||
class MacroConditionTransition : public MacroCondition {
|
||||
public:
|
||||
MacroConditionTransition(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionTransition>();
|
||||
return std::make_shared<MacroConditionTransition>(m);
|
||||
}
|
||||
void ConnectToTransitionSignals();
|
||||
void DisconnectTransitionSignals();
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ enum class VCamState {
|
|||
|
||||
class MacroConditionVCam : public MacroCondition {
|
||||
public:
|
||||
MacroConditionVCam(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionVCam>();
|
||||
return std::make_shared<MacroConditionVCam>(m);
|
||||
}
|
||||
|
||||
VCamState _state = VCamState::STOP;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,15 @@
|
|||
|
||||
class MacroConditionWindow : public MacroCondition {
|
||||
public:
|
||||
MacroConditionWindow(Macro *m) : MacroCondition(m) {}
|
||||
bool CheckCondition();
|
||||
bool Save(obs_data_t *obj);
|
||||
bool Load(obs_data_t *obj);
|
||||
std::string GetShortDesc();
|
||||
std::string GetId() { return id; };
|
||||
static std::shared_ptr<MacroCondition> Create()
|
||||
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||
{
|
||||
return std::make_shared<MacroConditionWindow>();
|
||||
return std::make_shared<MacroConditionWindow>(m);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,12 @@
|
|||
#include <QWidget>
|
||||
#include <obs.hpp>
|
||||
|
||||
class Macro;
|
||||
|
||||
class MacroSegment {
|
||||
public:
|
||||
MacroSegment(Macro *m) : _macro(m) {}
|
||||
Macro *GetMacro() { return _macro; }
|
||||
void SetIndex(int idx) { _idx = idx; }
|
||||
int GetIndex() { return _idx; }
|
||||
void SetCollapsed(bool collapsed) { _collapsed = collapsed; }
|
||||
|
|
@ -16,6 +20,9 @@ public:
|
|||
protected:
|
||||
int _idx = 0;
|
||||
bool _collapsed = false;
|
||||
|
||||
private:
|
||||
Macro *_macro = nullptr;
|
||||
};
|
||||
|
||||
class Section;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ struct LogicTypeInfo {
|
|||
|
||||
class MacroCondition : public MacroSegment {
|
||||
public:
|
||||
MacroCondition(Macro *m) : MacroSegment(m) {}
|
||||
virtual bool CheckCondition() = 0;
|
||||
virtual bool Save(obs_data_t *obj) = 0;
|
||||
virtual bool Load(obs_data_t *obj) = 0;
|
||||
|
|
@ -61,6 +62,7 @@ private:
|
|||
|
||||
class MacroAction : public MacroSegment {
|
||||
public:
|
||||
MacroAction(Macro *m) : MacroSegment(m) {}
|
||||
virtual bool PerformAction() = 0;
|
||||
virtual bool Save(obs_data_t *obj) = 0;
|
||||
virtual bool Load(obs_data_t *obj) = 0;
|
||||
|
|
@ -151,18 +153,21 @@ private:
|
|||
|
||||
class MacroRefCondition : public MacroCondition {
|
||||
public:
|
||||
MacroRefCondition(Macro *m) : MacroCondition(m) {}
|
||||
void ResolveMacroRef();
|
||||
MacroRef _macro;
|
||||
};
|
||||
|
||||
class MacroRefAction : public MacroAction {
|
||||
public:
|
||||
MacroRefAction(Macro *m) : MacroAction(m) {}
|
||||
void ResolveMacroRef();
|
||||
MacroRef _macro;
|
||||
};
|
||||
|
||||
class MultiMacroRefAction : public MacroAction {
|
||||
public:
|
||||
MultiMacroRefAction(Macro *m) : MacroAction(m) {}
|
||||
void ResolveMacroRef();
|
||||
std::vector<MacroRef> _macros;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@ bool MacroActionFactory::Register(const std::string &id, MacroActionInfo info)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<MacroAction> MacroActionFactory::Create(const std::string &id)
|
||||
std::shared_ptr<MacroAction> MacroActionFactory::Create(const std::string &id,
|
||||
Macro *m)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end())
|
||||
return it->second._createFunc();
|
||||
return it->second._createFunc(m);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -93,12 +94,13 @@ void MacroActionEdit::ActionSelectionChanged(const QString &text)
|
|||
}
|
||||
|
||||
auto idx = _entryData->get()->GetIndex();
|
||||
auto macro = _entryData->get()->GetMacro();
|
||||
std::string id = MacroActionFactory::GetIdByName(text);
|
||||
HeaderInfoChanged("");
|
||||
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
_entryData->reset();
|
||||
*_entryData = MacroActionFactory::Create(id);
|
||||
*_entryData = MacroActionFactory::Create(id, macro);
|
||||
(*_entryData)->SetIndex(idx);
|
||||
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||
|
|
@ -140,12 +142,12 @@ void AdvSceneSwitcher::AddMacroAction(int idx)
|
|||
if (idx - 1 >= 0) {
|
||||
id = macro->Actions().at(idx - 1)->GetId();
|
||||
} else {
|
||||
MacroActionSwitchScene temp;
|
||||
MacroActionSwitchScene temp(nullptr);
|
||||
id = temp.GetId();
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
macro->Actions().emplace(macro->Actions().begin() + idx,
|
||||
MacroActionFactory::Create(id));
|
||||
MacroActionFactory::Create(id, macro));
|
||||
if (idx - 1 >= 0) {
|
||||
auto data = obs_data_create();
|
||||
macro->Actions().at(idx - 1)->Save(data);
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ bool MacroConditionFactory::Register(const std::string &id,
|
|||
}
|
||||
|
||||
std::shared_ptr<MacroCondition>
|
||||
MacroConditionFactory::Create(const std::string &id)
|
||||
MacroConditionFactory::Create(const std::string &id, Macro *m)
|
||||
{
|
||||
if (auto it = _methods.find(id); it != _methods.end()) {
|
||||
return it->second._createFunc();
|
||||
return it->second._createFunc(m);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -189,6 +189,7 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
|||
}
|
||||
|
||||
auto idx = _entryData->get()->GetIndex();
|
||||
auto macro = _entryData->get()->GetMacro();
|
||||
std::string id = MacroConditionFactory::GetIdByName(text);
|
||||
|
||||
auto temp = DurationConstraint();
|
||||
|
|
@ -198,7 +199,7 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
|||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
auto logic = (*_entryData)->GetLogicType();
|
||||
_entryData->reset();
|
||||
*_entryData = MacroConditionFactory::Create(id);
|
||||
*_entryData = MacroConditionFactory::Create(id, macro);
|
||||
(*_entryData)->SetIndex(idx);
|
||||
(*_entryData)->SetLogicType(logic);
|
||||
auto widget =
|
||||
|
|
@ -260,14 +261,14 @@ void AdvSceneSwitcher::AddMacroCondition(int idx)
|
|||
if (idx - 1 >= 0) {
|
||||
id = macro->Conditions().at(idx - 1)->GetId();
|
||||
} else {
|
||||
MacroConditionScene temp;
|
||||
MacroConditionScene temp(macro);
|
||||
id = temp.GetId();
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
bool root = idx == 0;
|
||||
auto cond =
|
||||
macro->Conditions().emplace(macro->Conditions().begin() + idx,
|
||||
MacroConditionFactory::Create(id));
|
||||
auto cond = macro->Conditions().emplace(
|
||||
macro->Conditions().begin() + idx,
|
||||
MacroConditionFactory::Create(id, macro));
|
||||
if (idx - 1 >= 0) {
|
||||
auto data = obs_data_create();
|
||||
macro->Conditions().at(idx - 1)->Save(data);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ static void hotkeyCB(void *data, obs_hotkey_id, obs_hotkey_t *, bool pressed)
|
|||
|
||||
static uint32_t count = 1;
|
||||
|
||||
MacroConditionHotkey::MacroConditionHotkey()
|
||||
MacroConditionHotkey::MacroConditionHotkey(Macro *m) : MacroCondition(m)
|
||||
{
|
||||
if (_hotkeyID != OBS_INVALID_HOTKEY_ID) {
|
||||
obs_hotkey_unregister(_hotkeyID);
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ bool Macro::Load(obs_data_t *obj)
|
|||
|
||||
std::string id = obs_data_get_string(array_obj, "id");
|
||||
|
||||
auto newEntry = MacroConditionFactory::Create(id);
|
||||
auto newEntry = MacroConditionFactory::Create(id, this);
|
||||
if (newEntry) {
|
||||
_conditions.emplace_back(newEntry);
|
||||
auto c = _conditions.back().get();
|
||||
|
|
@ -331,7 +331,7 @@ bool Macro::Load(obs_data_t *obj)
|
|||
|
||||
std::string id = obs_data_get_string(array_obj, "id");
|
||||
|
||||
auto newEntry = MacroActionFactory::Create(id);
|
||||
auto newEntry = MacroActionFactory::Create(id, this);
|
||||
if (newEntry) {
|
||||
_actions.emplace_back(newEntry);
|
||||
_actions.back()->Load(array_obj);
|
||||
|
|
@ -372,7 +372,7 @@ void Macro::ResolveMacroRef()
|
|||
|
||||
bool Macro::SwitchesScene()
|
||||
{
|
||||
MacroActionSwitchScene temp;
|
||||
MacroActionSwitchScene temp(nullptr);
|
||||
auto sceneSwitchId = temp.GetId();
|
||||
for (auto &a : _actions) {
|
||||
if (a->GetId() == sceneSwitchId) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user