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

ScriptWindow configuration fixes #6250

Conversation

johnhaddon
Copy link
Member

This fixes a couple of regressions caused by c942d40, which was released in 1.5.3.0. That commit moved the ScriptWindow's __scriptAdded slot to the back of the slot list, while before it had been at the front. This means that ScriptWindows are now created last, after all other scriptAdded slots have run. This is a good thing - letting everyone configure the script how they want, and only then making the UI for it is far more natural.

But we had a couple of configs which were using ScriptWindow.acquire( createIfNecessary = False ), now at a time when the ScriptWindow hasn't been created yet. So they were skipping the configuration of the ScriptWindow that we needed. This PR solves that by introducing a new ScriptWindow.instanceCreatedSignal() which is emitted whenever a ScriptWindow is made, and using that in the configs instead.

I've targeted this PR to a new 1.5.4_maintenance branch with the intention that we'll push the fix out immediately in a 1.5.4.1 release rather than waiting for 1.5.5.0. We want to get this fix out quickly, and there are a couple of extra things we still want to get into 1.5.5.0, and things currently merged that should wait for them. We'll just need to merge 1.5.4_maintenance to 1.5_maintenance after making the release and then we should be back to our regular flow.

This is equivalent to `Editor.instanceCreatedSignal()`, providing opportunities for extensions to customise a ScriptWindow no matter how or when it is created. ScriptWindow and Editor have _very_ similar APIs at this point, and I wonder if at some point ScriptWindow might actually _be_ an Editor?

The motivation for this is that several configs currently use `ScriptWindow.acquire()` in an attempt to get a ScriptWindow when a script is added. But this puts them in a tricky situation :

- If they use `createIfMissing = True` then they are changing the point in time at which the ScriptWindow is created, which has proved fragile in the past.
- If they use `createIfMissing = False` then they risk not receiving a ScriptWindow at all, since they are not in control of the point in time that it _is_ created.

The new `instanceCreatedSignal()` provides a foolproof mechanism for a config to get access to every ScriptWindow while leaving the creation process itself well alone.
This was broken in c942d40, which moved ScriptWindow creation to _after_ the point the config files had run. Which meant that `acquire( createIfMissing = False )` always returned `None` and we never connected to the close signal.
Since c942d40, the ScriptWindow was getting created _after_ our `__scriptAdded()` callback, so we weren't updating it. We now use `ScriptWindow.instanceCreatedSignal()` to ensure we always get it set up, no matter when it is created.
@johnhaddon johnhaddon self-assigned this Jan 31, 2025
@ivanimanishi
Copy link
Member

If you do get a 1.5.4.1 release, can I also request that #6241 be included? That is a requirement for us to get it installed at IE.

Copy link
Contributor

@murraystevenson murraystevenson left a comment

Choose a reason for hiding this comment

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

Thanks John! Looks good to me. Fixes aside, this is quite a nice improvement!

@ivanimanishi Noted! We'll include that fix in a 1.5.4.1 release.

@murraystevenson murraystevenson merged commit 6150f7c into GafferHQ:1.5.4_maintenance Jan 31, 2025
5 checks passed
@johnhaddon johnhaddon deleted the scriptWindowAcquisitionFixes branch February 4, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants