From ba44387a4e6401ed96785790ec71de1b88f1ef9c Mon Sep 17 00:00:00 2001 From: Martin Reboredo Date: Wed, 3 Nov 2021 19:44:17 -0300 Subject: [PATCH 1/2] Shiboken2 for NatronEngine --- Engine/AppManager.h | 2 -- Engine/Engine.pro | 2 -- Engine/ImagePlaneDesc.h | 2 -- Engine/Knob.h | 2 -- Engine/PyParameter.h | 3 +++ Engine/PySideCompat.cpp | 2 -- Engine/Pyside_Engine_Python.h | 8 ++++---- Engine/typesystem_engine.xml | 22 +++++++++------------- Global/Enums.h | 10 ---------- Global/GlobalDefines.h | 8 ++++---- global.pri | 2 -- tools/utils/runPostShiboken.sh | 15 ++++++++------- 12 files changed, 28 insertions(+), 50 deletions(-) diff --git a/Engine/AppManager.h b/Engine/AppManager.h index 14ac18a198..5996152796 100644 --- a/Engine/AppManager.h +++ b/Engine/AppManager.h @@ -44,11 +44,9 @@ CLANG_DIAG_ON(deprecated) #include #include -#if !defined(Q_MOC_RUN) && !defined(SBK_RUN) #include #include #include -#endif #include "Engine/AfterQuitProcessingI.h" #include "Engine/Plugin.h" diff --git a/Engine/Engine.pro b/Engine/Engine.pro index 721f49d67f..95c763fb91 100644 --- a/Engine/Engine.pro +++ b/Engine/Engine.pro @@ -238,7 +238,6 @@ SOURCES += \ NatronEngine/intparam_wrapper.cpp \ NatronEngine/itembase_wrapper.cpp \ NatronEngine/layer_wrapper.cpp \ - NatronEngine/natron_namespace_wrapper.cpp \ NatronEngine/natronengine_module_wrapper.cpp \ NatronEngine/nodecreationproperty_wrapper.cpp \ NatronEngine/outputfileparam_wrapper.cpp \ @@ -383,7 +382,6 @@ HEADERS += \ PyParameter.h \ PyRoto.h \ PyTracker.h \ - Pyside_Engine_Python.h \ ReadNode.h \ RectD.h \ RectDSerialization.h \ diff --git a/Engine/ImagePlaneDesc.h b/Engine/ImagePlaneDesc.h index 559207970f..a967a9ac53 100644 --- a/Engine/ImagePlaneDesc.h +++ b/Engine/ImagePlaneDesc.h @@ -31,7 +31,6 @@ #include #include -#if !defined(Q_MOC_RUN) && !defined(SBK_RUN) GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF GCC_DIAG_OFF(unused-parameter) // /opt/local/include/boost/serialization/smart_cast.hpp:254:25: warning: unused parameter 'u' [-Wunused-parameter] @@ -41,7 +40,6 @@ GCC_DIAG_OFF(unused-parameter) #include GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_ON GCC_DIAG_ON(unused-parameter) -#endif #define IMAGEPLANEDESC_SERIALIZATION_INTRODUCES_ID 2 #define IMAGEPLANEDESC_SERIALIZATION_VERSION IMAGEPLANEDESC_SERIALIZATION_INTRODUCES_ID diff --git a/Engine/Knob.h b/Engine/Knob.h index a90fa3c088..1d829e72d8 100644 --- a/Engine/Knob.h +++ b/Engine/Knob.h @@ -33,10 +33,8 @@ #include #include -#if !defined(Q_MOC_RUN) && !defined(SBK_RUN) #include #include -#endif #include #include diff --git a/Engine/PyParameter.h b/Engine/PyParameter.h index e95c0cff11..67f57cd286 100644 --- a/Engine/PyParameter.h +++ b/Engine/PyParameter.h @@ -428,6 +428,7 @@ class Int2DParam Int2DTuple get() const; Int2DTuple get(double frame) const; + using IntParam::set; void set(int x, int y); void set(int x, int y, double frame); }; @@ -444,6 +445,8 @@ class Int3DParam Int3DTuple get() const; Int3DTuple get(double frame) const; + using IntParam::set; + using Int2DParam::set; void set(int x, int y, int z); void set(int x, int y, int z, double frame); }; diff --git a/Engine/PySideCompat.cpp b/Engine/PySideCompat.cpp index 0877733ebe..7441631e36 100644 --- a/Engine/PySideCompat.cpp +++ b/Engine/PySideCompat.cpp @@ -39,10 +39,8 @@ CLANG_DIAG_OFF(mismatched-tags) GCC_DIAG_OFF(unused-parameter) GCC_DIAG_OFF(missing-field-initializers) #include -#include #include #include -#include #include CLANG_DIAG_ON(mismatched-tags) GCC_DIAG_ON(unused-parameter) diff --git a/Engine/Pyside_Engine_Python.h b/Engine/Pyside_Engine_Python.h index 2193eea4a2..915d1ba991 100644 --- a/Engine/Pyside_Engine_Python.h +++ b/Engine/Pyside_Engine_Python.h @@ -17,6 +17,9 @@ * along with Natron. If not, see * ***** END LICENSE BLOCK ***** */ +//Defined to avoid including some headers when running shiboken which may crash shiboken (particularly boost headers) +#define SBK_RUN + #ifndef PYSIDE_ENGINE_PYTHON_H #define PYSIDE_ENGINE_PYTHON_H @@ -33,10 +36,7 @@ * Do not include it when compiling Natron. **/ -//Defined to avoid including some headers when running shiboken which may crash shiboken (particularly boost headers) -#define SBK_RUN - -#include +#include #include //Global #include diff --git a/Engine/typesystem_engine.xml b/Engine/typesystem_engine.xml index 43f853b411..4dc3503df9 100644 --- a/Engine/typesystem_engine.xml +++ b/Engine/typesystem_engine.xml @@ -18,10 +18,13 @@ - along with Natron. If not, see - ***** END LICENSE BLOCK ***** --> - + + + NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING + + - @@ -209,8 +212,8 @@ - - + @@ -225,7 +228,7 @@ - + @@ -1506,14 +1509,7 @@ for (int j = 0; j < subSize; ++j) { PyObject* pyString = PyList_GET_ITEM(subList,j); - if ( PyString_Check(pyString) ) { - char* buf = PyString_AsString(pyString); - if (buf) { - std::string ret; - ret.append(buf); - rowVec[j] = ret; - } - } else if (PyUnicode_Check(pyString) ) { + if (PyUnicode_Check(pyString) ) { PyObject* utf8pyobj = PyUnicode_AsUTF8String(pyString); // newRef if (utf8pyobj) { char* cstr = PyBytes_AS_STRING(utf8pyobj); // Borrowed pointer diff --git a/Global/Enums.h b/Global/Enums.h index 7e76a8c6a1..f74a8399a1 100644 --- a/Global/Enums.h +++ b/Global/Enums.h @@ -28,11 +28,6 @@ CLANG_DIAG_OFF(deprecated) CLANG_DIAG_ON(deprecated) NATRON_NAMESPACE_ENTER -#ifdef SBK_RUN -// shiboken doesn't generate SbkNatronEngine_StandardButtonEnum_as_number unless it is put in a class or namespace -NATRON_NAMESPACE_EXIT -namespace NATRON_NAMESPACE { -#endif enum ScaleTypeEnum { @@ -684,11 +679,6 @@ enum MergingFunctionEnum //typedef QFlags StandardButtons; Q_DECLARE_FLAGS(StandardButtons, StandardButtonEnum) -#ifdef SBK_RUN -} -NATRON_NAMESPACE_ENTER -#endif - NATRON_NAMESPACE_EXIT diff --git a/Global/GlobalDefines.h b/Global/GlobalDefines.h index 4929728224..30397bcc30 100644 --- a/Global/GlobalDefines.h +++ b/Global/GlobalDefines.h @@ -66,10 +66,10 @@ CLANG_DIAG_ON(deprecated) //#define foreach Q_FOREACH -typedef boost::uint32_t U32; -typedef boost::uint64_t U64; -typedef boost::uint8_t U8; -typedef boost::uint16_t U16; +typedef std::uint32_t U32; +typedef std::uint64_t U64; +typedef std::uint8_t U8; +typedef std::uint16_t U16; NATRON_NAMESPACE_ENTER diff --git a/global.pri b/global.pri index 96208f97e3..9d3a4d339f 100644 --- a/global.pri +++ b/global.pri @@ -41,8 +41,6 @@ run-without-python { # from : # "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included." CONFIG += python - QMAKE_CFLAGS += -include Python.h - QMAKE_CXXFLAGS += -include Python.h python3 { PYV=3 PY_PKG_SUFFIX=-embed diff --git a/tools/utils/runPostShiboken.sh b/tools/utils/runPostShiboken.sh index b7242401d9..19ea04aaa2 100755 --- a/tools/utils/runPostShiboken.sh +++ b/tools/utils/runPostShiboken.sh @@ -47,7 +47,7 @@ GCC_DIAG_OFF(uninitialized)\ GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF\ #include // produces many warnings@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp -sed -e 's@// Extra includes@// Extra includes\ +sed -e 's@// inner classes@// inner classes\ NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp # replace NATRON_NAMESPACE with Natron for enums with flags (e.g. StandardButtonEnum) @@ -56,9 +56,10 @@ sed -e 's@"NatronEngine\.NATRON_NAMESPACE@"NatronEngine.Natron@g' -e 's@, Natron # re-add the Natron namespace #sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/NatronEngine/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.cpp Gui/NatronGui/*.h -sed -e 's@SbkType< ::@SbkType@SbkType@g' -i Engine/NatronEngine/natronengine_python.h +sed -e 's@SbkType< ::@SbkType$@CLANG_DIAG_OFF(header-guard)\ #include // has wrong header guards in pyside 1.2.2@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp -sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ +sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ CLANG_DIAG_OFF(uninitialized)\ CLANG_DIAG_OFF(keyword-macro)\ -#include // produces warnings\ +#include // produces warnings\ CLANG_DIAG_ON(deprecated)\ CLANG_DIAG_ON(uninitialized)\ CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.h -sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ +sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ CLANG_DIAG_OFF(uninitialized)\ CLANG_DIAG_OFF(keyword-macro)\ -#include // produces warnings\ +#include // produces warnings\ CLANG_DIAG_ON(deprecated)\ CLANG_DIAG_ON(uninitialized)\ CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.h From 7a6b160dea1668215090aac2585756c23b6a14ba Mon Sep 17 00:00:00 2001 From: Martin Reboredo Date: Thu, 4 Nov 2021 15:10:27 -0300 Subject: [PATCH 2/2] Preprocessor suggestions --- Engine/AppManager.h | 2 + Engine/ImagePlaneDesc.h | 2 + Engine/Knob.h | 2 + Engine/PyParameter.h | 3 -- Engine/PySideCompat.cpp | 8 +++ Engine/Pyside_Engine_Python.h | 4 ++ Engine/typesystem_engine.xml | 11 ++++ Global/Enums.h | 10 ++++ Global/Pyside_Shiboken2_Macros.h | 1 + tools/utils/runPostShiboken.sh | 15 +++--- tools/utils/runPostShiboken2.sh | 88 ++++++++++++++++++++++++++++++++ 11 files changed, 135 insertions(+), 11 deletions(-) create mode 100644 Global/Pyside_Shiboken2_Macros.h create mode 100755 tools/utils/runPostShiboken2.sh diff --git a/Engine/AppManager.h b/Engine/AppManager.h index 5996152796..e10cbf97d1 100644 --- a/Engine/AppManager.h +++ b/Engine/AppManager.h @@ -44,9 +44,11 @@ CLANG_DIAG_ON(deprecated) #include #include +#if (!defined(Q_MOC_RUN) && !defined(SBK_RUN)) || defined(SBK2_GEN) #include #include #include +#endif #include "Engine/AfterQuitProcessingI.h" #include "Engine/Plugin.h" diff --git a/Engine/ImagePlaneDesc.h b/Engine/ImagePlaneDesc.h index a967a9ac53..d5747f2637 100644 --- a/Engine/ImagePlaneDesc.h +++ b/Engine/ImagePlaneDesc.h @@ -31,6 +31,7 @@ #include #include +#if (!defined(Q_MOC_RUN) && !defined(SBK_RUN)) || defined(SBK2_GEN) GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF GCC_DIAG_OFF(unused-parameter) // /opt/local/include/boost/serialization/smart_cast.hpp:254:25: warning: unused parameter 'u' [-Wunused-parameter] @@ -40,6 +41,7 @@ GCC_DIAG_OFF(unused-parameter) #include GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_ON GCC_DIAG_ON(unused-parameter) +#endif #define IMAGEPLANEDESC_SERIALIZATION_INTRODUCES_ID 2 #define IMAGEPLANEDESC_SERIALIZATION_VERSION IMAGEPLANEDESC_SERIALIZATION_INTRODUCES_ID diff --git a/Engine/Knob.h b/Engine/Knob.h index 1d829e72d8..131afa9235 100644 --- a/Engine/Knob.h +++ b/Engine/Knob.h @@ -33,8 +33,10 @@ #include #include +#if (!defined(Q_MOC_RUN) && !defined(SBK_RUN)) || defined(SBK2_GEN) #include #include +#endif #include #include diff --git a/Engine/PyParameter.h b/Engine/PyParameter.h index 67f57cd286..e95c0cff11 100644 --- a/Engine/PyParameter.h +++ b/Engine/PyParameter.h @@ -428,7 +428,6 @@ class Int2DParam Int2DTuple get() const; Int2DTuple get(double frame) const; - using IntParam::set; void set(int x, int y); void set(int x, int y, double frame); }; @@ -445,8 +444,6 @@ class Int3DParam Int3DTuple get() const; Int3DTuple get(double frame) const; - using IntParam::set; - using Int2DParam::set; void set(int x, int y, int z); void set(int x, int y, int z, double frame); }; diff --git a/Engine/PySideCompat.cpp b/Engine/PySideCompat.cpp index 7441631e36..c56c9807aa 100644 --- a/Engine/PySideCompat.cpp +++ b/Engine/PySideCompat.cpp @@ -38,9 +38,17 @@ CLANG_DIAG_OFF(mismatched-tags) GCC_DIAG_OFF(unused-parameter) GCC_DIAG_OFF(missing-field-initializers) +#ifdef SBK2_GEN #include #include #include +#else +#include +#include +#include +#include +#include +#endif #include CLANG_DIAG_ON(mismatched-tags) GCC_DIAG_ON(unused-parameter) diff --git a/Engine/Pyside_Engine_Python.h b/Engine/Pyside_Engine_Python.h index 915d1ba991..432aea27bd 100644 --- a/Engine/Pyside_Engine_Python.h +++ b/Engine/Pyside_Engine_Python.h @@ -36,7 +36,11 @@ * Do not include it when compiling Natron. **/ +#ifdef SBK2_GEN #include +#else +#include +#endif #include //Global #include diff --git a/Engine/typesystem_engine.xml b/Engine/typesystem_engine.xml index 4dc3503df9..669c9d76f3 100644 --- a/Engine/typesystem_engine.xml +++ b/Engine/typesystem_engine.xml @@ -1509,7 +1509,18 @@ for (int j = 0; j < subSize; ++j) { PyObject* pyString = PyList_GET_ITEM(subList,j); + #if PY_VERSION_MAJOR < 3 + if ( PyString_Check(pyString) ) { + char* buf = PyString_AsString(pyString); + if (buf) { + std::string ret; + ret.append(buf); + rowVec[j] = ret; + } + } else if (PyUnicode_Check(pyString) ) { + #else if (PyUnicode_Check(pyString) ) { + #endif PyObject* utf8pyobj = PyUnicode_AsUTF8String(pyString); // newRef if (utf8pyobj) { char* cstr = PyBytes_AS_STRING(utf8pyobj); // Borrowed pointer diff --git a/Global/Enums.h b/Global/Enums.h index f74a8399a1..3ec34bb7f8 100644 --- a/Global/Enums.h +++ b/Global/Enums.h @@ -28,6 +28,11 @@ CLANG_DIAG_OFF(deprecated) CLANG_DIAG_ON(deprecated) NATRON_NAMESPACE_ENTER +#if defined(SBK_RUN) && !defined(SBK2_GEN) +// shiboken doesn't generate SbkNatronEngine_StandardButtonEnum_as_number unless it is put in a class or namespace +NATRON_NAMESPACE_EXIT +namespace NATRON_NAMESPACE { +#endif enum ScaleTypeEnum { @@ -679,6 +684,11 @@ enum MergingFunctionEnum //typedef QFlags StandardButtons; Q_DECLARE_FLAGS(StandardButtons, StandardButtonEnum) +#if defined(SBK_RUN) && !defined(SBK2_GEN) +} +NATRON_NAMESPACE_ENTER +#endif + NATRON_NAMESPACE_EXIT diff --git a/Global/Pyside_Shiboken2_Macros.h b/Global/Pyside_Shiboken2_Macros.h new file mode 100644 index 0000000000..5c5d34b076 --- /dev/null +++ b/Global/Pyside_Shiboken2_Macros.h @@ -0,0 +1 @@ +#define SBK2_GEN diff --git a/tools/utils/runPostShiboken.sh b/tools/utils/runPostShiboken.sh index 19ea04aaa2..b7242401d9 100755 --- a/tools/utils/runPostShiboken.sh +++ b/tools/utils/runPostShiboken.sh @@ -47,7 +47,7 @@ GCC_DIAG_OFF(uninitialized)\ GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF\ #include // produces many warnings@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp -sed -e 's@// inner classes@// inner classes\ +sed -e 's@// Extra includes@// Extra includes\ NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp # replace NATRON_NAMESPACE with Natron for enums with flags (e.g. StandardButtonEnum) @@ -56,10 +56,9 @@ sed -e 's@"NatronEngine\.NATRON_NAMESPACE@"NatronEngine.Natron@g' -e 's@, Natron # re-add the Natron namespace #sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/NatronEngine/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.cpp Gui/NatronGui/*.h -sed -e '/AnimatedParam/ {:y;n;by};s@SbkType< ::\(.*\) >@SbkType@g' -i Engine/NatronEngine/natronengine_python.h -sed -e 's@SbkType< ::@SbkType$@CLANG_DIAG_OFF(header-guard)\ #include // has wrong header guards in pyside 1.2.2@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp -sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ +sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ CLANG_DIAG_OFF(uninitialized)\ CLANG_DIAG_OFF(keyword-macro)\ -#include // produces warnings\ +#include // produces warnings\ CLANG_DIAG_ON(deprecated)\ CLANG_DIAG_ON(uninitialized)\ CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.h -sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ +sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ CLANG_DIAG_OFF(uninitialized)\ CLANG_DIAG_OFF(keyword-macro)\ -#include // produces warnings\ +#include // produces warnings\ CLANG_DIAG_ON(deprecated)\ CLANG_DIAG_ON(uninitialized)\ CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.h diff --git a/tools/utils/runPostShiboken2.sh b/tools/utils/runPostShiboken2.sh new file mode 100755 index 0000000000..b692d65243 --- /dev/null +++ b/tools/utils/runPostShiboken2.sh @@ -0,0 +1,88 @@ +#!/bin/sh +# ***** BEGIN LICENSE BLOCK ***** +# This file is part of Natron , +# Copyright (C) 2016 INRIA and Alexandre Gauthier +# +# 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 +# ***** END LICENSE BLOCK ***** + +# exit if a command returns an error status +set -e + +# PySide version override, add 2 for Qt5/PySide2 +PYV="${1:-2}" + +# To be run after shiboken to fix errors + +sed -e '//d' -i'.bak' Engine/NatronEngine/*.cpp +sed -e '//d' -i'.bak' Gui/NatronGui/*.cpp +sed -e "/SbkPySide${PYV}_QtCoreTypes;/d" -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp +sed -e "/SbkPySide${PYV}_QtCoreTypeConverters;/d" -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp +sed -e '/SbkNatronEngineTypes;/d' -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp +sed -e '/SbkNatronEngineTypeConverters;/d' -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp +sed -e 's/cleanTypesAttributes/cleanGuiTypesAttributes/g' -i'.bak' Gui/NatronGui/natrongui_module_wrapper.cpp +sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Engine/NatronEngine/*.cpp +sed -e '/Py_BEGIN_ALLOW_THREADS/d' -i'.bak' Gui/NatronGui/*.cpp +sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Engine/NatronEngine/*.cpp +sed -e '/Py_END_ALLOW_THREADS/d' -i'.bak' Gui/NatronGui/*.cpp + +# fix warnings +sed -e 's@^#include $@#include "Global/Macros.h"\ +CLANG_DIAG_OFF(mismatched-tags)\ +GCC_DIAG_OFF(unused-parameter)\ +GCC_DIAG_OFF(missing-field-initializers)\ +GCC_DIAG_OFF(missing-declarations)\ +GCC_DIAG_OFF(uninitialized)\ +GCC_DIAG_UNUSED_LOCAL_TYPEDEFS_OFF\ +#include // produces many warnings@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp + +sed -e 's@// inner classes@// inner classes\ +NATRON_NAMESPACE_USING NATRON_PYTHON_NAMESPACE_USING@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp + +# replace NATRON_NAMESPACE with Natron for enums with flags (e.g. StandardButtonEnum) +sed -e 's@"NatronEngine\.NATRON_NAMESPACE@"NatronEngine.Natron@g' -e 's@, NatronEngine\.NATRON_NAMESPACE@, NatronEngine.Natron@g' -e 's@"NatronGui\.NATRON_NAMESPACE@"NatronGui.Natron@g' -e 's@"NATRON_NAMESPACE@"Natron@g' -i'.bak' Engine/NatronEngine/*_wrapper.cpp + +# re-add the Natron namespace +#sed -e 's@" ::\([^s][^t][^d]\)@ NATRON_NAMESPACE::\1@g' -i'.bak' Engine/NatronEngine/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.cpp Gui/NatronGui/*.h + +sed -e '/AnimatedParam/ {:y;n;by};s@SbkType< ::\(.*\) >@SbkType@g' -i Engine/NatronEngine/natronengine_python.h +sed -e 's@SbkType< ::@SbkType$@CLANG_DIAG_OFF(header-guard)\ +#include // has wrong header guards in pyside 1.2.2@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp + +sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ +CLANG_DIAG_OFF(uninitialized)\ +CLANG_DIAG_OFF(keyword-macro)\ +#include // produces warnings\ +CLANG_DIAG_ON(deprecated)\ +CLANG_DIAG_ON(uninitialized)\ +CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.h + +sed -e 's@^#include $@CLANG_DIAG_OFF(deprecated)\ +CLANG_DIAG_OFF(uninitialized)\ +CLANG_DIAG_OFF(keyword-macro)\ +#include // produces warnings\ +CLANG_DIAG_ON(deprecated)\ +CLANG_DIAG_ON(uninitialized)\ +CLANG_DIAG_ON(keyword-macro)@' -i'.bak' Engine/NatronEngine/*.cpp Gui/NatronGui/*.cpp Engine/NatronEngine/*.h Gui/NatronGui/*.h + +# clean up +rm Gui/NatronGui/*.bak Engine/NatronEngine/*.bak