diff --git a/src/external-macro-modules/opencv/macro-condition-video.hpp b/src/external-macro-modules/opencv/macro-condition-video.hpp index 50f1a37d..faadcfe8 100644 --- a/src/external-macro-modules/opencv/macro-condition-video.hpp +++ b/src/external-macro-modules/opencv/macro-condition-video.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } void GetScreenshot(); bool LoadImageFromFile(); diff --git a/src/external-macro-modules/openvr/macro-condition-openvr.hpp b/src/external-macro-modules/openvr/macro-condition-openvr.hpp index 7ee3550c..bbdab9b1 100644 --- a/src/external-macro-modules/openvr/macro-condition-openvr.hpp +++ b/src/external-macro-modules/openvr/macro-condition-openvr.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } double _minX = 0, _minY = 0, _minZ = 0, _maxX = 0, _maxY = 0, _maxZ = 0; diff --git a/src/headers/macro-action-audio.hpp b/src/headers/macro-action-audio.hpp index f4aab536..dc26dc06 100644 --- a/src/headers/macro-action-audio.hpp +++ b/src/headers/macro-action-audio.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } OBSWeakSource _audioSource; diff --git a/src/headers/macro-action-edit.hpp b/src/headers/macro-action-edit.hpp index a606c47f..c33343f9 100644 --- a/src/headers/macro-action-edit.hpp +++ b/src/headers/macro-action-edit.hpp @@ -2,7 +2,7 @@ #include "macro.hpp" struct MacroActionInfo { - using TCreateMethod = std::shared_ptr (*)(); + using TCreateMethod = std::shared_ptr (*)(Macro *m); using TCreateWidgetMethod = QWidget *(*)(QWidget *parent, std::shared_ptr); TCreateMethod _createFunc = nullptr; @@ -14,7 +14,8 @@ class MacroActionFactory { public: MacroActionFactory() = delete; static bool Register(const std::string &id, MacroActionInfo); - static std::shared_ptr Create(const std::string &id); + static std::shared_ptr Create(const std::string &id, + Macro *m); static QWidget *CreateWidget(const std::string &id, QWidget *parent, std::shared_ptr action); static auto GetActionTypes() { return _methods; } diff --git a/src/headers/macro-action-file.hpp b/src/headers/macro-action-file.hpp index cdc8cf66..e8403049 100644 --- a/src/headers/macro-action-file.hpp +++ b/src/headers/macro-action-file.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } std::string _file = obs_module_text("AdvSceneSwitcher.enterPath"); diff --git a/src/headers/macro-action-filter.hpp b/src/headers/macro-action-filter.hpp index 3ec576f7..8d0d73c9 100644 --- a/src/headers/macro-action-filter.hpp +++ b/src/headers/macro-action-filter.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } OBSWeakSource _source; diff --git a/src/headers/macro-action-hotkey.hpp b/src/headers/macro-action-hotkey.hpp index 6e83d632..1f6df1a3 100644 --- a/src/headers/macro-action-hotkey.hpp +++ b/src/headers/macro-action-hotkey.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } OBSWeakSource _HotkeySource; diff --git a/src/headers/macro-action-macro.hpp b/src/headers/macro-action-macro.hpp index a933d1ca..32c0ab54 100644 --- a/src/headers/macro-action-macro.hpp +++ b/src/headers/macro-action-macro.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } PerformMacroAction _action = PerformMacroAction::PAUSE; diff --git a/src/headers/macro-action-media.hpp b/src/headers/macro-action-media.hpp index 88ff2dcc..c6622faf 100644 --- a/src/headers/macro-action-media.hpp +++ b/src/headers/macro-action-media.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } OBSWeakSource _mediaSource; diff --git a/src/headers/macro-action-plugin-state.hpp b/src/headers/macro-action-plugin-state.hpp index 14705a28..5109b789 100644 --- a/src/headers/macro-action-plugin-state.hpp +++ b/src/headers/macro-action-plugin-state.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } PluginStateAction _action = PluginStateAction::STOP; diff --git a/src/headers/macro-action-preview-scene.hpp b/src/headers/macro-action-preview-scene.hpp index 01d6af00..94466520 100644 --- a/src/headers/macro-action-preview-scene.hpp +++ b/src/headers/macro-action-preview-scene.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } SceneSelection _scene; diff --git a/src/headers/macro-action-profile.hpp b/src/headers/macro-action-profile.hpp index 6a5d77ec..c89a64aa 100644 --- a/src/headers/macro-action-profile.hpp +++ b/src/headers/macro-action-profile.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } std::string _profile; diff --git a/src/headers/macro-action-random.hpp b/src/headers/macro-action-random.hpp index 7ed7375b..a6f3f97c 100644 --- a/src/headers/macro-action-random.hpp +++ b/src/headers/macro-action-random.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } // TODO: add weights to each macro ... diff --git a/src/headers/macro-action-recording.hpp b/src/headers/macro-action-recording.hpp index d7f71bac..b01ac871 100644 --- a/src/headers/macro-action-recording.hpp +++ b/src/headers/macro-action-recording.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } RecordAction _action = RecordAction::STOP; diff --git a/src/headers/macro-action-replay-buffer.hpp b/src/headers/macro-action-replay-buffer.hpp index 402003be..a292e3b3 100644 --- a/src/headers/macro-action-replay-buffer.hpp +++ b/src/headers/macro-action-replay-buffer.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } ReplayBufferAction _action = ReplayBufferAction::STOP; diff --git a/src/headers/macro-action-run.hpp b/src/headers/macro-action-run.hpp index c6741eff..4c0188be 100644 --- a/src/headers/macro-action-run.hpp +++ b/src/headers/macro-action-run.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } std::string _path = obs_module_text("AdvSceneSwitcher.enterPath"); diff --git a/src/headers/macro-action-scene-collection.hpp b/src/headers/macro-action-scene-collection.hpp index 988011fe..7f98ae76 100644 --- a/src/headers/macro-action-scene-collection.hpp +++ b/src/headers/macro-action-scene-collection.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } std::string _sceneCollection; diff --git a/src/headers/macro-action-scene-order.hpp b/src/headers/macro-action-scene-order.hpp index 37be93d8..c4615a83 100644 --- a/src/headers/macro-action-scene-order.hpp +++ b/src/headers/macro-action-scene-order.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } SceneSelection _scene; diff --git a/src/headers/macro-action-scene-swap.hpp b/src/headers/macro-action-scene-swap.hpp index 3ec521b2..af0f6c95 100644 --- a/src/headers/macro-action-scene-swap.hpp +++ b/src/headers/macro-action-scene-swap.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } private: diff --git a/src/headers/macro-action-scene-switch.hpp b/src/headers/macro-action-scene-switch.hpp index 2b1efab8..e97c052b 100644 --- a/src/headers/macro-action-scene-switch.hpp +++ b/src/headers/macro-action-scene-switch.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } SceneSelection _scene; TransitionSelection _transition; diff --git a/src/headers/macro-action-scene-transform.hpp b/src/headers/macro-action-scene-transform.hpp index 1468a95b..2c4481cf 100644 --- a/src/headers/macro-action-scene-transform.hpp +++ b/src/headers/macro-action-scene-transform.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } std::string GetSettings(); void SetSettings(std::string &); diff --git a/src/headers/macro-action-scene-visibility.hpp b/src/headers/macro-action-scene-visibility.hpp index aa5d0336..edfc582a 100644 --- a/src/headers/macro-action-scene-visibility.hpp +++ b/src/headers/macro-action-scene-visibility.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } SceneSelection _scene; diff --git a/src/headers/macro-action-screenshot.hpp b/src/headers/macro-action-screenshot.hpp index a167f05a..4abdbc0d 100644 --- a/src/headers/macro-action-screenshot.hpp +++ b/src/headers/macro-action-screenshot.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } OBSWeakSource _source; diff --git a/src/headers/macro-action-source.hpp b/src/headers/macro-action-source.hpp index cc6d688a..7b169aad 100644 --- a/src/headers/macro-action-source.hpp +++ b/src/headers/macro-action-source.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } OBSWeakSource _source; diff --git a/src/headers/macro-action-streaming.hpp b/src/headers/macro-action-streaming.hpp index 3dc8fa72..5147aaec 100644 --- a/src/headers/macro-action-streaming.hpp +++ b/src/headers/macro-action-streaming.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } StreamAction _action = StreamAction::STOP; diff --git a/src/headers/macro-action-systray.hpp b/src/headers/macro-action-systray.hpp index f77f50d1..260ab4ed 100644 --- a/src/headers/macro-action-systray.hpp +++ b/src/headers/macro-action-systray.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } std::string _msg = ""; diff --git a/src/headers/macro-action-timer.hpp b/src/headers/macro-action-timer.hpp index e45b2e62..6913858f 100644 --- a/src/headers/macro-action-timer.hpp +++ b/src/headers/macro-action-timer.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } Duration _duration; TimerAction _actionType = TimerAction::PAUSE; diff --git a/src/headers/macro-action-transition.hpp b/src/headers/macro-action-transition.hpp index b56f3fd8..58182f4c 100644 --- a/src/headers/macro-action-transition.hpp +++ b/src/headers/macro-action-transition.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } bool _setDuration = true; diff --git a/src/headers/macro-action-virtual-cam.hpp b/src/headers/macro-action-virtual-cam.hpp index 32a1490e..ff1f128e 100644 --- a/src/headers/macro-action-virtual-cam.hpp +++ b/src/headers/macro-action-virtual-cam.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } VCamAction _action = VCamAction::STOP; diff --git a/src/headers/macro-action-wait.hpp b/src/headers/macro-action-wait.hpp index 1b234b21..9ee23702 100644 --- a/src/headers/macro-action-wait.hpp +++ b/src/headers/macro-action-wait.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } Duration _duration; Duration _duration2; diff --git a/src/headers/macro-condition-audio.hpp b/src/headers/macro-condition-audio.hpp index bc7b6ce7..c28d9122 100644 --- a/src/headers/macro-condition-audio.hpp +++ b/src/headers/macro-condition-audio.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } static void SetVolumeLevel(void *data, const float magnitude[MAX_AUDIO_CHANNELS], diff --git a/src/headers/macro-condition-cursor.hpp b/src/headers/macro-condition-cursor.hpp index c58c31c7..69fd7224 100644 --- a/src/headers/macro-condition-cursor.hpp +++ b/src/headers/macro-condition-cursor.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } CursorCondition _condition = CursorCondition::REGION; diff --git a/src/headers/macro-condition-date.hpp b/src/headers/macro-condition-date.hpp index 9fb6f56a..0cc2aca8 100644 --- a/src/headers/macro-condition-date.hpp +++ b/src/headers/macro-condition-date.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } QDateTime _dateTime; diff --git a/src/headers/macro-condition-edit.hpp b/src/headers/macro-condition-edit.hpp index b7d5e43d..daebbd52 100644 --- a/src/headers/macro-condition-edit.hpp +++ b/src/headers/macro-condition-edit.hpp @@ -2,7 +2,7 @@ #include "macro.hpp" struct MacroConditionInfo { - using TCreateMethod = std::shared_ptr (*)(); + using TCreateMethod = std::shared_ptr (*)(Macro *m); using TCreateWidgetMethod = QWidget *(*)(QWidget *parent, std::shared_ptr); TCreateMethod _createFunc = nullptr; @@ -15,7 +15,8 @@ class MacroConditionFactory { public: MacroConditionFactory() = delete; static bool Register(const std::string &, MacroConditionInfo); - static std::shared_ptr Create(const std::string &); + static std::shared_ptr Create(const std::string &, + Macro *m); static QWidget *CreateWidget(const std::string &id, QWidget *parent, std::shared_ptr); static auto GetConditionTypes() { return _methods; } diff --git a/src/headers/macro-condition-file.hpp b/src/headers/macro-condition-file.hpp index 325ac0b2..0e0dd07a 100644 --- a/src/headers/macro-condition-file.hpp +++ b/src/headers/macro-condition-file.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } std::string _file = obs_module_text("AdvSceneSwitcher.enterPath"); diff --git a/src/headers/macro-condition-filter.hpp b/src/headers/macro-condition-filter.hpp index 578c71f6..1bf59302 100644 --- a/src/headers/macro-condition-filter.hpp +++ b/src/headers/macro-condition-filter.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } OBSWeakSource _source; diff --git a/src/headers/macro-condition-hotkey.hpp b/src/headers/macro-condition-hotkey.hpp index 1cb0ffb9..463e3f9c 100644 --- a/src/headers/macro-condition-hotkey.hpp +++ b/src/headers/macro-condition-hotkey.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } void SetPressed() { _pressed = true; } diff --git a/src/headers/macro-condition-idle.hpp b/src/headers/macro-condition-idle.hpp index 32a20187..76094b6a 100644 --- a/src/headers/macro-condition-idle.hpp +++ b/src/headers/macro-condition-idle.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } Duration _duration; diff --git a/src/headers/macro-condition-macro.hpp b/src/headers/macro-condition-macro.hpp index da3859d5..62527819 100644 --- a/src/headers/macro-condition-macro.hpp +++ b/src/headers/macro-condition-macro.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } MacroConditionMacroType _type = MacroConditionMacroType::STATE; diff --git a/src/headers/macro-condition-media.hpp b/src/headers/macro-condition-media.hpp index c67d4e15..b587e9bd 100644 --- a/src/headers/macro-condition-media.hpp +++ b/src/headers/macro-condition-media.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } void ClearSignalHandler(); void ResetSignalHandler(); diff --git a/src/headers/macro-condition-plugin-state.hpp b/src/headers/macro-condition-plugin-state.hpp index 98a322eb..071b6c57 100644 --- a/src/headers/macro-condition-plugin-state.hpp +++ b/src/headers/macro-condition-plugin-state.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } PluginStateCondition _condition = PluginStateCondition::SCENESWITCHED; diff --git a/src/headers/macro-condition-process.hpp b/src/headers/macro-condition-process.hpp index 6b109080..e09172b3 100644 --- a/src/headers/macro-condition-process.hpp +++ b/src/headers/macro-condition-process.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } std::string _process; diff --git a/src/headers/macro-condition-recording.hpp b/src/headers/macro-condition-recording.hpp index e25f2a07..b83c7f04 100644 --- a/src/headers/macro-condition-recording.hpp +++ b/src/headers/macro-condition-recording.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } RecordState _recordState = RecordState::STOP; diff --git a/src/headers/macro-condition-replay-buffer.hpp b/src/headers/macro-condition-replay-buffer.hpp index cc735ac3..1d9bb9f2 100644 --- a/src/headers/macro-condition-replay-buffer.hpp +++ b/src/headers/macro-condition-replay-buffer.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } ReplayBufferState _state = ReplayBufferState::STOP; diff --git a/src/headers/macro-condition-scene-order.hpp b/src/headers/macro-condition-scene-order.hpp index 81efa901..098071a2 100644 --- a/src/headers/macro-condition-scene-order.hpp +++ b/src/headers/macro-condition-scene-order.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } SceneSelection _scene; diff --git a/src/headers/macro-condition-scene-transform.hpp b/src/headers/macro-condition-scene-transform.hpp index fa0c23ea..7f61fbee 100644 --- a/src/headers/macro-condition-scene-transform.hpp +++ b/src/headers/macro-condition-scene-transform.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } SceneSelection _scene; diff --git a/src/headers/macro-condition-scene-visibility.hpp b/src/headers/macro-condition-scene-visibility.hpp index a51ecd2e..e1819264 100644 --- a/src/headers/macro-condition-scene-visibility.hpp +++ b/src/headers/macro-condition-scene-visibility.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } SceneSelection _scene; diff --git a/src/headers/macro-condition-scene.hpp b/src/headers/macro-condition-scene.hpp index fa765c87..be367ed7 100644 --- a/src/headers/macro-condition-scene.hpp +++ b/src/headers/macro-condition-scene.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } SceneSelection _scene; diff --git a/src/headers/macro-condition-source.hpp b/src/headers/macro-condition-source.hpp index 03864fbd..b2d226c1 100644 --- a/src/headers/macro-condition-source.hpp +++ b/src/headers/macro-condition-source.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } OBSWeakSource _source = nullptr; diff --git a/src/headers/macro-condition-streaming.hpp b/src/headers/macro-condition-streaming.hpp index 899647db..26aa9eee 100644 --- a/src/headers/macro-condition-streaming.hpp +++ b/src/headers/macro-condition-streaming.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } StreamState _streamState = StreamState::STOP; diff --git a/src/headers/macro-condition-studio-mode.hpp b/src/headers/macro-condition-studio-mode.hpp index 9a9d8f7d..a6f95ef1 100644 --- a/src/headers/macro-condition-studio-mode.hpp +++ b/src/headers/macro-condition-studio-mode.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } StudioModeCondition _condition = diff --git a/src/headers/macro-condition-timer.hpp b/src/headers/macro-condition-timer.hpp index 734eb805..2d867b05 100644 --- a/src/headers/macro-condition-timer.hpp +++ b/src/headers/macro-condition-timer.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } void Pause(); void Continue(); diff --git a/src/headers/macro-condition-transition.hpp b/src/headers/macro-condition-transition.hpp index 20c21f69..cbf8a42f 100644 --- a/src/headers/macro-condition-transition.hpp +++ b/src/headers/macro-condition-transition.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } void ConnectToTransitionSignals(); void DisconnectTransitionSignals(); diff --git a/src/headers/macro-condition-virtual-cam.hpp b/src/headers/macro-condition-virtual-cam.hpp index d440018e..f84ca860 100644 --- a/src/headers/macro-condition-virtual-cam.hpp +++ b/src/headers/macro-condition-virtual-cam.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } VCamState _state = VCamState::STOP; diff --git a/src/headers/macro-condition-window.hpp b/src/headers/macro-condition-window.hpp index 01264d5b..911c23f7 100644 --- a/src/headers/macro-condition-window.hpp +++ b/src/headers/macro-condition-window.hpp @@ -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 Create() + static std::shared_ptr Create(Macro *m) { - return std::make_shared(); + return std::make_shared(m); } private: diff --git a/src/headers/macro-segment.hpp b/src/headers/macro-segment.hpp index 238b0e6d..93d9f30b 100644 --- a/src/headers/macro-segment.hpp +++ b/src/headers/macro-segment.hpp @@ -2,8 +2,12 @@ #include #include +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; diff --git a/src/headers/macro.hpp b/src/headers/macro.hpp index b86bcde9..e2d95293 100644 --- a/src/headers/macro.hpp +++ b/src/headers/macro.hpp @@ -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 _macros; }; diff --git a/src/macro-action-edit.cpp b/src/macro-action-edit.cpp index 3d67cf16..fffd0da7 100644 --- a/src/macro-action-edit.cpp +++ b/src/macro-action-edit.cpp @@ -16,10 +16,11 @@ bool MacroActionFactory::Register(const std::string &id, MacroActionInfo info) return false; } -std::shared_ptr MacroActionFactory::Create(const std::string &id) +std::shared_ptr 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 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 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); diff --git a/src/macro-condition-edit.cpp b/src/macro-condition-edit.cpp index d1a37de9..14b1eadc 100644 --- a/src/macro-condition-edit.cpp +++ b/src/macro-condition-edit.cpp @@ -18,10 +18,10 @@ bool MacroConditionFactory::Register(const std::string &id, } std::shared_ptr -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 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 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); diff --git a/src/macro-condition-hotkey.cpp b/src/macro-condition-hotkey.cpp index 92a82e36..287078fc 100644 --- a/src/macro-condition-hotkey.cpp +++ b/src/macro-condition-hotkey.cpp @@ -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); diff --git a/src/macro.cpp b/src/macro.cpp index 0128562d..4da66433 100644 --- a/src/macro.cpp +++ b/src/macro.cpp @@ -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) {