Cleanup: various non-functional changes
- Use const pointers. - Avoid shadowing variables. - Remove redundant check.
This commit is contained in:
@@ -605,8 +605,8 @@ void Action::strip_keyframe_data_remove_if_unused(const int index)
|
||||
BLI_assert(index >= 0 && index < this->strip_keyframe_data_array_num);
|
||||
|
||||
/* Make sure the data isn't being used anywhere. */
|
||||
for (Layer *layer : this->layers()) {
|
||||
for (Strip *strip : layer->strips()) {
|
||||
for (const Layer *layer : this->layers()) {
|
||||
for (const Strip *strip : layer->strips()) {
|
||||
if (strip->type() == Strip::Type::Keyframe && strip->data_index == index) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1624,7 +1624,7 @@ static void icu_to_fcurves(ID *id,
|
||||
if ((id) && (icu->blocktype == GS(id->name)) && (GS(id->name) == ID_CU_LEGACY) &&
|
||||
(fcu->rna_path && STREQ(fcu->rna_path, "eval_time")))
|
||||
{
|
||||
Curve *cu = (Curve *)id;
|
||||
const Curve *cu = (const Curve *)id;
|
||||
|
||||
dst->vec[0][1] *= cu->pathlen;
|
||||
dst->vec[1][1] *= cu->pathlen;
|
||||
@@ -1637,8 +1637,8 @@ static void icu_to_fcurves(ID *id,
|
||||
* - were also degrees/10
|
||||
*/
|
||||
if (fcu->driver && fcu->driver->variables.first) {
|
||||
DriverVar *dvar = static_cast<DriverVar *>(fcu->driver->variables.first);
|
||||
DriverTarget *dtar = &dvar->targets[0];
|
||||
const DriverVar *dvar = static_cast<const DriverVar *>(fcu->driver->variables.first);
|
||||
const DriverTarget *dtar = &dvar->targets[0];
|
||||
|
||||
if (ELEM(dtar->transChan, DTAR_TRANSCHAN_ROTX, DTAR_TRANSCHAN_ROTY, DTAR_TRANSCHAN_ROTZ))
|
||||
{
|
||||
|
||||
@@ -1656,7 +1656,7 @@ ID *BKE_libblock_find_name(Main *bmain,
|
||||
const char *name,
|
||||
const std::optional<Library *> lib)
|
||||
{
|
||||
ListBase *lb = which_libbase(bmain, type);
|
||||
const ListBase *lb = which_libbase(bmain, type);
|
||||
BLI_assert(lb != nullptr);
|
||||
|
||||
ID *id = static_cast<ID *>(BLI_findstring(lb, name, offsetof(ID, name) + 2));
|
||||
@@ -1671,7 +1671,7 @@ ID *BKE_libblock_find_name(Main *bmain,
|
||||
|
||||
ID *BKE_libblock_find_session_uid(Main *bmain, const short type, const uint32_t session_uid)
|
||||
{
|
||||
ListBase *lb = which_libbase(bmain, type);
|
||||
const ListBase *lb = which_libbase(bmain, type);
|
||||
BLI_assert(lb != nullptr);
|
||||
LISTBASE_FOREACH (ID *, id, lb) {
|
||||
if (id->session_uid == session_uid) {
|
||||
|
||||
@@ -658,7 +658,8 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
|
||||
|
||||
float(*ofs)[3] = nullptr;
|
||||
std::optional<blender::Array<bool>> dependent;
|
||||
float *oldkey, *newkey, *ofp;
|
||||
const float *oldkey, *ofp;
|
||||
float *newkey;
|
||||
|
||||
/* editing the base key should update others */
|
||||
if (cu->key->type == KEY_RELATIVE) {
|
||||
|
||||
@@ -2404,7 +2404,7 @@ void uiItemFullR(uiLayout *layout,
|
||||
if (is_id_name_prop) {
|
||||
Main *bmain = CTX_data_main(static_cast<bContext *>(block->evil_C));
|
||||
ID *id = ptr->owner_id;
|
||||
UI_but_func_rename_full_set(but, [bmain, id](std::string &new_name) {
|
||||
UI_but_func_rename_full_set(but, [bmain, id](const std::string &new_name) {
|
||||
ED_id_rename(*bmain, *id, new_name);
|
||||
WM_main_add_notifier(NC_ID | NA_RENAME, nullptr);
|
||||
});
|
||||
|
||||
@@ -91,13 +91,13 @@ void uv_parametrizer_face_add(ParamHandle *handle,
|
||||
const ParamKey *vkeys,
|
||||
const float **co,
|
||||
float **uv, /* Output will eventually be written to `uv`. */
|
||||
float *weight,
|
||||
const float *weight,
|
||||
const bool *pin,
|
||||
const bool *select);
|
||||
|
||||
void uv_parametrizer_edge_set_seam(ParamHandle *handle, ParamKey *vkeys);
|
||||
void uv_parametrizer_edge_set_seam(ParamHandle *phandle, const ParamKey *vkeys);
|
||||
|
||||
void uv_parametrizer_construct_end(ParamHandle *handle,
|
||||
void uv_parametrizer_construct_end(ParamHandle *phandle,
|
||||
bool fill_holes,
|
||||
bool topology_from_uvs,
|
||||
int *r_count_failed = nullptr);
|
||||
|
||||
@@ -2160,14 +2160,13 @@ static void p_chart_simplify_compute(PChart *chart,
|
||||
* is at the top of the respective lists. */
|
||||
|
||||
Heap *heap = BLI_heap_new();
|
||||
PVert *v;
|
||||
PEdge *collapsededges = nullptr, *e;
|
||||
PEdge *collapsededges = nullptr;
|
||||
int ncollapsed = 0;
|
||||
Vector<PVert *> wheelverts;
|
||||
wheelverts.reserve(16);
|
||||
|
||||
/* insert all potential collapses into heap */
|
||||
for (v = chart->verts; v; v = v->nextlink) {
|
||||
for (PVert *v = chart->verts; v; v = v->nextlink) {
|
||||
float cost;
|
||||
PEdge *e = nullptr;
|
||||
|
||||
@@ -2181,7 +2180,7 @@ static void p_chart_simplify_compute(PChart *chart,
|
||||
}
|
||||
}
|
||||
|
||||
for (e = chart->edges; e; e = e->nextlink) {
|
||||
for (PEdge *e = chart->edges; e; e = e->nextlink) {
|
||||
e->u.nextcollapse = nullptr;
|
||||
}
|
||||
|
||||
@@ -3891,7 +3890,7 @@ static void p_add_ngon(ParamHandle *handle,
|
||||
const float *tri_co[3] = {co[v0], co[v1], co[v2]};
|
||||
float *tri_uv[3] = {uv[v0], uv[v1], uv[v2]};
|
||||
|
||||
float *tri_weight = nullptr;
|
||||
const float *tri_weight = nullptr;
|
||||
float tri_weight_tmp[3];
|
||||
|
||||
if (weight) {
|
||||
@@ -3917,7 +3916,7 @@ void uv_parametrizer_face_add(ParamHandle *phandle,
|
||||
const ParamKey *vkeys,
|
||||
const float **co,
|
||||
float **uv,
|
||||
float *weight,
|
||||
const float *weight,
|
||||
const bool *pin,
|
||||
const bool *select)
|
||||
{
|
||||
@@ -3934,8 +3933,7 @@ void uv_parametrizer_face_add(ParamHandle *phandle,
|
||||
permute.append_unchecked(i);
|
||||
}
|
||||
|
||||
int i = nverts - 1;
|
||||
while (i >= 0) {
|
||||
for (int i = nverts - 1; i >= 0;) {
|
||||
/* Just check the "ears" of the n-gon.
|
||||
* For quads, this is sufficient.
|
||||
* For pentagons and higher, we might miss internal duplicate triangles, but note
|
||||
@@ -4003,7 +4001,7 @@ void uv_parametrizer_face_add(ParamHandle *phandle,
|
||||
}
|
||||
}
|
||||
|
||||
void uv_parametrizer_edge_set_seam(ParamHandle *phandle, ParamKey *vkeys)
|
||||
void uv_parametrizer_edge_set_seam(ParamHandle *phandle, const ParamKey *vkeys)
|
||||
{
|
||||
BLI_assert(phandle->state == PHANDLE_STATE_ALLOCATED);
|
||||
|
||||
@@ -4470,7 +4468,7 @@ static bool p_validate_corrected_coords_point(const PEdge *corr_e,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(e->face->flag & PFACE_DONE) && (e != corr_e)) {
|
||||
if (!(e->face->flag & PFACE_DONE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -5159,7 +5157,7 @@ static void slim_flush_uvs(ParamHandle *phandle,
|
||||
(*count_changed)++;
|
||||
}
|
||||
|
||||
std::vector<double> &UV = mt_chart->uv_matrices;
|
||||
const std::vector<double> &UV = mt_chart->uv_matrices;
|
||||
for (v = chart->verts; v; v = v->nextlink) {
|
||||
if (v->flag & PVERT_PIN) {
|
||||
continue;
|
||||
|
||||
@@ -506,7 +506,7 @@ static void wm_gesture_draw_polyline(wmGesture *gt)
|
||||
draw_start_vertex_circle(*gt, shdr_pos);
|
||||
}
|
||||
|
||||
static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
|
||||
static void wm_gesture_draw_cross(const wmWindow *win, const wmGesture *gt)
|
||||
{
|
||||
const rcti *rect = static_cast<const rcti *>(gt->customdata);
|
||||
const blender::int2 win_size = WM_window_native_pixel_size(win);
|
||||
|
||||
@@ -371,8 +371,8 @@ static void toolsystem_brush_activate_from_toolref_for_object_paint(const bConte
|
||||
* Activate a brush compatible with \a tref, call when the active tool changes.
|
||||
*/
|
||||
static void toolsystem_brush_activate_from_toolref(const bContext *C,
|
||||
WorkSpace *workspace,
|
||||
bToolRef *tref)
|
||||
const WorkSpace *workspace,
|
||||
const bToolRef *tref)
|
||||
{
|
||||
BLI_assert(tref->runtime->flag & TOOLREF_FLAG_USE_BRUSHES);
|
||||
|
||||
@@ -1015,13 +1015,13 @@ void WM_toolsystem_update_from_context(
|
||||
|
||||
bool WM_toolsystem_active_tool_is_brush(const bContext *C)
|
||||
{
|
||||
bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C);
|
||||
const bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C);
|
||||
return tref_rt && (tref_rt->flag & TOOLREF_FLAG_USE_BRUSHES);
|
||||
}
|
||||
|
||||
bool WM_toolsystem_active_tool_has_custom_cursor(const bContext *C)
|
||||
{
|
||||
bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C);
|
||||
const bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C);
|
||||
return tref_rt && (tref_rt->cursor != WM_CURSOR_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user