MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / exportAllNodeKnobs

Function exportAllNodeKnobs

Engine/NodeGroup.cpp:2460–2548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2458} // exportRotoLayer
2459
2460static void
2461exportAllNodeKnobs(int indentLevel,
2462 const NodePtr& node,
2463 QTextStream& ts)
2464{
2465 const KnobsVec& knobs = node->getKnobs();
2466 std::list<KnobPage*> userPages;
2467
2468 for (KnobsVec::const_iterator it2 = knobs.begin(); it2 != knobs.end(); ++it2) {
2469 if ( (*it2)->getIsPersistent() && !(*it2)->isUserKnob() ) {
2470 QString getParamStr = QString::fromUtf8("lastNode.getParam(\"");
2471 const std::string& paramName = (*it2)->getName();
2472 if ( paramName.empty() ) {
2473 continue;
2474 }
2475 getParamStr += QString::fromUtf8( paramName.c_str() );
2476 getParamStr += QString::fromUtf8("\")");
2477 if ( exportKnobValues(indentLevel, *it2, getParamStr, true, ts) ) {
2478 WRITE_STATIC_LINE("");
2479 }
2480 }
2481
2482 if ( (*it2)->isUserKnob() ) {
2483 KnobPage* isPage = dynamic_cast<KnobPage*>( it2->get() );
2484 if (isPage) {
2485 userPages.push_back(isPage);
2486 }
2487 }
2488 } // for (KnobsVec::const_iterator it2 = knobs.begin(); it2 != knobs.end(); ++it2)
2489 if ( !userPages.empty() ) {
2490 WRITE_STATIC_LINE("");
2491 WRITE_INDENT(indentLevel); WRITE_STATIC_LINE("# Create the user parameters");
2492 }
2493 for (std::list<KnobPage*>::iterator it2 = userPages.begin(); it2 != userPages.end(); ++it2) {
2494 WRITE_INDENT(indentLevel); WRITE_STRING( QString::fromUtf8("lastNode.") + QString::fromUtf8( (*it2)->getName().c_str() ) +
2495 QString::fromUtf8(" = lastNode.createPageParam(") + ESC( (*it2)->getName() ) + QString::fromUtf8(", ") +
2496 ESC( (*it2)->getLabel() ) + QString::fromUtf8(")") );
2497 KnobsVec children = (*it2)->getChildren();
2498 for (KnobsVec::const_iterator it3 = children.begin(); it3 != children.end(); ++it3) {
2499 exportUserKnob(indentLevel, *it3, QString::fromUtf8("lastNode"), 0, *it2, ts);
2500 }
2501 }
2502
2503 if ( !userPages.empty() ) {
2504 WRITE_INDENT(indentLevel); WRITE_STATIC_LINE("# Refresh the GUI with the newly created parameters");
2505 std::list<std::string> pagesOrdering = node->getPagesOrder();
2506 if ( !pagesOrdering.empty() ) {
2507 QString line = QString::fromUtf8("lastNode.setPagesOrder([");
2508 std::list<std::string>::iterator next = pagesOrdering.begin();
2509 ++next;
2510 for (std::list<std::string>::iterator it = pagesOrdering.begin(); it != pagesOrdering.end(); ++it) {
2511 line += QLatin1Char('\'');
2512 line += QString::fromUtf8( it->c_str() );
2513 line += QLatin1Char('\'');
2514 if ( next != pagesOrdering.end() ) {
2515 line += QString::fromUtf8(", ");
2516 ++next;
2517 }

Callers 1

exportGroupInternalFunction · 0.85

Calls 15

exportKnobValuesFunction · 0.85
exportUserKnobFunction · 0.85
exportRotoLayerFunction · 0.85
getNameMethod · 0.80
emptyMethod · 0.80
getPagesOrderMethod · 0.80
isGloballyActivatedMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getIsPersistentMethod · 0.45
isUserKnobMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected