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

Function handleConnectionError

Gui/NodeGraph15.cpp:60–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mouseReleaseEventMethod · 0.85

Calls 10

getEffectInstanceMethod · 0.80
toStdStringMethod · 0.80
translateFunction · 0.70
canConnectInputMethod · 0.45
getNodeMethod · 0.45
getLabelMethod · 0.45
getAspectRatioMethod · 0.45
getFrameRateMethod · 0.45
isReaderMethod · 0.45
getPluginIDMethod · 0.45

Tested by

no test coverage detected