Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Fix button states on properties refresh #83

Merged
merged 1 commit into from
Nov 21, 2021
Merged
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
5 changes: 5 additions & 0 deletions VSTPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ void VSTPlugin::unloadEffect()
unloadLibrary();
}

bool VSTPlugin::isEditorOpen()
{
return editorWidget ? true : false;
}

void VSTPlugin::openEditor()
{
if (effect && !editorWidget) {
Expand Down
2 changes: 2 additions & 0 deletions headers/VSTPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class VSTPlugin : public QObject {
obs_audio_data *process(struct obs_audio_data *audio);
bool openInterfaceWhenActive = false;

bool isEditorOpen();

public slots:
void openEditor();
void closeEditor();
Expand Down
15 changes: 9 additions & 6 deletions obs-vst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,23 @@ static void fill_out_plugins(obs_property_t *list)

static obs_properties_t *vst_properties(void *data)
{
obs_properties_t *props = obs_properties_create();
obs_property_t * list = obs_properties_add_list(
VSTPlugin * vstPlugin = (VSTPlugin *)data;
obs_properties_t *props = obs_properties_create();
obs_property_t * list = obs_properties_add_list(
props, "plugin_path", PLUG_IN_NAME, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);

fill_out_plugins(list);

obs_properties_add_button(props, OPEN_VST_SETTINGS, OPEN_VST_TEXT, open_editor_button_clicked);

obs_properties_add_button(props, CLOSE_VST_SETTINGS, CLOSE_VST_TEXT, close_editor_button_clicked);
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS), false);

obs_properties_add_bool(props, OPEN_WHEN_ACTIVE_VST_SETTINGS, OPEN_WHEN_ACTIVE_VST_TEXT);
if (vstPlugin->isEditorOpen()) {
obs_property_set_visible(obs_properties_get(props, OPEN_VST_SETTINGS), false);
} else {
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS), false);
}

UNUSED_PARAMETER(data);
obs_properties_add_bool(props, OPEN_WHEN_ACTIVE_VST_SETTINGS, OPEN_WHEN_ACTIVE_VST_TEXT);

return props;
}
Expand Down