diff options
Diffstat (limited to 'source/blender/nodes')
17 files changed, 46 insertions, 40 deletions
diff --git a/source/blender/nodes/NOD_derived_node_tree.hh b/source/blender/nodes/NOD_derived_node_tree.hh index 2dda36b40ad..526bcce41e5 100644 --- a/source/blender/nodes/NOD_derived_node_tree.hh +++ b/source/blender/nodes/NOD_derived_node_tree.hh @@ -104,7 +104,7 @@ class DNode { * nested node group hierarchy. This type is small and can be passed around by value. * * A #DSocket can represent an input or an output socket. If the type of a socket is known at - * compile time is is preferable to use #DInputSocket or #DOutputSocket instead. */ + * compile time is preferable to use #DInputSocket or #DOutputSocket instead. */ class DSocket { protected: const DTreeContext *context_ = nullptr; diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh index fe7146f3507..ef6786e8a4d 100644 --- a/source/blender/nodes/NOD_geometry_exec.hh +++ b/source/blender/nodes/NOD_geometry_exec.hh @@ -302,7 +302,7 @@ class GeoNodeExecParams { void check_input_access(StringRef identifier, const CPPType *requested_type = nullptr) const; void check_output_access(StringRef identifier, const CPPType &value_type) const; - /* Find the active socket socket with the input name (not the identifier). */ + /* Find the active socket with the input name (not the identifier). */ const bNodeSocket *find_available_socket(const StringRef name) const; }; diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh index b028fc28bbc..4f2565cbbaf 100644 --- a/source/blender/nodes/NOD_node_tree_ref.hh +++ b/source/blender/nodes/NOD_node_tree_ref.hh @@ -146,7 +146,7 @@ class InputSocketRef final : public SocketRef { void foreach_logical_origin(FunctionRef<void(const OutputSocketRef &)> origin_fn, FunctionRef<void(const SocketRef &)> skipped_fn, bool only_follow_first_input_link, - Vector<const InputSocketRef *> &handled_sockets) const; + Vector<const InputSocketRef *> &seen_sockets_stack) const; }; class OutputSocketRef final : public SocketRef { @@ -159,7 +159,7 @@ class OutputSocketRef final : public SocketRef { private: void foreach_logical_target(FunctionRef<void(const InputSocketRef &)> target_fn, FunctionRef<void(const SocketRef &)> skipped_fn, - Vector<const OutputSocketRef *> &handled_sockets) const; + Vector<const OutputSocketRef *> &seen_sockets_stack) const; }; class NodeRef : NonCopyable, NonMovable { diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index 29d6335e685..9912c10b368 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -44,10 +44,10 @@ static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *no c->t3 = 0.0f; c->fsize = 0.0f; c->fstrength = 0.0f; - c->algorithm = 1; /*max channel limiting */ - c->channel = 1; /* limit by red */ - node->custom1 = 1; /* RGB channel */ - node->custom2 = 2; /* Green Channel */ + c->algorithm = 1; /* Max channel limiting. */ + c->channel = 1; /* Limit by red. */ + node->custom1 = 1; /* RGB channel. */ + node->custom2 = 2; /* Green Channel. */ } void register_node_type_cmp_channel_matte(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index 5e7a61377fb..7c70ccf412a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -37,7 +37,7 @@ static bNodeSocketTemplate cmp_node_view_levels_out[] = { static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node) { - node->custom1 = 1; /*All channels*/ + node->custom1 = 1; /* All channels. */ } void register_node_type_cmp_view_levels(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index b1ed09966c0..7dd39d5eaa1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -37,7 +37,7 @@ static bNodeSocketTemplate cmp_node_rotate_out[] = { static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node) { - node->custom1 = 1; /* Bilinear Filter*/ + node->custom1 = 1; /* Bilinear Filter. */ } void register_node_type_cmp_rotate(void) diff --git a/source/blender/nodes/geometry/node_geometry_exec.cc b/source/blender/nodes/geometry/node_geometry_exec.cc index a24a6d7ad21..8bf7680c835 100644 --- a/source/blender/nodes/geometry/node_geometry_exec.cc +++ b/source/blender/nodes/geometry/node_geometry_exec.cc @@ -17,7 +17,7 @@ #include "FN_cpp_type_make.hh" #include "NOD_geometry_exec.hh" -MAKE_CPP_TYPE(GeometrySet, GeometrySet); +MAKE_CPP_TYPE(GeometrySet, GeometrySet, CPPTypeFlags::Printable); namespace blender::nodes { diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc index 7b40456b180..60b5b91db19 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_convert.cc @@ -130,7 +130,7 @@ static void attribute_convert_calc(GeometryComponent &component, const CPPType *cpp_type = bke::custom_data_type_to_cpp_type(result_type); BLI_assert(cpp_type != nullptr); - cpp_type->copy_to_initialized_n(source_span.data(), result_span.data(), result_span.size()); + cpp_type->copy_assign_n(source_span.data(), result_span.data(), result_span.size()); result_attribute.save(); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc index eeb77abd624..15d419a003a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc @@ -189,6 +189,7 @@ Array<uint32_t> get_geometry_element_ids_as_uints(const GeometryComponent &compo if (hash_attribute) { BLI_assert(hashes.size() == hash_attribute->size()); const CPPType &cpp_type = hash_attribute->type(); + BLI_assert(cpp_type.is_hashable()); GVArray_GSpan items{*hash_attribute}; threading::parallel_for(hashes.index_range(), 512, [&](IndexRange range) { for (const int i : range) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc index 2725c625913..e37822bd262 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc @@ -298,7 +298,7 @@ static void copy_spline_domain_attributes(const CurveComponent &curve_component, if (size != 0) { BUFFER_FOR_CPP_TYPE_VALUE(type, buffer); spline_attribute->get(i, buffer); - type.fill_initialized(buffer, result[offset], size); + type.fill_assign_n(buffer, result[offset], size); } } diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc index bc758b59987..730cf08feaa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc @@ -208,7 +208,7 @@ static void fill_new_attribute(Span<const GeometryComponent *> src_components, GVArray_GSpan src_span{*read_attribute}; const void *src_buffer = src_span.data(); void *dst_buffer = dst_span[offset]; - cpp_type->copy_to_initialized_n(src_buffer, dst_buffer, domain_size); + cpp_type->copy_assign_n(src_buffer, dst_buffer, domain_size); offset += domain_size; } @@ -353,7 +353,7 @@ static void ensure_control_point_attribute(const StringRef name, BUFFER_FOR_CPP_TYPE_VALUE(type, buffer); current_curve_attribute->get(spline_index_in_component, buffer); - type.fill_initialized(buffer, new_attribute->data(), new_attribute->size()); + type.fill_assign_n(buffer, new_attribute->data(), new_attribute->size()); } } @@ -392,7 +392,7 @@ static void ensure_spline_attribute(const StringRef name, GVArray_GSpan src_span{*read_attribute}; const void *src_buffer = src_span.data(); - type.copy_to_initialized_n(src_buffer, result_attribute[offset], size); + type.copy_assign_n(src_buffer, result_attribute[offset], size); offset += size; } diff --git a/source/blender/nodes/intern/derived_node_tree.cc b/source/blender/nodes/intern/derived_node_tree.cc index 1e12f3c5763..c994077019c 100644 --- a/source/blender/nodes/intern/derived_node_tree.cc +++ b/source/blender/nodes/intern/derived_node_tree.cc @@ -241,7 +241,7 @@ void DInputSocket::foreach_origin_socket(FunctionRef<void(DSocket)> origin_fn) c /* Calls `target_fn` for every "real" target socket. "Real" means that reroutes, muted nodes * and node groups are handled by this function. Target sockets are on the nodes that use the value * from this socket. The `skipped_fn` function is called for sockets that have been skipped during - * the search for target sockets (e.g. reroutes). */ + * the search for target sockets (e.g. reroutes). */ void DOutputSocket::foreach_target_socket(FunctionRef<void(DInputSocket)> target_fn, FunctionRef<void(DSocket)> skipped_fn) const { diff --git a/source/blender/nodes/intern/node_socket.cc b/source/blender/nodes/intern/node_socket.cc index d00bf636e15..9f0a145ace2 100644 --- a/source/blender/nodes/intern/node_socket.cc +++ b/source/blender/nodes/intern/node_socket.cc @@ -662,10 +662,10 @@ static bNodeSocketType *make_socket_type_string() return socktype; } -MAKE_CPP_TYPE(Object, Object *) -MAKE_CPP_TYPE(Collection, Collection *) -MAKE_CPP_TYPE(Texture, Tex *) -MAKE_CPP_TYPE(Material, Material *) +MAKE_CPP_TYPE(Object, Object *, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(Collection, Collection *, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(Texture, Tex *, CPPTypeFlags::BasicType) +MAKE_CPP_TYPE(Material, Material *, CPPTypeFlags::BasicType) static bNodeSocketType *make_socket_type_object() { diff --git a/source/blender/nodes/intern/node_tree_ref.cc b/source/blender/nodes/intern/node_tree_ref.cc index 154ee716153..bed4d60382d 100644 --- a/source/blender/nodes/intern/node_tree_ref.cc +++ b/source/blender/nodes/intern/node_tree_ref.cc @@ -176,12 +176,12 @@ void NodeTreeRef::create_linked_socket_caches() /* Find logically linked sockets. */ Vector<const SocketRef *> logically_linked_sockets; Vector<const SocketRef *> logically_linked_skipped_sockets; - Vector<const InputSocketRef *> handled_sockets; + Vector<const InputSocketRef *> seen_sockets_stack; socket->foreach_logical_origin( [&](const OutputSocketRef &origin) { logically_linked_sockets.append(&origin); }, [&](const SocketRef &socket) { logically_linked_skipped_sockets.append(&socket); }, false, - handled_sockets); + seen_sockets_stack); if (logically_linked_sockets == directly_linked_sockets) { socket->logically_linked_sockets_ = socket->directly_linked_sockets_; } @@ -222,16 +222,17 @@ void NodeTreeRef::create_linked_socket_caches() } } -void InputSocketRef::foreach_logical_origin(FunctionRef<void(const OutputSocketRef &)> origin_fn, - FunctionRef<void(const SocketRef &)> skipped_fn, - bool only_follow_first_input_link, - Vector<const InputSocketRef *> &handled_sockets) const +void InputSocketRef::foreach_logical_origin( + FunctionRef<void(const OutputSocketRef &)> origin_fn, + FunctionRef<void(const SocketRef &)> skipped_fn, + bool only_follow_first_input_link, + Vector<const InputSocketRef *> &seen_sockets_stack) const { /* Protect against loops. */ - if (handled_sockets.contains(this)) { + if (seen_sockets_stack.contains(this)) { return; } - handled_sockets.append(this); + seen_sockets_stack.append(this); Span<const LinkRef *> links_to_check = this->directly_linked_links(); if (only_follow_first_input_link) { @@ -251,7 +252,7 @@ void InputSocketRef::foreach_logical_origin(FunctionRef<void(const OutputSocketR const OutputSocketRef &reroute_output = origin_node.output(0); skipped_fn.call_safe(reroute_input); skipped_fn.call_safe(reroute_output); - reroute_input.foreach_logical_origin(origin_fn, skipped_fn, false, handled_sockets); + reroute_input.foreach_logical_origin(origin_fn, skipped_fn, false, seen_sockets_stack); } else if (origin_node.is_muted()) { for (const InternalLinkRef *internal_link : origin_node.internal_links()) { @@ -259,7 +260,7 @@ void InputSocketRef::foreach_logical_origin(FunctionRef<void(const OutputSocketR const InputSocketRef &mute_input = internal_link->from(); skipped_fn.call_safe(origin); skipped_fn.call_safe(mute_input); - mute_input.foreach_logical_origin(origin_fn, skipped_fn, true, handled_sockets); + mute_input.foreach_logical_origin(origin_fn, skipped_fn, true, seen_sockets_stack); break; } } @@ -268,18 +269,20 @@ void InputSocketRef::foreach_logical_origin(FunctionRef<void(const OutputSocketR origin_fn(origin); } } + + seen_sockets_stack.pop_last(); } void OutputSocketRef::foreach_logical_target( FunctionRef<void(const InputSocketRef &)> target_fn, FunctionRef<void(const SocketRef &)> skipped_fn, - Vector<const OutputSocketRef *> &handled_sockets) const + Vector<const OutputSocketRef *> &seen_sockets_stack) const { /* Protect against loops. */ - if (handled_sockets.contains(this)) { + if (seen_sockets_stack.contains(this)) { return; } - handled_sockets.append(this); + seen_sockets_stack.append(this); for (const LinkRef *link : this->directly_linked_links()) { if (link->is_muted()) { @@ -294,7 +297,7 @@ void OutputSocketRef::foreach_logical_target( const OutputSocketRef &reroute_output = target_node.output(0); skipped_fn.call_safe(target); skipped_fn.call_safe(reroute_output); - reroute_output.foreach_logical_target(target_fn, skipped_fn, handled_sockets); + reroute_output.foreach_logical_target(target_fn, skipped_fn, seen_sockets_stack); } else if (target_node.is_muted()) { skipped_fn.call_safe(target); @@ -309,7 +312,7 @@ void OutputSocketRef::foreach_logical_target( const OutputSocketRef &mute_output = internal_link->to(); skipped_fn.call_safe(target); skipped_fn.call_safe(mute_output); - mute_output.foreach_logical_target(target_fn, skipped_fn, handled_sockets); + mute_output.foreach_logical_target(target_fn, skipped_fn, seen_sockets_stack); } } } @@ -317,6 +320,8 @@ void OutputSocketRef::foreach_logical_target( target_fn(target); } } + + seen_sockets_stack.pop_last(); } namespace { @@ -336,7 +341,7 @@ static std::unique_ptr<SocketIndexByIdentifierMap> create_identifier_map(const L return map; } -/* This function is not threadsafe. */ +/* This function is not threadsafe. */ static SocketByIdentifierMap get_or_create_identifier_map( const bNode &node, const ListBase &sockets, const bNodeSocketTemplate *sockets_template) { diff --git a/source/blender/nodes/intern/type_conversions.cc b/source/blender/nodes/intern/type_conversions.cc index 220e5ea9046..1a71a3418a5 100644 --- a/source/blender/nodes/intern/type_conversions.cc +++ b/source/blender/nodes/intern/type_conversions.cc @@ -231,7 +231,7 @@ void DataTypeConversions::convert_to_uninitialized(const CPPType &from_type, void *to_value) const { if (from_type == to_type) { - from_type.copy_to_uninitialized(from_value, to_value); + from_type.copy_construct(from_value, to_value); return; } diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 5ec982c4e7f..e23e2ac3b9d 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -398,7 +398,7 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree) if (socket->link != NULL && !(socket->link->flag & NODE_LINK_MUTED)) { bNodeLink *link = socket->link; /* Fix the case where the socket is actually converting the data. (see T71374) - * We only do the case of lossy conversion to float.*/ + * We only do the case of lossy conversion to float. */ if ((socket->type == SOCK_FLOAT) && (link->fromsock->type != link->tosock->type)) { if (link->fromsock->type == SOCK_RGBA) { bNode *tmp = nodeAddStaticNode(NULL, localtree, SH_NODE_RGBTOBW); diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.c b/source/blender/nodes/shader/nodes/node_shader_hair_info.c index fe1361e0d78..843185befb6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hair_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.c @@ -24,7 +24,7 @@ static bNodeSocketTemplate outputs[] = { {SOCK_FLOAT, N_("Intercept"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Thickness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_VECTOR, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - /*{ SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},*/ + // { SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Random")}, {-1, ""}, }; |