Cleanup: use doxygen doc-strings, spelling (make check_spelling_*)

This commit is contained in:
Campbell Barton
2025-05-29 10:38:34 +10:00
parent 71330894b7
commit 479d1f1d16
13 changed files with 163 additions and 118 deletions

View File

@@ -78,7 +78,7 @@ struct GHOST_FrameDiscard {
};
struct GHOST_SwapchainImage {
/** Swapchain image (owned by the swapchain). */
/** Swap-chain image (owned by the swapchain). */
VkImage vk_image = VK_NULL_HANDLE;
/**

View File

@@ -58,7 +58,7 @@ void BKE_sound_reset_runtime(struct bSound *sound);
void BKE_sound_load(struct Main *bmain, struct bSound *sound);
void BKE_sound_ensure_loaded(struct Main *bmain, struct bSound *sound);
/* Matches AUD_Channels. */
/** Matches AUD_Channels. */
typedef enum eSoundChannels {
SOUND_CHANNELS_INVALID = 0,
SOUND_CHANNELS_MONO = 1,
@@ -84,12 +84,18 @@ typedef struct SoundStreamInfo {
double start;
} SoundStreamInfo;
/* Get information about given sound. Returns truth on success., false if sound can not be loaded
* or if the codes is not supported. */
/**
* Get information about given sound.
*
* \return true on success, false if sound can not be loaded or if the codes is not supported.
*/
bool BKE_sound_info_get(struct Main *main, struct bSound *sound, SoundInfo *sound_info);
/* Get information about given sound. Returns truth on success., false if sound can not be loaded
* or if the codes is not supported. */
/**
* Get information about given sound.
*
* \return on success, false if sound can not be loaded or if the codes is not supported.
*/
bool BKE_sound_stream_info_get(struct Main *main,
const char *filepath,
int stream,
@@ -140,11 +146,13 @@ void BKE_sound_move_scene_sound(const struct Scene *scene,
double audio_offset);
void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Strip *sequence);
/* Join the Sequence with the structure in Audaspace, the second parameter is a bSound */
/** Join the Sequence with the structure in Audaspace, the second parameter is a #bSound. */
void BKE_sound_update_scene_sound(void *handle, struct bSound *sound);
/* Join the Sequence with the structure in Audaspace, the second parameter is the AUD_Sound created
* in Audaspace previously
/**
* Join the Sequence with the structure in Audaspace,
*
* \param sound_handle: the `AUD_Sound` created in Audaspace previously.
*/
void BKE_sound_update_sequence_handle(void *handle, void *sound_handle);

View File

@@ -101,7 +101,7 @@ static DataRequirement merge(const DataRequirement a, const DataRequirement b)
if ((a == DataRequirement::Field && b == DataRequirement::Single) ||
(a == DataRequirement::Single && b == DataRequirement::Field))
{
/* Single beats field, becasuse fields can accept single values too. */
/* Single beats field, because fields can accept single values too. */
return DataRequirement::Single;
}
return DataRequirement::Invalid;

View File

@@ -22,8 +22,8 @@ namespace blender {
*
* VectorList can be used when:
*
* 1) Don't know up front the number of elements that will be added to the list. Use array or
* vector.reserve when known up front.
* 1) Don't know up front the number of elements that will be added to the list.
* Use `array` or `vector.reserve` when known up front.
*
* 2) Number of reads/writes doesn't require sequential access
* of the whole list. A vector ensures memory is sequential which is fast when reading, writing can
@@ -43,11 +43,11 @@ template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096> cla
static_assert(is_power_of_2(CapacityMax));
static_assert(CapacityStart <= CapacityMax);
/* Contains the individual vectors. There must always be at least one vector. */
/** Contains the individual vectors. There must always be at least one vector. */
Vector<VectorT> vectors_;
/* Number of vectors in use. */
/** Number of vectors in use. */
int64_t used_vectors_ = 0;
/* Total element count accross all vectors_. */
/** Total element count across all vectors_. */
int64_t size_ = 0;
public:
@@ -70,19 +70,19 @@ template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096> cla
return move_assign_container(*this, std::move(other));
}
/* Insert a new element at the end of the VectorList. */
/** Insert a new element at the end of the VectorList. */
void append(const T &value)
{
this->append_as(value);
}
/* Insert a new element at the end of the VectorList. */
/** Insert a new element at the end of the VectorList. */
void append(T &&value)
{
this->append_as(std::move(value));
}
/* This is similar to `std::vector::emplace_back`. */
/** This is similar to `std::vector::emplace_back`. */
template<typename ForwardT> void append_as(ForwardT &&value)
{
VectorT &vector = this->ensure_space_for_one();
@@ -110,7 +110,7 @@ template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096> cla
return vectors_[used_vectors_ - 1].last();
}
/* Return how many values are currently stored in the VectorList. */
/** Return how many values are currently stored in the VectorList. */
int64_t size() const
{
return size_;
@@ -126,7 +126,7 @@ template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096> cla
return size_ == 0;
}
/* Afterwards the VectorList has 0 elements, but will still have memory to be refilled again. */
/** Afterwards the VectorList has 0 elements, but will still have memory to be refilled again. */
void clear()
{
for (VectorT &vector : vectors_) {
@@ -136,7 +136,7 @@ template<typename T, int64_t CapacityStart = 32, int64_t CapacityMax = 4096> cla
size_ = 0;
}
/* Afterwards the VectorList has 0 elements and the Vectors allocated memory will be freed. */
/** Afterwards the VectorList has 0 elements and the Vectors allocated memory will be freed. */
void clear_and_shrink()
{
vectors_.clear();

View File

@@ -61,10 +61,12 @@
/** \name Frame Change Operator
* \{ */
/* Persistent data to re-use during frame change modal operations. */
/** Persistent data to re-use during frame change modal operations. */
class FrameChangeModalData {
/* Used for keyframe snapping. Is populated when needed and re-used so it doesn't have to be
* created on every modal call. */
/**
* Used for keyframe snapping. Is populated when needed and re-used so it doesn't have to be
* created on every modal call.
*/
public:
AnimKeylist *keylist;
@@ -81,11 +83,13 @@ class FrameChangeModalData {
}
};
/* Point the playhead can snap to. */
/** Point the play-head can snap to. */
struct SnapTarget {
float pos;
/* If true, only snap if close to the point in screenspace. If false snap to this point
* regardless of screen space distance. */
/**
* If true, only snap if close to the point in screen-space. If false snap to this point
* regardless of screen space distance.
*/
bool use_snap_treshold;
};

View File

@@ -1519,7 +1519,7 @@ bool copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
int bezt_index = 0;
BezTriple *bezt = fcu->bezt;
for (; bezt_index < fcu->totvert; bezt_index++, bezt++) {
/* Dont copy if only a handle is selected. */
/* Don't copy if only a handle is selected. */
if (!BEZT_ISSEL_IDX(bezt, 1)) {
continue;
}

View File

@@ -897,9 +897,9 @@ static void file_space_blend_read_data(BlendDataReader *reader, SpaceLink *sl)
}
if (sfile->asset_params) {
sfile->asset_params->base_params.rename_id = nullptr;
/* Code (filebrowser etc.) asserts that this setting is one of the currently known values. So
* fallback to FILE_ASSET_IMPORT_FOLLOW_PREFS if it is not (e.g. because of
* forward-compatibility while reading a blendfile from the future). */
/* Code (file-browser etc.) asserts that this setting is one of the currently known values.
* So fallback to #FILE_ASSET_IMPORT_FOLLOW_PREFS if it is not
* (e.g. because of forward-compatibility while reading a blend-file from the future). */
switch (eFileAssetImportMethod(sfile->asset_params->import_method)) {
case FILE_ASSET_IMPORT_LINK:
case FILE_ASSET_IMPORT_APPEND:

View File

@@ -1065,7 +1065,7 @@ static void gizmo_node_split_prop_matrix_set(const wmGizmo *gz,
CMPNodeSplitAxis axis = static_cast<CMPNodeSplitAxis>(node->custom2);
if (axis == CMPNodeSplitAxis::CMP_NODE_SPLIT_VERTICAL) {
float fac = (matrix[3][1] - offset.y) / dims.y + 0.5f;
/* Prevet dragging the gizmo outside the image. */
/* Prevent dragging the gizmo outside the image. */
fac = math::clamp(fac, 0.0f, 1.0f);
factor_input->default_value_typed<bNodeSocketValueFloat>()->value = fac;
}

View File

@@ -243,11 +243,12 @@ void GPU_context_active_set(GPUContext *ctx_)
if (ctx) {
ctx->activate();
/* It can happen that the previous context drew with a different colorspace.
/* It can happen that the previous context drew with a different color-space.
* In the case where the new context is drawing with the same shader that was previously bound
* (shader binding optimization), the uniform would not be set again because the dirty flag
* would not have been set (since the color space of this new context never changed). The
* shader would reuse the same colorspace as the previous context framebuffer (see #137855). */
* shader would reuse the same color-space as the previous context frame-buffer (see #137855).
*/
ctx->shader_builtin_srgb_is_dirty = true;
}
}

View File

@@ -236,7 +236,7 @@ typedef struct bNodeSocket {
bool affects_node_output() const;
/**
* This becomes false when it is detected that the input socket is currently not used and its
* usage depends on a menu (as opposed to e.g. a boolean input). By convention, sockets whoose
* usage depends on a menu (as opposed to e.g. a boolean input). By convention, sockets whose
* visibility is controlled by a menu should be hidden.
*/
bool inferred_input_socket_visibility() const;

View File

@@ -102,7 +102,8 @@ using PropCollectionAssignIntFunc = bool (*)(PointerRNA *ptr,
int key,
const PointerRNA *assign_ptr);
/* extended versions with PropertyRNA argument */
/* Extended versions with #PropertyRNA argument. */
using PropBooleanGetFuncEx = bool (*)(PointerRNA *ptr, PropertyRNA *prop);
using PropBooleanSetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, bool value);
using PropBooleanArrayGetFuncEx = void (*)(PointerRNA *ptr, PropertyRNA *prop, bool *values);
@@ -197,12 +198,14 @@ struct PropertyRNAOrID {
struct RNAPropertyOverrideDiffContext {
/** General diffing parameters. */
/* Using #PropertyRNAOrID for properties info here allows to cover all three cases ('real' RNA
* properties, 'runtime' RNA properties created from python and stored in IDPropertoies, and
* 'pure' IDProperties).
/**
* Using #PropertyRNAOrID for properties info here allows to cover all three cases
* (*real* RNA properties, *runtime* RNA properties created from Python and stored in
* ID-properties, and *pure* ID-properties).
*
* This is necessary, because we cannot perform 'set/unset' checks on resolved properties
* (unset IDProperties would merely be nullptr then). */
* (unset ID-properties would merely be nullptr then).
*/
PropertyRNAOrID *prop_a = nullptr;
PropertyRNAOrID *prop_b = nullptr;
@@ -216,12 +219,16 @@ struct RNAPropertyOverrideDiffContext {
/** Results. */
/** `0` is matching, `-1` if `prop_a < prop_b`, `1` if `prop_a > prop_b`. Note that for
/**
* `0` is matching, `-1` if `prop_a < prop_b`, `1` if `prop_a > prop_b`. Note that for
* unquantifiable properties (e.g. pointers or collections), return value should be interpreted
* as a boolean (false == matching, true == not matching). */
* as a boolean (false == matching, true == not matching).
*/
int comparison = 0;
/** Additional flags reporting potential actions taken by the function (e.g. resetting forbidden
* overrides to their reference value). */
/**
* Additional flags reporting potential actions taken by the function (e.g. resetting forbidden
* overrides to their reference value).
*/
eRNAOverrideMatchResult report_flag = eRNAOverrideMatchResult(0);
};
using RNAPropOverrideDiff = void (*)(Main *bmain, RNAPropertyOverrideDiffContext &rnadiff_ctx);
@@ -293,7 +300,7 @@ struct PropertyRNAIdentifierGetter {
blender::StringRef operator()(const PropertyRNA *prop) const;
};
/* Container - generic abstracted container of RNA properties */
/** Container - generic abstracted container of RNA properties */
struct ContainerRNA {
void *next, *prev;
@@ -302,92 +309,104 @@ struct ContainerRNA {
};
struct FunctionRNA {
/* structs are containers of properties */
/** Structs are containers of properties. */
ContainerRNA cont;
/* unique identifier, keep after 'cont' */
/** Unique identifier, keep after `cont`. */
const char *identifier;
/* various options */
/** Various options */
int flag;
/* single line description, displayed in the tooltip for example */
/** Single line description, displayed in the tool-tip for example. */
const char *description;
/* callback to execute the function */
/** Callback to execute the function. */
CallFunc call;
/* parameter for the return value
* NOTE: this is only the C return value, rna functions can have multiple return values. */
/**
* Parameter for the return value.
*
* \note this is only the C return value, rna functions can have multiple return values.
*/
PropertyRNA *c_ret;
};
struct PropertyRNA {
PropertyRNA *next, *prev;
/* magic bytes to distinguish with IDProperty */
/** Magic bytes to distinguish with #IDProperty. */
int magic;
/* unique identifier */
/** Unique identifier. */
const char *identifier;
/* various options */
/** Various options. */
int flag;
/* various override options */
/** Various override options. */
int flag_override;
/* Function parameters flags. */
/** Function parameters flags. */
short flag_parameter;
/* Internal ("private") flags. */
/** Internal ("private") flags. */
short flag_internal;
/* The subset of StructRNA.prop_tag_defines values that applies to this property. */
/** The subset of #StructRNA::prop_tag_defines values that applies to this property. */
short tags;
/* user readable name */
/** User readable name. */
const char *name;
/* single line description, displayed in the tooltip for example */
/** Single line description, displayed in the tool-tip for example. */
const char *description;
/* icon ID */
/** Icon ID. */
int icon;
/* context for translation */
/** Context for translation. */
const char *translation_context;
/* property type as it appears to the outside */
/** Property type as it appears to the outside. */
PropertyType type;
/* subtype, 'interpretation' of the property */
/** Subtype, 'interpretation' of the property. */
PropertySubType subtype;
/* if non-NULL, overrides arraylength. Must not return 0? */
/** If non-NULL, overrides arraylength. Must not return 0? */
PropArrayLengthGetFunc getlength;
/* dimension of array */
/** Dimension of array. */
unsigned int arraydimension;
/* Array lengths for all dimensions (when `arraydimension > 0`). */
/** Array lengths for all dimensions (when `arraydimension > 0`). */
unsigned int arraylength[RNA_MAX_ARRAY_DIMENSION];
unsigned int totarraylength;
/* callback for updates on change */
/** Callback for updates on change. */
UpdateFunc update;
int noteflag;
/* Callback for testing if editable. Its r_info parameter can be used to
* return info on editable state that might be shown to user. E.g. tooltips
* of disabled buttons can show reason why button is disabled using this. */
/**
* Callback for testing if editable. Its r_info parameter can be used to
* return info on editable state that might be shown to user. E.g. tool-tips
* of disabled buttons can show reason why button is disabled using this.
*/
EditableFunc editable;
/* callback for testing if array-item editable (if applicable) */
/** Callback for testing if array-item editable (if applicable). */
ItemEditableFunc itemeditable;
/* Override handling callbacks (diff is also used for comparison). */
/** Override handling callbacks (diff is also used for comparison). */
RNAPropOverrideDiff override_diff;
RNAPropOverrideStore override_store;
RNAPropOverrideApply override_apply;
/* raw access */
/* Raw access. */
int rawoffset;
RawPropertyType rawtype;
/* This is used for accessing props/functions of this property
/**
* Attributes attached directly to this collection.
*
* This is used for accessing props/functions of this property
* any property can have this but should only be used for collections and arrays
* since python will convert int/bool/pointer's */
StructRNA *srna; /* attributes attached directly to this collection */
* since python will convert int/bool/pointer's.
*/
StructRNA *srna;
/* python handle to hold all callbacks
* (in a pointer array at the moment, may later be a tuple) */
/**
* Python handle to hold all callbacks
* (in a pointer array at the moment, may later be a tuple).
*/
void *py_data;
};
@@ -396,19 +415,21 @@ inline blender::StringRef PropertyRNAIdentifierGetter::operator()(const Property
return prop->identifier;
}
/* internal flags WARNING! 16bits only! */
/** Internal flags WARNING! 16bits only! */
enum PropertyFlagIntern {
PROP_INTERN_BUILTIN = (1 << 0),
PROP_INTERN_RUNTIME = (1 << 1),
PROP_INTERN_RAW_ACCESS = (1 << 2),
PROP_INTERN_RAW_ARRAY = (1 << 3),
PROP_INTERN_FREE_POINTERS = (1 << 4),
/* Negative mirror of PROP_PTR_NO_OWNERSHIP, used to prevent automatically setting that one in
* makesrna when pointer is an ID... */
/**
* Negative mirror of #PROP_PTR_NO_OWNERSHIP,
* used to prevent automatically setting that one in `makesrna` when pointer is an ID.
*/
PROP_INTERN_PTR_OWNERSHIP_FORCED = (1 << 5),
};
/* Property Types */
/* Property Types. */
struct BoolPropertyRNA {
PropertyRNA property;
@@ -509,7 +530,8 @@ struct StringPropertyRNA {
*/
StringPropertyPathFilterFunc path_filter;
int maxlength; /* includes string terminator! */
/** Maximum length including the string terminator! */
int maxlength;
const char *defaultvalue;
};
@@ -555,15 +577,17 @@ struct CollectionPropertyRNA {
PropCollectionLookupStringFunc lookupstring; /* optional */
PropCollectionAssignIntFunc assignint; /* optional */
StructRNA *item_type; /* the type of this item */
/** The type of this item. */
StructRNA *item_type;
};
/* changes to this struct require updating rna_generate_struct in makesrna.cc */
/**
* \note Changes to this struct require updating `rna_generate_struct` in `makesrna.cc`.
*/
struct StructRNA {
/* structs are containers of properties */
/** Structs are containers of properties. */
ContainerRNA cont;
/* unique identifier, keep after 'cont' */
/** Unique identifier, keep after `cont`. */
const char *identifier;
/**
@@ -575,44 +599,49 @@ struct StructRNA {
void *py_type;
void *blender_type;
/* various options */
/** Various options. */
int flag;
/* Each StructRNA type can define its own tags which properties can set
* (PropertyRNA.tags) for changed behavior based on struct-type. */
/**
* Each StructRNA type can define its own tags which properties can set
* (PropertyRNA.tags) for changed behavior based on struct-type.
*/
const EnumPropertyItem *prop_tag_defines;
/* user readable name */
/** User readable name. */
const char *name;
/* single line description, displayed in the tooltip for example */
/** Single line description, displayed in the tool-tip for example. */
const char *description;
/* context for translation */
/** Context for translation. */
const char *translation_context;
/* icon ID */
/** Icon ID. */
int icon;
/* property that defines the name */
/** Property that defines the name. */
PropertyRNA *nameproperty;
/* property to iterate over properties */
/** Property to iterate over properties. */
PropertyRNA *iteratorproperty;
/** Struct this is derived from. */
StructRNA *base;
/* only use for nested structs, where both the parent and child access
/**
* Only use for nested structs, where both the parent and child access
* the same C Struct but nesting is used for grouping properties.
* The parent property is used so we know NULL checks are not needed,
* and that this struct will never exist without its parent */
* and that this struct will never exist without its parent.
*/
StructRNA *nested;
/* function to give the more specific type */
/** Function to give the more specific type. */
StructRefineFunc refine;
/* function to find path to this struct in an ID */
/** Function to find path to this struct in an ID. */
StructPathFunc path;
/* function to register/unregister subclasses */
/** Function to register/unregister sub-classes. */
StructRegisterFunc reg;
/** Function to unregister sub-classes. */
StructUnregisterFunc unreg;
/**
* Optionally support reusing Python instances for this type.
@@ -630,20 +659,23 @@ struct StructRNA {
/** Return the location of the struct's pointer to the root group IDProperty. */
IDPropertiesFunc idproperties;
/* functions of this struct */
/** Functions of this struct. */
ListBase functions;
};
/* Blender RNA
/**
* Blender RNA
*
* Root RNA data structure that lists all struct types. */
* Root RNA data structure that lists all struct types.
*/
struct BlenderRNA {
ListBase structs;
/* A map of structs: {StructRNA.identifier -> StructRNA}
* These are ensured to have unique names (with STRUCT_PUBLIC_NAMESPACE enabled). */
/**
* A map of structs: `{StructRNA.identifier -> StructRNA}`
* These are ensured to have unique names (with #STRUCT_PUBLIC_NAMESPACE enabled).
*/
GHash *structs_map;
/* Needed because types with an empty identifier aren't included in 'structs_map'. */
/** Needed because types with an empty identifier aren't included in `structs_map`. */
unsigned int structs_len;
};

View File

@@ -281,7 +281,7 @@ static void rna_def_light_energy(StructRNA *srna, const short light_type)
break;
}
case LA_SPOT: {
/* Lights with a location have radiometric ppower in Watts,
/* Lights with a location have radiometric power in Watts,
* which is sensitive to scene unit scale. */
prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_range(prop, 0.0f, 1000000.0f, 10, 3);

View File

@@ -164,7 +164,7 @@ std::ostream &operator<<(std::ostream &stream, const RelationsInNode &relations)
} // namespace anonymous_attribute_lifetime
namespace aal = anonymous_attribute_lifetime;
/* Socket or panel declaration. */
/** Socket or panel declaration. */
class ItemDeclaration {
public:
const PanelDeclaration *parent = nullptr;
@@ -414,7 +414,7 @@ class BaseSocketDeclarationBuilder {
BaseSocketDeclarationBuilder &make_available(std::function<void(bNode &)> fn);
/**
* Provide a fully custom draw function for the socket that overrides any default behaviour.
* Provide a fully custom draw function for the socket that overrides any default behavior.
*/
BaseSocketDeclarationBuilder &custom_draw(CustomSocketDrawFn fn);
@@ -582,11 +582,11 @@ using PanelDeclarationPtr = std::unique_ptr<PanelDeclaration>;
class NodeDeclaration {
public:
/* Contains all items including recursive children. */
/** Contains all items including recursive children. */
Vector<ItemDeclarationPtr> all_items;
/* Contains only the items in the root. */
/** Contains only the items in the root. */
Vector<ItemDeclaration *> root_items;
/* All input and output socket declarations. */
/** All input and output socket declarations. */
Vector<SocketDeclaration *> inputs;
Vector<SocketDeclaration *> outputs;
Vector<PanelDeclaration *> panels;