Blender V4.3
NOD_inverse_eval_params.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "BLI_map.hh"
8
9#include "BKE_node_runtime.hh"
11
13
24 private:
27
28 public:
29 const bNode &node;
30
31 InverseEvalParams(const bNode &node,
34
35 template<typename T> T get_output(const StringRef identifier) const
36 {
37 const bNodeSocket &socket = node.output_by_identifier(identifier);
38 if (const bke::SocketValueVariant *value = socket_values_.lookup_ptr(&socket)) {
39 return value->get<T>();
40 }
41 return T();
42 }
43
44 template<typename T> T get_input(const StringRef identifier) const
45 {
46 const bNodeSocket &socket = node.input_by_identifier(identifier);
47 if (const bke::SocketValueVariant *value = socket_values_.lookup_ptr(&socket)) {
48 return value->get<T>();
49 }
50 return T();
51 }
52
53 template<typename T> void set_input(const StringRef identifier, T value)
54 {
55 const bNodeSocket &socket = node.input_by_identifier(identifier);
56 updated_socket_values_.add(&socket, bke::SocketValueVariant(value));
57 }
58};
59
60} // namespace blender::nodes::inverse_eval
const Value * lookup_ptr(const Key &key) const
Definition BLI_map.hh:484
bool add(const Key &key, const Value &value)
Definition BLI_map.hh:271
InverseEvalParams(const bNode &node, const Map< const bNodeSocket *, bke::SocketValueVariant > &socket_values, Map< const bNodeSocket *, bke::SocketValueVariant > &updated_socket_values)
void set_input(const StringRef identifier, T value)
#define T