mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-12 12:18:35 -05:00
Add support for inline scripts
* Script can be defined in the macro segment or loaded from a file * Supports both LUA and Python * Can be used for actions and conditions * obs_script_create and obs_script_destroy are resolved at runtime (Let's hope the API remains stable)
This commit is contained in:
56
plugins/scripting/macro-segment-script-inline.hpp
Normal file
56
plugins/scripting/macro-segment-script-inline.hpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
#include "file-selection.hpp"
|
||||
#include "inline-script.hpp"
|
||||
#include "variable-text-edit.hpp"
|
||||
|
||||
#include <QLayout>
|
||||
|
||||
namespace advss {
|
||||
|
||||
class MacroSegmentScriptInline {
|
||||
public:
|
||||
InlineScript::Type GetType() const { return _script.GetType(); }
|
||||
void SetType(InlineScript::Type);
|
||||
obs_script_lang GetLanguage() const { return _script.GetLanguage(); }
|
||||
void SetLanguage(obs_script_lang);
|
||||
StringVariable GetScript() const { return _script.GetText(); }
|
||||
void SetScript(const std::string &);
|
||||
std::string GetPath() const { return _script.GetPath(); }
|
||||
void SetPath(const std::string &);
|
||||
|
||||
protected:
|
||||
InlineScript _script;
|
||||
};
|
||||
|
||||
class MacroSegmentScriptInlineEdit : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MacroSegmentScriptInlineEdit(
|
||||
QWidget *, std::shared_ptr<MacroSegmentScriptInline> = nullptr);
|
||||
virtual ~MacroSegmentScriptInlineEdit() = default;
|
||||
|
||||
protected slots:
|
||||
void ScriptTypeChanged(int);
|
||||
void LanguageChanged(int);
|
||||
void ScriptChanged();
|
||||
void PathChanged(const QString &);
|
||||
|
||||
protected:
|
||||
void PopulateWidgets();
|
||||
void SetupWidgetConnections();
|
||||
void SetupLayout();
|
||||
void SetWidgetVisibility();
|
||||
|
||||
QComboBox *_scriptType;
|
||||
QComboBox *_language;
|
||||
ScriptEditor *_script;
|
||||
FileSelection *_path;
|
||||
QPushButton *_openFile;
|
||||
QHBoxLayout *_fileLayout;
|
||||
|
||||
std::shared_ptr<MacroSegmentScriptInline> _entryData;
|
||||
bool _loading = true;
|
||||
};
|
||||
|
||||
} // namespace advss
|
||||
Reference in New Issue
Block a user