UI: Add `obs_frontend_open_source_interaction()`

Adds a frontend api call to open the interact dialog of a source,
just like the `_properties` and `_filters` functions.
master
tt2468 2021-12-28 16:50:43 -08:00 committed by Jim
parent 466ba5ae29
commit 47397ce527
7 changed files with 34 additions and 0 deletions

View File

@ -618,6 +618,12 @@ struct OBSStudioAPI : obs_frontend_callbacks {
Q_ARG(OBSSource, OBSSource(source)));
}
void obs_frontend_open_source_interaction(obs_source_t *source) override
{
QMetaObject::invokeMethod(main, "OpenInteraction",
Q_ARG(OBSSource, OBSSource(source)));
}
char *obs_frontend_get_current_record_output_path(void) override
{
const char *recordOutputPath = main->GetCurrentOutputPath();

View File

@ -547,6 +547,12 @@ void obs_frontend_open_source_filters(obs_source_t *source)
c->obs_frontend_open_source_filters(source);
}
void obs_frontend_open_source_interaction(obs_source_t *source)
{
if (callbacks_valid())
c->obs_frontend_open_source_interaction(source);
}
char *obs_frontend_get_current_record_output_path(void)
{
return !!callbacks_valid()

View File

@ -220,6 +220,7 @@ EXPORT void obs_frontend_reset_video(void);
EXPORT void obs_frontend_open_source_properties(obs_source_t *source);
EXPORT void obs_frontend_open_source_filters(obs_source_t *source);
EXPORT void obs_frontend_open_source_interaction(obs_source_t *source);
EXPORT char *obs_frontend_get_current_record_output_path(void);

View File

@ -138,6 +138,8 @@ struct obs_frontend_callbacks {
virtual void
obs_frontend_open_source_properties(obs_source_t *source) = 0;
virtual void obs_frontend_open_source_filters(obs_source_t *source) = 0;
virtual void
obs_frontend_open_source_interaction(obs_source_t *source) = 0;
virtual char *obs_frontend_get_current_record_output_path(void) = 0;
};

View File

@ -6199,6 +6199,15 @@ void OBSBasic::OpenProperties(OBSSource source)
CreatePropertiesWindow(source);
}
void OBSBasic::OpenInteraction(OBSSource source)
{
if (source == nullptr) {
OBSSceneItem item = GetCurrentSceneItem();
source = obs_sceneitem_get_source(item);
}
CreateInteractionWindow(source);
}
void OBSBasic::OpenSceneFilters()
{
OBSScene scene = GetCurrentScene();

View File

@ -1092,6 +1092,7 @@ private slots:
void OpenSceneFilters();
void OpenFilters(OBSSource source = nullptr);
void OpenProperties(OBSSource source = nullptr);
void OpenInteraction(OBSSource source = nullptr);
void EnablePreviewDisplay(bool enable);
void TogglePreview();

View File

@ -749,6 +749,15 @@ Functions
---------------------------------------
.. function:: void *obs_frontend_open_source_interaction(obs_source_t *source)
Opens the interact window of the specified source. Only call if
source has the *OBS_SOURCE_INTERACTION* output flag.
:param source: The source to open the interact window of
---------------------------------------
.. function:: char *obs_frontend_get_current_record_output_path(void)
:return: A new pointer to the current record output path. Free