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

use a different (fake) enum namespace for shiboken & shiboken2 #713

Merged
merged 1 commit into from
Dec 4, 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
1 change: 1 addition & 0 deletions App/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.xcode/XCBuildData
NatronInfo.plist
20 changes: 10 additions & 10 deletions Engine/AppManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CLANG_DIAG_ON(deprecated)
#include <QtCore/QProcess>
#include <QtCore/QMap>

#if (!defined(Q_MOC_RUN) && !defined(SBK_RUN)) || defined(SBK2_GEN)
#if (!defined(Q_MOC_RUN) && !defined(SBK_RUN)) || defined(SBK2_RUN)
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
Expand Down Expand Up @@ -496,7 +496,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
void setOFXHostHandle(void* handle);

OFX::Host::ImageEffect::Descriptor* getPluginContextAndDescribe(OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
ContextEnum* ctx);
NATRON_ENUM::ContextEnum* ctx);
AppTLS* getAppTLS() const;
const OfxHost* getOFXHost() const;
GPUContextPool* getGPUContextPool() const;
Expand Down Expand Up @@ -569,7 +569,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON

bool isTextureFloatSupported() const;

bool hasOpenGLForRequirements(OpenGLRequirementsTypeEnum type, QString* missingOpenGLError = 0) const;
bool hasOpenGLForRequirements(NATRON_ENUM::OpenGLRequirementsTypeEnum type, QString* missingOpenGLError = 0) const;

virtual void updateAboutWindowLibrariesVersion() {}

Expand Down Expand Up @@ -734,14 +734,14 @@ void warningDialog(const std::string & title, const std::string & message, bool*
void informationDialog(const std::string & title, const std::string & message, bool useHtml = false);
void informationDialog(const std::string & title, const std::string & message, bool* stopAsking, bool useHtml = false);

StandardButtonEnum questionDialog(const std::string & title, const std::string & message, bool useHtml,
StandardButtons buttons =
StandardButtons(eStandardButtonYes | eStandardButtonNo),
StandardButtonEnum defaultButton = eStandardButtonNoButton);
NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & title, const std::string & message, bool useHtml,
NATRON_ENUM::StandardButtons buttons =
NATRON_ENUM::StandardButtons(NATRON_ENUM::eStandardButtonYes | NATRON_ENUM::eStandardButtonNo),
NATRON_ENUM::StandardButtonEnum defaultButton = NATRON_ENUM::eStandardButtonNoButton);

StandardButtonEnum questionDialog(const std::string & title, const std::string & message, bool useHtml,
StandardButtons buttons,
StandardButtonEnum defaultButton,
NATRON_ENUM::StandardButtonEnum questionDialog(const std::string & title, const std::string & message, bool useHtml,
NATRON_ENUM::StandardButtons buttons,
NATRON_ENUM::StandardButtonEnum defaultButton,
bool* stopAsking);
} // namespace Dialogs

Expand Down
9 changes: 2 additions & 7 deletions Engine/Engine.pro
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ QT += core network
greaterThan(QT_MAJOR_VERSION, 4): QT += concurrent

greaterThan(QT_MAJOR_VERSION, 4) {
ENGINE_WRAPPER_DIR = NatronEngine$${QT_MAJOR_VERSION}
ENGINE_WRAPPER_DIR = Qt$${QT_MAJOR_VERSION}/NatronEngine
} else {
ENGINE_WRAPPER_DIR = NatronEngine
}
Expand Down Expand Up @@ -464,6 +464,7 @@ ENGINE_GENERATED_SOURCES = \
intparam_wrapper \
itembase_wrapper \
layer_wrapper \
natron_enum_wrapper \
nodecreationproperty_wrapper \
outputfileparam_wrapper \
pageparam_wrapper \
Expand All @@ -487,12 +488,6 @@ for(name, ENGINE_GENERATED_SOURCES) {
HEADERS += $${ENGINE_WRAPPER_DIR}/$${name}.h
}

greaterThan(QT_MAJOR_VERSION, 4) {
SOURCES += $${ENGINE_WRAPPER_DIR}/natron_wrapper.cpp
HEADERS += $${ENGINE_WRAPPER_DIR}/natron_wrapper.h
} else {
SOURCES += $${ENGINE_WRAPPER_DIR}/natron_namespace_wrapper.cpp
}

OTHER_FILES += \
typesystem_engine.xml
Expand Down
2 changes: 1 addition & 1 deletion Engine/ImagePlaneDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <string>
#include <vector>

#if (!defined(Q_MOC_RUN) && !defined(SBK_RUN)) || defined(SBK2_GEN)
#if (!defined(Q_MOC_RUN) && !defined(SBK_RUN)) || defined(SBK2_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]
Expand Down
142 changes: 71 additions & 71 deletions Engine/Knob.h

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions Engine/KnobTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON

static const std::string & typeNameStatic();

ValueIsNormalizedEnum getValueIsNormalized(int dimension) const
NATRON_ENUM::ValueIsNormalizedEnum getValueIsNormalized(int dimension) const
{
return _valueIsNormalized[dimension];
}

void setValueIsNormalized(int dimension,
ValueIsNormalizedEnum state)
NATRON_ENUM::ValueIsNormalizedEnum state)
{
_valueIsNormalized[dimension] = state;
}
Expand Down Expand Up @@ -372,7 +372,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
/// - kOfxParamDoubleTypeNormalisedYAbsolute - normalised absolute position on the Y axis (1D only)
/// - kOfxParamDoubleTypeNormalisedXY - normalised to the project's X and Y size (2D only),
/// - kOfxParamDoubleTypeNormalisedXYAbsolute - normalised to the projects X and Y size, and is an absolute position on the image plane,
std::vector<ValueIsNormalizedEnum> _valueIsNormalized;
std::vector<NATRON_ENUM::ValueIsNormalizedEnum> _valueIsNormalized;

///For double params respecting the kOfxParamCoordinatesNormalised
///This tells us that only the default value is stored normalized.
Expand Down Expand Up @@ -1009,33 +1009,33 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
std::pair<double, double> getParametricRange() const WARN_UNUSED_RETURN;
CurvePtr getParametricCurve(int dimension) const;
CurvePtr getDefaultParametricCurve(int dimension) const;
StatusEnum addControlPoint(ValueChangedReasonEnum reason, int dimension, double key, double value, KeyframeTypeEnum interpolation = eKeyframeTypeSmooth) WARN_UNUSED_RETURN;
StatusEnum addControlPoint(ValueChangedReasonEnum reason, int dimension, double key, double value, double leftDerivative, double rightDerivative, KeyframeTypeEnum interpolation = eKeyframeTypeSmooth) WARN_UNUSED_RETURN;
StatusEnum getValue(int dimension, double parametricPosition, double *returnValue) const WARN_UNUSED_RETURN;
StatusEnum getNControlPoints(int dimension, int *returnValue) const WARN_UNUSED_RETURN;
StatusEnum getNthControlPoint(int dimension,
NATRON_ENUM::StatusEnum addControlPoint(NATRON_ENUM::ValueChangedReasonEnum reason, int dimension, double key, double value, NATRON_ENUM::KeyframeTypeEnum interpolation = NATRON_ENUM::eKeyframeTypeSmooth) WARN_UNUSED_RETURN;
NATRON_ENUM::StatusEnum addControlPoint(NATRON_ENUM::ValueChangedReasonEnum reason, int dimension, double key, double value, double leftDerivative, double rightDerivative, NATRON_ENUM::KeyframeTypeEnum interpolation = NATRON_ENUM::eKeyframeTypeSmooth) WARN_UNUSED_RETURN;
NATRON_ENUM::StatusEnum getValue(int dimension, double parametricPosition, double *returnValue) const WARN_UNUSED_RETURN;
NATRON_ENUM::StatusEnum getNControlPoints(int dimension, int *returnValue) const WARN_UNUSED_RETURN;
NATRON_ENUM::StatusEnum getNthControlPoint(int dimension,
int nthCtl,
double *key,
double *value) const WARN_UNUSED_RETURN;
StatusEnum getNthControlPoint(int dimension,
NATRON_ENUM::StatusEnum getNthControlPoint(int dimension,
int nthCtl,
double *key,
double *value,
double *leftDerivative,
double *rightDerivative) const WARN_UNUSED_RETURN;

StatusEnum setNthControlPointInterpolation(ValueChangedReasonEnum reason,
NATRON_ENUM::StatusEnum setNthControlPointInterpolation(NATRON_ENUM::ValueChangedReasonEnum reason,
int dimension,
int nThCtl,
KeyframeTypeEnum interpolation) WARN_UNUSED_RETURN;
NATRON_ENUM::KeyframeTypeEnum interpolation) WARN_UNUSED_RETURN;

StatusEnum setNthControlPoint(ValueChangedReasonEnum reason,
NATRON_ENUM::StatusEnum setNthControlPoint(NATRON_ENUM::ValueChangedReasonEnum reason,
int dimension,
int nthCtl,
double key,
double value) WARN_UNUSED_RETURN;

StatusEnum setNthControlPoint(ValueChangedReasonEnum reason,
NATRON_ENUM::StatusEnum setNthControlPoint(NATRON_ENUM::ValueChangedReasonEnum reason,
int dimension,
int nthCtl,
double key,
Expand All @@ -1044,8 +1044,8 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
double rightDerivative) WARN_UNUSED_RETURN;


StatusEnum deleteControlPoint(ValueChangedReasonEnum reason, int dimension, int nthCtl) WARN_UNUSED_RETURN;
StatusEnum deleteAllControlPoints(ValueChangedReasonEnum reason, int dimension) WARN_UNUSED_RETURN;
NATRON_ENUM::StatusEnum deleteControlPoint(NATRON_ENUM::ValueChangedReasonEnum reason, int dimension, int nthCtl) WARN_UNUSED_RETURN;
NATRON_ENUM::StatusEnum deleteAllControlPoints(NATRON_ENUM::ValueChangedReasonEnum reason, int dimension) WARN_UNUSED_RETURN;
static const std::string & typeNameStatic() WARN_UNUSED_RETURN;

void saveParametricCurves(std::list<Curve >* curves) const;
Expand Down
8 changes: 4 additions & 4 deletions Engine/MergingEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace Merge {
* Keep this in sync with the Merge node's operators otherwise everything will fall apart.
**/
inline std::string
getOperatorString(MergingFunctionEnum operation)
getOperatorString(NATRON_ENUM::MergingFunctionEnum operation)
{
switch (operation) {
case eMergeATop:
Expand Down Expand Up @@ -169,7 +169,7 @@ getOperatorString(MergingFunctionEnum operation)
} // getOperationString

inline std::string
getOperatorHelpString(MergingFunctionEnum operation)
getOperatorHelpString(NATRON_ENUM::MergingFunctionEnum operation)
{
switch (operation) {
case eMergeATop:
Expand Down Expand Up @@ -295,8 +295,8 @@ getOperatorHelpString(MergingFunctionEnum operation)
} // getOperationHelpString

inline
PixmapEnum
getOperatorPixmap(MergingFunctionEnum operation)
NATRON_ENUM::PixmapEnum
getOperatorPixmap(NATRON_ENUM::MergingFunctionEnum operation)
{
switch (operation) {
case eMergeATop:
Expand Down
12 changes: 6 additions & 6 deletions Engine/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class Plugin
QMutex* _lock;
int _majorVersion;
int _minorVersion;
ContextEnum _ofxContext;
NATRON_ENUM::ContextEnum _ofxContext;
mutable bool _hasShortcutSet; //< to speed up the keypress event of Nodegraph, this is used to find out quickly whether it has a shortcut or not.
bool _isReader, _isWriter;

Expand All @@ -198,7 +198,7 @@ class Plugin
bool _multiThreadingEnabled;
bool _openglActivated;

PluginOpenGLRenderSupport _openglRenderSupport;
NATRON_ENUM::PluginOpenGLRenderSupport _openglRenderSupport;

public:

Expand Down Expand Up @@ -358,9 +358,9 @@ class Plugin
void setOfxPlugin(OFX::Host::ImageEffect::ImageEffectPlugin* p);

OFX::Host::ImageEffect::ImageEffectPlugin* getOfxPlugin() const;
OFX::Host::ImageEffect::Descriptor* getOfxDesc(ContextEnum* ctx) const;
OFX::Host::ImageEffect::Descriptor* getOfxDesc(NATRON_ENUM::ContextEnum* ctx) const;

void setOfxDesc(OFX::Host::ImageEffect::Descriptor* desc, ContextEnum ctx);
void setOfxDesc(OFX::Host::ImageEffect::Descriptor* desc, NATRON_ENUM::ContextEnum ctx);

bool isRenderScaleEnabled() const;
void setRenderScaleEnabled(bool b);
Expand All @@ -374,8 +374,8 @@ class Plugin
bool isOpenGLEnabled() const;
void setOpenGLEnabled(bool b);

void setOpenGLRenderSupport(PluginOpenGLRenderSupport support);
PluginOpenGLRenderSupport getPluginOpenGLRenderSupport() const;
void setOpenGLRenderSupport(NATRON_ENUM::PluginOpenGLRenderSupport support);
NATRON_ENUM::PluginOpenGLRenderSupport getPluginOpenGLRenderSupport() const;
};

struct Plugin_compare_version
Expand Down
6 changes: 3 additions & 3 deletions Engine/PyNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class UserParamHolder
void refreshUserParamsGUI();

virtual bool onKnobValueChanged(KnobI* k,
NATRON_NAMESPACE::ValueChangedReasonEnum reason,
NATRON_ENUM::ValueChangedReasonEnum reason,
double time,
ViewSpec view,
bool originatedFromMainThread)
Expand Down Expand Up @@ -386,8 +386,8 @@ class Effect

double getPixelAspectRatio() const;

NATRON_NAMESPACE::ImageBitDepthEnum getBitDepth() const;
NATRON_NAMESPACE::ImagePremultiplicationEnum getPremult() const;
NATRON_ENUM::ImageBitDepthEnum getBitDepth() const;
NATRON_ENUM::ImagePremultiplicationEnum getPremult() const;

void setPagesOrder(const QStringList& pages);
};
Expand Down
20 changes: 10 additions & 10 deletions Engine/PyParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class AnimatedParam
bool setExpression(const QString& expr, bool hasRetVariable, int dimension = 0);
QString getExpression(int dimension, bool* hasRetVariable) const;

bool setInterpolationAtTime(double time, NATRON_NAMESPACE::KeyframeTypeEnum interpolation, int dimension = 0);
bool setInterpolationAtTime(double time, NATRON_ENUM::KeyframeTypeEnum interpolation, int dimension = 0);
};

/**
Expand Down Expand Up @@ -1174,31 +1174,31 @@ class ParametricParam

void getCurveColor(int dimension, ColorTuple& ret) const;

NATRON_NAMESPACE::StatusEnum addControlPoint(int dimension, double key, double value, NATRON_NAMESPACE::KeyframeTypeEnum interpolation = eKeyframeTypeSmooth);
NATRON_NAMESPACE::StatusEnum addControlPoint(int dimension, double key, double value, double leftDerivative, double rightDerivative, NATRON_NAMESPACE::KeyframeTypeEnum interpolation = eKeyframeTypeSmooth);
NATRON_ENUM::StatusEnum addControlPoint(int dimension, double key, double value, NATRON_ENUM::KeyframeTypeEnum interpolation = NATRON_ENUM::eKeyframeTypeSmooth);
NATRON_ENUM::StatusEnum addControlPoint(int dimension, double key, double value, double leftDerivative, double rightDerivative, NATRON_ENUM::KeyframeTypeEnum interpolation = NATRON_ENUM::eKeyframeTypeSmooth);

double getValue(int dimension, double parametricPosition) const;

int getNControlPoints(int dimension) const;

// NATRON_NAMESPACE is necessary for shiboken
NATRON_NAMESPACE::StatusEnum getNthControlPoint(int dimension,
// NATRON_ENUM:: is necessary for shiboken
NATRON_ENUM::StatusEnum getNthControlPoint(int dimension,
int nthCtl,
double *key,
double *value,
double *leftDerivative,
double *rightDerivative) const;
NATRON_NAMESPACE::StatusEnum setNthControlPoint(int dimension,
NATRON_ENUM::StatusEnum setNthControlPoint(int dimension,
int nthCtl,
double key,
double value,
double leftDerivative,
double rightDerivative);
NATRON_NAMESPACE::StatusEnum setNthControlPointInterpolation(int dimension,
NATRON_ENUM::StatusEnum setNthControlPointInterpolation(int dimension,
int nThCtl,
NATRON_NAMESPACE::KeyframeTypeEnum interpolation);
NATRON_NAMESPACE::StatusEnum deleteControlPoint(int dimension, int nthCtl);
NATRON_NAMESPACE::StatusEnum deleteAllControlPoints(int dimension);
NATRON_ENUM::KeyframeTypeEnum interpolation);
NATRON_ENUM::StatusEnum deleteControlPoint(int dimension, int nthCtl);
NATRON_ENUM::StatusEnum deleteAllControlPoints(int dimension);

void setDefaultCurvesFromCurrentCurves();
};
Expand Down
4 changes: 2 additions & 2 deletions Engine/PyRoto.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ class BezierCurve
ColorTuple getColor(double time);
void setColor(double time, double r, double g, double b);

void setCompositingOperator(NATRON_NAMESPACE::MergingFunctionEnum op);
NATRON_NAMESPACE::MergingFunctionEnum getCompositingOperator() const;
void setCompositingOperator(NATRON_ENUM::MergingFunctionEnum op);
NATRON_ENUM::MergingFunctionEnum getCompositingOperator() const;
BooleanParam* getActivatedParam() const;
DoubleParam* getOpacityParam() const;
DoubleParam* getFeatherDistanceParam() const;
Expand Down
29 changes: 29 additions & 0 deletions Engine/PySide2_Engine_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_Engine_Python.h"

#endif // PYSIDE2_ENGINE_PYTHON_H
2 changes: 1 addition & 1 deletion Engine/PySideCompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
CLANG_DIAG_OFF(mismatched-tags)
GCC_DIAG_OFF(unused-parameter)
GCC_DIAG_OFF(missing-field-initializers)
#ifdef SBK2_GEN
#ifdef SBK2_RUN
#include <basewrapper.h>
#include <sbkconverter.h>
#include <gilstate.h>
Expand Down
2 changes: 1 addition & 1 deletion Engine/Pyside_Engine_Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* Do not include it when compiling Natron.
**/

#ifdef SBK2_GEN
#ifdef SBK2_RUN
#include <pyside2_global.h>
#else
#include <pyside_global.h>
Expand Down
4 changes: 2 additions & 2 deletions Engine/typesystem_engine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
</container-type>

<!--Natron global enums-->
<namespace-type name="NATRON_NAMESPACE">
<namespace-type name="NATRON_ENUM">
<enum-type name="StatusEnum"/>
<enum-type name="MergingFunctionEnum"/>
<enum-type name="StandardButtonEnum" flags="StandardButtons"/>
Expand Down Expand Up @@ -1558,7 +1558,7 @@
double key,value,left,right;
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2,&amp;key,&amp;value, &amp;left, &amp;right);
%PYARG_0 = PyTuple_New(5);
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[NATRON_NAMESPACE::StatusEnum](%0));
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[NATRON_ENUM::StatusEnum](%0));
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[double](key));
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[double](value));
PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[double](left));
Expand Down
Loading