22#include <fmt/format.h>
30 b.use_custom_socket_order();
31 b.allow_any_socket_order();
32 b.add_default_layout();
36 b.add_output<
decl::Bundle>(
"Bundle"_ustr).align_with_previous().propagate_all();
37 if (
node !=
nullptr) {
40 auto &
decl =
b.add_output(socket_type,
"Item"_ustr).propagate_all();
42 decl.structure_type(StructureType::Dynamic);
45 decl.structure_type(StructureType(
storage.structure_type));
70 auto *
storage = MEM_new<NodeGetBundleItem>(__func__);
86 const std::string path = params.
extract_input<std::string>(
"Path"_ustr);
87 const bool remove = params.
extract_input<
bool>(
"Remove"_ustr);
93 params.
set_output(
"Bundle"_ustr, std::move(bundle));
103 params.
set_output(
"Bundle"_ustr, std::move(bundle));
107 const auto *socket_value = std::get_if<BundleItemSocketValue>(&value->
value);
111 fmt::format(
"{}: \"{}\"",
TIP_(
"Cannot get internal value from bundle"), path));
112 params.
set_output(
"Bundle"_ustr, std::move(bundle));
119 if (socket_value->type->type != stype->
type) {
121 *socket_value->type, output_value, *stype))
123 output_value = std::move(*converted_value);
127 "Cannot implicitly convert item to the selected type");
128 params.
set_output(
"Bundle"_ustr, std::move(bundle));
138 params.
set_output(
"Bundle"_ustr, std::move(bundle));
139 params.
set_output(
"Item"_ustr, std::move(output_value));
156 if (!split_path.has_value()) {
192 if (item_output.
type() == bundle_result.
type()) {
211 "Cannot implicitly convert item to the selected type");
217 if (this->
get_input(
"Remove").get_single_value_default<bool>()) {
241 "Value may be implicitly converted if the type does not match",
257 "What kind of higher order types are expected to flow through this socket",
267 ntype.
ui_name =
"Get Bundle Item";
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
#define BLI_SCOPED_DEFER(function_to_defer)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
T & ensure_mutable_inplace()
bool is_convertible(const CPPType &from_type, const CPPType &to_type) const
static Result get_result(Context &context, const nodes::BundleItemValue &item_value)
Result create_result(ResultType type, ResultPrecision precision)
NodeOperation(Context &context, const bNode &node)
void add_warning(nodes::NodeWarningType type, std::string message)
Result & get_result(StringRef identifier)
void allocate_default_remaining_outputs()
Context & context() const
Result & get_input(StringRef identifier) const
void share_data(const Result &source)
const CPPType & get_cpp_type() const
bool should_compute() const
void set_single_value(const T &value)
static ResultType type(gpu::TextureFormat format)
void allocate_single_value()
static ResultPrecision precision(gpu::TextureFormat format)
const T & get_single_value() const
void map_input_to_result(Result *result)
static bool is_valid_path(StringRef path)
bool remove_path(StringRef path)
const BundleItemValue * lookup_path(Span< BundleKey > path) const
static std::optional< Vector< BundleKey > > split_path(StringRef path)
void error_message_add(const NodeWarningType type, StringRef message) const
T extract_input(const UString identifier)
bool output_is_required(const UString identifier) const
const bNode & node() const
void set_default_remaining_outputs()
void set_output(const UString identifier, T &&value)
NodeOperation(Context &context, const bNode &node)
#define storage(slot, qualifiers)
const DataTypeConversions & get_implicit_type_conversions()
void node_register_type(bNodeType &ntype)
bNodeSocketType * node_socket_type_find_static(int type, int subtype=0)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static void node_geo_exec(GeoNodeExecParams params)
static NodeOperation * get_compositor_operation(Context &context, const bNode &node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_rna(StructRNA *srna)
static void node_layout_ex(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_init(bNodeTree *, bNode *node)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
std::optional< SocketValueVariant > implicitly_convert_socket_value(const bke::bNodeSocketType &from_type, const SocketValueVariant &from_value, const bke::bNodeSocketType &to_type)
bool socket_type_supported_in_bundle(const eNodeSocketDatatype socket_type, const int ntree_type)
const EnumPropertyItem * enum_items_filter(const EnumPropertyItem *original_item_array, FunctionRef< bool(const EnumPropertyItem &item)> fn)
ImplicitSharingPtr< Bundle > BundlePtr
const EnumPropertyItem rna_enum_node_socket_structure_type_items[]
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
void node_free_standard_storage(bNode *node)
void geo_cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
NodeGeometryExecFunction geometry_node_execute
void(*) draw_buttons_ex(ui::Layout &, bContext *C, PointerRNA *ptr)
void(*) initfunc(bNodeTree *ntree, bNode *node)
NodeDeclareFunction declare
std::variant< BundleItemSocketValue, BundleItemInternalValue > value
void use_property_decorate_set(bool is_decorate)
void use_property_split_set(bool is_sep)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)