本文整理汇总了C++中NodeGuiPtr::getInputArrow方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeGuiPtr::getInputArrow方法的具体用法?C++ NodeGuiPtr::getInputArrow怎么用?C++ NodeGuiPtr::getInputArrow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeGuiPtr
的用法示例。
在下文中一共展示了NodeGuiPtr::getInputArrow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: args
void
NodeGraph::connectCurrentViewerToSelection(int inputNB)
{
ViewerTab* lastUsedViewer = getLastSelectedViewer();
if (lastUsedViewer) {
boost::shared_ptr<NodeCollection> collection = lastUsedViewer->getInternalNode()->getNode()->getGroup();
if (collection && collection->getNodeGraph() != this) {
//somehow the group doesn't belong to this nodegraph , pick another one
const std::list<ViewerTab*>& tabs = getGui()->getViewersList();
lastUsedViewer = 0;
for (std::list<ViewerTab*>::const_iterator it = tabs.begin(); it!=tabs.end(); ++it) {
boost::shared_ptr<NodeCollection> otherCollection = (*it)->getInternalNode()->getNode()->getGroup();
if (otherCollection && otherCollection->getNodeGraph() == this) {
lastUsedViewer = *it;
break;
}
}
}
}
boost::shared_ptr<InspectorNode> v;
if ( lastUsedViewer ) {
v = boost::dynamic_pointer_cast<InspectorNode>( lastUsedViewer->
getInternalNode()->getNode() );
} else {
CreateNodeArgs args(QString::fromUtf8(PLUGINID_NATRON_VIEWER),
eCreateNodeReasonUserCreate,
getGroup());
NodePtr viewerNode = getGui()->getApp()->createNode(args);
if (!viewerNode) {
return;
}
v = boost::dynamic_pointer_cast<InspectorNode>(viewerNode);
}
if (!v) {
return;
}
///if the node is no longer active (i.e: it was deleted by the user), don't do anything.
if ( !v->isActivated() ) {
return;
}
///get a ptr to the NodeGui
boost::shared_ptr<NodeGuiI> gui_i = v->getNodeGui();
NodeGuiPtr gui = boost::dynamic_pointer_cast<NodeGui>(gui_i);
assert(gui);
///if there's no selected node or the viewer is selected, then try refreshing that input nb if it is connected.
bool viewerAlreadySelected = std::find(_imp->_selection.begin(),_imp->_selection.end(),gui) != _imp->_selection.end();
if (_imp->_selection.empty() || (_imp->_selection.size() > 1) || viewerAlreadySelected) {
v->setActiveInputAndRefresh(inputNB, false);
gui->refreshEdges();
return;
}
NodeGuiPtr selected = _imp->_selection.front();
if ( !selected->getNode()->canOthersConnectToThisNode() ) {
return;
}
///if the node doesn't have the input 'inputNb' created yet, populate enough input
///so it can be created.
Edge* foundInput = gui->getInputArrow(inputNB);
assert(foundInput);
///and push a connect command to the selected node.
pushUndoCommand( new ConnectCommand(this,foundInput,foundInput->getSource(),selected) );
///Set the viewer as the selected node (also wipe the current selection)
selectNode(gui,false);
} // connectCurrentViewerToSelection