MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / checkForHints

Method checkForHints

Gui/NodeGraph20.cpp:55–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

hasAllInputsConnectedMethod · 0.80
boundingRectWithEdgesMethod · 0.80
getEffectInstanceMethod · 0.80
isOutputNodeMethod · 0.80
hasInputConnectedMethod · 0.80
setMergeHintActiveMethod · 0.80
hasEdgeNearbyRectMethod · 0.80
getSourceMethod · 0.80
isOutputEdgeMethod · 0.80
isInputRotoBrushMethod · 0.80
getDestMethod · 0.80

Tested by

no test coverage detected