Skip to content

libobs, frontend: Fix issues with transition overrides - #14093

Open
Warchamp7 wants to merge 4 commits into
obsproject:masterfrom
Warchamp7:transition-swap-stuff
Open

Warchamp7 wants to merge 4 commits into
obsproject:masterfrom
Warchamp7:transition-swap-stuff

Conversation

@Warchamp7

Copy link
Copy Markdown
Member

Description

Adjusts scene transition logic to interrupt an active transition whenever trying to swap it.

The additional squashme commits perform some additional cleanup and refactoring


  • Rename GetCurrentTransition to getDefaultTransition

This function returns the transition that is currently selected in the transitions dock dropdown menu. This transition is essentially the 'global default' or 'current selection'. The name "current transition" is potentially confusing, as OBS Studio always has a transition source set in channel 0 of the main canvas, thus there is always a 'current' one which may be different from the 'default'.


  • Adjust transition override logic
  • Rename OverrideTransition to swapCurrentTransition

The current logic for transition overrides tracks whether an override is being used via overridingTransition. When the signal for a transition_stop comes in, it then tries to swap back to the 'default' transition if overridingTransition. This can lead to some weird races such as when interrupting a transition and immediately starting a different one, as this PR does.

Much of the logic inside OBSBasic::TransitionToScene already does a bunch of checks for whether to use a quick transition or an override so it is updated to simply use the "default transition" in the absence of those.

  • Fix TBar transition override bug

Another existing bug that stems from a race between libobs and the frontend. After using an override transition via the T Bar, the next attempt to use the T Bar to a scene with no override would fail, as the T Bar would update the transition time before it set the transition, and then fail the check for stillTransitioning in TransitionToScene.

Fixed by using obs_transition_is_active instead which was added very recently, and by moving the transition selection logic into TransitionToScene next to the rest.


  • Fix fade to black bug
  • Adjust UX for fade to black

This is a bug introduced by the above changes, where fading to black would get into a stuck state. Also adjusts the UX slightly so that the Program scene name doesn't change, and so that pressing the fade to black button after fading to black does nothing, instead of un-fading.


Motivation and Context

Scene transitions have a minor optimization via obs_transition_swap_begin / obs_transition_swap_end that avoids having to construct a new gs_texrender_t. However this swap skips a bunch of other transition state, leading to the bug in #11914 where interrupting a transition override could get the output stuck.

Rather than simply copy other state stuff and risk this breaking again in the future, this PR instead prevents swapping active transitions, and adjusts the frontend code to explicitly skip the active transition before trying to swap. This ensures that the frontend only ever tries to swap a transition that is 'at rest'.

Alternative solution to #14086

Fixes #11914

How Has This Been Tested?

The original issue that spurred this investigation was with a scene override in non-studio mode.

Tested transitions between a number of scenes with and without scene overrides. Tested in studio mode and non studio mode. Tested with the default transition set to Cut, Fade, and a Stinger. Tested with scene overrides set to None, Cut, Fade.

Tested with the T Bar for the above permutations as well.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

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

@Warchamp7 Warchamp7 added area/ui-ux Anything to do with changes or additions to UI/UX elements. area/libobs labels Oct 26, 2026

@Warchamp7 Warchamp7 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A few additional contextual notes for reviewers.

Comment on lines +249 to +263
static bool ValidTBarTransition(OBSSource transition)
{
if (!transition) {
return false;
}

QString id = QT_UTF8(obs_source_get_id(transition));

if (id == "cut_transition" || id == "obs_stinger_transition") {
return false;
}

return true;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This function was moved up the file, not created.

Anonymous namespace functions are preferred but trying to keep the changes light.


obs_transition_set_manual_torque(transition, 8.0f, 0.05f);
TransitionToScene(sceneSource, false, false, false, 0, true);
TransitionToScene(sceneSource, false, false, 0, false, true);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is fixing a typo in the arguments here that didn't have any negative side effects thus far since 0 and false are equivalent.

int quickDuration is the fourth argument, not the fifth.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libobs area/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.

Transition Override Prevents Transition (locks Program Scene)

1 participant