UI: Can copy-paste filters to multiple sources#4334
Conversation
|
The code looks good, but I wonder if it'd be worth warning the user about what they're about to do, especially if they select more than 4 or 5 sources - especially as there currently isn't an Undo button. Additionally, would it be worth making sure the source for the sceneitem is unique, so that the same filters aren't copied to the same source multiple times? |
Is that not what this section does? |
Not exactly. The check ensures that the filter is not pasted to the source it was copied from, but we also should ensure that if two "destination" scene items have the same source, we apply the filter only once. I'm writing the updated patch right now. |
|
An OBS Source can be used to create more than one scene item ("Add Existing" or "Paste Reference"), so getting an OBS source from multiple scene items that use the same source should result in the same OBSSource. I've just tested the current code and I didn't end up with duplicate filters pasted onto another scene item that uses the same OBS Source. Unless I'm missing something? |
|
It looks like Should we rename it to something more appropriate and reuse that? obs-studio/UI/window-basic-main.cpp Lines 5234 to 5245 in fc6e085 obs-studio/UI/window-basic-main.cpp Lines 5247 to 5251 in fc6e085 |
Yes, my initial approach duplicated the filter in the following situation:
|
1ad30f2 to
64d2619
Compare
I see what you mean now, and I observe that behavior too. In that case, since there is a need for unique OBSSource items in the collection, using |
I recently pushed an updated commit which does two things:
|
8bcb698 to
22e36be
Compare
|
May I do anything to advance this PR? |
|
Converting this to draft because I think undo-redo system has a bug #4562 which affects this PR. |
|
As the linked issues are fixed, would you be able to rebase this PR, clang format it, and then verify if all concerns have been dealt with so that it can be undrafted? Thanks! |
|
I rebased this PR and tested manually and it works as expected. |
|
Should I do anything to advance this PR? |
|
Hi, there are merge conflicts. Once the conflicts are resolved, we will perform a final review and/or merge. |
|
Closing as last call for rebasing this PR for proper review went unanswered for now over a year and a half. Can be reopened if a rebase took place and code is ready to be reviewed. |
Description
Fix #4290.
Add support for pasting copied filters to multiple selected sources, instead of only one which was selected first. Instead of calling
GetCurrentSceneItem()which returns the index of the first selected source from the array returned byui->sources->selectionModel()->selectedIndexes(), callui->sources->selectionModel()->selectedIndexes()directly and iterate over all selected sources.Adds confirmation prompt if filter is pasted to more than 4 sources:

Motivation and Context
Reporter of the original bug #4290, @AskMP, works with large numbers of sources. In one comment he mentioned having to copy-paste filters to 48 sources by hand.
How Has This Been Tested?
I a bunch of tests, here are a few:
Test env:
OS: Windows 10 Home 20H2
CPU: Intel(R) Core(TM) i7-10875H
GPU: Nvidia GeForce RTX 2060
It does not affect any other functions because I changed only
OBSBasic::on_actionPasteFilters_triggered()(I considered making a helper function for getting all selected scene items analogous toGetCurrentSceneItem(), but did not find any other function that could benefit from this helper.Types of changes
Checklist: