本文整理汇总了C++中NodeGuiPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeGuiPtr::get方法的具体用法?C++ NodeGuiPtr::get怎么用?C++ NodeGuiPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeGuiPtr
的用法示例。
在下文中一共展示了NodeGuiPtr::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logic_error
void
GuiAppInstance::onGroupCreationFinished(const NodePtr& node,
CreateNodeReason reason)
{
if (reason == eCreateNodeReasonUserCreate) {
NodeGraph* graph = 0;
boost::shared_ptr<NodeCollection> collection = node->getGroup();
assert(collection);
NodeGroup* isGrp = dynamic_cast<NodeGroup*>( collection.get() );
if (isGrp) {
NodeGraphI* graph_i = isGrp->getNodeGraph();
assert(graph_i);
graph = dynamic_cast<NodeGraph*>(graph_i);
} else {
graph = _imp->_gui->getNodeGraph();
}
assert(graph);
if (!graph) {
throw std::logic_error("");
}
NodesGuiList selectedNodes = graph->getSelectedNodes();
NodeGuiPtr selectedNode;
if ( !selectedNodes.empty() ) {
selectedNode = selectedNodes.front();
if ( dynamic_cast<BackdropGui*>( selectedNode.get() ) ) {
selectedNode.reset();
}
}
boost::shared_ptr<NodeGuiI> node_gui_i = node->getNodeGui();
assert(node_gui_i);
NodeGuiPtr nodeGui = boost::dynamic_pointer_cast<NodeGui>(node_gui_i);
graph->moveNodesForIdealPosition(nodeGui, selectedNode, true);
}
AppInstance::onGroupCreationFinished(node, reason);
/*std::list<ViewerInstance* > viewers;
node->hasViewersConnected(&viewers);
for (std::list<ViewerInstance* >::iterator it2 = viewers.begin(); it2 != viewers.end(); ++it2) {
(*it2)->renderCurrentFrame(false);
}*/
}
示例2: 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) {
//.........这里部分代码省略.........