本文整理汇总了C++中OutputSocket::getbNodeSocket方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputSocket::getbNodeSocket方法的具体用法?C++ OutputSocket::getbNodeSocket怎么用?C++ OutputSocket::getbNodeSocket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputSocket
的用法示例。
在下文中一共展示了OutputSocket::getbNodeSocket方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertToOperations
void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
/// Image output
OutputSocket *outputImage = this->getOutputSocket(0);
bNode *editorNode = this->getbNode();
Image *image = (Image *)editorNode->id;
ImageUser *imageuser = (ImageUser *)editorNode->storage;
int framenumber = context->getFramenumber();
int numberOfOutputs = this->getNumberOfOutputSockets();
BKE_image_user_frame_calc(imageuser, context->getFramenumber(), 0);
/* force a load, we assume iuser index will be set OK anyway */
if (image && image->type == IMA_TYPE_MULTILAYER) {
bool is_multilayer_ok = false;
ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL);
if (image->rr) {
RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
if (rl) {
OutputSocket *socket;
int index;
is_multilayer_ok = true;
for (index = 0; index < numberOfOutputs; index++) {
NodeOperation *operation = NULL;
socket = this->getOutputSocket(index);
if (socket->isConnected() || index == 0) {
bNodeSocket *bnodeSocket = socket->getbNodeSocket();
NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;
int passindex = storage->pass_index;
RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
if (rpass) {
imageuser->pass = passindex;
switch (rpass->channels) {
case 1:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VALUE);
break;
/* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
/* XXX any way to detect actual vector images? */
case 3:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
break;
case 4:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
break;
default:
/* dummy operation is added below */
break;
}
if (index == 0 && operation) {
addPreviewOperation(graph, context, operation->getOutputSocket());
}
}
}
/* incase we can't load the layer */
if (operation == NULL) {
convertToOperations_invalid_index(graph, index);
}
}
}
}
BKE_image_release_ibuf(image, ibuf, NULL);
/* without this, multilayer that fail to load will crash blender [#32490] */
if (is_multilayer_ok == false) {
convertToOperations_invalid(graph, context);
}
}
else {
if (numberOfOutputs > 0) {
ImageOperation *operation = new ImageOperation();
if (outputImage->isConnected()) {
outputImage->relinkConnections(operation->getOutputSocket());
}
operation->setImage(image);
operation->setImageUser(imageuser);
operation->setFramenumber(framenumber);
graph->addOperation(operation);
addPreviewOperation(graph, context, operation->getOutputSocket());
}
if (numberOfOutputs > 1) {
OutputSocket *alphaImage = this->getOutputSocket(1);
if (alphaImage->isConnected()) {
ImageAlphaOperation *alphaOperation = new ImageAlphaOperation();
alphaOperation->setImage(image);
alphaOperation->setImageUser(imageuser);
alphaOperation->setFramenumber(framenumber);
alphaImage->relinkConnections(alphaOperation->getOutputSocket());
graph->addOperation(alphaOperation);
}
}
if (numberOfOutputs > 2) {
OutputSocket *depthImage = this->getOutputSocket(2);
if (depthImage->isConnected()) {
ImageDepthOperation *depthOperation = new ImageDepthOperation();
depthOperation->setImage(image);
//.........这里部分代码省略.........
示例2: convertToOperations
void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
/// Image output
OutputSocket *outputImage = this->getOutputSocket(0);
bNode *editorNode = this->getbNode();
Image *image = (Image *)editorNode->id;
ImageUser *imageuser = (ImageUser *)editorNode->storage;
int framenumber = context->getFramenumber();
int numberOfOutputs = this->getNumberOfOutputSockets();
bool outputStraightAlpha = (editorNode->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0;
BKE_image_user_frame_calc(imageuser, context->getFramenumber(), 0);
/* force a load, we assume iuser index will be set OK anyway */
if (image && image->type == IMA_TYPE_MULTILAYER) {
bool is_multilayer_ok = false;
ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL);
if (image->rr) {
RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
if (rl) {
OutputSocket *socket;
int index;
is_multilayer_ok = true;
for (index = 0; index < numberOfOutputs; index++) {
NodeOperation *operation = NULL;
socket = this->getOutputSocket(index);
if (socket->isConnected() || index == 0) {
bNodeSocket *bnodeSocket = socket->getbNodeSocket();
/* Passes in the file can differ from passes stored in sockets (#36755).
* Look up the correct file pass using the socket identifier instead.
*/
#if 0
NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;*/
int passindex = storage->pass_index;*/
RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex);
#endif
int passindex;
RenderPass *rpass;
for (rpass = (RenderPass *)rl->passes.first, passindex = 0; rpass; rpass = rpass->next, ++passindex)
if (STREQ(rpass->name, bnodeSocket->identifier))
break;
if (rpass) {
imageuser->pass = passindex;
switch (rpass->channels) {
case 1:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VALUE);
break;
/* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
/* XXX any way to detect actual vector images? */
case 3:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_VECTOR);
break;
case 4:
operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR);
break;
default:
/* dummy operation is added below */
break;
}
if (index == 0 && operation) {
addPreviewOperation(graph, context, operation->getOutputSocket());
}
}
}
/* incase we can't load the layer */
if (operation == NULL) {
convertToOperations_invalid_index(graph, index);
}
}
}