Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"CMAKE_INSTALL_PREFIX": "xstudio_install",
"X_VCPKG_APPLOCAL_DEPS_INSTALL": "ON",
"BUILD_DOCS": "OFF",
"USE_VCPKG": "ON"
"USE_VCPKG": "ON",
"STUDIO_PLUGINS": ""
}
},
{
Expand Down
5 changes: 3 additions & 2 deletions docs/reference/build_guides/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ Follow [these instructions](downloading_qt.md)

### Download the VCPKG repo

To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo and run the bootstrap script before we build xstudio.
To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo, run the bootstrap script and then siwtch to a specific git commit before we build xstudio. Run these commands in a terminal:

git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
./vcpkg/bootstrap-vcpkg.bat
git checkout c2aeddd80357b17592e59ad965d2adf65a19b22f

### Download the xSTUDIO repo

Expand Down
3 changes: 2 additions & 1 deletion docs/reference/build_guides/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ Start a Windows Powershell to continue these instructions, where you must run a
mkdir dev
cd dev

To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo and run the bootstrap script before we build xstudio. Run these commands in the Powershell:
To build xSTUDIO we need a number of other open source software packages. We use the VCPKG package manager to do this. All that we need to do is download the repo, run the bootstrap script and then siwtch to a specific git commit before we build xstudio. Run these commands in the Powershell:

git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.bat
git checkout c2aeddd80357b17592e59ad965d2adf65a19b22f

### Download the xSTUDIO repo

Expand Down
2 changes: 1 addition & 1 deletion include/xstudio/atoms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_plugin_atoms, FIRST_CUSTOM_ID + (200 * 3))
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::embedded_python, python_eval_file_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::embedded_python, python_eval_locals_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::embedded_python, python_exec_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::embedded_python, python_exec_plugin_method_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::embedded_python, python_output_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::embedded_python, python_remove_session_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::embedded_python, python_session_input_atom)
Expand All @@ -549,7 +550,6 @@ CAF_BEGIN_TYPE_ID_BLOCK(xstudio_plugin_atoms, FIRST_CUSTOM_ID + (200 * 3))
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::plugin_manager, get_resident_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::plugin_manager, spawn_plugin_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::plugin_manager, spawn_plugin_base_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::plugin_manager, spawn_plugin_ui_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::shotgun_client, shotgun_acquire_authentication_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::shotgun_client, shotgun_acquire_token_atom)
CAF_ADD_ATOM(xstudio_plugin_atoms, xstudio::shotgun_client, shotgun_authenticate_atom)
Expand Down
14 changes: 5 additions & 9 deletions include/xstudio/data_source/data_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,18 @@ namespace data_source {
public:
DataSourcePlugin(
utility::Uuid uuid,
std::string name = "",
std::string author = "",
std::string description = "",
semver::version version = semver::version("0.0.0"),
std::string widget_ui_string = "",
std::string menu_ui_string = "")
std::string name = "",
std::string author = "",
std::string description = "",
semver::version version = semver::version("0.0.0"))
: plugin_manager::PluginFactoryTemplate<T>(
uuid,
name,
plugin_manager::PluginFlags::PF_DATA_SOURCE,
true,
author,
description,
version,
widget_ui_string,
menu_ui_string) {}
version) {}
~DataSourcePlugin() override = default;
};

Expand Down
2 changes: 1 addition & 1 deletion include/xstudio/embedded_python/embedded_python_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace embedded_python {
void join_broadcast(caf::actor act);
void leave_broadcast(caf::actor act);
void delayed_callback(utility::Uuid &cb_id, const int microseconds_delay);

utility::JsonStore process_non_specific_message(caf::message &msg);
void main_loop();

private:
Expand Down
3 changes: 3 additions & 0 deletions include/xstudio/global/global_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace global {

void connect_api(const caf::actor &embedded_python);
void disconnect_api(const caf::actor &embedded_python, const bool force = false);
void honour_requests_for_python_interpreter(const caf::actor &embedded_python);

template <class AudioOutputDev>
caf::actor spawn_audio_output_actor(const utility::JsonStore &prefs) {
Expand All @@ -82,6 +83,7 @@ namespace global {
int port_maximum_;
std::string bind_address_;
bool connected_;
bool connection_attempted_ = {false};

std::string remote_api_session_name_;
utility::RemoteSessionManager rsm_;
Expand All @@ -93,6 +95,7 @@ namespace global {
StatusType status_{StatusType::ST_NONE};
std::set<caf::actor_addr> busy_;
utility::JsonStore file_map_regex_;
std::vector<caf::typed_response_promise<caf::actor>> pending_python_interp_requests_;
};
} // namespace global
} // namespace xstudio
6 changes: 4 additions & 2 deletions include/xstudio/module/module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,10 @@ namespace module {

// Override this function to receive callbacks from QML from items
// created by 'create_qml_item'
virtual void qml_item_callback(
const utility::Uuid &qml_item_id, const utility::JsonStore &callback_data) {}
virtual utility::JsonStore qml_item_callback(
const utility::Uuid &qml_item_id, const utility::JsonStore &callback_data) {
return utility::JsonStore();
}

// This method can be overriden to receive a callback when the number of viewports
// connected to the module changes. This is used by the Playhead class, for example
Expand Down
73 changes: 52 additions & 21 deletions include/xstudio/plugin_manager/plugin_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@
#include "xstudio/utility/json_store.hpp"
#include "xstudio/plugin_manager/enums.hpp"

// Use the following macros to declare plugins.
// See src/plugin/data_source/demo/demo_datasource_plugin/src/demo_plugin.cpp for example useage

#define XSTUDIO_PLUGIN_DECLARE_BEGIN() \
extern "C" { \
plugin_manager::PluginFactoryCollection *plugin_factory_collection_ptr() { \
\
auto pfc = new plugin_manager::PluginFactoryCollection();

#define XSTUDIO_PLUGIN_DECLARE_END() \
return pfc; \
} \
}

#define XSTUDIO_REGISTER_PLUGIN( \
PLUGIN_CLASS, UUID, NAME, TYPE, RESIDENT, AUTHOR, DESCRIPTION, VERSION) \
pfc->register_plugin<PLUGIN_CLASS>( \
UUID, #NAME, TYPE, RESIDENT, #AUTHOR, #DESCRIPTION, semver::version(#VERSION));

#define XSTUDIO_REGISTER_MEDIA_READER_PLUGIN(PLUGIN_CLASS, UUID, NAME, AUTHOR, DESCRIPTION, VERSION) \
pfc->register_plugin<media_reader::MediaReaderActor<PLUGIN_CLASS>>( \
UUID, \
#NAME, \
plugin_manager::PluginFlags::PF_MEDIA_READER, \
false, \
#AUTHOR, \
#DESCRIPTION, \
semver::version(#VERSION));


namespace xstudio {
namespace plugin_manager {

Expand All @@ -35,32 +65,25 @@ namespace plugin_manager {
}

virtual void *instance_q_object(void *parent_q_object) { return nullptr; }

[[nodiscard]] virtual std::string spawn_widget_ui() { return ""; }
[[nodiscard]] virtual std::string spawn_menu_ui() { return ""; }
};

template <typename T> class PluginFactoryTemplate : public PluginFactory {
public:
PluginFactoryTemplate(
utility::Uuid uuid,
std::string name = "",
PluginType type = PluginFlags::PF_CUSTOM,
bool resident = false,
std::string author = "",
std::string description = "",
semver::version version = semver::version("0.0.0"),
std::string ui_widget_string = "",
std::string ui_menu_string = "")
std::string _name = "",
PluginType type = PluginFlags::PF_CUSTOM,
bool resident = false,
std::string author = "",
std::string description = "",
semver::version version = semver::version("0.0.0"))
: uuid_(std::move(uuid)),
name_(std::move(name)),
name_(std::move(_name)),
type_(type),
resident_(resident),
author_(std::move(author)),
description_(std::move(description)),
version_(std::move(version)),
ui_widget_string_(std::move(ui_widget_string)),
ui_menu_string_(std::move(ui_menu_string)) {}
version_(std::move(version)) {}
~PluginFactoryTemplate() override = default;

[[nodiscard]] std::string name() const override { return name_; }
Expand All @@ -70,8 +93,6 @@ namespace plugin_manager {
[[nodiscard]] std::string author() const override { return author_; }
[[nodiscard]] std::string description() const override { return description_; }
[[nodiscard]] semver::version version() const override { return version_; }
[[nodiscard]] std::string spawn_widget_ui() override { return ui_widget_string_; }
[[nodiscard]] std::string spawn_menu_ui() override { return ui_menu_string_; }
[[nodiscard]] caf::actor spawn(
caf::blocking_actor &sys,
const utility::JsonStore &json = utility::JsonStore()) override {
Expand Down Expand Up @@ -119,8 +140,6 @@ namespace plugin_manager {
[[nodiscard]] std::string author() const override { return author_; }
[[nodiscard]] std::string description() const override { return description_; }
[[nodiscard]] semver::version version() const override { return version_; }
[[nodiscard]] std::string spawn_widget_ui() override { return ui_widget_string_; }
[[nodiscard]] std::string spawn_menu_ui() override { return ui_menu_string_; }

void *instance_q_object(void *parent_q_object) override {
return T::instance_q_object(parent_q_object);
Expand All @@ -133,8 +152,6 @@ namespace plugin_manager {
std::string author_;
std::string description_;
semver::version version_;
std::string ui_widget_string_;
std::string ui_menu_string_;
};


Expand All @@ -148,6 +165,20 @@ namespace plugin_manager {
: factories_(std::move(vpf)) {}
virtual ~PluginFactoryCollection() = default;

template <typename T>
void register_plugin(
utility::Uuid uuid,
std::string name = "",
PluginType type = PluginFlags::PF_CUSTOM,
bool resident = false,
std::string author = "",
std::string description = "",
semver::version version = semver::version("0.0.0")) {
factories_.push_back(
std::make_shared<PluginFactoryTemplate<T>>(
uuid, name, type, resident, author, description, version));
}

std::vector<std::shared_ptr<PluginFactory>> &factories() { return factories_; }

protected:
Expand Down
10 changes: 2 additions & 8 deletions include/xstudio/plugin_manager/plugin_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ namespace plugin_manager {
class PluginEntry {
public:
PluginEntry(std::shared_ptr<PluginFactory> pf, std::string path)
: plugin_factory_(std::move(pf)), path_(std::move(path)) {
// auto enable xstudio plugins
// we might want to use uuids list.
if (plugin_factory_.get()->author() != "xStudio")
enabled_ = false;
}
: plugin_factory_(std::move(pf)), path_(std::move(path)) {}

virtual ~PluginEntry() = default;

Expand All @@ -29,6 +24,7 @@ namespace plugin_manager {
private:
std::shared_ptr<PluginFactory> plugin_factory_;
std::string path_;
// Plugins are always enabled by default
bool enabled_{true};
};

Expand Down Expand Up @@ -101,8 +97,6 @@ namespace plugin_manager {
caf::blocking_actor &sys,
const utility::Uuid &uuid,
const utility::JsonStore &json = utility::JsonStore());
[[nodiscard]] std::string spawn_widget_ui(const utility::Uuid &uuid);
[[nodiscard]] std::string spawn_menu_ui(const utility::Uuid &uuid);

private:
std::list<std::string> plugin_paths_;
Expand Down
6 changes: 6 additions & 0 deletions include/xstudio/ui/qml/helper_ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,12 @@ namespace ui {
Q_INVOKABLE void
moduleCallback(const QString &module_actor, const QVariant cb_data);

Q_INVOKABLE QFuture<QVariant>
pythonAsyncCallback(const QString pluginName, const QString method, QVariant args);

Q_INVOKABLE QVariant
pluginCallback(const QUuid &plugin_uuid, const QVariant cb_data);

Q_INVOKABLE [[nodiscard]] QObject *contextPanel(QObject *obj) const;

Q_INVOKABLE [[nodiscard]] QString contextPanelAddress(QObject *obj) const {
Expand Down
5 changes: 0 additions & 5 deletions include/xstudio/ui/qml/studio_ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace ui {

Q_OBJECT

Q_PROPERTY(QList<QObject *> dataSources READ dataSources NOTIFY dataSourcesChanged)
Q_PROPERTY(
QString sessionActorAddr READ sessionActorAddr WRITE setSessionActorAddr NOTIFY
sessionActorAddrChanged)
Expand Down Expand Up @@ -65,8 +64,6 @@ namespace ui {
}
Q_INVOKABLE QFuture<bool> loadSessionRequestFuture(const QUrl &path);

QList<QObject *> dataSources() { return data_sources_; }

[[nodiscard]] QString sessionActorAddr() const { return session_actor_addr_; };

void setSessionActorAddr(const QString &addr);
Expand Down Expand Up @@ -96,12 +93,10 @@ namespace ui {

private:
void init(caf::actor_system &system) override;
void updateDataSources();
xstudio::ui::qt::OffscreenViewport *offscreen_snapshot_viewport();
void loadVideoOutputPlugin(const utility::Uuid &plugin_id);


QList<QObject *> data_sources_;
xstudio::ui::qt::OffscreenViewport *snapshot_offscreen_viewport_ = nullptr;
std::vector<xstudio::ui::qt::OffscreenViewport *> offscreen_viewports_;
std::map<utility::Uuid, caf::actor> video_output_plugins_;
Expand Down
Loading
Loading