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

Support for building with Shiboken2 in Gui #698

Merged
merged 4 commits into from
Dec 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Engine/AppInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,22 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
virtual void warningDialog(const std::string & title, const std::string & message, bool* stopAsking, bool useHtml) const;
virtual void informationDialog(const std::string & title, const std::string & message, bool useHtml) const;
virtual void informationDialog(const std::string & title, const std::string & message, bool* stopAsking, bool useHtml) const;
virtual StandardButtonEnum questionDialog(const std::string & title,
virtual NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & title,
const std::string & message,
bool useHtml,
StandardButtons buttons =
StandardButtons(eStandardButtonYes | eStandardButtonNo),
StandardButtonEnum defaultButton = eStandardButtonNoButton) const WARN_UNUSED_RETURN;
NATRON_ENUM::StandardButtons buttons =
NATRON_ENUM::StandardButtons(NATRON_ENUM::eStandardButtonYes | NATRON_ENUM::eStandardButtonNo),
NATRON_ENUM::StandardButtonEnum defaultButton = NATRON_ENUM::eStandardButtonNoButton) const WARN_UNUSED_RETURN;

/**
* @brief Asks a question to the user and returns the reply.
* @param stopAsking Set to true if the user do not want Natron to ask the question again.
**/
virtual StandardButtonEnum questionDialog(const std::string & /*title*/,
virtual NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & /*title*/,
const std::string & /*message*/,
bool /*useHtml*/,
StandardButtons /*buttons*/,
StandardButtonEnum /*defaultButton*/,
NATRON_ENUM::StandardButtons /*buttons*/,
NATRON_ENUM::StandardButtonEnum /*defaultButton*/,
bool* /*stopAsking*/)
{
return eStandardButtonYes;
Expand Down Expand Up @@ -285,7 +285,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
{
}

ViewerColorSpaceEnum getDefaultColorSpaceForBitDepth(ImageBitDepthEnum bitdepth) const;
NATRON_ENUM::ViewerColorSpaceEnum getDefaultColorSpaceForBitDepth(NATRON_ENUM::ImageBitDepthEnum bitdepth) const;

double getProjectFrameRate() const;

Expand Down
40 changes: 24 additions & 16 deletions Gui/Gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ CONFIG += boost opengl qt cairo python shiboken pyside
QT += gui core opengl network
greaterThan(QT_MAJOR_VERSION, 4): QT += concurrent

greaterThan(QT_MAJOR_VERSION, 4) {
GUI_WRAPPER_DIR = Qt$${QT_MAJOR_VERSION}/NatronGui
ENGINE_WRAPPER_DIR = Qt$${QT_MAJOR_VERSION}/NatronEngine
} else {
GUI_WRAPPER_DIR = NatronGui
ENGINE_WRAPPER_DIR = NatronEngine
}

CONFIG += glad-flags

include(../global.pri)
Expand All @@ -50,7 +58,7 @@ DEPENDPATH += $$PWD/../Engine
DEPENDPATH += $$PWD/../Global

INCLUDEPATH += $$PWD/../Engine
INCLUDEPATH += $$PWD/../Engine/NatronEngine
INCLUDEPATH += $$PWD/../Engine/$$ENGINE_WRAPPER_DIR
INCLUDEPATH += $$PWD/../Global

#qhttpserver
Expand Down Expand Up @@ -218,13 +226,7 @@ SOURCES += \
ViewerTabPrivate.cpp \
ViewerToolButton.cpp \
ticks.cpp \
NatronGui/guiapp_wrapper.cpp \
NatronGui/pyguiapplication_wrapper.cpp \
NatronGui/pymodaldialog_wrapper.cpp \
NatronGui/pypanel_wrapper.cpp \
NatronGui/pytabwidget_wrapper.cpp \
NatronGui/pyviewer_wrapper.cpp \
NatronGui/natrongui_module_wrapper.cpp \
$${GUI_WRAPPER_DIR}/natrongui_module_wrapper.cpp \

HEADERS += \
AboutWindow.h \
Expand Down Expand Up @@ -325,7 +327,6 @@ HEADERS += \
PropertiesBinWrapper.h \
PyGlobalGui.h \
PyGuiApp.h \
Pyside_Gui_Python.h \
PythonPanels.h \
QtColorTriangle.h \
QtEnumConvert.h \
Expand Down Expand Up @@ -381,13 +382,20 @@ HEADERS += \
../libs/OpenFX/include/nuke/fnPublicOfxExtensions.h \
../libs/OpenFX/include/tuttle/ofxReadWrite.h \
../libs/OpenFX_extensions/ofxhParametricParam.h \
NatronGui/guiapp_wrapper.h \
NatronGui/natrongui_python.h \
NatronGui/pyguiapplication_wrapper.h \
NatronGui/pymodaldialog_wrapper.h \
NatronGui/pypanel_wrapper.h \
NatronGui/pytabwidget_wrapper.h \
NatronGui/pyviewer_wrapper.h
$${GUI_WRAPPER_DIR}/natrongui_python.h \

GUI_GENERATED_SOURCES = \
guiapp_wrapper \
pyguiapplication_wrapper \
pymodaldialog_wrapper \
pypanel_wrapper \
pytabwidget_wrapper \
pyviewer_wrapper

for(name, GUI_GENERATED_SOURCES) {
SOURCES += $${GUI_WRAPPER_DIR}/$${name}.cpp
HEADERS += $${GUI_WRAPPER_DIR}/$${name}.h
}

RESOURCES += \
GuiResources.qrc
Expand Down
12 changes: 6 additions & 6 deletions Gui/GuiAppInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
virtual void warningDialog(const std::string & title, const std::string & message, bool* stopAsking, bool useHtml) const OVERRIDE FINAL;
virtual void informationDialog(const std::string & title, const std::string & message, bool useHtml) const OVERRIDE FINAL;
virtual void informationDialog(const std::string & title, const std::string & message, bool* stopAsking, bool useHtml) const OVERRIDE FINAL;
virtual StandardButtonEnum questionDialog(const std::string & title,
virtual NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & title,
const std::string & message,
bool useHtml,
StandardButtons buttons = StandardButtons(eStandardButtonYes | eStandardButtonNo),
StandardButtonEnum defaultButton = eStandardButtonNoButton) const OVERRIDE FINAL WARN_UNUSED_RETURN;
virtual StandardButtonEnum questionDialog(const std::string & title,
NATRON_ENUM::StandardButtons buttons = NATRON_ENUM::StandardButtons(NATRON_ENUM::eStandardButtonYes | NATRON_ENUM::eStandardButtonNo),
NATRON_ENUM::StandardButtonEnum defaultButton = NATRON_ENUM::eStandardButtonNoButton) const OVERRIDE FINAL WARN_UNUSED_RETURN;
virtual NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & title,
const std::string & message,
bool useHtml,
StandardButtons buttons,
StandardButtonEnum defaultButton,
NATRON_ENUM::StandardButtons buttons,
NATRON_ENUM::StandardButtonEnum defaultButton,
bool* stopAsking) OVERRIDE FINAL WARN_UNUSED_RETURN;
virtual void loadProjectGui(bool isAutosave, boost::archive::xml_iarchive & archive) const OVERRIDE FINAL;
virtual void saveProjectGui(boost::archive::xml_oarchive & archive) OVERRIDE FINAL;
Expand Down
8 changes: 4 additions & 4 deletions Gui/GuiApplicationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
return false;
}

void getIcon(PixmapEnum e, QPixmap* pix) const;
void getIcon(PixmapEnum e, int size, QPixmap* pix) const;
void getIcon(NATRON_ENUM::PixmapEnum e, QPixmap* pix) const;
void getIcon(NATRON_ENUM::PixmapEnum e, int size, QPixmap* pix) const;

void setKnobClipBoard(KnobClipBoardType type,
void setKnobClipBoard(NATRON_ENUM::KnobClipBoardType type,
const KnobIPtr& serialization,
int dimension);


void getKnobClipBoard(KnobClipBoardType *type,
void getKnobClipBoard(NATRON_ENUM::KnobClipBoardType *type,
KnobIPtr* serialization,
int *dimension) const;

Expand Down
29 changes: 29 additions & 0 deletions Gui/PySide2_Gui_Python.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* ***** BEGIN LICENSE BLOCK *****
* This file is part of Natron <https://natrongithub.github.io/>,
* (C) 2018-2021 The Natron developers
* (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat
*
* Natron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Natron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
* ***** END LICENSE BLOCK ***** */


#ifndef PYSIDE2_ENGINE_PYTHON_H
#define PYSIDE2_ENGINE_PYTHON_H

// Defined for shiboken2-specific tweaks
#define SBK2_RUN

#include "Pyside_Gui_Python.h"

#endif // PYSIDE2_ENGINE_PYTHON_H
11 changes: 8 additions & 3 deletions Gui/Pyside_Gui_Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
* ***** END LICENSE BLOCK ***** */

//Defined to avoid including some headers when running shiboken which may crash shiboken (particularly boost headers)
#define SBK_RUN

#ifndef PYSIDE_GUI_PYTHON_H
#define PYSIDE_GUI_PYTHON_H

Expand All @@ -28,10 +31,12 @@

#include "Global/Macros.h"

//Defined to avoid including some headers when running shiboken which may crash shiboken (particularly boost headers)
#define SBK_RUN

#ifdef SBK2_RUN
#include <pyside2_global.h>
#else
#include <pyside_global.h>
#endif

#include <QtGui/qpytextobject.h>

//Global
Expand Down
14 changes: 14 additions & 0 deletions Gui/PythonPanels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,20 @@ PyModalDialog::getParam(const QString& scriptName) const
return Effect::createParamWrapperForKnob(knob);
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QSize
PyModalDialog::minimumSizeHint() const
{
return QWidget::minimumSizeHint();
}

QSize
PyModalDialog::sizeHint() const
{
return QWidget::sizeHint();
}
#endif

struct PyPanelPrivate
{
DialogParamHolder* holder;
Expand Down
12 changes: 9 additions & 3 deletions Gui/PythonPanels.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "Global/Macros.h"

#if !defined(Q_MOC_RUN) && !defined(SBK_RUN)
#if (!defined(Q_MOC_RUN) && !defined(SBK_RUN)) || defined(SBK2_RUN)
#include <boost/scoped_ptr.hpp>
#endif

Expand Down Expand Up @@ -76,7 +76,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
virtual void initializeKnobs() OVERRIDE FINAL {}

virtual bool onKnobValueChanged(KnobI* k,
ValueChangedReasonEnum reason,
NATRON_ENUM::ValueChangedReasonEnum reason,
double time,
ViewSpec view,
bool originatedFromMainThread) OVERRIDE FINAL;
Expand All @@ -93,7 +93,7 @@ class PyModalDialog
public:

PyModalDialog( Gui* gui,
StandardButtons defaultButtons = StandardButtons(eStandardButtonOk | eStandardButtonCancel) );
NATRON_ENUM::StandardButtons defaultButtons = NATRON_ENUM::StandardButtons(NATRON_ENUM::eStandardButtonOk | NATRON_ENUM::eStandardButtonCancel) );

virtual ~PyModalDialog();

Expand All @@ -105,6 +105,12 @@ class PyModalDialog

void addWidget(QWidget* widget);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
virtual QSize minimumSizeHint() const OVERRIDE FINAL;

virtual QSize sizeHint() const OVERRIDE FINAL;
#endif

DialogParamHolder* getKnobsHolder() const;

private:
Expand Down
2 changes: 2 additions & 0 deletions Gui/typesystem_natronGui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

<!--Load QtGui typesystem-->
<load-typesystem name="typesystem_gui.xml" generate="no" />
<!--Load QtWidgets typesystem-->
YakoYakoYokuYoku marked this conversation as resolved.
Show resolved Hide resolved
<load-typesystem name="typesystem_widgets.xml" generate="no" />
<!--Load Engine typesystem-->
<load-typesystem name="typesystem_engine.xml" generate="no" />

Expand Down
4 changes: 4 additions & 0 deletions Shiboken/typesystem_widgets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<typesystem package="SnakeOil">
<!-- This is a placeholder typesystem only meant to be used for shiboken 1.2 generation -->
</typesystem>
4 changes: 4 additions & 0 deletions tools/utils/runPostShiboken.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ NATRON_PYTHON_NAMESPACE_EXIT NATRON_NAMESPACE_EXIT@g' -i'.bak' Engine/NatronEng
sed -e 's@NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::NATRON_NAMESPACE@NATRON_NAMESPACE@g' -i'.bak' Engine/NatronEngine/natronengine_python.h Gui/NatronGui/natrongui_python.h
sed -e 's@NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::NATRON_ENUM@NATRON_ENUM@g' -i'.bak' Engine/NatronEngine/natronengine_python.h Gui/NatronGui/natrongui_python.h

perl -pe 'BEGIN{undef $/;} s/ \{\n.*SnakeOil(.*\n)*.*SnakeOil.*\n }//g;' -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp
sed -e '/SnakeOil/d' -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp
sed -e '/snakeoil_python/d' -i'.bak' Gui/NatronGui/natrongui_python.h

sed -e 's@^#include <pysidemetafunction.h>$@CLANG_DIAG_OFF(header-guard)\
#include <pysidemetafunction.h> // has wrong header guards in pyside 1.2.2@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp

Expand Down
50 changes: 27 additions & 23 deletions tools/utils/runPostShiboken2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ PYV="${1:-2}"

# To be run after shiboken to fix errors

sed -e '/<destroylistener.h>/d' -i'.bak' Engine/NatronEngine5/*.cpp
sed -e '/<destroylistener.h>/d' -i'.bak' Gui/NatronGui5/*.cpp
sed -e "/SbkPySide${PYV}_QtCoreTypes;/d" -i'.bak' Gui/NatronGui5/natrongui_module_wrapper.cpp
sed -e "/SbkPySide${PYV}_QtCoreTypeConverters;/d" -i'.bak' Gui/NatronGui5/natrongui_module_wrapper.cpp
sed -e '/SbkNatronEngineTypes;/d' -i'.bak' Gui/NatronGui5/natrongui_module_wrapper.cpp
sed -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' Gui/NatronGui5/natrongui_module_wrapper.cpp
sed -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' Gui/NatronGui5/natrongui_module_wrapper.cpp
sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Engine/NatronEngine5/*.cpp
sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Gui/NatronGui5/*.cpp
sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Engine/NatronEngine5/*.cpp
sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Gui/NatronGui5/*.cpp
sed -e '/<destroylistener.h>/d' -i'.bak' Engine/Qt5/NatronEngine/*.cpp
sed -e '/<destroylistener.h>/d' -i'.bak' Gui/Qt5/NatronGui/*.cpp
sed -e "/SbkPySide${PYV}_QtCoreTypes;/d" -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp
sed -e "/SbkPySide${PYV}_QtCoreTypeConverters;/d" -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp
sed -e '/SbkNatronEngineTypes;/d' -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp
sed -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp
sed -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp
sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Engine/Qt5/NatronEngine/*.cpp
sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Gui/Qt5/NatronGui/*.cpp
sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Engine/Qt5/NatronEngine/*.cpp
sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Gui/Qt5/NatronGui/*.cpp

# fix warnings
sed -e 's@^#include <shiboken.h>$@#include "Global/Macros.h"\
Expand All @@ -45,44 +45,48 @@ GCC_DIAG_OFF(missing-field-initializers)\
GCC_DIAG_OFF(missing-declarations)\
GCC_DIAG_OFF(uninitialized)\
GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF\
#include <shiboken.h> // produces many warnings@' -i'.bak' Engine/NatronEngine5/*.cpp Gui/NatronGui5/*.cpp
#include <pysidesignal.h>\
#include <shiboken.h> // produces many warnings@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp

sed -e 's@// inner classes@// inner classes\
NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/NatronEngine5/*.cpp Gui/NatronGui5/*.cpp
NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp
sed -e 's@// Extra includes@// Extra includes\
NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/Qt5/NatronEngine/natronengine_module_wrapper.cpp Gui/Qt5/NatronGui/natrongui_module_wrapper.cpp

# replace NATRON_NAMESPACE with Natron for enums with flags (e.g. StandardButtonEnum)
sed -e 's@"1:NatronEngine\.NATRON_NAMESPACE@"1:NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"1:NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' Engine/NatronEngine5/*_wrapper.cpp
sed -e 's@"1:NatronEngine\.NATRON_NAMESPACE@"1:NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"1:NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' Engine/Qt5/NatronEngine/*_wrapper.cpp

# re-add the Natron namespace
#sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/NatronEngine5/*.cpp Engine/NatronEngine5/*.h Gui/NatronGui5/*.cpp Gui/NatronGui5/*.h
#sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Engine/Qt5/NatronEngine/*.h Gui/Qt5/NatronGui/*.cpp Gui/Qt5/NatronGui/*.h

sed -e 's@SbkType< ::\(\(QFlags<\)\?Natron::.*\) >@SbkType< \1 >@g' -i Engine/NatronEngine5/natronengine_python.h
sed -e 's@SbkType< ::@SbkType<NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::@g' -e 's@SbkType<Natron::QFlags<@SbkType< ::QFlags<NATRON_NAMESPACE::@g' -e's@NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::Rect@NATRON_NAMESPACE::Rect@g' -i'.bak' Engine/NatronEngine5/natronengine_python.h Gui/NatronGui5/natrongui_python.h
# sed -e 's@SbkType< ::\(\(QFlags<\)\?Natron::.*\) >@SbkType< \1 >@g' -i Engine/Qt5/NatronEngine/natronengine_python.h
sed -e 's@SbkType< ::@SbkType<NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::@g' -e 's@SbkType<NATRON_NAMESPACE.*::QFlags<@SbkType< ::QFlags<::@g' -e's@NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::Rect@NATRON_NAMESPACE::Rect@g' -i'.bak' Engine/Qt5/NatronEngine/natronengine_python.h Gui/Qt5/NatronGui/natrongui_python.h
sed -e 's@^class @NATRON_NAMESPACE_ENTER NATRON_PYTHON_NAMESPACE_ENTER\
class @g;T;{:y;/^};/! {n;by}};s@^};@};\
NATRON_PYTHON_NAMESPACE_EXIT NATRON_NAMESPACE_EXIT@g' -i'.bak' Engine/NatronEngine5/*.h Gui/NatronGui5/*.h
NATRON_PYTHON_NAMESPACE_EXIT NATRON_NAMESPACE_EXIT@g' -i'.bak' Engine/Qt5/NatronEngine/*.h Gui/Qt5/NatronGui/*.h

# replace NATRON_NAMESPACE::NATRON_NAMESPACE with NATRON_NAMESPACE in the enums wrappers
sed -e 's@NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::NATRON_NAMESPACE@NATRON_NAMESPACE@g' -i'.bak' Engine/NatronEngine5/natronengine_python.h Gui/NatronGui5/natrongui_python.h
sed -e 's@NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::NATRON_NAMESPACE@NATRON_NAMESPACE@g' -i'.bak' Engine/Qt5/NatronEngine/natronengine_python.h Gui/Qt5/NatronGui/natrongui_python.h
sed -e 's@NATRON_NAMESPACE::NATRON_PYTHON_NAMESPACE::NATRON_ENUM@NATRON_ENUM@g' -i'.bak' Engine/Qt5/NatronEngine/natronengine_python.h Gui/Qt5/NatronGui/natrongui_python.h

sed -e 's@^#include <pysidemetafunction.h>$@CLANG_DIAG_OFF(header-guard)\
#include <pysidemetafunction.h> // has wrong header guards in pyside 1.2.2@' -i'.bak' Engine/NatronEngine5/*.cpp Gui/NatronGui5/*.cpp
#include <pysidemetafunction.h> // has wrong header guards in pyside 1.2.2@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp

sed -e 's@^#include <pyside'${PYV}'_qtcore_python.h>$@CLANG_DIAG_OFF(deprecated)\
CLANG_DIAG_OFF(uninitialized)\
CLANG_DIAG_OFF(keyword-macro)\
#include <pyside'${PYV}'_qtcore_python.h> // produces warnings\
CLANG_DIAG_ON(deprecated)\
CLANG_DIAG_ON(uninitialized)\
CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine5/*.cpp Gui/NatronGui5/*.cpp Engine/NatronEngine5/*.h Gui/NatronGui5/*.h
CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp Engine/Qt5/NatronEngine/*.h Gui/Qt5/NatronGui/*.h

sed -e 's@^#include <pyside'${PYV}'_qtgui_python.h>$@CLANG_DIAG_OFF(deprecated)\
CLANG_DIAG_OFF(uninitialized)\
CLANG_DIAG_OFF(keyword-macro)\
#include <pyside'${PYV}'_qtgui_python.h> // produces warnings\
CLANG_DIAG_ON(deprecated)\
CLANG_DIAG_ON(uninitialized)\
CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine5/*.cpp Gui/NatronGui5/*.cpp Engine/NatronEngine5/*.h Gui/NatronGui5/*.h
CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/Qt5/NatronEngine/*.cpp Gui/Qt5/NatronGui/*.cpp Engine/Qt5/NatronEngine/*.h Gui/Qt5/NatronGui/*.h

# clean up
rm Gui/NatronGui5/*.bak Engine/NatronEngine5/*.bak
rm Gui/Qt5/NatronGui/*.bak Engine/Qt5/NatronEngine/*.bak