Files
Jacques Lucke 890ab23e0d Refactor: Nodes: return pointer instead of reference from in/output_by_identifier
This makes it possible to use these methods in cases where it's not guaranteed
that the identifier exists on a node.
2025-07-31 21:58:58 +02:00

43 lines
1.2 KiB
C++

/* SPDX-FileCopyrightText: 2025 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_string_ref.hh"
#include "DNA_node_types.h"
#include "BKE_node_runtime.hh"
#include "GPU_material.hh"
#include "COM_utilities_gpu_material.hh"
namespace blender::compositor {
GPUNodeStack &get_shader_node_input(const bNode &node,
GPUNodeStack inputs[],
const StringRef identifier)
{
return inputs[node.input_by_identifier(identifier)->index()];
}
GPUNodeStack &get_shader_node_output(const bNode &node,
GPUNodeStack outputs[],
const StringRef identifier)
{
return outputs[node.output_by_identifier(identifier)->index()];
}
GPUNodeLink *get_shader_node_input_link(const bNode &node,
GPUNodeStack inputs[],
const StringRef identifier)
{
GPUNodeStack &input = get_shader_node_input(node, inputs, identifier);
if (input.link) {
return input.link;
}
return GPU_uniform(input.vec);
}
} // namespace blender::compositor