MCPcopy Create free account
hub / github.com/MrKepzie/Natron / removeParameterFromPython

Method removeParameterFromPython

Engine/Node.cpp:10953–10989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10951} // Node::declarePythonFields
10952
10953void
10954Node::removeParameterFromPython(const std::string& parameterName)
10955{
10956#ifdef NATRON_RUN_WITHOUT_PYTHON
10957
10958 return;
10959#endif
10960 if (getScriptName_mt_safe().empty()) {
10961 return;
10962 }
10963 PythonGILLocker pgl;
10964 std::string appID = getApp()->getAppIDString();
10965 std::string nodeName;
10966 if (getIOContainer()) {
10967 nodeName = getIOContainer()->getFullyQualifiedName();
10968 } else {
10969 nodeName = getFullyQualifiedName();
10970 }
10971 std::string nodeFullName = appID + "." + nodeName;
10972 bool alreadyDefined = false;
10973 PyObject* nodeObj = NATRON_PYTHON_NAMESPACE::getAttrRecursive(nodeFullName, NATRON_PYTHON_NAMESPACE::getMainModule(), &alreadyDefined);
10974 assert(nodeObj);
10975 Q_UNUSED(nodeObj);
10976 if (!alreadyDefined) {
10977 qDebug() << QString::fromUtf8("removeParameterFromPython(): attribute ") + QString::fromUtf8( nodeFullName.c_str() ) + QString::fromUtf8(" is not defined");
10978 throw std::logic_error(std::string("removeParameterFromPython(): attribute ") + nodeFullName + " is not defined");
10979 }
10980 assert( PyObject_HasAttrString( nodeObj, parameterName.c_str() ) );
10981 std::string script = "del " + nodeFullName + "." + parameterName;
10982 if ( !appPTR->isBackground() ) {
10983 getApp()->printAutoDeclaredVariable(script);
10984 }
10985 std::string err;
10986 if ( !NATRON_PYTHON_NAMESPACE::interpretPythonScript(script, &err, 0) ) {
10987 qDebug() << err.c_str();
10988 }
10989}
10990
10991void
10992Node::declareAllPythonAttributes()

Callers 1

deleteKnobMethod · 0.80

Calls 6

getAppFunction · 0.85
emptyMethod · 0.80
getAppIDStringMethod · 0.80
getFullyQualifiedNameMethod · 0.45
isBackgroundMethod · 0.45

Tested by

no test coverage detected