Blender V4.3
COM_SwitchViewNode.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2015 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
7namespace blender::compositor {
8
9SwitchViewNode::SwitchViewNode(bNode *editor_node) : Node(editor_node)
10{
11 /* pass */
12}
13
15 const CompositorContext &context) const
16{
18 const char *view_name = context.get_view_name();
19 const bNode *bnode = this->get_bnode();
20
21 /* get the internal index of the socket with a matching name */
22 int nr = BLI_findstringindex(&bnode->inputs, view_name, offsetof(bNodeSocket, name));
23 nr = std::max(nr, 0);
24
25 result = converter.add_input_proxy(get_input_socket(nr), false);
26 converter.map_output_socket(get_output_socket(0), result);
27}
28
29} // namespace blender::compositor
int BLI_findstringindex(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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:85
NodeInput * get_input_socket(unsigned int index) const
Definition COM_Node.cc:90
const bNode * get_bnode() const
get the reference to the SDNA bNode struct
Definition COM_Node.h:65
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
#define offsetof(t, d)
ListBase inputs