本文整理汇总了C++中NodePtr::disconnectInput方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::disconnectInput方法的具体用法?C++ NodePtr::disconnectInput怎么用?C++ NodePtr::disconnectInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodePtr
的用法示例。
在下文中一共展示了NodePtr::disconnectInput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void
ViewerNode::refreshInputFromChoiceMenu(int internalInputIdx)
{
assert(internalInputIdx == 0 || internalInputIdx == 1);
// Get the "Input" nodes
std::vector<NodePtr> groupInputNodes;
getInputs(&groupInputNodes);
KnobChoicePtr knob = internalInputIdx == 0 ? _imp->aInputNodeChoiceKnob.lock() : _imp->bInputNodeChoiceKnob.lock();
// Read from the choice menu the current selected node
ChoiceOption curLabel = internalInputIdx == 0 ? _imp->aInputNodeChoiceKnob.lock()->getCurrentEntry() : _imp->bInputNodeChoiceKnob.lock()->getCurrentEntry();
// Find recursively the node that we should connect to the "Input" node
NodePtr nodeToConnect = _imp->getInputRecursive(internalInputIdx);
if (curLabel.id == "-") {
if (nodeToConnect->getEffectInstance().get() == this) {
nodeToConnect->disconnectInput(internalInputIdx);
} else {
int prefInput = nodeToConnect->getPreferredInput();
if (prefInput != -1) {
nodeToConnect->disconnectInput(prefInput);
}
}
} else {
int groupInputIndex = QString::fromUtf8(curLabel.id.c_str()).toInt();
if (groupInputIndex < (int)groupInputNodes.size() && groupInputIndex >= 0) {
if (nodeToConnect == _imp->internalViewerProcessNode[internalInputIdx].lock()) {
nodeToConnect->swapInput(groupInputNodes[groupInputIndex], 0);
} else {
int prefInput = nodeToConnect->getPreferredInputForConnection();
if (prefInput != -1) {
nodeToConnect->swapInput(groupInputNodes[groupInputIndex], prefInput);
}
}
}
}
} // refreshInputFromChoiceMenu
示例2: getNode
void
JoinViewsNode::onMetadataChanged(const NodeMetadata& metadata)
{
NodePtr node = getNode();
std::size_t nInputs, oldNInputs;
const std::vector<std::string>& views = getApp()->getProject()->getProjectViewNames();
//Reverse names
oldNInputs = getNInputs();
nInputs = views.size();
std::vector<NodePtr> inputs(oldNInputs);
for (std::size_t i = 0; i < oldNInputs; ++i) {
inputs[i] = node->getInput(i);
}
node->beginInputEdition();
node->removeAllInputs();
for (std::size_t i = 0; i < nInputs; ++i) {
const std::string& inputName = views[nInputs - 1 - i];
InputDescriptionPtr desc = InputDescription::create(inputName, inputName, "", false, false, std::bitset<4>(std::string("1111")));
node->addInput(desc);
}
//Reconnect the inputs
int index = oldNInputs - 1;
if (index >= 0) {
for (int i = (int)nInputs - 1; i >= 0; --i, --index) {
node->disconnectInput(i);
if (index >= 0) {
if (inputs[index]) {
node->connectInput(inputs[index], i);
}
}
}
}
node->endInputEdition(true);
EffectInstance::onMetadataChanged(metadata);
}