本文整理汇总了C++中NodeGroup::getNode方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeGroup::getNode方法的具体用法?C++ NodeGroup::getNode怎么用?C++ NodeGroup::getNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeGroup
的用法示例。
在下文中一共展示了NodeGroup::getNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logic_error
LinkToKnobDialog::LinkToKnobDialog(const KnobGuiPtr& from,
QWidget* parent)
: QDialog(parent)
, _imp( new LinkToKnobDialogPrivate(from) )
{
_imp->mainLayout = new QVBoxLayout(this);
_imp->firstLine = new QWidget(this);
_imp->firstLineLayout = new QHBoxLayout(_imp->firstLine);
_imp->mainLayout->addWidget(_imp->firstLine);
_imp->buttons = new QDialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel),
Qt::Horizontal, this);
QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(accept()) );
QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) );
_imp->mainLayout->addWidget(_imp->buttons);
_imp->selectNodeLabel = new Label(tr("Parent:"), _imp->firstLine);
_imp->firstLineLayout->addWidget(_imp->selectNodeLabel);
EffectInstance* isEffect = dynamic_cast<EffectInstance*>( from->getKnob()->getHolder() );
assert(isEffect);
if (!isEffect) {
throw std::logic_error("");
}
boost::shared_ptr<NodeCollection> group = isEffect->getNode()->getGroup();
group->getActiveNodes(&_imp->allNodes);
NodeGroup* isGroup = dynamic_cast<NodeGroup*>( group.get() );
if (isGroup) {
_imp->allNodes.push_back( isGroup->getNode() );
}
QStringList nodeNames;
for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) {
QString name = QString::fromUtf8( (*it)->getLabel().c_str() );
nodeNames.push_back(name);
//_imp->nodeSelectionCombo->addItem(name);
}
nodeNames.sort();
_imp->nodeSelectionCombo = new CompleterLineEdit(nodeNames, nodeNames, false, this);
_imp->nodeSelectionCombo->setToolTip( GuiUtils::convertFromPlainText(tr("Input the name of a node in the current project."), Qt::WhiteSpaceNormal) );
_imp->firstLineLayout->addWidget(_imp->nodeSelectionCombo);
_imp->nodeSelectionCombo->setFocus(Qt::PopupFocusReason);
QTimer::singleShot( 25, _imp->nodeSelectionCombo, SLOT(showCompleter()) );
_imp->knobSelectionCombo = new ComboBox(_imp->firstLine);
_imp->firstLineLayout->addWidget(_imp->knobSelectionCombo);
QObject::connect( _imp->nodeSelectionCombo, SIGNAL(itemCompletionChosen()), this, SLOT(onNodeComboEditingFinished()) );
_imp->firstLineLayout->addStretch();
}
示例2: selRect
void
NodeGraph::mouseMoveEvent(QMouseEvent* e)
{
QPointF newPos = mapToScene( e->pos() );
QPointF lastMousePosScene = mapToScene( _imp->_lastMousePos.x(), _imp->_lastMousePos.y() );
double dx, dy;
{
QPointF newPosRoot = _imp->_root->mapFromScene(newPos);
QPointF lastMousePosRoot = _imp->_root->mapFromScene(lastMousePosScene);
dx = newPosRoot.x() - lastMousePosRoot.x();
dy = newPosRoot.y() - lastMousePosRoot.y();
}
_imp->_hasMovedOnce = true;
bool mustUpdate = true;
boost::shared_ptr<NodeCollection> collection = getGroup();
NodeGroup* isGroup = dynamic_cast<NodeGroup*>( collection.get() );
bool isGroupEditable = true;
bool groupEdited = true;
if (isGroup) {
isGroupEditable = isGroup->isSubGraphEditable();
groupEdited = isGroup->getNode()->hasPyPlugBeenEdited();
}
if (!groupEdited && isGroupEditable) {
///check if user is nearby unlock
int iw = _imp->unlockIcon.width();
int ih = _imp->unlockIcon.height();
int w = width();
if ( ( e->x() >= (w - iw - 10 - 15) ) && ( e->x() <= (w - 10 + 15) ) &&
( e->y() >= (10 - 15) ) && ( e->y() <= (10 + ih + 15) ) ) {
assert(isGroup);
QPoint pos = mapToGlobal( e->pos() );
QToolTip::showText( pos, GuiUtils::convertFromPlainText(QCoreApplication::translate("NodeGraph", "Clicking the unlock button will convert the PyPlug to a regular group saved in the project and dettach it from the script.\n"
"Any modification will not be written to the Python script. Subsequent loading of the project will no longer load this group from the python script."), Qt::WhiteSpaceNormal) );
}
}
QRectF sceneR = visibleSceneRect();
if ( groupEdited && (_imp->_evtState != eEventStateSelectionRect) && (_imp->_evtState != eEventStateDraggingArrow) ) {
// Set cursor
std::set<NodeGui*> visibleNodes;
getNodesWithinViewportRect(visibleWidgetRect(), &visibleNodes);
NodeGuiPtr selected;
Edge* selectedEdge = 0;
bool optionalInputsAutoHidden = areOptionalInputsAutoHidden();
for (std::set<NodeGui*>::iterator it = visibleNodes.begin(); it != visibleNodes.end(); ++it) {
QPointF evpt = (*it)->mapFromScene(newPos);
QRectF bbox = (*it)->mapToScene( (*it)->boundingRect() ).boundingRect();
if ( (*it)->isActive() && bbox.intersects(sceneR) ) {
if ( (*it)->contains(evpt) ) {
selected = (*it)->shared_from_this();
if (optionalInputsAutoHidden) {
(*it)->refreshEdgesVisility(true);
} else {
break;
}
} else {
Edge* edge = (*it)->hasEdgeNearbyPoint(newPos);
if (edge) {
selectedEdge = edge;
if (!optionalInputsAutoHidden) {
break;
}
} else if ( optionalInputsAutoHidden && !(*it)->getIsSelected() ) {
(*it)->refreshEdgesVisility(false);
}
}
}
}
if (selected) {
_imp->cursorSet = true;
setCursor( QCursor(Qt::OpenHandCursor) );
} else if (selectedEdge) {
} else if (!selectedEdge && !selected) {
if (_imp->cursorSet) {
_imp->cursorSet = false;
unsetCursor();
}
}
}
bool mustUpdateNavigator = false;
///Apply actions
switch (_imp->_evtState) {
case eEventStateDraggingArrow: {
QPointF np = _imp->_arrowSelected->mapFromScene(newPos);
if ( _imp->_arrowSelected->isOutputEdge() ) {
_imp->_arrowSelected->dragDest(np);
} else {
_imp->_arrowSelected->dragSource(np);
}
checkAndStartAutoScrollTimer(newPos);
mustUpdate = true;
break;
}
case eEventStateDraggingNode: {
//.........这里部分代码省略.........
示例3: logic_error
PickKnobDialog::PickKnobDialog(DockablePanel* panel,
QWidget* parent)
: QDialog(parent)
, _imp( new PickKnobDialogPrivate(panel) )
{
NodeSettingsPanel* nodePanel = dynamic_cast<NodeSettingsPanel*>(panel);
assert(nodePanel);
if (!nodePanel) {
throw std::logic_error("PickKnobDialog::PickKnobDialog()");
}
NodeGuiPtr nodeGui = nodePanel->getNode();
NodePtr node = nodeGui->getNode();
NodeGroup* isGroup = node->isEffectGroup();
boost::shared_ptr<NodeCollection> collec = node->getGroup();
NodeGroup* isCollecGroup = dynamic_cast<NodeGroup*>( collec.get() );
NodesList collectNodes = collec->getNodes();
for (NodesList::iterator it = collectNodes.begin(); it != collectNodes.end(); ++it) {
if ( !(*it)->getParentMultiInstance() && (*it)->isActivated() && ( (*it)->getKnobs().size() > 0 ) ) {
_imp->allNodes.push_back(*it);
}
}
if (isCollecGroup) {
_imp->allNodes.push_back( isCollecGroup->getNode() );
}
if (isGroup) {
NodesList groupnodes = isGroup->getNodes();
for (NodesList::iterator it = groupnodes.begin(); it != groupnodes.end(); ++it) {
if ( !(*it)->getParentMultiInstance() && (*it)->isActivated() && ( (*it)->getKnobs().size() > 0 ) ) {
_imp->allNodes.push_back(*it);
}
}
}
QStringList nodeNames;
for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) {
QString name = QString::fromUtf8( (*it)->getLabel().c_str() );
nodeNames.push_back(name);
}
nodeNames.sort();
_imp->mainLayout = new QGridLayout(this);
_imp->selectNodeLabel = new Label( tr("Node:") );
_imp->nodeSelectionCombo = new CompleterLineEdit(nodeNames, nodeNames, false, this);
_imp->nodeSelectionCombo->setToolTip( GuiUtils::convertFromPlainText(tr("Input the name of a node in the current project."), Qt::WhiteSpaceNormal) );
_imp->nodeSelectionCombo->setFocus(Qt::PopupFocusReason);
_imp->knobSelectionCombo = new ComboBox(this);
QObject::connect( _imp->knobSelectionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onKnobComboIndexChanged(int)) );
QString useAliasTt = GuiUtils::convertFromPlainText(tr("If checked, an alias of the selected parameter will be created, coyping entirely its state. "
"Only the script-name, label and tooltip will be editable.\n"
"For choice parameters this will also "
"dynamically refresh the menu entries when the original parameter's menu is changed.\n"
"When unchecked, a simple expression will be set linking the two parameters, but things such as dynamic menus "
"will be disabled."), Qt::WhiteSpaceNormal);
_imp->useAliasLabel = new Label(tr("Make Alias:"), this);
_imp->useAliasLabel->setToolTip(useAliasTt);
_imp->useAliasCheckBox = new QCheckBox(this);
_imp->useAliasCheckBox->setToolTip(useAliasTt);
_imp->useAliasCheckBox->setChecked(true);
QObject::connect( _imp->nodeSelectionCombo, SIGNAL(itemCompletionChosen()), this, SLOT(onNodeComboEditingFinished()) );
_imp->destPageLabel = new Label(tr("Page:"), this);
QString pagett = GuiUtils::convertFromPlainText(tr("Select the page into which the parameter will be created."), Qt::WhiteSpaceNormal);
_imp->destPageLabel->setToolTip(pagett);
_imp->destPageCombo = new ComboBox(this);
_imp->destPageCombo->setToolTip(pagett);
QObject::connect( _imp->destPageCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onPageComboIndexChanged(int)) );
const KnobsVec& knobs = node->getKnobs();
for (std::size_t i = 0; i < knobs.size(); ++i) {
if ( knobs[i]->isUserKnob() ) {
boost::shared_ptr<KnobPage> isPage = boost::dynamic_pointer_cast<KnobPage>(knobs[i]);
if (isPage) {
_imp->pages.push_back(isPage);
_imp->destPageCombo->addItem( QString::fromUtf8( isPage->getName().c_str() ) );
} else {
boost::shared_ptr<KnobGroup> isGrp = boost::dynamic_pointer_cast<KnobGroup>(knobs[i]);
if (isGrp) {
_imp->groups.push_back(isGrp);
}
}
}
}
if (_imp->destPageCombo->count() == 0) {
_imp->destPageLabel->hide();
_imp->destPageCombo->hide();
}
_imp->groupLabel = new Label(tr("Group:"), this);
QString grouptt = GuiUtils::convertFromPlainText(tr("Select the group into which the parameter will be created."), Qt::WhiteSpaceNormal);
_imp->groupCombo = new ComboBox(this);
_imp->groupLabel->setToolTip(grouptt);
_imp->groupCombo->setToolTip(grouptt);
onPageComboIndexChanged(0);
_imp->buttons = new QDialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel),
Qt::Horizontal, this);
QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(accept()) );
QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) );
//.........这里部分代码省略.........