| 2548 | } // exportAllNodeKnobs |
| 2549 | |
| 2550 | static bool |
| 2551 | exportKnobLinks(int indentLevel, |
| 2552 | const NodePtr& groupNode, |
| 2553 | const NodePtr& node, |
| 2554 | const QString& groupName, |
| 2555 | const QString& nodeName, |
| 2556 | QTextStream& ts) |
| 2557 | { |
| 2558 | bool hasExportedLink = false; |
| 2559 | const KnobsVec& knobs = node->getKnobs(); |
| 2560 | |
| 2561 | for (KnobsVec::const_iterator it2 = knobs.begin(); it2 != knobs.end(); ++it2) { |
| 2562 | QString paramName = nodeName + QString::fromUtf8(".getParam(\"") + QString::fromUtf8( (*it2)->getName().c_str() ) + QString::fromUtf8("\")"); |
| 2563 | bool hasDefined = false; |
| 2564 | |
| 2565 | //Check for alias link |
| 2566 | KnobIPtr alias = (*it2)->getAliasMaster(); |
| 2567 | if (alias) { |
| 2568 | if (!hasDefined) { |
| 2569 | WRITE_INDENT(indentLevel); WRITE_STRING(QString::fromUtf8("param = ") + paramName); |
| 2570 | hasDefined = true; |
| 2571 | } |
| 2572 | hasExportedLink = true; |
| 2573 | |
| 2574 | EffectInstance* aliasHolder = dynamic_cast<EffectInstance*>( alias->getHolder() ); |
| 2575 | assert(aliasHolder); |
| 2576 | if (!aliasHolder) { |
| 2577 | throw std::logic_error("exportKnobLinks"); |
| 2578 | } |
| 2579 | QString aliasName; |
| 2580 | if ( groupNode && aliasHolder == groupNode->getEffectInstance().get() ) { |
| 2581 | aliasName = groupName; |
| 2582 | } else { |
| 2583 | aliasName = groupName + QString::fromUtf8( aliasHolder->getNode()->getScriptName_mt_safe().c_str() ); |
| 2584 | } |
| 2585 | aliasName += QString::fromUtf8(".getParam("); |
| 2586 | aliasName += ESC(QString::fromUtf8( alias->getName().c_str() )); |
| 2587 | aliasName += QString::fromUtf8(")"); |
| 2588 | |
| 2589 | WRITE_INDENT(indentLevel); WRITE_STRING( aliasName + QString::fromUtf8(".setAsAlias(param)") ); |
| 2590 | } else { |
| 2591 | for (int i = 0; i < (*it2)->getDimension(); ++i) { |
| 2592 | std::string expr = (*it2)->getExpression(i); |
| 2593 | QString hasRetVar = (*it2)->isExpressionUsingRetVariable(i) ? QString::fromUtf8("True") : QString::fromUtf8("False"); |
| 2594 | if ( !expr.empty() ) { |
| 2595 | if (!hasDefined) { |
| 2596 | WRITE_INDENT(indentLevel); WRITE_STRING(QString::fromUtf8("param = ") + paramName); |
| 2597 | hasDefined = true; |
| 2598 | } |
| 2599 | hasExportedLink = true; |
| 2600 | WRITE_INDENT(indentLevel); WRITE_STRING( QString::fromUtf8("param.setExpression(") + ESC(expr) + QString::fromUtf8(", ") + |
| 2601 | hasRetVar + QString::fromUtf8(", ") + NUM_INT(i) + QString::fromUtf8(")") ); |
| 2602 | } |
| 2603 | |
| 2604 | std::pair<int, KnobIPtr> master = (*it2)->getMaster(i); |
| 2605 | if (master.second) { |
| 2606 | if (!hasDefined) { |
| 2607 | WRITE_INDENT(indentLevel); WRITE_STRING(QString::fromUtf8("param = ") + paramName); |
no test coverage detected