-
Notifications
You must be signed in to change notification settings - Fork 345
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
Support for building with Shiboken2 in Gui #698
Conversation
21c42a2
to
76a8e7a
Compare
Hi, After merging the Engine PR, I had to re-add ENgine/NatronEngine/natron_namespace_wrapper, because My suggestion:
Could you please make these changes in this PR? |
76a8e7a
to
be706bc
Compare
In reality I wasn't expecting to get the changes in |
RB-2.5 is still WIP, so I'd like to integrate your source code changes ASAP, making sure they don't break Qt4/PySide. It's OK if we break the build a few times in the process (and that would be nice to have at least working github actions in place to do early checks). The goal is to release 2.5 with Qt4/PySide/Python3, with your non-breaking changes for Qt5/PySide2 integrated in the source code. Then we will hopefully be able to start working on 2.6 with Qt5/PySide2/Python3. There may be some platform-dependent graphical stuff to fix. the master branch also builds with Qt5 and has a few graphical goodies that we may want to backport. |
be706bc
to
8e50548
Compare
Due to the merge of #704 there are no more blockers for this PR, marking as ready. |
I had forgotten to post my comment above, can you check that? |
Thank you very much for your work. It seems like you managed to add shiboken2/pyside2 support with very little sourcecode change, and I'm very grateful for that. |
Did you ever try to build the "master" branch? I don't even know if it still builds, but you may want to look at the UI to see if there are UI/UX bits and improvements that we would want to backport. The master branch is pretty much dead, because the render engine is very buggy and unreliable. And too much code was moved around/refactored to bring back the Natron 2 render engine (which has some bugs and limitations, but seems more reliable overall). |
Never took a look at the |
a42a894
to
873290c
Compare
@devernay any further blockers? |
I didn't have time to check, sorry. Is shiboken 1 still working with this PR? Did you get a chance to check? |
It generated with old Shiboken as well, but it had obviously needed to pass a typesystem location flag ( |
873290c
to
b8d3675
Compare
OK, I am testing with Qt4/shiboken. I have an issue with the previous PR (the Engine one): did you have a specific reason for changing the namespace from "NATRON_NAMESPACE" to "Natron" in the typesystem? This removes all methods that use enums. Switching back to NATRON_NAMESPACE fixes that. Will it break for shiboken2? And a second issue: Engine/NatronEngine/natron_namespace_wrapper.cpp and Engine/NatronEngine/natron_namespace_wrapper.h are not generated in RB-2.5. They were generated correctly in RB-2.4. Can you help me solve that? I don't understand why this happens. |
ok that's because of the changes you did to Global/Enums.h Were they necessary and why? |
The namespace changes were introduced due to issues with the enum generation. Due to the usage of |
Isn't that because you also did that change in the typesystem? We can't affort to break shiboken1 for now, so I'll have to put back NATRON_NAMESPACE both in Enum.h and typesystem_engine.xml Also can you confirm that the inject-code section is not necessary? |
The issue with the enums not being generated was happening even before #697. Shiboken1 during its run doesn't expand
The code injection section is necessary, although the same could be achieved with |
Enums are correctly generated using shiboken1 (I just reverted the relevant changes so that it works as in RB-2.4)/ The shiboken2 solution should not break shiboken1 |
If namespaces work fine in shiboken2, why not simply enable these on shiboken2 in Global/Macros.h? Is there a shiboken2-specifc define? |
Namespaces wouldn't work just fine in shiboken2 as they only support enums and because of that the rest of classes and methods cannot be namespaced. To begin with I'd say that the enums must be placed in a explicit namespace and not a define alias, so that we do not rely on many hacks after generation. In fact, almost all of the |
the enums are in a namespace, see https://github.com/NatronGitHub/Natron/blob/RB-2.5/Global/Enums.h#L32 |
I'm working on a solution (using a fake namespace just for enums) |
@YakoYakoYokuYoku please review #713 |
Can you rebase & fix if necessary? |
860c286
to
a0f5c63
Compare
The only changes were a couple of methods relocations and the $ shiboken --avoid-protected-hack --enable-pyside-extensions \
--include-paths=../Engine:../Global:/usr/include:/usr/include/qt4:/usr/include/PySide \
--typesystem-paths=/usr/share/PySide/typesystems --output-directory=Engine \
Engine/Pyside_Engine_Python.h Engine/typesystem_engine.xml
$ shiboken --avoid-protected-hack --enable-pyside-extensions \
--include-paths=../Engine:../Gui:../Global:/usr/include:/usr/include/qt4:/usr/include/PySide \
--typesystem-paths=/usr/share/PySide/typesystems:Engine:Shiboken --output-directory=Gui \
Gui/Pyside_Gui_Python.h Gui/typesystem_natronGui.xml
$ ./tools/utils/runPostShiboken.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just get rid of that "using namespace" in a header file, and we're good
Thank you! |
For Shiboken1 I have absolutely no idea, Shiboken2 and Shiboken6 do generate the bindings always in alphabetical order. |
ok thanks! |
As a heads-up I'll start submitting for reviews, in the span from days to weeks, changes to make Qt API usages compatible with the 5.15 LTS release with the possibility of 6 support and the deprecation of the old usages. |
what's your shiboken2 command? I can't get shiboken2 to find QDialog on macOS |
and can you please push the shiboken2-generated bindings (no need to PR)? |
Forgot to post it... $ shiboken2 --enable-parent-ctor-heuristic --use-isnull-as-nb_nonzero --avoid-protected-hack \
--include-paths=.:Global:Engine:libs/OpenFX/include:/usr/include/PySide2:/usr/include/QtCore \
--include-paths=/usr/include/QtGui:/usr/include/QtWidgets:/usr/include/python3.9 \
--typesystem-paths=Engine:/usr/share/PySide2/typesystems --output-directory=Gui/Qt5 \
Gui/PySide2_Gui_Python.h Gui/typesystem_natronGui.xml There you go, although that all under both |
no need for |
They are going to be needed if we want to use features like signal and slots in the Python scripts, so I'd pass the flag unless is found to be completely unnecessary. |
I'll have to PR due to the |
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. Additionally, make sure you've done all of these things:
PR Description
What type of PR is this? (Check one of the boxes below)
What does this pull request do?
See the dependant PR. Depends on #697.
Show a few screenshots (if this is a visual change)
N/A yet.
Have you tested your changes (if applicable)? If so, how?
See the dependant PR.
Futher details of this pull request
See the dependant PR.