Cleanup: Remove unnecessary const qualifiers in function declarations

This commit is contained in:
Hans Goudey
2025-02-14 14:32:57 -05:00
parent 2e22be10f8
commit 4727dfd627
23 changed files with 46 additions and 49 deletions

View File

@@ -94,7 +94,7 @@ class CombinedKeyingResult {
* "Object Transforms" channel group name.
*/
std::optional<StringRefNull> default_channel_group_for_path(const PointerRNA *animated_struct,
const StringRef prop_rna_path);
StringRef prop_rna_path);
/* -------------------------------------------------------------------- */

View File

@@ -152,10 +152,9 @@ void BKE_id_attributes_default_color_set(struct ID *id, std::optional<blender::S
const struct CustomDataLayer *BKE_id_attributes_color_find(const struct ID *id,
blender::StringRef name);
bool BKE_color_attribute_supported(const struct Mesh &mesh, const blender::StringRef name);
bool BKE_color_attribute_supported(const struct Mesh &mesh, blender::StringRef name);
std::string BKE_attribute_calc_unique_name(const AttributeOwner &owner,
const blender::StringRef name);
std::string BKE_attribute_calc_unique_name(const AttributeOwner &owner, blender::StringRef name);
[[nodiscard]] blender::StringRef BKE_uv_map_vert_select_name_get(blender::StringRef uv_map_name,
char *buffer);

View File

@@ -521,12 +521,12 @@ class AttributeAccessor {
/**
* \return True, when the attribute is available.
*/
bool contains(const StringRef attribute_id) const;
bool contains(StringRef attribute_id) const;
/**
* \return Information about the attribute if it exists.
*/
std::optional<AttributeMetaData> lookup_meta_data(const StringRef attribute_id) const;
std::optional<AttributeMetaData> lookup_meta_data(StringRef attribute_id) const;
/**
* \return True, when attributes can exist on that domain.

View File

@@ -36,8 +36,8 @@ struct BakePath {
};
std::string frame_to_file_name(const SubFrame &frame);
std::optional<SubFrame> file_name_to_frame(const StringRef file_name);
std::optional<SubFrame> file_name_to_frame(StringRef file_name);
Vector<MetaFile> find_sorted_meta_files(const StringRefNull meta_dir);
Vector<MetaFile> find_sorted_meta_files(StringRefNull meta_dir);
} // namespace blender::bke::bake

View File

@@ -31,8 +31,7 @@ namespace blender::bke::cryptomatte {
* The output of this function is:
* 'cryptomatte/{hash of layer_name}/{key_name}'.
*/
std::string BKE_cryptomatte_meta_data_key(const StringRef layer_name,
const StringRefNull key_name);
std::string BKE_cryptomatte_meta_data_key(StringRef layer_name, StringRefNull key_name);
/**
* Extract the cryptomatte layer name from the given `render_pass_name`.
@@ -49,7 +48,7 @@ std::string BKE_cryptomatte_meta_data_key(const StringRef layer_name,
* \note The return type is a sub-string of `render_pass_name` and therefore cannot outlive the
* `render_pass_name` internal data.
*/
StringRef BKE_cryptomatte_extract_layer_name(const StringRef render_pass_name);
StringRef BKE_cryptomatte_extract_layer_name(StringRef render_pass_name);
struct CryptomatteHash {
uint32_t hash;
@@ -129,8 +128,7 @@ struct CryptomatteStampDataCallbackData {
const blender::Vector<std::string> &BKE_cryptomatte_layer_names_get(
const CryptomatteSession &session);
CryptomatteLayer *BKE_cryptomatte_layer_get(CryptomatteSession &session,
const StringRef layer_name);
CryptomatteLayer *BKE_cryptomatte_layer_get(CryptomatteSession &session, StringRef layer_name);
struct CryptomatteSessionDeleter {
void operator()(CryptomatteSession *session)

View File

@@ -46,7 +46,7 @@ struct FileHandlerType {
/**
* Generate a default file name for use with this file handler.
*/
std::string get_default_filename(const StringRefNull name);
std::string get_default_filename(StringRefNull name);
};
/**

View File

@@ -585,14 +585,14 @@ class Layer : public ::GreasePencilLayer {
* armature.
*/
StringRefNull parent_bone_name() const;
void set_parent_bone_name(const StringRef new_name);
void set_parent_bone_name(StringRef new_name);
/**
* Returns the view layer name that this layer should be rendered in or an empty
* `StringRefNull` if no such name is set.
*/
StringRefNull view_layer_name() const;
void set_view_layer_name(const StringRef new_name);
void set_view_layer_name(StringRef new_name);
private:
/**

View File

@@ -19,7 +19,7 @@ namespace blender::bke::greasepencil {
void validate_drawing_vertex_groups(GreasePencil &grease_pencil);
/** Find or create a vertex group in a drawing. */
int ensure_vertex_group(const StringRef name, ListBase &vertex_group_names);
int ensure_vertex_group(StringRef name, ListBase &vertex_group_names);
/** Assign selected vertices to the vertex group. */
void assign_to_vertex_group(Drawing &drawing, StringRef name, float weight);

View File

@@ -288,8 +288,8 @@ template<typename T> const T &get_socket_data_as(const bNodeTreeInterfaceSocket
bNodeTreeInterfaceSocket *add_interface_socket_from_node(bNodeTree &ntree,
const bNode &from_node,
const bNodeSocket &from_sock,
const StringRef socket_type,
const StringRef name);
StringRef socket_type,
StringRef name);
inline bNodeTreeInterfaceSocket *add_interface_socket_from_node(bNodeTree &ntree,
const bNode &from_node,

View File

@@ -253,12 +253,12 @@ class DictionaryValue : public Value {
*/
Lookup create_lookup() const;
const std::shared_ptr<Value> *lookup(const StringRef key) const;
std::optional<StringRefNull> lookup_str(const StringRef key) const;
std::optional<int64_t> lookup_int(const StringRef key) const;
std::optional<double> lookup_double(const StringRef key) const;
const DictionaryValue *lookup_dict(const StringRef key) const;
const ArrayValue *lookup_array(const StringRef key) const;
const std::shared_ptr<Value> *lookup(StringRef key) const;
std::optional<StringRefNull> lookup_str(StringRef key) const;
std::optional<int64_t> lookup_int(StringRef key) const;
std::optional<double> lookup_double(StringRef key) const;
const DictionaryValue *lookup_dict(StringRef key) const;
const ArrayValue *lookup_array(StringRef key) const;
Span<Item> elements() const
{
return values_;

View File

@@ -73,7 +73,7 @@ class bUUID : public ::bUUID {
bUUID(std::initializer_list<uint32_t> field_values);
/** Initialize by parsing the string; undefined behavior when the string is invalid. */
explicit bUUID(const StringRefNull string_formatted_uuid);
explicit bUUID(StringRefNull string_formatted_uuid);
/** Return the UUID as formatted ASCII string, see #BLI_uuid_format(). */
std::string str() const;

View File

@@ -16,7 +16,7 @@
* \return Whether attributes with the given name are stored in special flags or fields in BMesh
* rather than in the regular custom data blocks.
*/
bool BM_attribute_stored_in_bmesh_builtin(const blender::StringRef name);
bool BM_attribute_stored_in_bmesh_builtin(blender::StringRef name);
struct CustomData_MeshMasks;
struct Main;

View File

@@ -51,10 +51,10 @@ class ShaderNode {
void compile(GPUMaterial *material);
/* Returns the GPU node stack of the input with the given identifier. */
GPUNodeStack &get_input(const StringRef identifier);
GPUNodeStack &get_input(StringRef identifier);
/* Returns the GPU node stack of the output with the given identifier. */
GPUNodeStack &get_output(const StringRef identifier);
GPUNodeStack &get_output(StringRef identifier);
private:
/* Populate the inputs of the node. The input link is set to nullptr and is expected to be

View File

@@ -16,13 +16,13 @@ namespace blender::compositor {
* given inputs stack array. See the ShaderNode class for more information. */
GPUNodeStack &get_shader_node_input(const bNode &node,
GPUNodeStack inputs[],
const StringRef identifier);
StringRef identifier);
/* Returns the GPU node stack of the output with the given identifier in the given node within the
* given output stack array. See the ShaderNode class for more information. */
GPUNodeStack &get_shader_node_output(const bNode &node,
GPUNodeStack outputs[],
const StringRef identifier);
StringRef identifier);
/* Returns the GPU node link of the input with the given identifier in the given node within the
* given inputs stack array, if the input is not linked, a uniform link carrying the value of the
@@ -31,6 +31,6 @@ GPUNodeStack &get_shader_node_output(const bNode &node,
* information. */
GPUNodeLink *get_shader_node_input_link(const bNode &node,
GPUNodeStack inputs[],
const StringRef identifier);
StringRef identifier);
} // namespace blender::compositor

View File

@@ -83,7 +83,7 @@ void type_unregister(const AssetShelfType &shelf_type);
* Permanent/non-popup asset shelf regions should use #type_poll_for_space_type() instead.
*/
bool type_poll_for_popup(const bContext &C, const AssetShelfType *shelf_type);
AssetShelfType *type_find_from_idname(const StringRef idname);
AssetShelfType *type_find_from_idname(StringRef idname);
/** \} */

View File

@@ -57,7 +57,7 @@ AssetLibraryReference get_asset_library_ref_from_opptr(PointerRNA &ptr);
void visit_library_catalogs_catalog_for_search(
const Main &bmain,
const AssetLibraryReference lib,
const StringRef edit_text,
StringRef edit_text,
const FunctionRef<void(StringPropertySearchVisitParams)> visit_fn);
} // namespace blender::ed::asset

View File

@@ -81,7 +81,7 @@ void remove_selection_attributes(
Span<float3> get_selection_attribute_positions(
const bke::CurvesGeometry &curves,
const bke::crazyspace::GeometryDeformation &deformation,
const StringRef attribute_name);
StringRef attribute_name);
using SelectionRangeFn = FunctionRef<void(
IndexRange range, Span<float3> positions, StringRef selection_attribute_name)>;

View File

@@ -1197,7 +1197,7 @@ uiBut *uiDefButR(uiBlock *block,
short width,
short height,
PointerRNA *ptr,
const blender::StringRefNull propname,
blender::StringRefNull propname,
int index,
float min,
float max,
@@ -2428,8 +2428,8 @@ uiLayout *uiLayoutPanelProp(const bContext *C,
uiLayout *uiLayoutPanelPropWithBoolHeader(const bContext *C,
uiLayout *layout,
PointerRNA *open_prop_owner,
const blender::StringRefNull open_prop_name,
const blender::StringRefNull bool_prop_name,
blender::StringRefNull open_prop_name,
blender::StringRefNull bool_prop_name,
const std::optional<blender::StringRefNull> label);
/**
@@ -2726,7 +2726,7 @@ void uiTemplateStatusInfo(uiLayout *layout, bContext *C);
void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr);
bool uiTemplateEventFromKeymapItem(uiLayout *layout,
const blender::StringRefNull text,
blender::StringRefNull text,
const wmKeyMapItem *kmi,
bool text_fallback);

View File

@@ -1059,7 +1059,7 @@ uiPopupBlockHandle *ui_popover_panel_create(bContext *C,
*/
void ui_pie_menu_level_create(uiBlock *block,
wmOperatorType *ot,
const blender::StringRefNull propname,
blender::StringRefNull propname,
IDProperty *properties,
const EnumPropertyItem *items,
int totitem,

View File

@@ -105,7 +105,7 @@ const Object *get_armature_modifier_obj(const Object &obj, const Depsgraph *deps
* bone name is found or if the object does not have an armature modifier
*/
bool is_armature_modifier_bone_name(const Object &obj,
const StringRefNull name,
StringRefNull name,
const Depsgraph *depsgraph);
/**

View File

@@ -53,7 +53,7 @@ class USDGenericMeshWriter : public USDAbstractWriter {
const bke::AttributeIter &attr);
void write_uv_data(const pxr::UsdGeomMesh &usd_mesh,
const bke::AttributeIter &attr,
const StringRef active_uvmap_name);
StringRef active_uvmap_name);
};
class USDMeshWriter : public USDGenericMeshWriter {

View File

@@ -58,7 +58,7 @@ class OBJWriter : NonMovable, NonCopyable {
/**
* Write file name of Material Library in `.OBJ` file.
*/
void write_mtllib_name(const StringRefNull mtl_filepath) const;
void write_mtllib_name(StringRefNull mtl_filepath) const;
/**
* Write vertex coordinates for all vertices as "v x y z" or "v x y z r g b".
*/

View File

@@ -33,16 +33,16 @@ struct NodeGraph {
const Material *material,
const ExportParams &export_params,
const MaterialX::DocumentPtr &document);
NodeGraph(const NodeGraph &parent, const StringRef child_name);
NodeGraph(const NodeGraph &parent, StringRef child_name);
NodeItem empty_node() const;
NodeItem get_node(const StringRef name) const;
NodeItem get_output(const StringRef name) const;
NodeItem get_input(const StringRef name) const;
NodeItem get_node(StringRef name) const;
NodeItem get_output(StringRef name) const;
NodeItem get_input(StringRef name) const;
std::string unique_node_name(const bNode *node,
const StringRef socket_out_name,
const NodeItem::Type to_type);
StringRef socket_out_name,
NodeItem::Type to_type);
void set_output_node_name(const NodeItem &item) const;
static std::string unique_anonymous_node_name(MaterialX::GraphElement *graph_element);