|
Blender V4.5
|
Namespaces | |
| namespace | detail |
| namespace | ops |
| namespace | ui |
Classes | |
| struct | SocketItemsAccessorDefaults |
| struct | SocketItemsRef |
Functions | |
| template<typename Accessor> | |
| bNode * | find_node_by_item (bNodeTree &ntree, const typename Accessor::ItemT &item) |
| template<typename Accessor> | |
| void | destruct_array (bNode &node) |
| template<typename Accessor> | |
| void | clear (bNode &node) |
| template<typename Accessor> | |
| void | copy_array (const bNode &src_node, bNode &dst_node) |
| template<typename Accessor> | |
| std::string | get_validated_name (const StringRef name) |
| template<typename Accessor> | |
| void | set_item_name_and_make_unique (bNode &node, typename Accessor::ItemT &item, const char *value) |
| template<typename Accessor> | |
| Accessor::ItemT * | add_item_with_socket_type_and_name (bNode &node, const eNodeSocketDatatype socket_type, const char *name) |
| template<typename Accessor> | |
| Accessor::ItemT * | add_item_with_name (bNode &node, const char *name) |
| template<typename Accessor> | |
| Accessor::ItemT * | add_item (bNode &node) |
| template<typename Accessor> | |
| std::string | get_socket_identifier (const typename Accessor::ItemT &item, const eNodeSocketInOut in_out) |
| template<typename Accessor> | |
| bool | try_add_item_via_extend_socket (bNodeTree &ntree, bNode &extend_node, bNodeSocket &extend_socket, bNode &storage_node, bNodeLink &link) |
| template<typename Accessor> | |
| 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) |
| template<typename Accessor> | |
| void | blend_write (BlendWriter *writer, const bNode &node) |
| template<typename Accessor> | |
| void | blend_read_data (BlendDataReader *reader, bNode &node) |
Some nodes have a dynamic number of sockets (e.g. simulation input/output). These nodes store an array of items in their bNode->storage (e.g. NodeSimulationItem). Different nodes have slightly different storage requirements, but a lot of the logic is still the same between nodes. This file implements various shared functionality that can be used by different nodes to deal with these item arrays.
In order to use the functions, one has to implement an "accessor" which tells the shared code how to deal with specific item arrays. Different functions have different requirements for the accessor. It's easiest to just look at existing accessors like SimulationItemsAccessor and RepeatItemsAccessor and to implement the same methods.
|
inline |
Add a new item at the end.
Definition at line 219 of file NOD_socket_items.hh.
References add_item(), and blender::nodes::socket_items::detail::add_item_to_array().
Referenced by add_item(), blender::nodes::socket_items::ops::add_item(), and try_add_item_via_extend_socket().
|
inline |
Add a new item at the end with the given name.
Definition at line 208 of file NOD_socket_items.hh.
References blender::nodes::socket_items::detail::add_item_to_array(), and add_item_with_name().
Referenced by blender::nodes::socket_items::ops::add_item(), add_item_with_name(), blender::nodes::node_geo_menu_switch_cc::node_init(), and try_add_item_via_extend_socket().
|
inline |
Add a new item at the end with the given socket type and name.
Definition at line 194 of file NOD_socket_items.hh.
References blender::nodes::socket_items::detail::add_item_to_array(), add_item_with_socket_type_and_name(), and BLI_assert.
Referenced by blender::nodes::socket_items::ops::add_item(), add_item_with_socket_type_and_name(), blender::nodes::node_geo_attribute_capture_cc::node_gather_link_searches(), blender::nodes::node_geo_bake_cc::node_gather_link_searches(), blender::nodes::node_geo_repeat_cc::repeat_output_node::node_gather_link_searches(), blender::nodes::node_geo_simulation_cc::sim_output_node::node_gather_link_searches(), try_add_item_via_extend_socket(), and blender::nodes::node_geo_closure_cc::output_node::try_initialize_closure_from_evaluator().
|
inline |
Definition at line 24 of file NOD_socket_items_blend.hh.
References blend_read_data(), BLO_read_struct_array_with_size(), blender::nodes::socket_items::SocketItemsRef< T >::items, blender::nodes::socket_items::SocketItemsRef< T >::items_num, and blender::MutableSpan< T >::MutableSpan().
Referenced by blend_read_data(), blender::nodes::node_fn_format_string_cc::node_blend_read(), blender::nodes::node_geo_attribute_capture_cc::node_blend_read(), blender::nodes::node_geo_bake_cc::node_blend_read(), blender::nodes::node_geo_closure_cc::output_node::node_blend_read(), blender::nodes::node_geo_combine_bundle_cc::node_blend_read(), blender::nodes::node_geo_evaluate_closure_cc::node_blend_read(), blender::nodes::node_geo_foreach_geometry_element_cc::output_node::node_blend_read(), blender::nodes::node_geo_index_switch_cc::node_blend_read(), blender::nodes::node_geo_menu_switch_cc::node_blend_read(), blender::nodes::node_geo_repeat_cc::repeat_output_node::node_blend_read(), blender::nodes::node_geo_separate_bundle_cc::node_blend_read(), and blender::nodes::node_geo_simulation_cc::sim_output_node::node_blend_read().
|
inline |
Definition at line 13 of file NOD_socket_items_blend.hh.
References blend_write(), BLO_write_struct_array_by_id(), blender::nodes::socket_items::SocketItemsRef< T >::items, blender::nodes::socket_items::SocketItemsRef< T >::items_num, blender::dna::sdna_struct_id_get(), and blender::Span< T >::Span().
Referenced by blend_write(), blender::nodes::node_fn_format_string_cc::node_blend_write(), blender::nodes::node_geo_attribute_capture_cc::node_blend_write(), blender::nodes::node_geo_bake_cc::node_blend_write(), blender::nodes::node_geo_closure_cc::output_node::node_blend_write(), blender::nodes::node_geo_combine_bundle_cc::node_blend_write(), blender::nodes::node_geo_evaluate_closure_cc::node_blend_write(), blender::nodes::node_geo_foreach_geometry_element_cc::output_node::node_blend_write(), blender::nodes::node_geo_index_switch_cc::node_blend_write(), blender::nodes::node_geo_menu_switch_cc::node_blend_write(), blender::nodes::node_geo_repeat_cc::repeat_output_node::node_blend_write(), blender::nodes::node_geo_separate_bundle_cc::node_blend_write(), and blender::nodes::node_geo_simulation_cc::sim_output_node::node_blend_write().
|
inline |
Removes all items from the node.
Definition at line 82 of file NOD_socket_items.hh.
References blender::nodes::socket_items::SocketItemsRef< T >::active_index, clear(), destruct_array(), and blender::nodes::socket_items::SocketItemsRef< T >::items_num.
Referenced by clear(), blender::nodes::node_geo_foreach_geometry_element_cc::output_node::node_gather_link_searches(), blender::nodes::node_geo_repeat_cc::repeat_output_node::node_gather_link_searches(), and blender::nodes::node_geo_simulation_cc::sim_output_node::node_gather_link_searches().
|
inline |
Copy the items from the storage of the source node to the storage of the destination node.
Definition at line 93 of file NOD_socket_items.hh.
References copy_array(), i, blender::IndexRange::IndexRange(), blender::nodes::socket_items::SocketItemsRef< T >::items, blender::nodes::socket_items::SocketItemsRef< T >::items_num, and MEM_calloc_arrayN().
Referenced by copy_array(), blender::nodes::node_fn_format_string_cc::node_copy_storage(), blender::nodes::node_geo_attribute_capture_cc::node_copy_storage(), blender::nodes::node_geo_bake_cc::node_copy_storage(), blender::nodes::node_geo_closure_cc::output_node::node_copy_storage(), blender::nodes::node_geo_combine_bundle_cc::node_copy_storage(), blender::nodes::node_geo_evaluate_closure_cc::node_copy_storage(), blender::nodes::node_geo_foreach_geometry_element_cc::output_node::node_copy_storage(), blender::nodes::node_geo_index_switch_cc::node_copy_storage(), blender::nodes::node_geo_menu_switch_cc::node_copy_storage(), blender::nodes::node_geo_repeat_cc::repeat_output_node::node_copy_storage(), blender::nodes::node_geo_separate_bundle_cc::node_copy_storage(), and blender::nodes::node_geo_simulation_cc::sim_output_node::node_copy_storage().
|
inline |
Destruct all the items and the free the array itself.
Definition at line 68 of file NOD_socket_items.hh.
References destruct_array(), i, blender::IndexRange::IndexRange(), blender::nodes::socket_items::SocketItemsRef< T >::items, blender::nodes::socket_items::SocketItemsRef< T >::items_num, and MEM_SAFE_FREE.
Referenced by clear(), destruct_array(), blender::nodes::node_fn_format_string_cc::node_free_storage(), blender::nodes::node_geo_attribute_capture_cc::node_free_storage(), blender::nodes::node_geo_bake_cc::node_free_storage(), blender::nodes::node_geo_closure_cc::output_node::node_free_storage(), blender::nodes::node_geo_combine_bundle_cc::node_free_storage(), blender::nodes::node_geo_evaluate_closure_cc::node_free_storage(), blender::nodes::node_geo_foreach_geometry_element_cc::output_node::node_free_storage(), blender::nodes::node_geo_index_switch_cc::node_free_storage(), blender::nodes::node_geo_menu_switch_cc::node_free_storage(), blender::nodes::node_geo_repeat_cc::repeat_output_node::node_free_storage(), blender::nodes::node_geo_separate_bundle_cc::node_free_storage(), and blender::nodes::node_geo_simulation_cc::sim_output_node::node_free_storage().
|
inline |
Iterates over the node tree to find the node that this item belongs to.
Definition at line 53 of file NOD_socket_items.hh.
References find_node_by_item().
Referenced by find_node_by_item().
|
inline |
Definition at line 228 of file NOD_socket_items.hh.
References get_socket_identifier(), and SOCK_IN.
Referenced by get_socket_identifier(), and try_add_item_via_extend_socket().
|
inline |
Enforce constraints on the name of the item.
Definition at line 108 of file NOD_socket_items.hh.
References get_validated_name().
Referenced by get_validated_name(), and set_item_name_and_make_unique().
|
inline |
Changes the name of an existing item and makes sure that the name is unique among other the other items in the same array.
Definition at line 123 of file NOD_socket_items.hh.
References ARRAY_SIZE, BLI_assert, BLI_strdup(), BLI_uniquename_cb(), blender::StringRefNull::c_str(), get_validated_name(), MAX_NAME, MEM_SAFE_FREE, blender::bke::node_static_socket_label(), set_item_name_and_make_unique(), blender::StringRef::StringRef(), and STRNCPY().
Referenced by blender::nodes::MenuSwitchItemsAccessor::init_with_name(), blender::nodes::BakeItemsAccessor::init_with_socket_type_and_name(), blender::nodes::CaptureAttributeItemsAccessor::init_with_socket_type_and_name(), blender::nodes::ClosureInputItemsAccessor::init_with_socket_type_and_name(), blender::nodes::ClosureOutputItemsAccessor::init_with_socket_type_and_name(), blender::nodes::CombineBundleItemsAccessor::init_with_socket_type_and_name(), blender::nodes::EvaluateClosureInputItemsAccessor::init_with_socket_type_and_name(), blender::nodes::EvaluateClosureOutputItemsAccessor::init_with_socket_type_and_name(), blender::nodes::ForeachGeometryElementGenerationItemsAccessor::init_with_socket_type_and_name(), blender::nodes::ForeachGeometryElementInputItemsAccessor::init_with_socket_type_and_name(), blender::nodes::ForeachGeometryElementMainItemsAccessor::init_with_socket_type_and_name(), blender::nodes::FormatStringItemsAccessor::init_with_socket_type_and_name(), blender::nodes::RepeatItemsAccessor::init_with_socket_type_and_name(), blender::nodes::SeparateBundleItemsAccessor::init_with_socket_type_and_name(), blender::nodes::SimulationItemsAccessor::init_with_socket_type_and_name(), and set_item_name_and_make_unique().
|
inlinenodiscard |
Allow the item array to be extended from any extend-socket in the node.
Definition at line 308 of file NOD_socket_items.hh.
References bNodeLink::fromnode, bNodeLink::fromsock, bNodeSocket::identifier, bNodeSocket::idname, STREQ, bNodeLink::tonode, bNodeLink::tosock, try_add_item_via_any_extend_socket(), and try_add_item_via_extend_socket().
Referenced by blender::nodes::node_fn_format_string_cc::node_insert_link(), blender::nodes::node_geo_attribute_capture_cc::node_insert_link(), blender::nodes::node_geo_bake_cc::node_insert_link(), blender::nodes::node_geo_closure_cc::input_node::node_insert_link(), blender::nodes::node_geo_closure_cc::output_node::node_insert_link(), blender::nodes::node_geo_combine_bundle_cc::node_insert_link(), blender::nodes::node_geo_evaluate_closure_cc::node_insert_link(), blender::nodes::node_geo_foreach_geometry_element_cc::input_node::node_insert_link(), blender::nodes::node_geo_foreach_geometry_element_cc::output_node::node_insert_link(), blender::nodes::node_geo_index_switch_cc::node_insert_link(), blender::nodes::node_geo_menu_switch_cc::node_insert_link(), blender::nodes::node_geo_repeat_cc::repeat_input_node::node_insert_link(), blender::nodes::node_geo_repeat_cc::repeat_output_node::node_insert_link(), blender::nodes::node_geo_separate_bundle_cc::node_insert_link(), blender::nodes::node_geo_simulation_cc::sim_input_node::node_insert_link(), blender::nodes::node_geo_simulation_cc::sim_output_node::node_insert_link(), and try_add_item_via_any_extend_socket().
|
inlinenodiscard |
Check if the link connects to the extend_socket. If yes, create a new item for the linked socket, update the node and then change the link to point to the new socket.
Definition at line 248 of file NOD_socket_items.hh.
References add_item(), add_item_with_name(), add_item_with_socket_type_and_name(), bNodeLink::fromsock, get_socket_identifier(), bNodeSocket::name, blender::bke::node_find_socket(), SOCK_IN, SOCK_OUT, bNodeLink::tosock, try_add_item_via_extend_socket(), bNodeSocket::type, and blender::nodes::update_node_declaration_and_sockets().
Referenced by try_add_item_via_any_extend_socket(), and try_add_item_via_extend_socket().