Compare commits

..

4 Commits

Author SHA1 Message Date
WarmUpTill
bad1a548fb Fix resource table shortcuts conflicting with OBS shortcuts
This could happen when adding the variable tab as a dock.
The problem is visible in the OBS log:
QAction::event: Ambiguous shortcut overload: Del
2025-12-27 20:38:53 +01:00
WarmUpTill
f706416df5 Fix warnings
Some checks failed
debian-build / build (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled
2025-12-21 14:33:08 +01:00
WarmUpTill
c344c88acd Add support for scenes of secondary canvases in source selection 2025-12-21 14:33:08 +01:00
WarmUpTill
2cd9e61717 Adapt paths to new OBS directory structure 2025-12-21 14:33:08 +01:00
11 changed files with 58 additions and 24 deletions

View File

@@ -6,18 +6,18 @@ You have the option to ...
Both methods require [CMake](https://cmake.org/download/).
The plugin can be compiled for OBS 27 and above, although using the latest version of OBS is recommended to support all features.
The plugin can be compiled for OBS 31 and above, although using the latest version of OBS is recommended to support all features.
## Compiling in tree (recommended for development)
This section assumes that you have a working [OBS Studio development environment](https://obsproject.com/wiki/Building-OBS-Studio).
Add the "SceneSwitcher" source directory to your obs-studio source directory under obs-studio/UI/frontend-plugins/:
Add the "SceneSwitcher" source directory to your obs-studio source directory under obs-studio/plugins:
```
cd obs-studio/UI/frontend-plugins/
cd obs-studio/plugins
git clone --recursive https://github.com/WarmUpTill/SceneSwitcher.git
```
Then modify the obs-studio/UI/frontend-plugins/CMakeLists.txt Example and add an entry for the scene switcher:
Then modify the obs-studio/plugins/CMakeLists.txt and add an entry for the scene switcher:
```
add_subdirectory(SceneSwitcher)
```

View File

@@ -65,13 +65,16 @@ ResourceTable::ResourceTable(QWidget *parent, const QString &help,
[openSettings]() { openSettings(); });
auto settingsShortcut = new QShortcut(QKeySequence("F2"), this);
settingsShortcut->setContext(Qt::WidgetWithChildrenShortcut);
QWidget::connect(settingsShortcut, &QShortcut::activated, this,
openSettings);
auto removeShortcut = new QShortcut(QKeySequence("Del"), this);
removeShortcut->setContext(Qt::WidgetWithChildrenShortcut);
QWidget::connect(removeShortcut, &QShortcut::activated, this,
[this]() { Remove(); });
auto newShortcut = new QShortcut(QKeySequence("Ctrl+N"), this);
newShortcut->setContext(Qt::WidgetWithChildrenShortcut);
QWidget::connect(newShortcut, &QShortcut::activated, this,
[this]() { Add(); });
}

View File

@@ -1,4 +1,5 @@
#include "source-helpers.hpp"
#include "canvas-helpers.hpp"
#include <obs-frontend-api.h>
@@ -28,15 +29,43 @@ std::string GetWeakSourceName(obs_weak_source_t *weak_source)
OBSWeakSource GetWeakSourceByName(const char *name)
{
OBSWeakSource weak;
obs_source_t *source = obs_get_source_by_name(name);
OBSSourceAutoRelease source = obs_get_source_by_name(name);
if (source) {
weak = obs_source_get_weak_source(source);
obs_weak_source_release(weak);
obs_source_release(source);
return OBSGetWeakRef(source);
}
return weak;
#if LIBOBS_API_VER > MAKE_SEMANTIC_VERSION(31, 1, 0)
struct SearchData {
const char *name;
OBSWeakSource &scene;
};
static const auto enumCanvasScenes = [](void *dataPtr,
obs_source_t *source) -> bool {
auto data = static_cast<SearchData *>(dataPtr);
if (strcmp(data->name, obs_source_get_name(source)) == 0) {
data->scene = OBSGetWeakRef(source);
return false;
}
return true;
};
static const auto enumCanvases = [](void *dataPtr,
obs_canvas_t *canvas) -> bool {
obs_canvas_enum_scenes(canvas, enumCanvasScenes, dataPtr);
auto data = static_cast<SearchData *>(dataPtr);
return data->scene == nullptr;
};
OBSWeakSource weakScene;
SearchData searchData{name, weakScene};
obs_enum_canvases(enumCanvases, &searchData);
return weakScene;
#else
return nullptr;
#endif
}
OBSWeakSource GetWeakSourceByQString(const QString &name)

View File

@@ -10,7 +10,7 @@ namespace advss {
enum class HotkeyType;
bool CanSimulateKeyPresses();
void PressKeys(const std::vector<HotkeyType> keys, int duration);
void PressKeys(const std::vector<HotkeyType> &keys, int duration);
class Hotkey {
public:

View File

@@ -188,7 +188,7 @@ static const std::unordered_map<HotkeyType, long> keyTable = {
{HotkeyType::Key_NumpadEnter, XK_KP_Enter},
};
void PressKeys(const std::vector<HotkeyType> keys, int duration)
void PressKeys(const std::vector<HotkeyType> &keys, int duration)
{
if (!canSimulateKeyPresses) {
return;

View File

@@ -9,7 +9,7 @@ bool CanSimulateKeyPresses()
return canSimulateKeyPresses;
}
void PressKeys(const std::vector<HotkeyType> keys, int duration)
void PressKeys(const std::vector<HotkeyType> &, int)
{
// Not supported on MacOS
return;

View File

@@ -138,7 +138,7 @@ static const std::unordered_map<HotkeyType, long> keyTable = {
{HotkeyType::Key_NumpadEnter, VK_RETURN},
};
void PressKeys(const std::vector<HotkeyType> keys, int duration)
void PressKeys(const std::vector<HotkeyType> &keys, int duration)
{
const int repeatInterval = 100;

View File

@@ -513,7 +513,7 @@ void ScriptHandler::SetVariableValue(void *, calldata_t *data)
RETURN_SUCCESS();
}
void ScriptHandler::GetRunningStatus(void *ctx, calldata_t *data)
void ScriptHandler::GetRunningStatus(void *, calldata_t *data)
{
calldata_set_bool(data, "is_running", PluginIsRunning());
}

View File

@@ -58,14 +58,16 @@ std::string TwitchChannel::GetUserID(const TwitchToken &token) const
}
OBSDataArrayAutoRelease array = obs_data_get_array(res.data, "data");
size_t count = obs_data_array_count(array);
for (size_t i = 0; i < count; i++) {
OBSDataAutoRelease arrayObj = obs_data_array_item(array, i);
std::string id = obs_data_get_string(arrayObj, "id");
userIDCache[_name] = id;
return id;
if (count == 0) {
userIDCache[_name] = "invalid";
return "invalid";
}
userIDCache[_name] = "invalid";
return "invalid";
OBSDataAutoRelease arrayObj = obs_data_array_item(array, 0);
const std::string id = obs_data_get_string(arrayObj, "id");
userIDCache[_name] = id;
return id;
}
static QDate parseRFC3339Date(const std::string &rfc3339Date)

View File

@@ -448,7 +448,7 @@ void EventSub::StartServerMigrationClient(const std::string &url)
auto client = std::make_unique<EventSubWSClient>();
SetupClient(*client);
client->set_open_handler([this](connection_hdl hdl) {
client->set_open_handler([this](connection_hdl) {
vblog(LOG_INFO, "Twitch EventSub migration client opened");
});

View File

@@ -829,7 +829,7 @@ void TokenGrabberThread::run()
if (_serverThread.joinable()) {
_serverThread.join();
}
_stopWaiting = {false};
_stopWaiting = false;
// Generate URI to request token
auto state = generateStateString();