本文整理汇总了C++中NodeGuiPtr::boundingRectWithEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeGuiPtr::boundingRectWithEdges方法的具体用法?C++ NodeGuiPtr::boundingRectWithEdges怎么用?C++ NodeGuiPtr::boundingRectWithEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeGuiPtr
的用法示例。
在下文中一共展示了NodeGuiPtr::boundingRectWithEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
NodeGraph::checkForHints(bool shiftdown,
bool controlDown,
const NodeGuiPtr& selectedNode,
const QRectF& visibleSceneR)
{
NodePtr internalNode = selectedNode->getNode();
bool doMergeHints = shiftdown && controlDown;
bool doConnectionHints = appPTR->getCurrentSettings()->isConnectionHintEnabled();
//Ignore hints for backdrops
BackdropGui* isBd = dynamic_cast<BackdropGui*>( selectedNode.get() );
if (isBd) {
return;
}
if (!doMergeHints) {
///for nodes already connected don't show hint
if ( ( internalNode->getMaxInputCount() == 0) && internalNode->hasOutputConnected() ) {
doConnectionHints = false;
} else if ( ( internalNode->getMaxInputCount() > 0) && internalNode->hasAllInputsConnected() && internalNode->hasOutputConnected() ) {
doConnectionHints = false;
}
}
if (!doConnectionHints) {
return;
}
QRectF selectedNodeBbox = selectedNode->boundingRectWithEdges(); //selectedNode->mapToParent( selectedNode->boundingRect() ).boundingRect();
double tolerance = 10;
selectedNodeBbox.adjust(-tolerance, -tolerance, tolerance, tolerance);
NodeGuiPtr nodeToShowMergeRect;
NodePtr selectedNodeInternalNode = selectedNode->getNode();
bool selectedNodeIsReader = selectedNodeInternalNode->getEffectInstance()->isReader() || selectedNodeInternalNode->getMaxInputCount() == 0;
Edge* edge = 0;
std::set<NodeGui*> nodesWithinRect;
getNodesWithinViewportRect(visibleWidgetRect(), &nodesWithinRect);
{
for (std::set<NodeGui*>::iterator it = nodesWithinRect.begin(); it != nodesWithinRect.end(); ++it) {
bool isAlreadyAnOutput = false;
const NodesWList& outputs = internalNode->getGuiOutputs();
for (NodesWList::const_iterator it2 = outputs.begin(); it2 != outputs.end(); ++it2) {
NodePtr node = it2->lock();
if (!node) {
continue;
}
if ( node == (*it)->getNode() ) {
isAlreadyAnOutput = true;
break;
}
}
if (isAlreadyAnOutput) {
continue;
}
QRectF nodeBbox = (*it)->boundingRectWithEdges();
if ( ( (*it) != selectedNode.get() ) && (*it)->isVisible() && nodeBbox.intersects(visibleSceneR) ) {
if (doMergeHints) {
//QRectF nodeRect = (*it)->mapToParent((*it)->boundingRect()).boundingRect();
NodePtr internalNode = (*it)->getNode();
if ( !internalNode->isOutputNode() && nodeBbox.intersects(selectedNodeBbox) ) {
bool nHasInput = internalNode->hasInputConnected();
int nMaxInput = internalNode->getMaxInputCount();
bool selectedHasInput = selectedNodeInternalNode->hasInputConnected();
int selectedMaxInput = selectedNodeInternalNode->getMaxInputCount();
double nPAR = internalNode->getEffectInstance()->getAspectRatio(-1);
double selectedPAR = selectedNodeInternalNode->getEffectInstance()->getAspectRatio(-1);
double nFPS = internalNode->getEffectInstance()->getFrameRate();
double selectedFPS = selectedNodeInternalNode->getEffectInstance()->getFrameRate();
bool isValid = true;
if ( (selectedPAR != nPAR) || (std::abs(nFPS - selectedFPS) > 0.01) ) {
if (nHasInput || selectedHasInput) {
isValid = false;
} else if ( !nHasInput && (nMaxInput == 0) && !selectedHasInput && (selectedMaxInput == 0) ) {
isValid = false;
}
}
if (isValid) {
nodeToShowMergeRect = (*it)->shared_from_this();
}
} else {
(*it)->setMergeHintActive(false);
}
} else { //!doMergeHints
edge = (*it)->hasEdgeNearbyRect(selectedNodeBbox);
///if the edge input is the selected node don't continue
if ( edge && ( edge->getSource() == selectedNode) ) {
edge = 0;
}
if ( edge && edge->isOutputEdge() ) {
if (selectedNodeIsReader) {
//.........这里部分代码省略.........
示例2: toBackdropGui
GCC_DIAG_UNUSED_PRIVATE_FIELD_ON
#include "Engine/EffectInstance.h"
#include "Engine/Node.h"
#include "Engine/NodeGroup.h"
#include "Engine/Settings.h"
#include "Engine/Utils.h" // convertFromPlainText
#include "Gui/BackdropGui.h"
#include "Gui/Edge.h"
#include "Gui/GuiApplicationManager.h"
#include "Gui/GuiMacros.h"
#include "Gui/NodeGui.h"
#include "Gui/TabWidget.h"
#include "Global/QtCompat.h"
NATRON_NAMESPACE_ENTER
void
NodeGraph::checkForHints(bool shiftdown,
bool controlDown,
const NodeGuiPtr& selectedNode,
const QRectF& visibleSceneR)
{
NodePtr internalNode = selectedNode->getNode();
if (!internalNode) {
return;
}
bool doMergeHints = shiftdown && controlDown;
bool doConnectionHints = controlDown;
//Ignore hints for backdrops
BackdropGuiPtr isBd = toBackdropGui( selectedNode );
if (isBd) {
return;
}
if (!doMergeHints) {
///for nodes already connected don't show hint
if ( ( internalNode->getNInputs() == 0) && internalNode->hasOutputConnected() ) {
doConnectionHints = false;
} else if ( ( internalNode->getNInputs() > 0) && internalNode->hasAllInputsConnected() && internalNode->hasOutputConnected() ) {
doConnectionHints = false;
}
}
if (!doConnectionHints) {
return;
}
QRectF selectedNodeBbox = selectedNode->boundingRectWithEdges(); //selectedNode->mapToParent( selectedNode->boundingRect() ).boundingRect();
double tolerance = 10;
selectedNodeBbox.adjust(-tolerance, -tolerance, tolerance, tolerance);
NodeGuiPtr nodeToShowMergeRect;
NodePtr selectedNodeInternalNode = selectedNode->getNode();
bool selectedNodeIsReader = selectedNodeInternalNode->getEffectInstance()->isReader() || selectedNodeInternalNode->getNInputs() == 0;
Edge* edge = 0;
std::set<NodeGuiPtr> nodesWithinRect;
getNodesWithinViewportRect(visibleWidgetRect(), &nodesWithinRect);
{
for (std::set<NodeGuiPtr>::iterator it = nodesWithinRect.begin(); it != nodesWithinRect.end(); ++it) {
OutputNodesMap outputs;
internalNode->getOutputs(outputs);
OutputNodesMap::const_iterator foundAsOutput = outputs.find((*it)->getNode());
if (foundAsOutput != outputs.end()) {
continue;
}
QRectF nodeBbox = (*it)->boundingRectWithEdges();
if ( ( (*it) != selectedNode ) && (*it)->isVisible() && nodeBbox.intersects(visibleSceneR) ) {
if (doMergeHints) {
//QRectF nodeRect = (*it)->mapToParent((*it)->boundingRect()).boundingRect();
NodePtr internalNode = (*it)->getNode();
if ( !internalNode->isOutputNode() && nodeBbox.intersects(selectedNodeBbox) ) {
bool nHasInput = internalNode->hasInputConnected();
int nMaxInput = internalNode->getNInputs();
bool selectedHasInput = selectedNodeInternalNode->hasInputConnected();
int selectedMaxInput = selectedNodeInternalNode->getNInputs();
double nPAR = internalNode->getEffectInstance()->getAspectRatio(-1);
double selectedPAR = selectedNodeInternalNode->getEffectInstance()->getAspectRatio(-1);
double nFPS = internalNode->getEffectInstance()->getFrameRate();
double selectedFPS = selectedNodeInternalNode->getEffectInstance()->getFrameRate();
bool isValid = true;
if ( (selectedPAR != nPAR) || (std::abs(nFPS - selectedFPS) > 0.01) ) {
if (nHasInput || selectedHasInput) {
isValid = false;
} else if ( !nHasInput && (nMaxInput == 0) && !selectedHasInput && (selectedMaxInput == 0) ) {
isValid = false;
}
}
if (isValid) {
//.........这里部分代码省略.........