| 52 | #include "Global/QtCompat.h" |
| 53 | |
| 54 | NATRON_NAMESPACE_ENTER |
| 55 | void |
| 56 | NodeGraph::checkForHints(bool shiftdown, |
| 57 | bool controlDown, |
| 58 | const NodeGuiPtr& selectedNode, |
| 59 | const QRectF& visibleSceneR) |
| 60 | { |
| 61 | NodePtr internalNode = selectedNode->getNode(); |
| 62 | bool doMergeHints = shiftdown && controlDown; |
| 63 | bool doConnectionHints = controlDown; |
| 64 | |
| 65 | //Ignore hints for backdrops |
| 66 | BackdropGui* isBd = dynamic_cast<BackdropGui*>( selectedNode.get() ); |
| 67 | |
| 68 | if (isBd) { |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | if (!doMergeHints) { |
| 73 | ///for nodes already connected don't show hint |
| 74 | if ( ( internalNode->getMaxInputCount() == 0) && internalNode->hasOutputConnected() ) { |
| 75 | doConnectionHints = false; |
| 76 | } else if ( ( internalNode->getMaxInputCount() > 0) && internalNode->hasAllInputsConnected() && internalNode->hasOutputConnected() ) { |
| 77 | doConnectionHints = false; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | if (!doConnectionHints) { |
| 82 | return; |
| 83 | } |
| 84 | |
| 85 | QRectF selectedNodeBbox = selectedNode->boundingRectWithEdges(); //selectedNode->mapToParent( selectedNode->boundingRect() ).boundingRect(); |
| 86 | double tolerance = 10; |
| 87 | selectedNodeBbox.adjust(-tolerance, -tolerance, tolerance, tolerance); |
| 88 | |
| 89 | NodeGuiPtr nodeToShowMergeRect; |
| 90 | NodePtr selectedNodeInternalNode = selectedNode->getNode(); |
| 91 | bool selectedNodeIsReader = selectedNodeInternalNode->getEffectInstance()->isReader() || selectedNodeInternalNode->getMaxInputCount() == 0; |
| 92 | Edge* edge = 0; |
| 93 | std::set<NodeGui*> nodesWithinRect; |
| 94 | getNodesWithinViewportRect(visibleWidgetRect(), &nodesWithinRect); |
| 95 | |
| 96 | { |
| 97 | for (std::set<NodeGui*>::iterator it = nodesWithinRect.begin(); it != nodesWithinRect.end(); ++it) { |
| 98 | bool isAlreadyAnOutput = false; |
| 99 | const NodesWList& outputs = internalNode->getGuiOutputs(); |
| 100 | for (NodesWList::const_iterator it2 = outputs.begin(); it2 != outputs.end(); ++it2) { |
| 101 | NodePtr node = it2->lock(); |
| 102 | if (!node) { |
| 103 | continue; |
| 104 | } |
| 105 | if ( node == (*it)->getNode() ) { |
| 106 | isAlreadyAnOutput = true; |
| 107 | break; |
| 108 | } |
| 109 | } |
| 110 | if (isAlreadyAnOutput) { |
| 111 | continue; |
nothing calls this directly
no test coverage detected