Cleanup: spelling in comments, use C-style comments

This commit is contained in:
Campbell Barton
2023-08-03 08:56:59 +10:00
parent 8bb8cfb54e
commit 8c8ff6b85b
33 changed files with 63 additions and 60 deletions

View File

@@ -6,7 +6,7 @@
* \ingroup GHOST
* %Main interface file for C++ Api with declaration of GHOST_ISystem interface
* class.
* Contains the doxygen documentation main page.
* Contains the DOXYGEN documentation main page.
*/
#pragma once

View File

@@ -104,7 +104,7 @@ class Drawing : public ::GreasePencilDrawing {
/**
* Add a user for this drawing. When a drawing has multiple users, both users are allowed to
* modifify this drawings data.
* modify this drawings data.
*/
void add_user() const;
/**

View File

@@ -89,8 +89,8 @@ enum {
ID_REMAP_FORCE_USER_REFCOUNT = 1 << 17,
/**
* Do NOT handle user count for IDs (used in some cases when dealing with IDs from different
* BMains, if usercount will be recomputed anyway afterwards, like e.g. in memfile reading during
* undo step decoding).
* BMains, if user-count will be recomputed anyway afterwards, like e.g.
* in memfile reading during undo step decoding).
*/
ID_REMAP_SKIP_USER_REFCOUNT = 1 << 18,
/**

View File

@@ -95,7 +95,7 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh);
* the difference is how active/render/clone/stencil indices are handled here.
*
* normally they're being set from `pdata` which totally makes sense for meshes which are
* already converted to #BMesh ures, but when loading older files indices shall be updated in
* already converted to #BMesh structures, but when loading older files indices shall be updated in
* other way around, so newly added `pdata` and `ldata` would have this indices set based on
* `pdata` layer.
*

View File

@@ -2197,7 +2197,7 @@ void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float r_m
if (theta <= SAFE_THRESHOLD) {
/* When nor is close to negative Y axis (0,-1,0) the theta precision is very bad,
* so recompute it from x and z instead, using the series expansion for sqrt. */
* so recompute it from x and z instead, using the series expansion for `sqrt`. */
theta = theta_alt * 0.5f + theta_alt * theta_alt * 0.125f;
}

View File

@@ -859,7 +859,7 @@ static void update_velocities(FluidEffectorSettings *fes,
nearest.index = -1;
/* Distance between two opposing vertices in a unit cube.
* I.e. the unit cube diagonal or sqrt(3).
* I.e. the unit cube diagonal or `sqrt(3)`.
* This value is our nearest neighbor search distance. */
const float surface_distance = 1.732;
/* find_nearest uses squared distance */
@@ -1703,7 +1703,7 @@ static void update_distances(int index,
BVHTreeNearest nearest = {0};
nearest.index = -1;
/* Distance between two opposing vertices in a unit cube.
* I.e. the unit cube diagonal or sqrt(3).
* I.e. the unit cube diagonal or `sqrt(3)`.
* This value is our nearest neighbor search distance. */
const float surface_distance = 1.732;
/* find_nearest uses squared distance. */
@@ -1825,7 +1825,7 @@ static void sample_mesh(FluidFlowSettings *ffs,
nearest.index = -1;
/* Distance between two opposing vertices in a unit cube.
* I.e. the unit cube diagonal or sqrt(3).
* I.e. the unit cube diagonal or `sqrt(3)`.
* This value is our nearest neighbor search distance. */
const float surface_distance = 1.732;
/* find_nearest uses squared distance. */

View File

@@ -1049,14 +1049,14 @@ bool BKE_gpencil_stroke_smooth_point(bGPDstroke *gps,
/* This function uses a binomial kernel, which is the discrete version of gaussian blur.
* The weight for a vertex at the relative index point_index is
* w = nCr(n, j + n/2) / 2^n = (n/1 * (n-1)/2 * ... * (n-j-n/2)/(j+n/2)) / 2^n
* `w = nCr(n, j + n/2) / 2^n = (n/1 * (n-1)/2 * ... * (n-j-n/2)/(j+n/2)) / 2^n`
* All weights together sum up to 1
* This is equivalent to doing multiple iterations of averaging neighbors,
* where n = iterations * 2 and -n/2 <= j <= n/2
*
* Now the problem is that nCr(n, j + n/2) is very hard to compute for n > 500, since even
* Now the problem is that `nCr(n, j + n/2)` is very hard to compute for `n > 500`, since even
* double precision isn't sufficient. A very good robust approximation for n > 20 is
* nCr(n, j + n/2) / 2^n = sqrt(2/(pi*n)) * exp(-2*j*j/n)
* `nCr(n, j + n/2) / 2^n = sqrt(2/(pi*n)) * exp(-2*j*j/n)`
*
* There is one more problem left: The old smooth algorithm was doing a more aggressive
* smooth. To solve that problem, choose a different n/2, which does not match the range and
@@ -1064,8 +1064,8 @@ bool BKE_gpencil_stroke_smooth_point(bGPDstroke *gps,
*
* keep_shape is a new option to stop the stroke from severely deforming.
* It uses different partially negative weights.
* w = 2 * (nCr(n, j + n/2) / 2^n) - (nCr(3*n, j + n) / 2^(3*n))
* ~ 2 * sqrt(2/(pi*n)) * exp(-2*j*j/n) - sqrt(2/(pi*3*n)) * exp(-2*j*j/(3*n))
* w = `2 * (nCr(n, j + n/2) / 2^n) - (nCr(3*n, j + n) / 2^(3*n))`
* ~ `2 * sqrt(2/(pi*n)) * exp(-2*j*j/n) - sqrt(2/(pi*3*n)) * exp(-2*j*j/(3*n))`
* All weights still sum up to 1.
* Note these weights only work because the averaging is done in relative coordinates.
*/
@@ -1117,7 +1117,7 @@ bool BKE_gpencil_stroke_smooth_point(bGPDstroke *gps,
}
total_w += w - w2;
/* The accumulated weight total_w should be
* ~sqrt(M_PI * n_half) * exp((iterations * iterations) / n_half) < 100
* `~sqrt(M_PI * n_half) * exp((iterations * iterations) / n_half) < 100`
* here, but sometimes not quite. */
mul_v3_fl(sco, float(1.0 / total_w));
/* Shift back to global coordinates. */

View File

@@ -7,7 +7,7 @@
/** \file
* \ingroup bli
*
* This file provides safe alternatives to common math functions like sqrt, powf.
* This file provides safe alternatives to common math functions like `sqrt`, `powf`.
* In this context "safe" means that the output is not NaN if the input is not NaN.
*/

View File

@@ -1051,9 +1051,11 @@ static float voronoi_Cr(float x, float y, float z)
return t;
}
/* Signed version of all 6 of the above, just 2x-1, not really correct though
* (range is potentially (0, sqrt(6)).
* Used in the musgrave functions */
/**
* Signed version of all 6 of the above, just 2x-1, not really correct though
* (range is potentially `(0, sqrt(6))`.
* Used in the musgrave functions.
*/
static float voronoi_F1S(float x, float y, float z)
{
float da[4], pa[12];

View File

@@ -850,7 +850,7 @@ TEST(string, StringNLen)
EXPECT_EQ(1, BLI_strnlen("x", 1));
EXPECT_EQ(1, BLI_strnlen("x", 100));
// ü is \xc3\xbc
/* `ü` is `\xc3\xbc`. */
EXPECT_EQ(2, BLI_strnlen("ü", 100));
EXPECT_EQ(0, BLI_strnlen("this is a longer string", 0));

View File

@@ -45,7 +45,7 @@
/* local prototypes --------------------- */
void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp);
/* Access routines used by filesel. */
/* Access routines used by file-selector. */
void BLO_datablock_info_free(BLODataBlockInfo *datablock_info)
{

View File

@@ -288,7 +288,7 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
SpaceGraph *sipo = (SpaceGraph *)sl;
memcpy(&region->v2d, &sipo->v2d, sizeof(View2D));
/* init mainarea view2d */
/* Initialize main-area view2d. */
region->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
region->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
@@ -1148,7 +1148,7 @@ void blo_do_versions_250(FileData *fd, Library * /*lib*/, Main *bmain)
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 250, 10)) {
/* properly initialize hair clothsim data on old files */
/* Properly initialize hair cloth-simulation data on old files. */
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
if (md->type == eModifierType_Cloth) {

View File

@@ -1245,7 +1245,7 @@ static void square_roughness_node_insert(bNodeTree *ntree)
bNodeSocket *fromsock,
bNode *tonode,
bNodeSocket *tosock) {
/* Add sqrt node. */
/* Add `sqrt` node. */
bNode *node = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
node->custom1 = NODE_MATH_POWER;
node->locx = 0.5f * (fromnode->locx + tonode->locx);

View File

@@ -46,7 +46,7 @@
* The formatting of these bmesh operators is parsed by
* 'doc/python_api/rst_from_bmesh_opdefines.py'
* for use in python docs, so reStructuredText may be used
* rather than doxygen syntax.
* rather than DOXYGEN syntax.
*
* template (py quotes used because nested comments don't work
* on all C compilers):

View File

@@ -289,7 +289,7 @@ static int bm_vert_tri_find_unique_edge(BMVert *verts[3])
{
/* find the most 'unique' loop, (greatest difference to others) */
#if 1
/* optimized version that avoids sqrt */
/* Optimized version that avoids `sqrt`. */
float difs[3];
for (int i_prev = 1, i_curr = 2, i_next = 0; i_next < 3; i_prev = i_curr, i_curr = i_next++) {
const float *co = verts[i_curr]->co;

View File

@@ -3582,11 +3582,11 @@ static void adjust_the_cycle_or_chain(BoundVert *vstart, bool iscycle)
v = vstart;
int i = 0;
/* Sqrt of factor to weight down importance of spec match. */
/* Square root of factor to weight down importance of spec match. */
double weight = BEVEL_MATCH_SPEC_WEIGHT;
EdgeHalf *eleft, *eright, *enextleft;
do {
/* Except at end of chain, v's indep variable is offset_r of v->efirst. */
/* Except at end of chain, v's indep variable is offset_r of `v->efirst`. */
if (iscycle || i < np - 1) {
eright = v->efirst;
eleft = v->elast;
@@ -5292,7 +5292,7 @@ static BMEdge *snap_edge_for_center_vmesh_vert(int i,
* interpolates in the current boundvert's frep [= interpolation face] or the next one's.
* Similarly, when n is odd, the center row (ring ns2) is ambiguous as to
* whether it interpolates in the current boundvert's frep or the previous one's.
* Parameter frep_beats_next should have an array of size n_bndv of bools
* Parameter frep_beats_next should have an array of size n_bndv of booleans
* that say whether the tie should be broken in favor of the next boundvert's
* frep (if true) or the current one's.
* For vertices in the center polygon (when ns is odd), the snapping edge depends
@@ -7306,12 +7306,12 @@ static void find_even_superellipse_chords_general(int seg, float r, double *xval
}
/**
* Find equidistant points (x0,y0), (x1,y1)... (xn,yn) on the superellipse
* Find equidistant points `(x0,y0), (x1,y1)... (xn,yn)` on the superellipse
* function in the first quadrant. For special profiles (linear, arc,
* rectangle) the point can be calculated easily, for any other profile a more
* expensive search procedure must be used because there is no known closed
* form for equidistant parametrization.
* xvals and yvals should be size n+1.
* `xvals` and `yvals` should be size `n+1`.
*/
static void find_even_superellipse_chords(int n, float r, double *xvals, double *yvals)
{

View File

@@ -389,7 +389,7 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm,
earray[i] = e_iter;
}
/* Remove all edges/verts left behind from dissolving,
* nullptr'ing the vertex array so we don't re-use. */
* nulling the vertex array so we don't re-use. */
for (i = bm->totedge - 1; i != -1; i--) {
e_iter = earray[i];

View File

@@ -126,7 +126,7 @@ LinkNode *BM_mesh_calc_path_uv_vert(BMesh *bm,
BMFace *f;
/* NOTE: would pass BM_EDGE except we are looping over all faces anyway. */
// BM_mesh_elem_index_ensure(bm, BM_LOOP); // NOT NEEDED FOR FACETAG
// BM_mesh_elem_index_ensure(bm, BM_LOOP); /* NOTE: not needed for facetag. */
BM_ITER_MESH (f, &viter, bm, BM_FACES_OF_MESH) {
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
@@ -556,7 +556,7 @@ LinkNode *BM_mesh_calc_path_uv_face(BMesh *bm,
const void *const f_endpoints[2] = {f_src, f_dst};
/* NOTE: would pass BM_EDGE except we are looping over all faces anyway. */
// BM_mesh_elem_index_ensure(bm, BM_LOOP); // NOT NEEDED FOR FACETAG
// BM_mesh_elem_index_ensure(bm, BM_LOOP); /* NOTE: not needed for facetag. */
{
BMFace *f;

View File

@@ -179,7 +179,7 @@ void InpaintSimpleOperation::pix_step(int x, int y)
weight = 1.0f;
}
else {
weight = M_SQRT1_2; /* 1.0f / sqrt(2) */
weight = M_SQRT1_2; /* `1.0f / sqrt(2)`. */
}
madd_v3_v3fl(pix, this->get_pixel(x_ofs, y_ofs), weight);

View File

@@ -357,8 +357,8 @@ void Instance::render_read_result(RenderLayer *render_layer, const char *view_na
BLI_mutex_lock(&render->update_render_passes_mutex);
/* WORKAROUND: We use texture read to avoid using a frame-buffer to get the render result.
* However, on some implementation, we need a buffer with a few extra bytes for the read to
* happen correctly (see GLTexture::read()). So we need a custom memory allocation. */
/* Avoid memcpy(), replace the pointer directly. */
* happen correctly (see #GLTexture::read()). So we need a custom memory allocation. */
/* Avoid `memcpy()`, replace the pointer directly. */
RE_pass_set_buffer_data(rp, result);
BLI_mutex_unlock(&render->update_render_passes_mutex);
}

View File

@@ -671,8 +671,8 @@ void OVERLAY_light_cache_populate(OVERLAY_Data *vedata, Object *ob)
* `y = (1/sqrt(1 + x^2) - a)/((1 - a) b)`
* x being the tangent of the angle between the light direction and the generatrix of the cone.
* We solve the case where spot attenuation y = 1 and y = 0
* root for y = 1 is sqrt(1/c^2 - 1)
* root for y = 0 is sqrt(1/a^2 - 1)
* root for y = 1 is `sqrt(1/c^2 - 1)`.
* root for y = 0 is `sqrt(1/a^2 - 1)`
* and use that to position the blend circle. */
float a = cosf(la->spotsize * 0.5f);
float b = la->spotblend;

View File

@@ -4700,12 +4700,12 @@ static int ui_do_but_TEX(
if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN, EVT_PADENTER, EVT_RETKEY) &&
event->val == KM_PRESS) {
if (ELEM(event->type, EVT_PADENTER, EVT_RETKEY) && !UI_but_is_utf8(but)) {
/* pass - allow filesel, enter to execute */
/* Pass, allow file-selector, enter to execute. */
}
else if (ELEM(but->emboss, UI_EMBOSS_NONE, UI_EMBOSS_NONE_OR_STATUS) &&
((event->modifier & KM_CTRL) == 0))
{
/* pass */
/* Pass. */
}
else {
if (!ui_but_extra_operator_icon_mouse_over_get(but, data->region, event)) {

View File

@@ -712,7 +712,7 @@ void ACTION_OT_paste(wmOperatorType *ot)
"frame";
/* api callbacks */
// ot->invoke = WM_operator_props_popup; // better wait for action redo panel
// ot->invoke = WM_operator_props_popup; /* Better wait for action redo panel. */
ot->get_description = actkeys_paste_description;
ot->exec = actkeys_paste_exec;
ot->poll = ED_operator_action_active;

View File

@@ -448,7 +448,7 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *region)
keymap = WM_keymap_ensure(wm->defaultconf, "Grease Pencil Paint Mode", 0, 0);
WM_event_add_keymap_handler(&region->handlers, keymap);
/* editfont keymap swallows all... */
/* Edit-font key-map swallows almost all (because of text input). */
keymap = WM_keymap_ensure(wm->defaultconf, "Font", 0, 0);
WM_event_add_keymap_handler(&region->handlers, keymap);

View File

@@ -277,8 +277,7 @@ void PackIsland::finalize_geometry_(const UVPackIsland_Params &params, MemArena
* computing convex hull.
* In the future, we might also detect special-cases for speed or efficiency, such as
* rectangle approximation, circle approximation, detecting if the shape has any holes,
* analysing the shape for rotational symmetry or removing overlaps.
*/
* analyzing the shape for rotational symmetry or removing overlaps. */
BLI_assert(triangle_vertices_.size() >= 3);
calculate_pre_rotation_(params);
@@ -1329,7 +1328,7 @@ static uv_phi find_best_fit_for_island(const PackIsland *island,
const float bitmap_scale = 1.0f / occupancy.bitmap_scale_reciprocal;
/* TODO: If `target_aspect_y != 1.0f`, to avoid aliasing issues, we should probably iterate
* seperately on `scan_line_x` and `scan_line_y`. See also: Bresenham's algorithm. */
* Separately on `scan_line_x` and `scan_line_y`. See also: Bresenham's algorithm. */
const float sqrt_target_aspect_y = sqrtf(target_aspect_y);
const int scan_line_x = int(scan_line * sqrt_target_aspect_y);
const int scan_line_y = int(scan_line / sqrt_target_aspect_y);

View File

@@ -1,5 +1,5 @@
// clang-format off
/* clang-format off */
#ifndef GPU_METAL
bool is_integer(bool v) { return true; }
#endif
@@ -78,7 +78,7 @@ uint to_type(mat3x4 v) { return TEST_TYPE_MAT3X4; }
uint to_type(mat4x2 v) { return TEST_TYPE_MAT4X2; }
uint to_type(mat4x3 v) { return TEST_TYPE_MAT4X3; }
uint to_type(mat4x4 v) { return TEST_TYPE_MAT4X4; }
// clang-format on
/* clang-format on */
#define WRITE_MATRIX(v) \
TestOutputRawData raw; \
@@ -113,7 +113,7 @@ uint to_type(mat4x4 v) { return TEST_TYPE_MAT4X4; }
raw.data[0] = uint(v); \
return raw;
// clang-format off
/* clang-format off */
#ifndef GPU_METAL
TestOutputRawData as_raw_data(bool v) { WRITE_INT_SCALAR(v); }
#endif
@@ -138,7 +138,7 @@ TestOutputRawData as_raw_data(mat3x4 v) { WRITE_MATRIX(v); }
TestOutputRawData as_raw_data(mat4x2 v) { WRITE_MATRIX(v); }
TestOutputRawData as_raw_data(mat4x3 v) { WRITE_MATRIX(v); }
TestOutputRawData as_raw_data(mat4x4 v) { WRITE_MATRIX(v); }
// clang-format on
/* clang-format on */
int g_test_id = 0;

View File

@@ -210,9 +210,11 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
set_transparency(ep, ma);
/* TODO: */
// set_shininess(ep, ma); shininess not supported for lambert
// set_ambient(ep, ma);
// set_specular(ep, ma);
#if 0
set_shininess(ep, ma); /* Shininess not supported for lambert. */
set_ambient(ep, ma);
set_specular(ep, ma);
#endif
get_images(ma, material_image_map);
std::string active_uv(getActiveUVLayerName(ob));

View File

@@ -36,7 +36,7 @@ class MaterialsExporter : COLLADASW::LibraryMaterials {
BCExportSettings &export_settings;
};
// used in forEachMaterialInScene
/* Used in `forEachMaterialInScene`. */
template<class Functor> class ForEachMaterialFunctor {
std::vector<std::string>
mMat; /* contains list of material names, to avoid duplicate calling of f */

View File

@@ -109,7 +109,7 @@ typedef struct BoidData {
short state_id, mode;
} BoidData;
// planned for near future
/* Planned for near future. */
// typedef enum BoidConditionMode {
// eBoidConditionType_Then = 0,
// eBoidConditionType_And = 1,
@@ -161,7 +161,7 @@ typedef struct BoidState {
float volume, falloff;
} BoidState;
// planned for near future
/* Planned for near future. */
// typedef struct BoidSignal {
// struct BoidSignal *next, *prev;
// float loc[3];

View File

@@ -159,7 +159,7 @@ static void dm_mvert_map_doubles(int *doubles_map,
const int source_verts_num,
const float dist)
{
const float dist3 = (float(M_SQRT3) + 0.00005f) * dist; /* Just above sqrt(3) */
const float dist3 = (float(M_SQRT3) + 0.00005f) * dist; /* Just above `sqrt(3)`. */
int i_source, i_target, i_target_low_bound, target_end, source_end;
SortVertsElem *sve_source, *sve_target, *sve_target_low_bound;
bool target_scan_completed;

View File

@@ -177,7 +177,7 @@ static float hook_falloff(const HookData_cb *hd, const float len_sq)
goto finally;
}
else if (hd->falloff_type == eHook_Falloff_InvSquare) {
/* avoid sqrt below */
/* Avoid `sqrt` below. */
fac = 1.0f - (len_sq / hd->falloff_sq);
goto finally;
}

View File

@@ -532,7 +532,7 @@ static Mesh *modify_mesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh
vc->e[0] = vc->e[1] = nullptr;
vc->v[0] = vc->v[1] = SV_UNUSED;
/* Length in 2D, don't sqrt because this is only for comparison. */
/* Length in 2D, don't `sqrt` because this is only for comparison. */
vc->dist_sq = vc->co[other_axis_1] * vc->co[other_axis_1] +
vc->co[other_axis_2] * vc->co[other_axis_2];

View File

@@ -697,7 +697,7 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data,
bpoly->point_edgemid_angles[1] = max_ff(0, point_angles[1]);
/* Compute the distance scale for the corner. The base value is the orthogonal
* distance from the corner to the chord, scaled by sqrt(2) to preserve the old
* distance from the corner to the chord, scaled by `sqrt(2)` to preserve the old
* values in case of a square grid. This doesn't use the centroid because the
* LOOPTRI method only uses these three vertices. */
bpoly->scale_mid = area_tri_v2(vert0_v2, corner_v2, vert1_v2) /