| 1947 | } |
| 1948 | |
| 1949 | void |
| 1950 | OutputSchedulerThread::runCallbackWithVariables(const QString& callback) |
| 1951 | { |
| 1952 | if ( !callback.isEmpty() ) { |
| 1953 | OutputEffectInstancePtr effect = _imp->outputEffect.lock(); |
| 1954 | QString script = callback; |
| 1955 | std::string appID = effect->getApp()->getAppIDString(); |
| 1956 | std::string nodeName = effect->getNode()->getFullyQualifiedName(); |
| 1957 | std::string nodeFullName = appID + "." + nodeName; |
| 1958 | script.append( QString::fromUtf8( nodeFullName.c_str() ) ); |
| 1959 | script.append( QLatin1Char(',') ); |
| 1960 | script.append( QString::fromUtf8( appID.c_str() ) ); |
| 1961 | script.append( QString::fromUtf8(")\n") ); |
| 1962 | |
| 1963 | std::string err, output; |
| 1964 | if ( !NATRON_PYTHON_NAMESPACE::interpretPythonScript(callback.toStdString(), &err, &output) ) { |
| 1965 | effect->getApp()->appendToScriptEditor("Failed to run callback: " + err); |
| 1966 | throw std::runtime_error(err); |
| 1967 | } else if ( !output.empty() ) { |
| 1968 | effect->getApp()->appendToScriptEditor(output); |
| 1969 | } |
| 1970 | } |
| 1971 | } |
| 1972 | |
| 1973 | //////////////////////////////////////////////////////////// |
| 1974 | //////////////////////////////////////////////////////////// |
no test coverage detected