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

Fix loading of CreateViews nodes saved from Gaffer 1.5+ #6059

Merged

Conversation

johnhaddon
Copy link
Member

Back in #6015, we improved the way we created and serialised ArrayPlugs. For the most part this all works fine with earlier Gaffer versions, but it created serialisation for CreateViews that would crash in Gaffer 1.3 and 1.4. This PR backports some of the bugfixes from that PR, and then adds a compatibility shim to allow the files to load. As noted in the commit log, I'm not especially happy with this approach, but it will at least be short-lived.

Note : When merging forwards, we should drop all these commits when they reach main.

- Fix error when resizing removed a plug with an input connection. In this case, the "resize when inputs change" behaviour was kicking in during the outer resize and messing everything up.
- Fix failure to resize output plugs, due to attempting to add an input plug as a child.
In 1.5, the `views` array is created with a prototype, and `resize()` is used in the serialisation to add all necessary children. When running `resize()` in 1.3 though, we have no prototype and can't resize. So we make `ArrayPlug::resize()` a no-op in this case and add the plugs on a just-in-time basis in a compatibility config.

I really don't like monkey-patching all ArrayPlugs like this, but it's not possible to monkey-patch individual instances when patching Python's magic methods (of which `__getitem__` is one). We'll rip out all of this code when merging forwards to `main` though, so it won't live for _too_ long.
@danieldresser-ie
Copy link
Contributor

Oh, that is kind of unfortunate ... sorry for causing this mess when I wrote CreateViews :(

Looks like a reasonable solution though, and it's good that it won't be needed on main. LGTM.

Test failures might require a bit of attention though ... does our whitespace checker not like how we write out .gfr files? And have we ever seen it before that testNoUnecessaryUpdates (GafferImageUITest.ImageGadgetTest.ImageGadgetTest) causes a bug on Windows that endlessly spams the log?

@johnhaddon johnhaddon merged commit be7087f into GafferHQ:1.3_maintenance Sep 26, 2024
3 of 5 checks passed
@johnhaddon
Copy link
Member Author

does our whitespace checker not like how we write out .gfr files?

Yeah, there's a trailing newline it doesn't like. Completely harmless, so I haven't yet found the motivation to deal with it.

And have we ever seen it before that testNoUnecessaryUpdates

Yeah, I've seen this a couple of times now - nothing to do with this PR. I will need to find some time to bang my head against a Windows build for a bit sometime soon...but I'm already pretty sure the problem is in the test and not the thing being tested.

@johnhaddon
Copy link
Member Author

sorry for causing this mess when I wrote CreateViews :(

We can share responsibility here - I reviewed it, and I was the one who put the loopholes in ArrayPlug in the first place.

@johnhaddon johnhaddon deleted the arrayPlugForwardCompat branch October 1, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pending release
Development

Successfully merging this pull request may close these issues.

2 participants