Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend: Transitions (dock) separation part 1 #11880

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tytan652
Copy link
Collaborator

@tytan652 tytan652 commented Feb 18, 2025

Description

Began to split transitions and transition duration storage from the UI.
Also makes the frontend code rely more on transitions UUID even if those are not preserved between sessions for now.

While this PR remove any kind of reliance on index of a transition, it does not overhaul things to rely only on UUID so there is still reliance on the transition name as an identifier. Same for retaining which transition was inserted last.

Motivation and Context

After multiple tries, I finally managed to separated the transitions data from this combobox, now it needs reviews and testings…

The awaited sequel of #7278, but it's the prequel of the expected sequel.

How Has This Been Tested?

Please tests

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@tytan652 tytan652 added Seeking Testers Build artifacts on CI Enhancement Improvement to existing functionality UI/UX Anything to do with changes or additions to UI/UX elements. labels Feb 18, 2025
@tytan652
Copy link
Collaborator Author

tytan652 commented Feb 18, 2025

@PatTheMav, please just say to avoid mutator even if we check if present beforehand.

Using diffs for every mutator use make the review less readable and uses too much space that github ends up hiding stuff.

@tytan652 tytan652 marked this pull request as draft February 18, 2025 18:24
@PatTheMav
Copy link
Member

@PatTheMav, please just say to avoid mutator even if we check if present beforehand.

Using diffs for every mutator use make the review less readable and uses too much space that github ends up hiding stuff.

I disagree, it is the correct tool for the job to highlight requested changes exactly where they are requested, including the context of the change. Expanding all changes takes a single click and that's a small price to pay for the improved clarity of changes and keeping discussions local to specific changes.

@tytan652
Copy link
Collaborator Author

I think you are mixing up the code selected and the diff that you explicitly type in the review. I'm talking about the second.

@tytan652 tytan652 force-pushed the transitions_dock_separation_part_1 branch from 68ec976 to 6985616 Compare February 18, 2025 19:22
@tytan652 tytan652 marked this pull request as ready for review February 18, 2025 19:22
@tytan652 tytan652 force-pushed the transitions_dock_separation_part_1 branch from 6985616 to 0d91fd9 Compare February 18, 2025 19:27
@tytan652 tytan652 requested a review from PatTheMav February 18, 2025 19:43
std::string uuid = obs_source_get_uuid(tr);

transitions.insert({uuid, tr});
transitionNameToUuids.insert({obs_source_get_name(tr), uuid});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are default transitions not supposed to be also contained in transitionUuids?

Comment on lines +521 to +522
transitionUuids.erase(std::find(transitionUuids.begin(), transitionUuids.end(), currentTransitionUuid));
transitionNameToUuids.erase(obs_source_get_name(tr));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood the C++ docs correctly, erase can take an argument of the key type and will only throw if the comparator itself throws (so providing an std::string key for a non-existent element should just do nothing).

If it is preferred to explicitly use an iterator, I'd rather have that on its own line to make the code more readable, but the shortened form should be sufficient.

I'm more concerned about the second line, as it relies on implicit conversion between char * and std::string. I dunno if that conversion has defined behaviour when a NULL pointer is provided - if it does the code should be safe (as the empty string object will just fail to match anything in the collection).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement to existing functionality Seeking Testers Build artifacts on CI UI/UX Anything to do with changes or additions to UI/UX elements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants