From ea9442c585b2dc6d6f97788d806ab4aebf300a6c Mon Sep 17 00:00:00 2001 From: Exeldro Date: Thu, 25 Jan 2024 17:58:00 +0100 Subject: [PATCH] Add show filter to nvidia ar move filter settings --- .github/workflows/build.yml | 20 +------------------ data/locale/en-US.ini | 1 + nvidia-move-filter.c | 38 ++++++++++++++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1d41d0..950eac2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -292,20 +292,6 @@ jobs: with: name: 'installer-files' path: . - - name: Create Code Signing Certificate - if: success() && github.event_name != 'pull_request' - run: | - New-Item -ItemType directory -Path certificate - Set-Content -Path certificate\certificate.txt -Value '${{ secrets.CERTIFICATE }}' - certutil -decode certificate\certificate.txt certificate\certificate.pfx - - name: Code Sign 32 - if: success() && github.event_name != 'pull_request' - run: | - & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.CERTIFICATE_PASS }}' /t http://timestamp.comodoca.com/authenticode .\package\obs-plugins\32bit\${{ env.PLUGIN_NAME }}.dll - - name: Code Sign 64 - if: success() && github.event_name != 'pull_request' - run: | - & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.CERTIFICATE_PASS }}' /t http://timestamp.comodoca.com/authenticode .\package\obs-plugins\64bit\${{ env.PLUGIN_NAME }}.dll - name: Publish zip if: success() uses: actions/upload-artifact@v3.1.1 @@ -319,10 +305,6 @@ jobs: - name: "Package Installer (Compile)" run: | & 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /Qp ".\installer.iss" - - name: Code Sign Installer - if: success() && github.event_name != 'pull_request' - run: | - & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64/signtool.exe' sign /f certificate\certificate.pfx /p '${{ secrets.CERTIFICATE_PASS }}' /t http://timestamp.comodoca.com/authenticode .\package\${{ env.PLUGIN_NAME }}-installer.exe - name: Publish installer if: success() uses: actions/upload-artifact@v3.1.1 @@ -332,4 +314,4 @@ jobs: - name: Remove temp artifacts uses: geekyeggo/delete-artifact@v2.0.0 with: - name: "${{ env.FILE_NAME_X86 }}\n${{ env.FILE_NAME_X64 }}\ninstaller-files" + name: "${{ env.FILE_NAME_X86 }}\n${{ env.FILE_NAME_X64 }}" diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index 3aed341..07bb6ea 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -90,6 +90,7 @@ StopTrigger="Stop Trigger" StopTrigger.None="None: stop only when the move is done or this filter is disabled" Actions="Actions" Action="Action" +Show="Show" SimultaneousMove="Simultaneous Move" SimultaneousMove.None="None" NextMove="Next Move" diff --git a/nvidia-move-filter.c b/nvidia-move-filter.c index f2b3f41..c645a28 100644 --- a/nvidia-move-filter.c +++ b/nvidia-move-filter.c @@ -1453,12 +1453,37 @@ bool nv_move_actions_changed(void *priv, obs_properties_t *props, struct dstr name = {0}; long long actions = obs_data_get_int(settings, "actions"); bool changed = false; + obs_property_t *show = obs_properties_get(props, "show"); + long long f = obs_data_get_int(settings, "show"); for (long long i = 1; i <= MAX_ACTIONS; i++) { dstr_printf(&name, "action_%lld_group", i); obs_property_t *group = obs_properties_get(props, name.array); - if (obs_property_visible(group) == (i <= actions)) + + if (i > actions) { + obs_property_list_item_remove(show, (size_t)i); + } else { + const char *od = + obs_property_list_item_name(show, (size_t)i); + dstr_printf(&name, "action_%lld_description", i); + const char *nd = + obs_data_get_string(settings, name.array); + if (strlen(nd)) { + dstr_copy(&name, nd); + } else { + dstr_printf(&name, "%s %lld", + obs_module_text("Action"), i); + } + if (!od || strcmp(od, name.array) != 0) { + obs_property_list_item_remove(show, (size_t)i); + obs_property_list_insert_int(show, (size_t)i, + name.array, i); + changed = true; + } + } + bool visible = (i <= actions) && (f > 0 ? i == f : true); + if (obs_property_visible(group) == visible) continue; - obs_property_set_visible(group, i <= actions); + obs_property_set_visible(group, visible); changed = true; } dstr_free(&name); @@ -1858,7 +1883,7 @@ static obs_properties_t *nv_move_properties(void *data) struct nvidia_move_info *filter = (struct nvidia_move_info *)data; obs_properties_t *props = obs_properties_create(); - if (filter->last_error) { + if (filter && filter->last_error) { obs_property_text_set_info_type( obs_properties_add_text(props, "last_error", filter->last_error, @@ -1872,6 +1897,13 @@ static obs_properties_t *nv_move_properties(void *data) obs_property_set_modified_callback2(p, nv_move_actions_changed, data); + p = obs_properties_add_list(props, "show", obs_module_text("Show"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + + obs_property_list_add_int(p, obs_module_text("All"), 0); + + obs_property_set_modified_callback2(p, nv_move_actions_changed, data); + struct dstr name = {0}; struct dstr description = {0}; for (long long i = 1; i <= MAX_ACTIONS; i++) {