Cleanup: use StringRef instead of std::string in a few places
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
struct Mesh;
|
||||
namespace blender {
|
||||
@@ -22,7 +23,7 @@ Mesh *create_cuboid_mesh(const float3 &size,
|
||||
int verts_x,
|
||||
int verts_y,
|
||||
int verts_z,
|
||||
const std::optional<std::string> &uv_id);
|
||||
const std::optional<StringRef> &uv_id);
|
||||
|
||||
Mesh *create_cuboid_mesh(const float3 &size, int verts_x, int verts_y, int verts_z);
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BKE_anonymous_attribute_id.hh"
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
struct Mesh;
|
||||
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
struct Mesh;
|
||||
namespace blender::bke {
|
||||
class AttributeIDRef;
|
||||
} // namespace blender::bke
|
||||
|
||||
namespace blender::geometry {
|
||||
|
||||
@@ -18,6 +16,6 @@ Mesh *create_grid_mesh(int verts_x,
|
||||
int verts_y,
|
||||
float size_x,
|
||||
float size_y,
|
||||
const std::optional<std::string> &uv_map_id);
|
||||
const std::optional<StringRef> &uv_map_id);
|
||||
|
||||
} // namespace blender::geometry
|
||||
|
||||
@@ -5,15 +5,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "BLI_bounds_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
struct Mesh;
|
||||
namespace blender::bke {
|
||||
class AttributeIDRef;
|
||||
} // namespace blender::bke
|
||||
|
||||
namespace blender::geometry {
|
||||
|
||||
@@ -29,6 +26,6 @@ Bounds<float3> calculate_bounds_radial_primitive(float radius_top,
|
||||
Mesh *create_uv_sphere_mesh(float radius,
|
||||
int segments,
|
||||
int rings,
|
||||
const std::optional<std::string> &uv_map_id);
|
||||
const std::optional<StringRef> &uv_map_id);
|
||||
|
||||
} // namespace blender::geometry
|
||||
|
||||
@@ -289,7 +289,7 @@ static void calculate_corner_verts(const CuboidConfig &config, MutableSpan<int>
|
||||
}
|
||||
}
|
||||
|
||||
static void calculate_uvs(const CuboidConfig &config, Mesh *mesh, const std::string &uv_id)
|
||||
static void calculate_uvs(const CuboidConfig &config, Mesh *mesh, const StringRef uv_id)
|
||||
{
|
||||
bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
bke::SpanAttributeWriter uv_attribute = attributes.lookup_or_add_for_write_only_span<float2>(
|
||||
@@ -369,7 +369,7 @@ Mesh *create_cuboid_mesh(const float3 &size,
|
||||
const int verts_x,
|
||||
const int verts_y,
|
||||
const int verts_z,
|
||||
const std::optional<std::string> &uv_id)
|
||||
const std::optional<StringRef> &uv_id)
|
||||
{
|
||||
const CuboidConfig config(size, verts_x, verts_y, verts_z);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ Mesh *create_grid_mesh(const int verts_x,
|
||||
const int verts_y,
|
||||
const float size_x,
|
||||
const float size_y,
|
||||
const std::optional<std::string> &uv_map_id)
|
||||
const std::optional<StringRef> &uv_map_id)
|
||||
{
|
||||
BLI_assert(verts_x > 0 && verts_y > 0);
|
||||
const int edges_x = verts_x - 1;
|
||||
|
||||
@@ -294,7 +294,7 @@ static Bounds<float3> calculate_bounds_uv_sphere(const float radius,
|
||||
Mesh *create_uv_sphere_mesh(const float radius,
|
||||
const int segments,
|
||||
const int rings,
|
||||
const std::optional<std::string> &uv_map_id)
|
||||
const std::optional<StringRef> &uv_map_id)
|
||||
{
|
||||
Mesh *mesh = BKE_mesh_new_nomain(sphere_vert_total(segments, rings),
|
||||
sphere_edge_total(segments, rings),
|
||||
|
||||
@@ -110,9 +110,9 @@ static void copy_curve_domain_attributes(const AttributeAccessor curve_attribute
|
||||
}
|
||||
|
||||
static PointCloud *pointcloud_from_curves(bke::CurvesGeometry curves,
|
||||
const std::optional<std::string> &tangent_id,
|
||||
const std::optional<std::string> &normal_id,
|
||||
const std::optional<std::string> &rotation_id)
|
||||
const std::optional<StringRef> &tangent_id,
|
||||
const std::optional<StringRef> &normal_id,
|
||||
const std::optional<StringRef> &rotation_id)
|
||||
{
|
||||
PointCloud *pointcloud = BKE_pointcloud_new_nomain(0);
|
||||
pointcloud->totpoint = curves.points_num();
|
||||
@@ -142,7 +142,7 @@ static void curve_to_points(GeometrySet &geometry_set,
|
||||
GeoNodeExecParams params,
|
||||
const GeometryNodeCurveResampleMode mode,
|
||||
geometry::ResampleCurvesOutputAttributeIDs resample_attributes,
|
||||
std::optional<std::string> rotation_anonymous_id)
|
||||
const std::optional<StringRef> &rotation_anonymous_id)
|
||||
{
|
||||
switch (mode) {
|
||||
case GEO_NODE_CURVE_RESAMPLE_COUNT: {
|
||||
@@ -213,7 +213,7 @@ static void grease_pencil_to_points(GeometrySet &geometry_set,
|
||||
GeoNodeExecParams params,
|
||||
const GeometryNodeCurveResampleMode mode,
|
||||
geometry::ResampleCurvesOutputAttributeIDs resample_attributes,
|
||||
std::optional<std::string> rotation_anonymous_id,
|
||||
const std::optional<StringRef> &rotation_anonymous_id,
|
||||
const AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
Field<int> count;
|
||||
|
||||
@@ -624,8 +624,8 @@ static void interpolate_curve_attributes(bke::CurvesGeometry &child_curves,
|
||||
}
|
||||
|
||||
static void store_output_attributes(bke::CurvesGeometry &child_curves,
|
||||
const std::optional<std::string> weight_attribute_id,
|
||||
const std::optional<std::string> index_attribute_id,
|
||||
const std::optional<StringRef> &weight_attribute_id,
|
||||
const std::optional<StringRef> &index_attribute_id,
|
||||
const int max_neighbors,
|
||||
const Span<int> all_neighbor_counts,
|
||||
const Span<int> all_neighbor_indices,
|
||||
@@ -689,8 +689,8 @@ static GeometrySet generate_interpolated_curves(
|
||||
const VArray<int> &point_group_ids,
|
||||
const int max_neighbors,
|
||||
const AnonymousAttributePropagationInfo &propagation_info,
|
||||
const std::optional<std::string> &index_attribute_id,
|
||||
const std::optional<std::string> &weight_attribute_id)
|
||||
const std::optional<StringRef> &index_attribute_id,
|
||||
const std::optional<StringRef> &weight_attribute_id)
|
||||
{
|
||||
const bke::CurvesGeometry &guide_curves = guide_curves_id.geometry.wrap();
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ static Mesh *create_cube_mesh(const float3 size,
|
||||
const int verts_x,
|
||||
const int verts_y,
|
||||
const int verts_z,
|
||||
const std::optional<std::string> &uv_map_id)
|
||||
const std::optional<StringRef> &uv_map_id)
|
||||
{
|
||||
const int dimensions = (verts_x - 1 > 0) + (verts_y - 1 > 0) + (verts_z - 1 > 0);
|
||||
if (dimensions == 0) {
|
||||
|
||||
Reference in New Issue
Block a user