| 6680 | } // Node::declarePythonFields |
| 6681 | |
| 6682 | void |
| 6683 | Node::removeParameterFromPython(const std::string& parameterName) |
| 6684 | { |
| 6685 | #ifdef NATRON_RUN_WITHOUT_PYTHON |
| 6686 | |
| 6687 | return; |
| 6688 | #endif |
| 6689 | if (getScriptName_mt_safe().empty()) { |
| 6690 | return; |
| 6691 | } |
| 6692 | PythonGILLocker pgl; |
| 6693 | std::string appID = getApp()->getAppIDString(); |
| 6694 | std::string nodeName; |
| 6695 | if (getIOContainer()) { |
| 6696 | nodeName = getIOContainer()->getFullyQualifiedName(); |
| 6697 | } else { |
| 6698 | nodeName = getFullyQualifiedName(); |
| 6699 | } |
| 6700 | std::string nodeFullName = appID + "." + nodeName; |
| 6701 | bool alreadyDefined = false; |
| 6702 | PyObject* nodeObj = NATRON_PYTHON_NAMESPACE::getAttrRecursive(nodeFullName, NATRON_PYTHON_NAMESPACE::getMainModule(), &alreadyDefined); |
| 6703 | assert(nodeObj); |
| 6704 | Q_UNUSED(nodeObj); |
| 6705 | if (!alreadyDefined) { |
| 6706 | qDebug() << QString::fromUtf8("removeParameterFromPython(): attribute ") + QString::fromUtf8( nodeFullName.c_str() ) + QString::fromUtf8(" is not defined"); |
| 6707 | throw std::logic_error(std::string("removeParameterFromPython(): attribute ") + nodeFullName + " is not defined"); |
| 6708 | } |
| 6709 | assert( PyObject_HasAttrString( nodeObj, parameterName.c_str() ) ); |
| 6710 | std::string script = "del " + nodeFullName + "." + parameterName; |
| 6711 | if ( !appPTR->isBackground() ) { |
| 6712 | getApp()->printAutoDeclaredVariable(script); |
| 6713 | } |
| 6714 | std::string err; |
| 6715 | if ( !NATRON_PYTHON_NAMESPACE::interpretPythonScript(script, &err, 0) ) { |
| 6716 | qDebug() << err.c_str(); |
| 6717 | } |
| 6718 | } |
| 6719 | |
| 6720 | void |
| 6721 | Node::declareAllPythonAttributes() |
no test coverage detected