From 98eb3467ffff6b6499e84ba0f1021df25a3c3aa0 Mon Sep 17 00:00:00 2001 From: Alexandre Gauthier Date: Thu, 15 Sep 2016 16:54:35 +0200 Subject: [PATCH] Python: add Effect::getInput(inputLabel) for convenience --- .../PythonReference/NatronEngine/Effect.rst | 14 +- Engine/NatronEngine/effect_wrapper.cpp | 46 ++- .../natronengine_module_wrapper.cpp | 322 +++++++++--------- Engine/NatronEngine/natronengine_python.h | 118 +++---- Engine/PyNode.cpp | 21 ++ Engine/PyNode.h | 1 + Engine/typesystem_engine.xml | 8 + Gui/NatronGui/natrongui_module_wrapper.cpp | 4 +- 8 files changed, 297 insertions(+), 237 deletions(-) diff --git a/Documentation/source/devel/PythonReference/NatronEngine/Effect.rst b/Documentation/source/devel/PythonReference/NatronEngine/Effect.rst index 4e90e8d7d7..296bd88c6f 100644 --- a/Documentation/source/devel/PythonReference/NatronEngine/Effect.rst +++ b/Documentation/source/devel/PythonReference/NatronEngine/Effect.rst @@ -28,6 +28,7 @@ Functions * def :meth:`getCurrentTime` () * def :meth:`getFrameRate` () * def :meth:`getInput` (inputNumber) +* def :meth:`getInput` (inputName) * def :meth:`getLabel` () * def :meth:`getInputLabel` (inputNumber) * def :meth:`getMaxInputCount` () @@ -258,10 +259,17 @@ thread. :param inputNumber: :class:`int` :rtype: :class:`Effect` + Returns the node connected at the given *inputNumber*. - -Returns the node connected at the given *inputNumber*. - + +.. method:: NatronEngine.Effect.getInput(inputName) + + +:param inputName: :class:`str` +:rtype: :class:`Effect` + + Same as :func:`getInput(inputNumber)` except that the parameter in input + is the name of the input as diplayed on the node-graph. This function is made available for convenience. diff --git a/Engine/NatronEngine/effect_wrapper.cpp b/Engine/NatronEngine/effect_wrapper.cpp index f24391596d..c7628b4f5e 100644 --- a/Engine/NatronEngine/effect_wrapper.cpp +++ b/Engine/NatronEngine/effect_wrapper.cpp @@ -570,26 +570,48 @@ static PyObject* Sbk_EffectFunc_getInput(PyObject* self, PyObject* pyArg) SBK_UNUSED(pythonToCpp) // Overloaded function decisor - // 0: getInput(int)const + // 0: getInput(QString)const + // 1: getInput(int)const if ((pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter(), (pyArg)))) { - overloadId = 0; // getInput(int)const + overloadId = 1; // getInput(int)const + } else if ((pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArg)))) { + overloadId = 0; // getInput(QString)const } // Function signature not found. if (overloadId == -1) goto Sbk_EffectFunc_getInput_TypeError; // Call function/method - { - int cppArg0; - pythonToCpp(pyArg, &cppArg0); + switch (overloadId) { + case 0: // getInput(const QString & inputLabel) const + { + ::QString cppArg0 = ::QString(); + pythonToCpp(pyArg, &cppArg0); - if (!PyErr_Occurred()) { - // getInput(int)const - Effect * cppResult = const_cast(cppSelf)->getInput(cppArg0); - pyResult = Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_EFFECT_IDX], cppResult); + if (!PyErr_Occurred()) { + // getInput(QString)const + Effect * cppResult = const_cast(cppSelf)->getInput(cppArg0); + pyResult = Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_EFFECT_IDX], cppResult); - // Ownership transferences. - Shiboken::Object::getOwnership(pyResult); + // Ownership transferences. + Shiboken::Object::getOwnership(pyResult); + } + break; + } + case 1: // getInput(int inputNumber) const + { + int cppArg0; + pythonToCpp(pyArg, &cppArg0); + + if (!PyErr_Occurred()) { + // getInput(int)const + Effect * cppResult = const_cast(cppSelf)->getInput(cppArg0); + pyResult = Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_EFFECT_IDX], cppResult); + + // Ownership transferences. + Shiboken::Object::getOwnership(pyResult); + } + break; } } @@ -600,7 +622,7 @@ static PyObject* Sbk_EffectFunc_getInput(PyObject* self, PyObject* pyArg) return pyResult; Sbk_EffectFunc_getInput_TypeError: - const char* overloads[] = {"int", 0}; + const char* overloads[] = {"unicode", "int", 0}; Shiboken::setErrorAboutWrongArguments(pyArg, "NatronEngine.Effect.getInput", overloads); return 0; } diff --git a/Engine/NatronEngine/natronengine_module_wrapper.cpp b/Engine/NatronEngine/natronengine_module_wrapper.cpp index 73f67dffcf..a9e40b95fc 100644 --- a/Engine/NatronEngine/natronengine_module_wrapper.cpp +++ b/Engine/NatronEngine/natronengine_module_wrapper.cpp @@ -35,16 +35,26 @@ static PyMethodDef NatronEngine_methods[] = { }; // Classes initialization functions ------------------------------------------------------------ +void init_PyCoreApplication(PyObject* module); +void init_Group(PyObject* module); +void init_App(PyObject* module); +void init_AppSettings(PyObject* module); +void init_NodeCreationProperty(PyObject* module); +void init_IntNodeCreationProperty(PyObject* module); +void init_BoolNodeCreationProperty(PyObject* module); +void init_FloatNodeCreationProperty(PyObject* module); +void init_StringNodeCreationProperty(PyObject* module); +void init_ItemBase(PyObject* module); +void init_Layer(PyObject* module); +void init_BezierCurve(PyObject* module); +void init_Roto(PyObject* module); +void init_Track(PyObject* module); +void init_Tracker(PyObject* module); void init_ImageLayer(PyObject* module); void init_UserParamHolder(PyObject* module); +void init_Effect(PyObject* module); void init_Param(PyObject* module); -void init_GroupParam(PyObject* module); void init_AnimatedParam(PyObject* module); -void init_StringParamBase(PyObject* module); -void init_StringParam(PyObject* module); -void init_FileParam(PyObject* module); -void init_OutputFileParam(PyObject* module); -void init_PathParam(PyObject* module); void init_IntParam(PyObject* module); void init_Int2DParam(PyObject* module); void init_Int3DParam(PyObject* module); @@ -54,10 +64,16 @@ void init_Double3DParam(PyObject* module); void init_ColorParam(PyObject* module); void init_ChoiceParam(PyObject* module); void init_BooleanParam(PyObject* module); -void init_PageParam(PyObject* module); +void init_StringParamBase(PyObject* module); +void init_StringParam(PyObject* module); +void init_FileParam(PyObject* module); +void init_OutputFileParam(PyObject* module); +void init_PathParam(PyObject* module); void init_ButtonParam(PyObject* module); void init_ParametricParam(PyObject* module); void init_SeparatorParam(PyObject* module); +void init_GroupParam(PyObject* module); +void init_PageParam(PyObject* module); void init_Int2DTuple(PyObject* module); void init_Int3DTuple(PyObject* module); void init_Double2DTuple(PyObject* module); @@ -65,22 +81,6 @@ void init_Double3DTuple(PyObject* module); void init_ColorTuple(PyObject* module); void init_RectI(PyObject* module); void init_RectD(PyObject* module); -void init_PyCoreApplication(PyObject* module); -void init_Group(PyObject* module); -void init_App(PyObject* module); -void init_Effect(PyObject* module); -void init_AppSettings(PyObject* module); -void init_NodeCreationProperty(PyObject* module); -void init_IntNodeCreationProperty(PyObject* module); -void init_BoolNodeCreationProperty(PyObject* module); -void init_FloatNodeCreationProperty(PyObject* module); -void init_StringNodeCreationProperty(PyObject* module); -void init_ItemBase(PyObject* module); -void init_Layer(PyObject* module); -void init_BezierCurve(PyObject* module); -void init_Roto(PyObject* module); -void init_Track(PyObject* module); -void init_Tracker(PyObject* module); void init_NATRON_NAMESPACE(PyObject* module); // Required modules' type and converter arrays. @@ -113,6 +113,99 @@ static PythonToCppFunc is_PyLong_PythonToCpp_std_size_t_Convertible(PyObject* py // Container Type converters. +// C++ to Python conversion for type 'std::vector'. +static PyObject* std_vector_RectI__CppToPython_std_vector_RectI_(const void* cppIn) { + ::std::vector& cppInRef = *((::std::vector*)cppIn); + + // TEMPLATE - stdVectorToPyList - START + ::std::vector::size_type vectorSize = cppInRef.size(); + PyObject* pyOut = PyList_New((int) vectorSize); + for (::std::vector::size_type idx = 0; idx < vectorSize; ++idx) { + ::RectI cppItem(cppInRef[idx]); + PyList_SET_ITEM(pyOut, idx, Shiboken::Conversions::copyToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTI_IDX], &cppItem)); + } + return pyOut; + // TEMPLATE - stdVectorToPyList - END + +} +static void std_vector_RectI__PythonToCpp_std_vector_RectI_(PyObject* pyIn, void* cppOut) { + ::std::vector& cppOutRef = *((::std::vector*)cppOut); + + // TEMPLATE - pySeqToStdVector - START + int vectorSize = PySequence_Size(pyIn); + cppOutRef.reserve(vectorSize); + for (int idx = 0; idx < vectorSize; ++idx) { + Shiboken::AutoDecRef pyItem(PySequence_GetItem(pyIn, idx)); + ::RectI cppItem = ::RectI(); + Shiboken::Conversions::pythonToCppCopy((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTI_IDX], pyItem, &(cppItem)); + cppOutRef.push_back(cppItem); + } + // TEMPLATE - pySeqToStdVector - END + +} +static PythonToCppFunc is_std_vector_RectI__PythonToCpp_std_vector_RectI__Convertible(PyObject* pyIn) { + if (Shiboken::Conversions::convertibleSequenceTypes((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTI_IDX], pyIn)) + return std_vector_RectI__PythonToCpp_std_vector_RectI_; + return 0; +} + +// C++ to Python conversion for type 'std::pair'. +static PyObject* std_pair_QString_QString__CppToPython_std_pair_QString_QString_(const void* cppIn) { + ::std::pair& cppInRef = *((::std::pair*)cppIn); + + PyObject* pyOut = PyTuple_New(2); + PyTuple_SET_ITEM(pyOut, 0, Shiboken::Conversions::copyToPython(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppInRef.first)); + PyTuple_SET_ITEM(pyOut, 1, Shiboken::Conversions::copyToPython(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppInRef.second)); + return pyOut; + +} +static void std_pair_QString_QString__PythonToCpp_std_pair_QString_QString_(PyObject* pyIn, void* cppOut) { + ::std::pair& cppOutRef = *((::std::pair*)cppOut); + + Shiboken::Conversions::pythonToCppCopy(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], PySequence_Fast_GET_ITEM(pyIn, 0), &(cppOutRef.first)); + Shiboken::Conversions::pythonToCppCopy(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], PySequence_Fast_GET_ITEM(pyIn, 1), &(cppOutRef.second)); + +} +static PythonToCppFunc is_std_pair_QString_QString__PythonToCpp_std_pair_QString_QString__Convertible(PyObject* pyIn) { + if (Shiboken::Conversions::convertiblePairTypes(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], false, SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], false, pyIn)) + return std_pair_QString_QString__PythonToCpp_std_pair_QString_QString_; + return 0; +} + +// C++ to Python conversion for type 'const std::list > &'. +static PyObject* conststd_list_std_pair_QString_QString__REF_CppToPython_conststd_list_std_pair_QString_QString__REF(const void* cppIn) { + ::std::list >& cppInRef = *((::std::list >*)cppIn); + + // TEMPLATE - stdListToPyList - START + PyObject* pyOut = PyList_New((int) cppInRef.size()); + ::std::list >::const_iterator it = cppInRef.begin(); + for (int idx = 0; it != cppInRef.end(); ++it, ++idx) { + ::std::pair cppItem(*it); + PyList_SET_ITEM(pyOut, idx, Shiboken::Conversions::copyToPython(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], &cppItem)); + } + return pyOut; + // TEMPLATE - stdListToPyList - END + +} +static void conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF(PyObject* pyIn, void* cppOut) { + ::std::list >& cppOutRef = *((::std::list >*)cppOut); + + // TEMPLATE - pyListToStdList - START + for (int i = 0; i < PySequence_Size(pyIn); i++) { + Shiboken::AutoDecRef pyItem(PySequence_GetItem(pyIn, i)); + ::std::pair cppItem = ::std::pair(); + Shiboken::Conversions::pythonToCppCopy(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], pyItem, &(cppItem)); + cppOutRef.push_back(cppItem); + } + // TEMPLATE - pyListToStdList - END + +} +static PythonToCppFunc is_conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF_Convertible(PyObject* pyIn) { + if (Shiboken::Conversions::convertibleSequenceTypes(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], pyIn)) + return conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF; + return 0; +} + // C++ to Python conversion for type 'std::list *'. static PyObject* std_list_TrackPTR_PTR_CppToPython_std_list_TrackPTR_PTR(const void* cppIn) { ::std::list& cppInRef = *((::std::list*)cppIn); @@ -538,99 +631,6 @@ static PythonToCppFunc is_conststd_list_int_REF_PythonToCpp_conststd_list_int_RE return 0; } -// C++ to Python conversion for type 'std::vector'. -static PyObject* std_vector_RectI__CppToPython_std_vector_RectI_(const void* cppIn) { - ::std::vector& cppInRef = *((::std::vector*)cppIn); - - // TEMPLATE - stdVectorToPyList - START - ::std::vector::size_type vectorSize = cppInRef.size(); - PyObject* pyOut = PyList_New((int) vectorSize); - for (::std::vector::size_type idx = 0; idx < vectorSize; ++idx) { - ::RectI cppItem(cppInRef[idx]); - PyList_SET_ITEM(pyOut, idx, Shiboken::Conversions::copyToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTI_IDX], &cppItem)); - } - return pyOut; - // TEMPLATE - stdVectorToPyList - END - -} -static void std_vector_RectI__PythonToCpp_std_vector_RectI_(PyObject* pyIn, void* cppOut) { - ::std::vector& cppOutRef = *((::std::vector*)cppOut); - - // TEMPLATE - pySeqToStdVector - START - int vectorSize = PySequence_Size(pyIn); - cppOutRef.reserve(vectorSize); - for (int idx = 0; idx < vectorSize; ++idx) { - Shiboken::AutoDecRef pyItem(PySequence_GetItem(pyIn, idx)); - ::RectI cppItem = ::RectI(); - Shiboken::Conversions::pythonToCppCopy((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTI_IDX], pyItem, &(cppItem)); - cppOutRef.push_back(cppItem); - } - // TEMPLATE - pySeqToStdVector - END - -} -static PythonToCppFunc is_std_vector_RectI__PythonToCpp_std_vector_RectI__Convertible(PyObject* pyIn) { - if (Shiboken::Conversions::convertibleSequenceTypes((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTI_IDX], pyIn)) - return std_vector_RectI__PythonToCpp_std_vector_RectI_; - return 0; -} - -// C++ to Python conversion for type 'std::pair'. -static PyObject* std_pair_QString_QString__CppToPython_std_pair_QString_QString_(const void* cppIn) { - ::std::pair& cppInRef = *((::std::pair*)cppIn); - - PyObject* pyOut = PyTuple_New(2); - PyTuple_SET_ITEM(pyOut, 0, Shiboken::Conversions::copyToPython(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppInRef.first)); - PyTuple_SET_ITEM(pyOut, 1, Shiboken::Conversions::copyToPython(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppInRef.second)); - return pyOut; - -} -static void std_pair_QString_QString__PythonToCpp_std_pair_QString_QString_(PyObject* pyIn, void* cppOut) { - ::std::pair& cppOutRef = *((::std::pair*)cppOut); - - Shiboken::Conversions::pythonToCppCopy(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], PySequence_Fast_GET_ITEM(pyIn, 0), &(cppOutRef.first)); - Shiboken::Conversions::pythonToCppCopy(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], PySequence_Fast_GET_ITEM(pyIn, 1), &(cppOutRef.second)); - -} -static PythonToCppFunc is_std_pair_QString_QString__PythonToCpp_std_pair_QString_QString__Convertible(PyObject* pyIn) { - if (Shiboken::Conversions::convertiblePairTypes(SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], false, SbkPySide_QtCoreTypeConverters[SBK_QSTRING_IDX], false, pyIn)) - return std_pair_QString_QString__PythonToCpp_std_pair_QString_QString_; - return 0; -} - -// C++ to Python conversion for type 'const std::list > &'. -static PyObject* conststd_list_std_pair_QString_QString__REF_CppToPython_conststd_list_std_pair_QString_QString__REF(const void* cppIn) { - ::std::list >& cppInRef = *((::std::list >*)cppIn); - - // TEMPLATE - stdListToPyList - START - PyObject* pyOut = PyList_New((int) cppInRef.size()); - ::std::list >::const_iterator it = cppInRef.begin(); - for (int idx = 0; it != cppInRef.end(); ++it, ++idx) { - ::std::pair cppItem(*it); - PyList_SET_ITEM(pyOut, idx, Shiboken::Conversions::copyToPython(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], &cppItem)); - } - return pyOut; - // TEMPLATE - stdListToPyList - END - -} -static void conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF(PyObject* pyIn, void* cppOut) { - ::std::list >& cppOutRef = *((::std::list >*)cppOut); - - // TEMPLATE - pyListToStdList - START - for (int i = 0; i < PySequence_Size(pyIn); i++) { - Shiboken::AutoDecRef pyItem(PySequence_GetItem(pyIn, i)); - ::std::pair cppItem = ::std::pair(); - Shiboken::Conversions::pythonToCppCopy(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], pyItem, &(cppItem)); - cppOutRef.push_back(cppItem); - } - // TEMPLATE - pyListToStdList - END - -} -static PythonToCppFunc is_conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF_Convertible(PyObject* pyIn) { - if (Shiboken::Conversions::convertibleSequenceTypes(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], pyIn)) - return conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF; - return 0; -} - // C++ to Python conversion for type 'std::map'. static PyObject* std_map_ImageLayer_EffectPTR__CppToPython_std_map_ImageLayer_EffectPTR_(const void* cppIn) { ::std::map& cppInRef = *((::std::map*)cppIn); @@ -832,16 +832,26 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) #endif // Initialize classes in the type system + init_PyCoreApplication(module); + init_Group(module); + init_App(module); + init_AppSettings(module); + init_NodeCreationProperty(module); + init_IntNodeCreationProperty(module); + init_BoolNodeCreationProperty(module); + init_FloatNodeCreationProperty(module); + init_StringNodeCreationProperty(module); + init_ItemBase(module); + init_Layer(module); + init_BezierCurve(module); + init_Roto(module); + init_Track(module); + init_Tracker(module); init_ImageLayer(module); init_UserParamHolder(module); + init_Effect(module); init_Param(module); - init_GroupParam(module); init_AnimatedParam(module); - init_StringParamBase(module); - init_StringParam(module); - init_FileParam(module); - init_OutputFileParam(module); - init_PathParam(module); init_IntParam(module); init_Int2DParam(module); init_Int3DParam(module); @@ -851,10 +861,16 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) init_ColorParam(module); init_ChoiceParam(module); init_BooleanParam(module); - init_PageParam(module); + init_StringParamBase(module); + init_StringParam(module); + init_FileParam(module); + init_OutputFileParam(module); + init_PathParam(module); init_ButtonParam(module); init_ParametricParam(module); init_SeparatorParam(module); + init_GroupParam(module); + init_PageParam(module); init_Int2DTuple(module); init_Int3DTuple(module); init_Double2DTuple(module); @@ -862,22 +878,6 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) init_ColorTuple(module); init_RectI(module); init_RectD(module); - init_PyCoreApplication(module); - init_Group(module); - init_App(module); - init_Effect(module); - init_AppSettings(module); - init_NodeCreationProperty(module); - init_IntNodeCreationProperty(module); - init_BoolNodeCreationProperty(module); - init_FloatNodeCreationProperty(module); - init_StringNodeCreationProperty(module); - init_ItemBase(module); - init_Layer(module); - init_BezierCurve(module); - init_Roto(module); - init_Track(module); - init_Tracker(module); init_NATRON_NAMESPACE(module); // Register converter for type 'NatronEngine.std::size_t'. @@ -889,6 +889,28 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) is_PyLong_PythonToCpp_std_size_t_Convertible); + // Register converter for type 'std::vector'. + SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_VECTOR_RECTI_IDX] = Shiboken::Conversions::createConverter(&PyList_Type, std_vector_RectI__CppToPython_std_vector_RectI_); + Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_VECTOR_RECTI_IDX], "std::vector"); + Shiboken::Conversions::addPythonToCppValueConversion(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_VECTOR_RECTI_IDX], + std_vector_RectI__PythonToCpp_std_vector_RectI_, + is_std_vector_RectI__PythonToCpp_std_vector_RectI__Convertible); + + // Register converter for type 'std::pair'. + SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX] = Shiboken::Conversions::createConverter(&PyList_Type, std_pair_QString_QString__CppToPython_std_pair_QString_QString_); + Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], "std::pair"); + Shiboken::Conversions::addPythonToCppValueConversion(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], + std_pair_QString_QString__PythonToCpp_std_pair_QString_QString_, + is_std_pair_QString_QString__PythonToCpp_std_pair_QString_QString__Convertible); + + // Register converter for type 'const std::list>&'. + SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX] = Shiboken::Conversions::createConverter(&PyList_Type, conststd_list_std_pair_QString_QString__REF_CppToPython_conststd_list_std_pair_QString_QString__REF); + Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX], "const std::list>&"); + Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX], "std::list>"); + Shiboken::Conversions::addPythonToCppValueConversion(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX], + conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF, + is_conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF_Convertible); + // Register converter for type 'std::list*'. SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_TRACKPTR_IDX] = Shiboken::Conversions::createConverter(&PyList_Type, std_list_TrackPTR_PTR_CppToPython_std_list_TrackPTR_PTR); Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_TRACKPTR_IDX], "std::list*"); @@ -979,28 +1001,6 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronEngine) conststd_list_int_REF_PythonToCpp_conststd_list_int_REF, is_conststd_list_int_REF_PythonToCpp_conststd_list_int_REF_Convertible); - // Register converter for type 'std::vector'. - SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_VECTOR_RECTI_IDX] = Shiboken::Conversions::createConverter(&PyList_Type, std_vector_RectI__CppToPython_std_vector_RectI_); - Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_VECTOR_RECTI_IDX], "std::vector"); - Shiboken::Conversions::addPythonToCppValueConversion(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_VECTOR_RECTI_IDX], - std_vector_RectI__PythonToCpp_std_vector_RectI_, - is_std_vector_RectI__PythonToCpp_std_vector_RectI__Convertible); - - // Register converter for type 'std::pair'. - SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX] = Shiboken::Conversions::createConverter(&PyList_Type, std_pair_QString_QString__CppToPython_std_pair_QString_QString_); - Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], "std::pair"); - Shiboken::Conversions::addPythonToCppValueConversion(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX], - std_pair_QString_QString__PythonToCpp_std_pair_QString_QString_, - is_std_pair_QString_QString__PythonToCpp_std_pair_QString_QString__Convertible); - - // Register converter for type 'const std::list>&'. - SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX] = Shiboken::Conversions::createConverter(&PyList_Type, conststd_list_std_pair_QString_QString__REF_CppToPython_conststd_list_std_pair_QString_QString__REF); - Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX], "const std::list>&"); - Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX], "std::list>"); - Shiboken::Conversions::addPythonToCppValueConversion(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX], - conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF, - is_conststd_list_std_pair_QString_QString__REF_PythonToCpp_conststd_list_std_pair_QString_QString__REF_Convertible); - // Register converter for type 'std::map'. SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX] = Shiboken::Conversions::createConverter(&PyDict_Type, std_map_ImageLayer_EffectPTR__CppToPython_std_map_ImageLayer_EffectPTR_); Shiboken::Conversions::registerConverterName(SbkNatronEngineTypeConverters[SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX], "std::map"); diff --git a/Engine/NatronEngine/natronengine_python.h b/Engine/NatronEngine/natronengine_python.h index 84cc615d64..58bb1cc55d 100644 --- a/Engine/NatronEngine/natronengine_python.h +++ b/Engine/NatronEngine/natronengine_python.h @@ -21,10 +21,10 @@ CLANG_DIAG_ON(uninitialized) // Binded library includes #include #include -#include #include -#include +#include #include +#include #include #include #include @@ -73,21 +73,6 @@ CLANG_DIAG_ON(uninitialized) #define SBK_NATRON_NAMESPACE_PLAYBACKMODEENUM_IDX 39 #define SBK_NATRON_NAMESPACE_PIXMAPENUM_IDX 38 #define SBK_NATRON_NAMESPACE_VIEWERCOLORSPACEENUM_IDX 43 -#define SBK_TRACKER_IDX 62 -#define SBK_TRACK_IDX 61 -#define SBK_ROTO_IDX 55 -#define SBK_ITEMBASE_IDX 27 -#define SBK_BEZIERCURVE_IDX 3 -#define SBK_LAYER_IDX 28 -#define SBK_NODECREATIONPROPERTY_IDX 45 -#define SBK_STRINGNODECREATIONPROPERTY_IDX 57 -#define SBK_FLOATNODECREATIONPROPERTY_IDX 17 -#define SBK_BOOLNODECREATIONPROPERTY_IDX 4 -#define SBK_INTNODECREATIONPROPERTY_IDX 25 -#define SBK_APPSETTINGS_IDX 2 -#define SBK_GROUP_IDX 18 -#define SBK_APP_IDX 1 -#define SBK_PYCOREAPPLICATION_IDX 51 #define SBK_RECTD_IDX 53 #define SBK_RECTI_IDX 54 #define SBK_COLORTUPLE_IDX 9 @@ -96,9 +81,14 @@ CLANG_DIAG_ON(uninitialized) #define SBK_INT3DTUPLE_IDX 24 #define SBK_INT2DTUPLE_IDX 22 #define SBK_PARAM_IDX 48 +#define SBK_PAGEPARAM_IDX 47 +#define SBK_GROUPPARAM_IDX 19 #define SBK_SEPARATORPARAM_IDX 56 #define SBK_BUTTONPARAM_IDX 6 #define SBK_ANIMATEDPARAM_IDX 0 +#define SBK_INTPARAM_IDX 26 +#define SBK_INT2DPARAM_IDX 21 +#define SBK_INT3DPARAM_IDX 23 #define SBK_STRINGPARAMBASE_IDX 60 #define SBK_PATHPARAM_IDX 50 #define SBK_OUTPUTFILEPARAM_IDX 46 @@ -111,15 +101,25 @@ CLANG_DIAG_ON(uninitialized) #define SBK_DOUBLEPARAM_IDX 14 #define SBK_DOUBLE2DPARAM_IDX 10 #define SBK_DOUBLE3DPARAM_IDX 12 -#define SBK_INTPARAM_IDX 26 -#define SBK_INT2DPARAM_IDX 21 -#define SBK_INT3DPARAM_IDX 23 #define SBK_PARAMETRICPARAM_IDX 49 -#define SBK_PAGEPARAM_IDX 47 -#define SBK_GROUPPARAM_IDX 19 #define SBK_USERPARAMHOLDER_IDX 63 -#define SBK_EFFECT_IDX 15 #define SBK_IMAGELAYER_IDX 20 +#define SBK_TRACKER_IDX 62 +#define SBK_TRACK_IDX 61 +#define SBK_ROTO_IDX 55 +#define SBK_ITEMBASE_IDX 27 +#define SBK_BEZIERCURVE_IDX 3 +#define SBK_LAYER_IDX 28 +#define SBK_NODECREATIONPROPERTY_IDX 45 +#define SBK_STRINGNODECREATIONPROPERTY_IDX 57 +#define SBK_FLOATNODECREATIONPROPERTY_IDX 17 +#define SBK_BOOLNODECREATIONPROPERTY_IDX 4 +#define SBK_INTNODECREATIONPROPERTY_IDX 25 +#define SBK_APPSETTINGS_IDX 2 +#define SBK_GROUP_IDX 18 +#define SBK_APP_IDX 1 +#define SBK_EFFECT_IDX 15 +#define SBK_PYCOREAPPLICATION_IDX 51 #define SBK_NatronEngine_IDX_COUNT 64 // This variable stores all Python types exported by this module. @@ -130,21 +130,21 @@ extern SbkConverter** SbkNatronEngineTypeConverters; // Converter indices #define SBK_STD_SIZE_T_IDX 0 -#define SBK_NATRONENGINE_STD_LIST_TRACKPTR_IDX 1 // std::list * -#define SBK_NATRONENGINE_STD_LIST_PARAMPTR_IDX 2 // std::list -#define SBK_NATRONENGINE_STD_LIST_DOUBLE_IDX 3 // std::list * -#define SBK_NATRONENGINE_STD_LIST_ITEMBASEPTR_IDX 4 // std::list -#define SBK_NATRONENGINE_STD_VECTOR_STD_STRING_IDX 5 // const std::vector & -#define SBK_NATRONENGINE_STD_VECTOR_DOUBLE_IDX 6 // const std::vector & -#define SBK_NATRONENGINE_STD_VECTOR_BOOL_IDX 7 // const std::vector & -#define SBK_NATRONENGINE_STD_VECTOR_INT_IDX 8 // const std::vector & -#define SBK_NATRONENGINE_STD_LIST_EFFECTPTR_IDX 9 // std::list -#define SBK_NATRONENGINE_STD_MAP_QSTRING_NODECREATIONPROPERTYPTR_IDX 10 // const std::map & -#define SBK_NATRONENGINE_STD_LIST_QSTRING_IDX 11 // std::list -#define SBK_NATRONENGINE_STD_LIST_INT_IDX 12 // const std::list & -#define SBK_NATRONENGINE_STD_VECTOR_RECTI_IDX 13 // std::vector -#define SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX 14 // std::pair -#define SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX 15 // const std::list > & +#define SBK_NATRONENGINE_STD_VECTOR_RECTI_IDX 1 // std::vector +#define SBK_NATRONENGINE_STD_PAIR_QSTRING_QSTRING_IDX 2 // std::pair +#define SBK_NATRONENGINE_STD_LIST_STD_PAIR_QSTRING_QSTRING_IDX 3 // const std::list > & +#define SBK_NATRONENGINE_STD_LIST_TRACKPTR_IDX 4 // std::list * +#define SBK_NATRONENGINE_STD_LIST_PARAMPTR_IDX 5 // std::list +#define SBK_NATRONENGINE_STD_LIST_DOUBLE_IDX 6 // std::list * +#define SBK_NATRONENGINE_STD_LIST_ITEMBASEPTR_IDX 7 // std::list +#define SBK_NATRONENGINE_STD_VECTOR_STD_STRING_IDX 8 // const std::vector & +#define SBK_NATRONENGINE_STD_VECTOR_DOUBLE_IDX 9 // const std::vector & +#define SBK_NATRONENGINE_STD_VECTOR_BOOL_IDX 10 // const std::vector & +#define SBK_NATRONENGINE_STD_VECTOR_INT_IDX 11 // const std::vector & +#define SBK_NATRONENGINE_STD_LIST_EFFECTPTR_IDX 12 // std::list +#define SBK_NATRONENGINE_STD_MAP_QSTRING_NODECREATIONPROPERTYPTR_IDX 13 // const std::map & +#define SBK_NATRONENGINE_STD_LIST_QSTRING_IDX 14 // std::list +#define SBK_NATRONENGINE_STD_LIST_INT_IDX 15 // const std::list & #define SBK_NATRONENGINE_STD_MAP_IMAGELAYER_EFFECTPTR_IDX 16 // std::map #define SBK_NATRONENGINE_QLIST_QVARIANT_IDX 17 // QList #define SBK_NATRONENGINE_QLIST_QSTRING_IDX 18 // QList @@ -173,21 +173,6 @@ template<> inline PyTypeObject* SbkType inline PyTypeObject* SbkType() { return SbkNatronEngineTypes[SBK_NATRON_NAMESPACE_PLAYBACKMODEENUM_IDX]; } template<> inline PyTypeObject* SbkType() { return SbkNatronEngineTypes[SBK_NATRON_NAMESPACE_PIXMAPENUM_IDX]; } template<> inline PyTypeObject* SbkType() { return SbkNatronEngineTypes[SBK_NATRON_NAMESPACE_VIEWERCOLORSPACEENUM_IDX]; } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_TRACKER_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_TRACK_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_ROTO_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_ITEMBASE_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_BEZIERCURVE_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_LAYER_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_NODECREATIONPROPERTY_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_STRINGNODECREATIONPROPERTY_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_FLOATNODECREATIONPROPERTY_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_BOOLNODECREATIONPROPERTY_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INTNODECREATIONPROPERTY_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_APPSETTINGS_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_GROUP_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_APP_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PYCOREAPPLICATION_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_RECTD_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_RECTI_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_COLORTUPLE_IDX]); } @@ -196,9 +181,14 @@ template<> inline PyTypeObject* SbkType inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT3DTUPLE_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT2DTUPLE_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PAGEPARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_GROUPPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_SEPARATORPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_BUTTONPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_ANIMATEDPARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INTPARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT2DPARAM_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT3DPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_STRINGPARAMBASE_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PATHPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_OUTPUTFILEPARAM_IDX]); } @@ -211,15 +201,25 @@ template<> inline PyTypeObject* SbkType inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_DOUBLEPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_DOUBLE2DPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_DOUBLE3DPARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INTPARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT2DPARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INT3DPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PARAMETRICPARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PAGEPARAM_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_GROUPPARAM_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_USERPARAMHOLDER_IDX]); } -template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_EFFECT_IDX]); } template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_IMAGELAYER_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_TRACKER_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_TRACK_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_ROTO_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_ITEMBASE_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_BEZIERCURVE_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_LAYER_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_NODECREATIONPROPERTY_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_STRINGNODECREATIONPROPERTY_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_FLOATNODECREATIONPROPERTY_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_BOOLNODECREATIONPROPERTY_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_INTNODECREATIONPROPERTY_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_APPSETTINGS_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_GROUP_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_APP_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_EFFECT_IDX]); } +template<> inline PyTypeObject* SbkType() { return reinterpret_cast(SbkNatronEngineTypes[SBK_PYCOREAPPLICATION_IDX]); } } // namespace Shiboken diff --git a/Engine/PyNode.cpp b/Engine/PyNode.cpp index f84c2d40ae..d025b5e840 100644 --- a/Engine/PyNode.cpp +++ b/Engine/PyNode.cpp @@ -300,6 +300,27 @@ Effect::getInput(int inputNumber) const return NULL; } +Effect* +Effect::getInput(const QString& inputLabel) const +{ + NodePtr node = getInternalNode(); + if (!node) { + return 0; + } + int maxInputs = node->getMaxInputCount(); + for (int i = 0; i < maxInputs; ++i) { + if (QString::fromUtf8(node->getInputLabel(i).c_str()) == inputLabel) { + NodePtr ret = node->getRealInput(i); + if (!ret) { + return 0; + } + + return new Effect(ret); + } + } + return 0; +} + QString Effect::getScriptName() const { diff --git a/Engine/PyNode.h b/Engine/PyNode.h index 4199de049b..f67e78c5d1 100644 --- a/Engine/PyNode.h +++ b/Engine/PyNode.h @@ -268,6 +268,7 @@ class Effect * @returns Pointer to an Effect, the caller is responsible for freeing it. **/ Effect* getInput(int inputNumber) const; + Effect* getInput(const QString& inputLabel) const; /** * @brief Returns the name of the Effect as used internally diff --git a/Engine/typesystem_engine.xml b/Engine/typesystem_engine.xml index 9a9f90a432..25b42e780d 100644 --- a/Engine/typesystem_engine.xml +++ b/Engine/typesystem_engine.xml @@ -570,6 +570,14 @@ + + + Returns the node at the given input. + + + + + diff --git a/Gui/NatronGui/natrongui_module_wrapper.cpp b/Gui/NatronGui/natrongui_module_wrapper.cpp index e2d1df2407..6823567781 100644 --- a/Gui/NatronGui/natrongui_module_wrapper.cpp +++ b/Gui/NatronGui/natrongui_module_wrapper.cpp @@ -39,8 +39,8 @@ void init_PyGuiApplication(PyObject* module); void init_GuiApp(PyObject* module); void init_PyViewer(PyObject* module); void init_PyTabWidget(PyObject* module); -void init_PyPanel(PyObject* module); void init_PyModalDialog(PyObject* module); +void init_PyPanel(PyObject* module); // Required modules' type and converter arrays. PyTypeObject** SbkPySide_QtGuiTypes; @@ -508,8 +508,8 @@ SBK_MODULE_INIT_FUNCTION_BEGIN(NatronGui) init_GuiApp(module); init_PyViewer(module); init_PyTabWidget(module); - init_PyPanel(module); init_PyModalDialog(module); + init_PyPanel(module); // Register converter for type 'const std::map&'. SbkNatronGuiTypeConverters[SBK_NATRONGUI_STD_MAP_QSTRING_NODECREATIONPROPERTYPTR_IDX] = Shiboken::Conversions::createConverter(&PyDict_Type, _conststd_map_QString_NodeCreationPropertyPTR_REF_CppToPython__conststd_map_QString_NodeCreationPropertyPTR_REF);