24#include <fmt/format.h>
34 const bNode *node =
b.node_or_null();
42 auto &
decl =
b.add_output(socket_type,
name, identifier)
46 .reference_pass_all();
51 decl.structure_type(StructureType::Dynamic);
68 dst_node->
storage = dst_storage;
104 layout->
op(
"node.sockets_sync",
IFACE_(
"Sync"), ICON_FILE_REFRESH);
105 layout->
prop(node_ptr,
"define_signature",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
108 C, panel, ntree, node);
112 panel->use_property_split_set(
true);
113 panel->use_property_decorate_set(
false);
131 params.set_default_remaining_outputs();
143 if (
name.is_empty()) {
154 fmt::format(fmt::runtime(
TIP_(
"Value not found in bundle: \"{}\"")),
name));
157 const auto *socket_value = std::get_if<BundleItemSocketValue>(&value->
value);
161 fmt::format(
"{}: \"{}\"",
TIP_(
"Cannot get internal value from bundle"),
name));
166 if (socket_value->type->type != stype->
type) {
168 *socket_value->type, output_value, *stype))
170 output_value = std::move(*converted_value);
174 TIP_(
"Implicit type conversion when separating bundle"),
176 TIP_(socket_value->type->label),
183 TIP_(
"Conversion not supported when separating bundle"),
185 TIP_(socket_value->type->label),
193 params.set_default_remaining_outputs();
206 bNode &node =
params.add_node(
"NodeSeparateBundle");
210 params.update_and_connect_available_socket(node, item->
name);
218 bNode &node =
params.add_node(
"NodeSeparateBundle");
219 params.connect_available_socket(node,
"Bundle");
242 ntype.
ui_name =
"Separate Bundle";
SpaceNode * CTX_wm_space_node(const bContext *C)
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_SEPARATE_BUNDLE
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_SMALL_TRIANGLE
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
void BLO_write_string(BlendWriter *writer, const char *data_ptr)
@ NODE_INTERFACE_SOCKET_STRUCTURE_TYPE_AUTO
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void set_output(int index, T &&value)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
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_declare(NodeDeclarationBuilder &b)
static void node_geo_exec(GeoNodeExecParams params)
static void node_free_storage(bNode *node)
static void node_blend_write(const bNodeTree &, const bNode &node, BlendWriter &writer)
static void node_operators()
static bool node_insert_link(bke::NodeInsertLinkParams ¶ms)
static void node_register()
static void node_init(bNodeTree *, bNode *node)
static void node_layout_ex(uiLayout *layout, bContext *C, PointerRNA *node_ptr)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
static void node_blend_read(bNodeTree &, bNode &node, BlendDataReader &reader)
void make_common_operators()
static void draw_items_list_with_operators(const bContext *C, uiLayout *layout, const bNodeTree &tree, const bNode &node)
static void draw_active_item_props(const bNodeTree &tree, const bNode &node, const FunctionRef< void(PointerRNA *item_ptr)> draw_item)
void blend_write(BlendWriter *writer, const bNode &node)
void destruct_array(bNode &node)
void blend_read_data(BlendDataReader *reader, bNode &node)
void copy_array(const bNode &src_node, bNode &dst_node)
Accessor::ItemT * add_item_with_socket_type_and_name(bNodeTree &ntree, bNode &node, const eNodeSocketDatatype socket_type, const char *name, std::optional< int > dimensions=std::nullopt)
bool try_add_item_via_any_extend_socket(bNodeTree &ntree, bNode &extend_node, bNode &storage_node, bNodeLink &link, const std::optional< StringRef > socket_identifier=std::nullopt, typename Accessor::ItemT **r_new_item=nullptr)
ImplicitSharingPtr< Bundle > BundlePtr
void sync_sockets_separate_bundle(SpaceNode &snode, bNode &separate_bundle_node, ReportList *reports, const bNodeSocket *src_bundle_socket)
std::optional< SocketValueVariant > implicitly_convert_socket_value(const bke::bNodeSocketType &from_type, const SocketValueVariant &from_value, const bke::bNodeSocketType &to_type)
bool socket_type_always_single(const eNodeSocketDatatype socket_type)
void sh_geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
NodeSeparateBundleItem * items
struct bNodeTree * edittree
bNodeSocketTypeHandle * typeinfo
const SocketValueVariant * geometry_nodes_default_value
NodeBlendWriteFunction blend_write_storage_content
std::string ui_description
NodeBlendDataReadFunction blend_data_read_storage_content
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeGeometryExecFunction geometry_node_execute
bool(* insert_link)(NodeInsertLinkParams ¶ms)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
void(* register_operators)()
std::variant< BundleItemSocketValue, BundleItemInternalValue > value
static bool supports_socket_type(const eNodeSocketDatatype socket_type, const int ntree_type)
NodeSeparateBundleItem ItemT
static void blend_write_item(BlendWriter *writer, const ItemT &item)
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
static std::string socket_identifier_for_item(const ItemT &item)
static StructRNA * item_srna
void use_property_decorate_set(bool is_sep)
PanelLayout panel(const bContext *C, blender::StringRef idname, bool default_closed)
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, blender::wm::OpCallContext context, eUI_Item_Flag flag)
void use_property_split_set(bool value)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)