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

Method checkForHints

Gui/NodeGraph20.cpp:54–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52#include "Global/QtCompat.h"
53
54NATRON_NAMESPACE_ENTER
55void
56NodeGraph::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;

Callers

nothing calls this directly

Calls 15

absFunction · 0.85
hasAllInputsConnectedMethod · 0.80
boundingRectWithEdgesMethod · 0.80
getEffectInstanceMethod · 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