From ed8fee16acea48173b10d399bff7315ff59e2dc1 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 25 Nov 2022 14:59:27 -0600 Subject: [PATCH 1/2] Fix: Hide "Squeeze Value" node from node search Based on discussion in D10891, this node isn't meant to be exposed and may be removed in the future. The fact that it was exposed in search menus was a mistake from the implementation of link-drag-search and bdb57541475f20ccc4. I explicitly removed the link drag search implementation, and added (Legacy) to the node name which hides it from the add node search. --- source/blender/nodes/shader/nodes/node_shader_squeeze.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc index 62e21088791..33f6d15abfd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc @@ -34,7 +34,8 @@ void register_node_type_sh_squeeze() static bNodeType ntype; - sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER); + sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value (Legacy)", NODE_CLASS_CONVERTER); + ntype.gather_link_search_ops = nullptr; ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_squeeze); From 680a0fb23be03d57a837daa7ee693c6c51a61535 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 25 Nov 2022 15:25:37 -0600 Subject: [PATCH 2/2] Fix T102752: Missing default radius when joining point clouds Point clouds are meant to use a default radius of 0.01 when there is no radius attribute. The curve to points node can create curves without a radius attribute. This affects joining and the realize instances node. Similar to 30f244d96f16142d4. --- .../geometry/intern/realize_instances.cc | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc index 2d9c23df348..57a4ae70b5f 100644 --- a/source/blender/geometry/intern/realize_instances.cc +++ b/source/blender/geometry/intern/realize_instances.cc @@ -75,6 +75,7 @@ struct PointCloudRealizeInfo { Array> attributes; /** Id attribute on the point cloud. If there are no ids, this #Span is empty. */ Span positions; + VArray radii; Span stored_ids; }; @@ -180,6 +181,7 @@ struct AllPointCloudsInfo { /** Preprocessed data about every original point cloud. This is ordered by #order. */ Array realize_info; bool create_id_attribute = false; + bool create_radius_attribute = false; }; struct AllMeshesInfo { @@ -622,7 +624,10 @@ static void gather_realize_tasks_recursive(GatherTasksInfo &gather_info, * \{ */ static OrderedAttributes gather_generic_pointcloud_attributes_to_propagate( - const GeometrySet &in_geometry_set, const RealizeInstancesOptions &options, bool &r_create_id) + const GeometrySet &in_geometry_set, + const RealizeInstancesOptions &options, + bool &r_create_radii, + bool &r_create_id) { Vector src_component_types; src_component_types.append(GEO_COMPONENT_TYPE_POINT_CLOUD); @@ -635,6 +640,7 @@ static OrderedAttributes gather_generic_pointcloud_attributes_to_propagate( src_component_types, GEO_COMPONENT_TYPE_POINT_CLOUD, true, attributes_to_propagate); attributes_to_propagate.remove("position"); r_create_id = attributes_to_propagate.pop_try("id").has_value(); + r_create_radii = attributes_to_propagate.pop_try("radius").has_value(); OrderedAttributes ordered_attributes; for (const auto item : attributes_to_propagate.items()) { ordered_attributes.ids.add_new(item.key); @@ -663,7 +669,7 @@ static AllPointCloudsInfo preprocess_pointclouds(const GeometrySet &geometry_set { AllPointCloudsInfo info; info.attributes = gather_generic_pointcloud_attributes_to_propagate( - geometry_set, options, info.create_id_attribute); + geometry_set, options, info.create_radius_attribute, info.create_id_attribute); gather_pointclouds_to_realize(geometry_set, info.order); info.realize_info.reinitialize(info.order.size()); @@ -690,6 +696,9 @@ static AllPointCloudsInfo preprocess_pointclouds(const GeometrySet &geometry_set pointcloud_info.stored_ids = ids_attribute.varray.get_internal_span().typed(); } } + if (info.create_radius_attribute) { + pointcloud_info.radii = attributes.lookup_or_default("radius", ATTR_DOMAIN_POINT, 0.01f); + } const VArray position_attribute = attributes.lookup_or_default( "position", ATTR_DOMAIN_POINT, float3(0)); pointcloud_info.positions = position_attribute.get_internal_span(); @@ -702,6 +711,7 @@ static void execute_realize_pointcloud_task( const RealizePointCloudTask &task, const OrderedAttributes &ordered_attributes, MutableSpan dst_attribute_writers, + MutableSpan all_dst_radii, MutableSpan all_dst_ids, MutableSpan all_dst_positions) { @@ -717,6 +727,9 @@ static void execute_realize_pointcloud_task( create_result_ids( options, pointcloud_info.stored_ids, task.id, all_dst_ids.slice(point_slice)); } + if (!all_dst_radii.is_empty()) { + pointcloud_info.radii.materialize(all_dst_radii.slice(point_slice)); + } copy_generic_attributes_to_result( pointcloud_info.attributes, @@ -759,6 +772,11 @@ static void execute_realize_pointcloud_tasks(const RealizeInstancesOptions &opti if (all_pointclouds_info.create_id_attribute) { point_ids = dst_attributes.lookup_or_add_for_write_only_span("id", ATTR_DOMAIN_POINT); } + SpanAttributeWriter point_radii; + if (all_pointclouds_info.create_radius_attribute) { + point_radii = dst_attributes.lookup_or_add_for_write_only_span("radius", + ATTR_DOMAIN_POINT); + } /* Prepare generic output attributes. */ Vector dst_attribute_writers; @@ -777,6 +795,7 @@ static void execute_realize_pointcloud_tasks(const RealizeInstancesOptions &opti task, ordered_attributes, dst_attribute_writers, + point_radii.span, point_ids.span, positions.span); } @@ -787,6 +806,7 @@ static void execute_realize_pointcloud_tasks(const RealizeInstancesOptions &opti dst_attribute.finish(); } positions.finish(); + point_radii.finish(); point_ids.finish(); }