| 2416 | } // exportRotoLayer |
| 2417 | |
| 2418 | static void |
| 2419 | exportAllNodeKnobs(int indentLevel, |
| 2420 | const NodePtr& node, |
| 2421 | QTextStream& ts) |
| 2422 | { |
| 2423 | const KnobsVec& knobs = node->getKnobs(); |
| 2424 | std::list<KnobPage*> userPages; |
| 2425 | |
| 2426 | for (KnobsVec::const_iterator it2 = knobs.begin(); it2 != knobs.end(); ++it2) { |
| 2427 | if ( (*it2)->getIsPersistent() && !(*it2)->isUserKnob() ) { |
| 2428 | QString getParamStr = QString::fromUtf8("lastNode.getParam(\""); |
| 2429 | const std::string& paramName = (*it2)->getName(); |
| 2430 | if ( paramName.empty() ) { |
| 2431 | continue; |
| 2432 | } |
| 2433 | getParamStr += QString::fromUtf8( paramName.c_str() ); |
| 2434 | getParamStr += QString::fromUtf8("\")"); |
| 2435 | if ( exportKnobValues(indentLevel, *it2, getParamStr, true, ts) ) { |
| 2436 | WRITE_STATIC_LINE(""); |
| 2437 | } |
| 2438 | } |
| 2439 | |
| 2440 | if ( (*it2)->isUserKnob() ) { |
| 2441 | KnobPage* isPage = dynamic_cast<KnobPage*>( it2->get() ); |
| 2442 | if (isPage) { |
| 2443 | userPages.push_back(isPage); |
| 2444 | } |
| 2445 | } |
| 2446 | } // for (KnobsVec::const_iterator it2 = knobs.begin(); it2 != knobs.end(); ++it2) |
| 2447 | if ( !userPages.empty() ) { |
| 2448 | WRITE_STATIC_LINE(""); |
| 2449 | WRITE_INDENT(indentLevel); WRITE_STATIC_LINE("# Create the user parameters"); |
| 2450 | } |
| 2451 | for (std::list<KnobPage*>::iterator it2 = userPages.begin(); it2 != userPages.end(); ++it2) { |
| 2452 | WRITE_INDENT(indentLevel); WRITE_STRING( QString::fromUtf8("lastNode.") + QString::fromUtf8( (*it2)->getName().c_str() ) + |
| 2453 | QString::fromUtf8(" = lastNode.createPageParam(") + ESC( (*it2)->getName() ) + QString::fromUtf8(", ") + |
| 2454 | ESC( (*it2)->getLabel() ) + QString::fromUtf8(")") ); |
| 2455 | KnobsVec children = (*it2)->getChildren(); |
| 2456 | for (KnobsVec::const_iterator it3 = children.begin(); it3 != children.end(); ++it3) { |
| 2457 | exportUserKnob(indentLevel, *it3, QString::fromUtf8("lastNode"), 0, *it2, ts); |
| 2458 | } |
| 2459 | } |
| 2460 | |
| 2461 | if ( !userPages.empty() ) { |
| 2462 | WRITE_INDENT(indentLevel); WRITE_STATIC_LINE("# Refresh the GUI with the newly created parameters"); |
| 2463 | std::list<std::string> pagesOrdering = node->getPagesOrder(); |
| 2464 | if ( !pagesOrdering.empty() ) { |
| 2465 | QString line = QString::fromUtf8("lastNode.setPagesOrder(["); |
| 2466 | std::list<std::string>::iterator next = pagesOrdering.begin(); |
| 2467 | ++next; |
| 2468 | for (std::list<std::string>::iterator it = pagesOrdering.begin(); it != pagesOrdering.end(); ++it) { |
| 2469 | line += QLatin1Char('\''); |
| 2470 | line += QString::fromUtf8( it->c_str() ); |
| 2471 | line += QLatin1Char('\''); |
| 2472 | if ( next != pagesOrdering.end() ) { |
| 2473 | line += QString::fromUtf8(", "); |
| 2474 | ++next; |
| 2475 | } |
no test coverage detected