diff --git a/source/blender/blenkernel/BKE_anonymous_attribute_id.hh b/source/blender/blenkernel/BKE_anonymous_attribute_id.hh index d9024ed9c05..8f6422fad06 100644 --- a/source/blender/blenkernel/BKE_anonymous_attribute_id.hh +++ b/source/blender/blenkernel/BKE_anonymous_attribute_id.hh @@ -29,7 +29,7 @@ namespace blender::bke { * * Once created, #AnonymousAttributeID is immutable. Also it is intrinsically reference counted so * that it can have shared ownership. `std::shared_ptr` can't be used for that purpose here, - * because that is not available in C code. If possible, the #AutoAnonymousAttributeID wrapper + * because that is not available in C code. If possible, the #AnonymousAttributeIDPtr wrapper * should be used to avoid manual reference counting in C++ code. */ class AnonymousAttributeID : public ImplicitSharingMixin { @@ -54,7 +54,7 @@ class AnonymousAttributeID : public ImplicitSharingMixin { }; /** Wrapper for #AnonymousAttributeID that avoids manual reference counting. */ -using AutoAnonymousAttributeID = ImplicitSharingPtr; +using AnonymousAttributeIDPtr = ImplicitSharingPtr; /** * A set of anonymous attribute names that is passed around in geometry nodes. diff --git a/source/blender/blenkernel/BKE_geometry_fields.hh b/source/blender/blenkernel/BKE_geometry_fields.hh index 506be65e183..5145ea79347 100644 --- a/source/blender/blenkernel/BKE_geometry_fields.hh +++ b/source/blender/blenkernel/BKE_geometry_fields.hh @@ -259,11 +259,11 @@ class NormalFieldInput : public GeometryFieldInput { class AnonymousAttributeFieldInput : public GeometryFieldInput { private: - AutoAnonymousAttributeID anonymous_id_; + AnonymousAttributeIDPtr anonymous_id_; std::string producer_name_; public: - AnonymousAttributeFieldInput(AutoAnonymousAttributeID anonymous_id, + AnonymousAttributeFieldInput(AnonymousAttributeIDPtr anonymous_id, const CPPType &type, std::string producer_name) : GeometryFieldInput(type, anonymous_id->user_name()), @@ -274,7 +274,7 @@ class AnonymousAttributeFieldInput : public GeometryFieldInput { } template - static fn::Field Create(AutoAnonymousAttributeID anonymous_id, std::string producer_name) + static fn::Field Create(AnonymousAttributeIDPtr anonymous_id, std::string producer_name) { const CPPType &type = CPPType::get(); auto field_input = std::make_shared( @@ -282,7 +282,7 @@ class AnonymousAttributeFieldInput : public GeometryFieldInput { return fn::Field{field_input}; } - const AutoAnonymousAttributeID &anonymous_id() const + const AnonymousAttributeIDPtr &anonymous_id() const { return anonymous_id_; } diff --git a/source/blender/geometry/intern/mesh_split_edges.cc b/source/blender/geometry/intern/mesh_split_edges.cc index b3b6a21f415..47dcabc9b59 100644 --- a/source/blender/geometry/intern/mesh_split_edges.cc +++ b/source/blender/geometry/intern/mesh_split_edges.cc @@ -73,7 +73,7 @@ static void add_new_edges(Mesh &mesh, /* Store a copy of the IDs locally since we will remove the existing attributes which * can also free the names, since the API does not provide pointer stability. */ Vector named_ids; - Vector anonymous_ids; + Vector anonymous_ids; for (const bke::AttributeIDRef &id : attributes.all_ids()) { if (attributes.lookup_meta_data(id)->domain != ATTR_DOMAIN_EDGE) { continue; @@ -95,7 +95,7 @@ static void add_new_edges(Mesh &mesh, for (const StringRef name : named_ids) { local_edge_ids.append(name); } - for (const bke::AutoAnonymousAttributeID &id : anonymous_ids) { + for (const bke::AnonymousAttributeIDPtr &id : anonymous_ids) { local_edge_ids.append(*id); } diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh index baacd1bedbe..d1ff1c6e807 100644 --- a/source/blender/nodes/NOD_geometry_exec.hh +++ b/source/blender/nodes/NOD_geometry_exec.hh @@ -18,6 +18,7 @@ namespace blender::nodes { using bke::AnonymousAttributeFieldInput; using bke::AnonymousAttributeID; +using bke::AnonymousAttributeIDPtr; using bke::AnonymousAttributePropagationInfo; using bke::AttributeAccessor; using bke::AttributeFieldInput; @@ -26,7 +27,6 @@ using bke::AttributeKind; using bke::AttributeMetaData; using bke::AttributeReader; using bke::AttributeWriter; -using bke::AutoAnonymousAttributeID; using bke::GAttributeReader; using bke::GAttributeWriter; using bke::GSpanAttributeWriter; @@ -259,7 +259,7 @@ class GeoNodeExecParams { * Return a new anonymous attribute id for the given output. None is returned if the anonymous * attribute is not needed. */ - AutoAnonymousAttributeID get_output_anonymous_attribute_id_if_needed( + AnonymousAttributeIDPtr get_output_anonymous_attribute_id_if_needed( const StringRef output_identifier, const bool force_create = false) { if (!this->anonymous_attribute_output_is_required(output_identifier) && !force_create) { diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh index cfef1bcaae7..c6524762207 100644 --- a/source/blender/nodes/geometry/node_geometry_util.hh +++ b/source/blender/nodes/geometry/node_geometry_util.hh @@ -56,10 +56,10 @@ Mesh *create_grid_mesh( int verts_x, int verts_y, float size_x, float size_y, const AttributeIDRef &uv_map_id); struct ConeAttributeOutputs { - AutoAnonymousAttributeID top_id; - AutoAnonymousAttributeID bottom_id; - AutoAnonymousAttributeID side_id; - AutoAnonymousAttributeID uv_map_id; + AnonymousAttributeIDPtr top_id; + AnonymousAttributeIDPtr bottom_id; + AnonymousAttributeIDPtr side_id; + AnonymousAttributeIDPtr uv_map_id; }; Mesh *create_cylinder_or_cone_mesh(float radius_top, diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc index a07cd1437d6..6718a0b0d78 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc @@ -142,7 +142,7 @@ static void node_geo_exec(GeoNodeExecParams params) const eAttrDomain domain = eAttrDomain(storage.domain); const std::string output_identifier = "Attribute" + identifier_suffix(data_type); - AutoAnonymousAttributeID attribute_id = params.get_output_anonymous_attribute_id_if_needed( + AnonymousAttributeIDPtr attribute_id = params.get_output_anonymous_attribute_id_if_needed( output_identifier); if (!attribute_id) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc index 0135567c5e4..b1885970071 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc @@ -30,7 +30,7 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) } struct AttributeOutputs { - AutoAnonymousAttributeID intersecting_edges_id; + AnonymousAttributeIDPtr intersecting_edges_id; }; static void node_update(bNodeTree *ntree, bNode *node) diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc index 46468c6cbf0..acf3654a166 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc @@ -59,7 +59,7 @@ static Curves *create_star_curve(const float inner_radius, } static void create_selection_output(CurveComponent &component, - AutoAnonymousAttributeID &r_attribute) + AnonymousAttributeIDPtr &r_attribute) { SpanAttributeWriter selection = component.attributes_for_write()->lookup_or_add_for_write_only_span(*r_attribute, @@ -78,8 +78,8 @@ static void node_geo_exec(GeoNodeExecParams params) std::max(params.extract_input("Points"), 3)); GeometrySet output = GeometrySet::create_with_curves(curves); - if (AutoAnonymousAttributeID outer_points_id = - params.get_output_anonymous_attribute_id_if_needed("Outer Points")) { + if (AnonymousAttributeIDPtr outer_points_id = params.get_output_anonymous_attribute_id_if_needed( + "Outer Points")) { create_selection_output(output.get_component_for_write(), outer_points_id); params.set_output("Outer Points", AnonymousAttributeFieldInput::Create( 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 80bd70e1a01..22286969c24 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 @@ -135,13 +135,13 @@ static void node_geo_exec(GeoNodeExecParams params) GeometryComponentEditData::remember_deformed_curve_positions_if_necessary(geometry_set); - AutoAnonymousAttributeID rotation_anonymous_id = + AnonymousAttributeIDPtr rotation_anonymous_id = params.get_output_anonymous_attribute_id_if_needed("Rotation"); const bool need_tangent_and_normal = bool(rotation_anonymous_id); - AutoAnonymousAttributeID tangent_anonymous_id = + AnonymousAttributeIDPtr tangent_anonymous_id = params.get_output_anonymous_attribute_id_if_needed("Tangent", need_tangent_and_normal); - AutoAnonymousAttributeID normal_anonymous_id = - params.get_output_anonymous_attribute_id_if_needed("Normal", need_tangent_and_normal); + AnonymousAttributeIDPtr normal_anonymous_id = params.get_output_anonymous_attribute_id_if_needed( + "Normal", need_tangent_and_normal); geometry::ResampleCurvesOutputAttributeIDs resample_attributes; resample_attributes.tangent_id = tangent_anonymous_id.get(); diff --git a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc index dd106e13fcb..b4bc18c465c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc @@ -322,8 +322,8 @@ BLI_NOINLINE static void propagate_existing_attributes( namespace { struct AttributeOutputs { - AutoAnonymousAttributeID normal_id; - AutoAnonymousAttributeID rotation_id; + AnonymousAttributeIDPtr normal_id; + AnonymousAttributeIDPtr rotation_id; }; } // namespace diff --git a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc index 23f55a6dd25..963ac71297b 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc @@ -57,7 +57,7 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr) } struct IndexAttributes { - AutoAnonymousAttributeID duplicate_index; + AnonymousAttributeIDPtr duplicate_index; }; /* -------------------------------------------------------------------- */ diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc index bd635594fc3..a3d89e2f796 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc @@ -62,8 +62,8 @@ static void node_update(bNodeTree *ntree, bNode *node) } struct AttributeOutputs { - AutoAnonymousAttributeID top_id; - AutoAnonymousAttributeID side_id; + AnonymousAttributeIDPtr top_id; + AnonymousAttributeIDPtr side_id; }; static void save_selection_as_attribute(Mesh &mesh, diff --git a/source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc index 1b119f63bc0..2e256caea4a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_interpolate_curves.cc @@ -593,8 +593,8 @@ static void interpolate_curve_attributes(bke::CurvesGeometry &child_curves, } static void store_output_attributes(bke::CurvesGeometry &child_curves, - const AutoAnonymousAttributeID weight_attribute_id, - const AutoAnonymousAttributeID index_attribute_id, + const AnonymousAttributeIDPtr weight_attribute_id, + const AnonymousAttributeIDPtr index_attribute_id, const int max_neighbors, const Span all_neighbor_counts, const Span all_neighbor_indices, @@ -658,8 +658,8 @@ static GeometrySet generate_interpolated_curves( const VArray &point_group_ids, const int max_neighbors, const AnonymousAttributePropagationInfo &propagation_info, - const AutoAnonymousAttributeID &index_attribute_id, - const AutoAnonymousAttributeID &weight_attribute_id) + const AnonymousAttributeIDPtr &index_attribute_id, + const AnonymousAttributeIDPtr &weight_attribute_id) { const bke::CurvesGeometry &guide_curves = guide_curves_id.geometry.wrap(); @@ -813,10 +813,10 @@ static void node_geo_exec(GeoNodeExecParams params) const AnonymousAttributePropagationInfo propagation_info = params.get_output_propagation_info( "Curves"); - AutoAnonymousAttributeID index_attribute_id = params.get_output_anonymous_attribute_id_if_needed( + AnonymousAttributeIDPtr index_attribute_id = params.get_output_anonymous_attribute_id_if_needed( "Closest Index"); - AutoAnonymousAttributeID weight_attribute_id = - params.get_output_anonymous_attribute_id_if_needed("Closest Weight"); + AnonymousAttributeIDPtr weight_attribute_id = params.get_output_anonymous_attribute_id_if_needed( + "Closest Weight"); GeometrySet new_curves = generate_interpolated_curves(guide_curves_id, *points_component->attributes(), diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc index 3af830562d9..bb615d6315e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc @@ -107,8 +107,7 @@ static void node_geo_exec(GeoNodeExecParams params) return; } - AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed( - "UV Map"); + AnonymousAttributeIDPtr uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map"); Mesh *mesh = create_cube_mesh(size, verts_x, verts_y, verts_z, uv_map_id.get()); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc index 5703eea738c..ed2fc92ebb8 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc @@ -198,8 +198,7 @@ static void node_geo_exec(GeoNodeExecParams params) return; } - AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed( - "UV Map"); + AnonymousAttributeIDPtr uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map"); Mesh *mesh = create_grid_mesh(verts_x, verts_y, size_x, size_y, uv_map_id.get()); BKE_id_material_eval_ensure_default_slot(&mesh->id); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc index 3253cd918ea..74053462f0e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc @@ -111,8 +111,7 @@ static void node_geo_exec(GeoNodeExecParams params) const int subdivisions = std::min(params.extract_input("Subdivisions"), 10); const float radius = params.extract_input("Radius"); - AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed( - "UV Map"); + AnonymousAttributeIDPtr uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map"); Mesh *mesh = create_ico_sphere_mesh(subdivisions, radius, uv_map_id.get()); params.set_output("Mesh", GeometrySet::create_with_mesh(mesh)); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc index d49ddb439ba..f7fedcb4b74 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc @@ -358,8 +358,7 @@ static void node_geo_exec(GeoNodeExecParams params) const float radius = params.extract_input("Radius"); - AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed( - "UV Map"); + AnonymousAttributeIDPtr uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map"); Mesh *mesh = create_uv_sphere_mesh(radius, segments_num, rings_num, uv_map_id.get()); params.set_output("Mesh", GeometrySet::create_with_mesh(mesh)); diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc index 9d71a5a14ae..6c52af3956f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc @@ -342,7 +342,7 @@ static void create_attributes(GeoNodeExecParams ¶ms, { MutableAttributeAccessor attributes = instances.attributes_for_write(); - if (AutoAnonymousAttributeID line_id = params.get_output_anonymous_attribute_id_if_needed( + if (AnonymousAttributeIDPtr line_id = params.get_output_anonymous_attribute_id_if_needed( "Line")) { SpanAttributeWriter line_attribute = attributes.lookup_or_add_for_write_only_span( *line_id, ATTR_DOMAIN_INSTANCE); @@ -353,7 +353,7 @@ static void create_attributes(GeoNodeExecParams ¶ms, params.attribute_producer_name())); } - if (AutoAnonymousAttributeID pivot_id = params.get_output_anonymous_attribute_id_if_needed( + if (AnonymousAttributeIDPtr pivot_id = params.get_output_anonymous_attribute_id_if_needed( "Pivot Point")) { SpanAttributeWriter pivot_attribute = attributes.lookup_or_add_for_write_only_span(*pivot_id, ATTR_DOMAIN_INSTANCE);