[Bf-blender-cvs] [a1bc7729f20] master: Cleanup: use ofs instead of offs as an abbreviation for offset
Campbell Barton
noreply at git.blender.org
Mon Mar 8 04:56:13 CET 2021
Commit: a1bc7729f20b8a8250f938d768ab2d104c41af54
Author: Campbell Barton
Date: Mon Mar 8 14:48:45 2021 +1100
Branches: master
https://developer.blender.org/rBa1bc7729f20b8a8250f938d768ab2d104c41af54
Cleanup: use ofs instead of offs as an abbreviation for offset
Used for local structs/variables,
since `ofs` is by far the most widely used abbreviation.
===================================================================
M source/blender/blenkernel/intern/displist.c
M source/blender/blenkernel/intern/particle_distribute.c
M source/blender/editors/animation/anim_markers.c
M source/blender/editors/armature/armature_select.c
M source/blender/editors/armature/pose_slide.c
M source/blender/editors/gpencil/gpencil_interpolate.c
M source/blender/editors/gpencil/gpencil_primitive.c
M source/blender/editors/interface/interface_handlers.c
M source/blender/editors/interface/interface_widgets.c
M source/blender/editors/space_graph/graph_slider_ops.c
M source/blender/editors/space_sequencer/sequencer_draw.c
M source/blender/editors/space_view3d/view3d_select.c
M source/blender/gpu/intern/gpu_matrix.cc
M source/blender/render/intern/multires_bake.c
M source/blender/render/intern/texture_procedural.c
===================================================================
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index c860e57520d..708b1971bd5 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -875,9 +875,9 @@ static float (*displist_vert_coords_alloc(ListBase *dispbase, int *r_vert_len))[
allverts = MEM_mallocN(sizeof(float[3]) * (*r_vert_len), "displist_vert_coords_alloc allverts");
fp = (float *)allverts;
LISTBASE_FOREACH (DispList *, dl, dispbase) {
- int offs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
- memcpy(fp, dl->verts, sizeof(float) * offs);
- fp += offs;
+ int ofs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
+ memcpy(fp, dl->verts, sizeof(float) * ofs);
+ fp += ofs;
}
return allverts;
@@ -889,9 +889,9 @@ static void displist_vert_coords_apply(ListBase *dispbase, float (*allverts)[3])
fp = (float *)allverts;
LISTBASE_FOREACH (DispList *, dl, dispbase) {
- int offs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
- memcpy(dl->verts, fp, sizeof(float) * offs);
- fp += offs;
+ int ofs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
+ memcpy(dl->verts, fp, sizeof(float) * ofs);
+ fp += ofs;
}
}
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index c3cc9136057..ad617b4198b 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -338,18 +338,18 @@ static void hammersley_create(float *out, int n, int seed, float amount)
{
RNG *rng;
- double offs[2], t;
+ double ofs[2], t;
rng = BLI_rng_new(31415926 + n + seed);
- offs[0] = BLI_rng_get_double(rng) + (double)amount;
- offs[1] = BLI_rng_get_double(rng) + (double)amount;
+ ofs[0] = BLI_rng_get_double(rng) + (double)amount;
+ ofs[1] = BLI_rng_get_double(rng) + (double)amount;
BLI_rng_free(rng);
for (int k = 0; k < n; k++) {
BLI_hammersley_1d(k, &t);
- out[2 * k + 0] = fmod((double)k / (double)n + offs[0], 1.0);
- out[2 * k + 1] = fmod(t + offs[1], 1.0);
+ out[2 * k + 0] = fmod((double)k / (double)n + ofs[0], 1.0);
+ out[2 * k + 1] = fmod(t + ofs[1], 1.0);
}
}
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 2ab809c3633..7adddf8f4ae 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -762,9 +762,9 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
MarkerMove *mm = op->customdata;
TimeMarker *marker, *selmarker = NULL;
- const int offs = RNA_int_get(op->ptr, "frames");
+ const int ofs = RNA_int_get(op->ptr, "frames");
char str[UI_MAX_DRAW_STR];
- char str_offs[NUM_STR_REP_LEN];
+ char str_ofs[NUM_STR_REP_LEN];
int totmark;
const bool use_time = ed_marker_move_use_time(mm);
@@ -776,27 +776,27 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
}
if (hasNumInput(&mm->num)) {
- outputNumInput(&mm->num, str_offs, &scene->unit);
+ outputNumInput(&mm->num, str_ofs, &scene->unit);
}
else if (use_time) {
- BLI_snprintf(str_offs, sizeof(str_offs), "%.2f", FRA2TIME(offs));
+ BLI_snprintf(str_ofs, sizeof(str_ofs), "%.2f", FRA2TIME(ofs));
}
else {
- BLI_snprintf(str_offs, sizeof(str_offs), "%d", offs);
+ BLI_snprintf(str_ofs, sizeof(str_ofs), "%d", ofs);
}
if (totmark == 1 && selmarker) {
/* we print current marker value */
if (use_time) {
BLI_snprintf(
- str, sizeof(str), TIP_("Marker %.2f offset %s"), FRA2TIME(selmarker->frame), str_offs);
+ str, sizeof(str), TIP_("Marker %.2f offset %s"), FRA2TIME(selmarker->frame), str_ofs);
}
else {
- BLI_snprintf(str, sizeof(str), TIP_("Marker %d offset %s"), selmarker->frame, str_offs);
+ BLI_snprintf(str, sizeof(str), TIP_("Marker %d offset %s"), selmarker->frame, str_ofs);
}
}
else {
- BLI_snprintf(str, sizeof(str), TIP_("Marker offset %s"), str_offs);
+ BLI_snprintf(str, sizeof(str), TIP_("Marker offset %s"), str_ofs);
}
ED_area_status_text(CTX_wm_area(C), str);
@@ -907,12 +907,12 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op)
#endif
MarkerMove *mm = op->customdata;
TimeMarker *marker;
- int a, offs;
+ int a, ofs;
- offs = RNA_int_get(op->ptr, "frames");
+ ofs = RNA_int_get(op->ptr, "frames");
for (a = 0, marker = mm->markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
- marker->frame = mm->oldframe[a] + offs;
+ marker->frame = mm->oldframe[a] + ofs;
a++;
}
}
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 60fe8ee7dee..226253cc063 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -644,8 +644,8 @@ static int selectbuffer_ret_hits_12(uint *UNUSED(buffer), const int hits12)
static int selectbuffer_ret_hits_5(uint *buffer, const int hits12, const int hits5)
{
- const int offs = 4 * hits12;
- memcpy(buffer, buffer + offs, 4 * hits5 * sizeof(uint));
+ const int ofs = 4 * hits12;
+ memcpy(buffer, buffer + ofs, 4 * hits5 * sizeof(uint));
return hits5;
}
@@ -704,17 +704,12 @@ static EditBone *get_nearest_editbonepoint(
goto cache_end;
}
else if (hits12 > 0) {
- int offs;
+ int ofs;
- offs = 4 * hits12;
+ ofs = 4 * hits12;
BLI_rcti_init_pt_radius(&rect, vc->mval, 5);
- const int hits5 = view3d_opengl_select_with_id_filter(vc,
- buffer + offs,
- MAXPICKBUF - offs,
- &rect,
- select_mode,
- select_filter,
- select_id_ignore);
+ const int hits5 = view3d_opengl_select_with_id_filter(
+ vc, buffer + ofs, MAXPICKBUF - ofs, &rect, select_mode, select_filter, select_id_ignore);
if (hits5 == 1) {
hits = selectbuffer_ret_hits_5(buffer, hits12, hits5);
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index d636f0d68af..93d36abe792 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -873,12 +873,12 @@ static void pose_slide_draw_status(tPoseSlideOp *pso)
if (hasNumInput(&pso->num)) {
Scene *scene = pso->scene;
- char str_offs[NUM_STR_REP_LEN];
+ char str_ofs[NUM_STR_REP_LEN];
- outputNumInput(&pso->num, str_offs, &scene->unit);
+ outputNumInput(&pso->num, str_ofs, &scene->unit);
BLI_snprintf(
- status_str, sizeof(status_str), "%s: %s | %s", mode_str, str_offs, limits_str);
+ status_str, sizeof(status_str), "%s: %s | %s", mode_str, str_ofs, limits_str);
}
else {
BLI_snprintf(status_str,
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 7c541f61d75..3b7c80cee07 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -599,10 +599,10 @@ static void gpencil_interpolate_status_indicators(bContext *C, tGPDinterpolate *
BLI_strncpy(msg_str, TIP_("GPencil Interpolation: "), UI_MAX_DRAW_STR);
if (hasNumInput(&p->num)) {
- char str_offs[NUM_STR_REP_LEN];
+ char str_ofs[NUM_STR_REP_LEN];
- outputNumInput(&p->num, str_offs, &scene->unit);
- BLI_snprintf(status_str, sizeof(status_str), "%s%s", msg_str, str_offs);
+ outputNumInput(&p->num, str_ofs, &scene->unit);
+ BLI_snprintf(status_str, sizeof(status_str), "%s%s", msg_str, str_ofs);
}
else {
BLI_snprintf(status_str,
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index b29ef2e7ee2..dfff0ce639e 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -466,10 +466,10 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi
GP_STROKE_BOX,
GP_STROKE_POLYLINE)) {
if (hasNumInput(&tgpi->num)) {
- char str_offs[NUM_STR_REP_LEN];
+ char str_ofs[NUM_STR_REP_LEN];
- outputNumInput(&tgpi->num, str_offs, &scene->unit);
- BLI_snprintf(status_str, sizeof(status_str), "%s: %s", msg_str, str_offs);
+ outputNumInput(&tgpi->num, str_ofs, &scene->unit);
+ BLI_snprintf(status_str, sizeof(status_str), "%s: %s", msg_str, str_ofs);
}
else {
if (tgpi->flag == IN_PROGRESS) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 042f10ddded..834be49b2b3 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -5246,8 +5246,8 @@ static bool ui_numedit_but_SLI(uiBut *but,
(but->softmax - but->softmin + but->a1);
}
else {
- const float offs = (BLI_rctf_size_y(&but->rect) / 2.0f);
- cursor_x_range = (BLI_rctf_size_x(&but->rect) - offs);
+ const float ofs = (BLI_rctf_size_y(&but->rect) / 2.0f);
+ cursor_x_range = (BLI_rctf_size_x(&but->rect) - ofs);
}
f = (mx_fl - data->dragstartx) / cursor_x_range + data->dragfstart;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 06b87dd857f..1d7d10b6d0c 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3667,16 +3667,16 @@ static void widget_progressbar(
/* round corners */
const f
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list