Blender  V3.3
COM_SwitchViewNode.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2015 Blender Foundation. */
3 
4 #include "COM_SwitchViewNode.h"
5 
6 namespace blender::compositor {
7 
8 SwitchViewNode::SwitchViewNode(bNode *editor_node) : Node(editor_node)
9 {
10  /* pass */
11 }
12 
14  const CompositorContext &context) const
15 {
17  const char *view_name = context.get_view_name();
18  bNode *bnode = this->get_bnode();
19 
20  /* get the internal index of the socket with a matching name */
21  int nr = BLI_findstringindex(&bnode->inputs, view_name, offsetof(bNodeSocket, name));
22  nr = MAX2(nr, 0);
23 
24  result = converter.add_input_proxy(get_input_socket(nr), false);
26 }
27 
28 } // namespace blender::compositor
int BLI_findstringindex(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define MAX2(a, b)
Overall context of the compositor.
void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
NodeOperationOutput * add_input_proxy(NodeInput *input, bool use_conversion)
NodeOutput * get_output_socket(unsigned int index=0) const
Definition: COM_Node.cc:84
bNode * get_bnode() const
get the reference to the SDNA bNode struct
Definition: COM_Node.h:64
NodeInput * get_input_socket(unsigned int index) const
Definition: COM_Node.cc:89
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
ListBase inputs