mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Utils: Add GetSceneTransitionByName
This commit is contained in:
parent
e05be47847
commit
5cbf439f55
@ -133,6 +133,7 @@ namespace Utils {
|
||||
|
||||
namespace SearchHelper {
|
||||
obs_hotkey_t *GetHotkeyByName(std::string name);
|
||||
obs_source_t *GetSceneTransitionByName(std::string name); // Increments source ref. Use OBSSourceAutoRelease
|
||||
obs_sceneitem_t *GetSceneItemByName(obs_scene_t *scene, std::string name); // Increments ref. Use OBSSceneItemAutoRelease
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,26 @@ obs_hotkey_t *Utils::Obs::SearchHelper::GetHotkeyByName(std::string name)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Increments source ref. Use OBSSourceAutoRelease
|
||||
obs_source_t *Utils::Obs::SearchHelper::GetSceneTransitionByName(std::string name)
|
||||
{
|
||||
obs_frontend_source_list transitionList = {};
|
||||
obs_frontend_get_transitions(&transitionList);
|
||||
|
||||
obs_source_t *ret = nullptr;
|
||||
for (size_t i = 0; i < transitionList.sources.num; i++) {
|
||||
obs_source_t *transition = transitionList.sources.array[i];
|
||||
if (obs_source_get_name(transition) == name) {
|
||||
ret = obs_source_get_ref(transition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
obs_frontend_source_list_free(&transitionList);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Increments item ref. Use OBSSceneItemAutoRelease
|
||||
obs_sceneitem_t *Utils::Obs::SearchHelper::GetSceneItemByName(obs_scene_t *scene, std::string name)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user