mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-26 00:01:13 -05:00
Fix imported variables / actions not being added to respective tabs
This commit is contained in:
parent
032f5e2fe9
commit
b3bde6c59f
|
|
@ -1,6 +1,7 @@
|
||||||
#include "action-queue.hpp"
|
#include "action-queue.hpp"
|
||||||
#include "obs-module-helper.hpp"
|
#include "obs-module-helper.hpp"
|
||||||
#include "plugin-state-helpers.hpp"
|
#include "plugin-state-helpers.hpp"
|
||||||
|
#include "ui-helpers.hpp"
|
||||||
|
|
||||||
namespace advss {
|
namespace advss {
|
||||||
|
|
||||||
|
|
@ -379,11 +380,24 @@ static bool queueWithNameExists(const std::string &name)
|
||||||
return !GetWeakActionQueueByName(name).expired();
|
return !GetWeakActionQueueByName(name).expired();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void signalImportedQueues(void *varsPtr)
|
||||||
|
{
|
||||||
|
auto queues = std::unique_ptr<std::vector<std::shared_ptr<Item>>>(
|
||||||
|
static_cast<std::vector<std::shared_ptr<Item>> *>(varsPtr));
|
||||||
|
for (const auto &queue : *queues) {
|
||||||
|
ActionQueueSignalManager::Instance()->Add(
|
||||||
|
QString::fromStdString(queue->Name()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ImportQueues(obs_data_t *data)
|
void ImportQueues(obs_data_t *data)
|
||||||
{
|
{
|
||||||
OBSDataArrayAutoRelease array =
|
OBSDataArrayAutoRelease array =
|
||||||
obs_data_get_array(data, "actionQueues");
|
obs_data_get_array(data, "actionQueues");
|
||||||
size_t count = obs_data_array_count(array);
|
size_t count = obs_data_array_count(array);
|
||||||
|
|
||||||
|
auto importedQueues = new std::vector<std::shared_ptr<Item>>;
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
OBSDataAutoRelease arrayElement = obs_data_array_item(array, i);
|
OBSDataAutoRelease arrayElement = obs_data_array_item(array, i);
|
||||||
auto queue = ActionQueue::Create();
|
auto queue = ActionQueue::Create();
|
||||||
|
|
@ -392,7 +406,10 @@ void ImportQueues(obs_data_t *data)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
queues.emplace_back(queue);
|
queues.emplace_back(queue);
|
||||||
|
importedQueues->emplace_back(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QeueUITask(signalImportedQueues, importedQueues);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::weak_ptr<ActionQueue> GetWeakActionQueueByName(const std::string &name)
|
std::weak_ptr<ActionQueue> GetWeakActionQueueByName(const std::string &name)
|
||||||
|
|
|
||||||
|
|
@ -166,4 +166,9 @@ std::string GetThemeTypeName()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QeueUITask(void (*task)(void *param), void *param)
|
||||||
|
{
|
||||||
|
obs_queue_task(OBS_TASK_UI, task, param, false);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,6 @@ EXPORT void DisplayTrayMessage(const QString &title, const QString &msg,
|
||||||
|
|
||||||
EXPORT std::string GetThemeTypeName();
|
EXPORT std::string GetThemeTypeName();
|
||||||
|
|
||||||
|
void QeueUITask(void (*task)(void *param), void *param);
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "variable.hpp"
|
#include "variable.hpp"
|
||||||
#include "math-helpers.hpp"
|
#include "math-helpers.hpp"
|
||||||
#include "obs-module-helper.hpp"
|
#include "obs-module-helper.hpp"
|
||||||
|
#include "ui-helpers.hpp"
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
|
@ -375,11 +376,23 @@ void LoadVariables(obs_data_t *obj)
|
||||||
obs_data_array_release(variablesArray);
|
obs_data_array_release(variablesArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void signalImportedVariables(void *varsPtr)
|
||||||
|
{
|
||||||
|
auto vars = std::unique_ptr<std::vector<std::shared_ptr<Item>>>(
|
||||||
|
static_cast<std::vector<std::shared_ptr<Item>> *>(varsPtr));
|
||||||
|
for (const auto &var : *vars) {
|
||||||
|
VariableSignalManager::Instance()->Add(
|
||||||
|
QString::fromStdString(var->Name()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ImportVariables(obs_data_t *data)
|
void ImportVariables(obs_data_t *data)
|
||||||
{
|
{
|
||||||
obs_data_array_t *array = obs_data_get_array(data, "variables");
|
obs_data_array_t *array = obs_data_get_array(data, "variables");
|
||||||
size_t count = obs_data_array_count(array);
|
size_t count = obs_data_array_count(array);
|
||||||
|
|
||||||
|
auto importedVars = new std::vector<std::shared_ptr<Item>>;
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
obs_data_t *arrayElement = obs_data_array_item(array, i);
|
obs_data_t *arrayElement = obs_data_array_item(array, i);
|
||||||
auto var = Variable::Create();
|
auto var = Variable::Create();
|
||||||
|
|
@ -391,9 +404,12 @@ void ImportVariables(obs_data_t *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
GetVariables().emplace_back(var);
|
GetVariables().emplace_back(var);
|
||||||
|
importedVars->emplace_back(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_data_array_release(array);
|
obs_data_array_release(array);
|
||||||
|
|
||||||
|
QeueUITask(signalImportedVariables, importedVars);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::chrono::high_resolution_clock::time_point GetLastVariableChangeTime()
|
std::chrono::high_resolution_clock::time_point GetLastVariableChangeTime()
|
||||||
|
|
|
||||||
|
|
@ -33,4 +33,6 @@ std::string GetThemeTypeName()
|
||||||
return "Dark";
|
return "Dark";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QeueUITask(void (*task)(void *param), void *) {}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user