Blender V4.3
COM_FileOutputNode.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
7#include "BLI_string.h"
8
9namespace blender::compositor {
10
11FileOutputNode::FileOutputNode(bNode *editor_node) : Node(editor_node)
12{
13 /* pass */
14}
15
17{
18 const DataType data_type = input->get_data_type();
19 /* Incoming inputs to vector sockets can be 4D, so we declare them as 4-channel color inputs to
20 * avoid loss of fourth channel due to implicit conversion. The operation will look into the
21 * is_4d_vector meta data member of the input to check if it should be written as 4D or 3D, where
22 * the last channel will be ignored in the 3D case. */
23 if (data_type == DataType::Vector) {
24 return DataType::Color;
25 }
26 return data_type;
27}
28
30 const CompositorContext &context) const
31{
32 for (NodeInput *input : inputs_) {
33 if (input->is_linked()) {
34 converter.add_node_input_preview(input);
35 break;
36 }
37 }
38
39 if (!context.is_rendering()) {
40 return;
41 }
42
44 for (NodeInput *input : inputs_) {
45 auto *storage = static_cast<NodeImageMultiFileSocket *>(input->get_bnode_socket()->storage);
46 inputs.append(FileOutputInput(storage, get_input_data_type(input), input->get_data_type()));
47 }
48
49 auto *storage = static_cast<const NodeImageMultiFile *>(this->get_bnode()->storage);
50 auto *output_operation = new FileOutputOperation(&context, storage, inputs);
51 converter.add_operation(output_operation);
52
53 for (int i = 0; i < inputs_.size(); i++) {
54 converter.map_input_socket(inputs_[i], output_operation->get_input_socket(i));
55 }
56}
57
58} // namespace blender::compositor
Overall context of the compositor.
void convert_to_operations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
void add_node_input_preview(NodeInput *input)
void add_operation(NodeOperation *operation)
void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket)
NodeInput are sockets that can receive data/input.
Definition COM_Node.h:191
Vector< NodeInput * > inputs_
the list of actual input-sockets
Definition COM_Node.h:51
const bNode * get_bnode() const
get the reference to the SDNA bNode struct
Definition COM_Node.h:65
DataType
possible data types for sockets
Definition COM_defines.h:21
@ Vector
Vector data type.
static DataType get_input_data_type(NodeInput *input)
static blender::bke::bNodeSocketTemplate inputs[]
void * storage