| 59 | |
| 60 | |
| 61 | NATRON_NAMESPACE_ENTER |
| 62 | static bool |
| 63 | handleConnectionError(const NodeGuiPtr& outputNode, |
| 64 | const NodeGuiPtr& inputNode, |
| 65 | int inputNb) |
| 66 | { |
| 67 | Node::CanConnectInputReturnValue linkRetCode = outputNode->getNode()->canConnectInput(inputNode->getNode(), inputNb); |
| 68 | |
| 69 | if ( (linkRetCode != Node::eCanConnectInput_ok) && (linkRetCode != Node::eCanConnectInput_inputAlreadyConnected) ) { |
| 70 | if (linkRetCode == Node::eCanConnectInput_differentPars) { |
| 71 | QString error = QCoreApplication::translate("NodeGraph", "%1 and %2 do not have the same pixel aspect ratio (%3 vs. %4), and %1 does not support inputs with different pixel aspect ratio.\n" |
| 72 | "This might yield unwanted results.") |
| 73 | .arg( QString::fromUtf8( outputNode->getNode()->getLabel().c_str() ) ) |
| 74 | .arg( QString::fromUtf8( inputNode->getNode()->getLabel().c_str() ) ) |
| 75 | .arg( outputNode->getNode()->getEffectInstance()->getAspectRatio(-1) ) |
| 76 | .arg( inputNode->getNode()->getEffectInstance()->getAspectRatio(-1) ); |
| 77 | Dialogs::warningDialog( QCoreApplication::translate("NodeGraph", "Different pixel aspect").toStdString(), |
| 78 | error.toStdString() ); |
| 79 | |
| 80 | return true; |
| 81 | } else if (linkRetCode == Node::eCanConnectInput_differentFPS) { |
| 82 | QString error = QCoreApplication::translate("NodeGraph", "%1 and %2 do not have the same frame rate (%3 vs. %4).\n" |
| 83 | "This might yield unwanted results.\n" |
| 84 | "Either change the FPS from the Read node parameters or change the settings of the project.") |
| 85 | .arg( QString::fromUtf8( outputNode->getNode()->getLabel().c_str() ) ) |
| 86 | .arg( QString::fromUtf8( inputNode->getNode()->getLabel().c_str() ) ) |
| 87 | .arg( outputNode->getNode()->getEffectInstance()->getFrameRate() ) |
| 88 | .arg( inputNode->getNode()->getEffectInstance()->getFrameRate() ); |
| 89 | Dialogs::warningDialog( QCoreApplication::translate("NodeGraph", "Different frame rate").toStdString(), |
| 90 | error.toStdString() ); |
| 91 | |
| 92 | return true; |
| 93 | } else if (linkRetCode == Node::eCanConnectInput_groupHasNoOutput) { |
| 94 | QString error = QCoreApplication::translate("NodeGraph", "You cannot connect %1 to %2, because it is a group which does not have an Output node.") |
| 95 | .arg( QString::fromUtf8( outputNode->getNode()->getLabel().c_str() ) ) |
| 96 | .arg( QString::fromUtf8( inputNode->getNode()->getLabel().c_str() ) ); |
| 97 | Dialogs::errorDialog( QCoreApplication::translate("NodeGraph", "Different frame rate").toStdString(), |
| 98 | error.toStdString() ); |
| 99 | } else if (linkRetCode == Node::eCanConnectInput_multiResNotSupported) { |
| 100 | QString error = QCoreApplication::translate("NodeGraph", "You cannot connect %1 to %2 because multi-resolution is not supported on %1, " |
| 101 | "which means that it cannot receive images with a lower left corner different than (0,0) and cannot have " |
| 102 | "multiple inputs/outputs with different image sizes.\n" |
| 103 | "To overcome this, use a Resize or Crop node upstream to change the image size. In some cases you might also need to make sure the input image size is the project size.").arg( QString::fromUtf8( outputNode->getNode()->getLabel().c_str() ) ) |
| 104 | .arg( QString::fromUtf8( inputNode->getNode()->getLabel().c_str() ) ); |
| 105 | Dialogs::errorDialog( QCoreApplication::translate("NodeGraph", "Multi-resolution not supported").toStdString(), |
| 106 | error.toStdString() );; |
| 107 | } |
| 108 | |
| 109 | return false; |
| 110 | } |
| 111 | |
| 112 | if ( (linkRetCode == Node::eCanConnectInput_ok) && outputNode->getNode()->getEffectInstance()->isReader() && |
| 113 | ( inputNode->getNode()->getPluginID() != PLUGINID_OFX_RUNSCRIPT) && |
| 114 | !inputNode->getNode()->getEffectInstance()->isWriter() ) { |
| 115 | Dialogs::warningDialog( QCoreApplication::translate("NodeGraph", "Reader input").toStdString(), |
| 116 | QCoreApplication::translate("NodeGraph", "Connecting an input to a Reader node " |
| 117 | "is only useful when connecting to the output of a Writer " |
| 118 | "or RunScript node " |
no test coverage detected