Cleanup: redundant initialization
These were limited to obvious cases. Some less obvious cases were kept as refactoring might make them necessary in future.
This commit is contained in:
parent
f731bce6cd
commit
ab38223047
|
@ -1521,12 +1521,12 @@ void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys)
|
|||
|
||||
void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys)
|
||||
{
|
||||
MVert *mvert = CustomData_duplicate_referenced_layer(&me->vdata, CD_MVERT, me->totvert);
|
||||
CustomData_duplicate_referenced_layer(&me->vdata, CD_MVERT, me->totvert);
|
||||
/* If the referenced layer has been re-allocated need to update pointers stored in the mesh. */
|
||||
BKE_mesh_update_customdata_pointers(me, false);
|
||||
|
||||
int i = me->totvert;
|
||||
for (mvert = me->mvert; i--; mvert++) {
|
||||
for (MVert *mvert = me->mvert; i--; mvert++) {
|
||||
add_v3_v3(mvert->co, offset);
|
||||
}
|
||||
|
||||
|
|
|
@ -2567,7 +2567,7 @@ bool BKE_mesh_center_median_from_polys(const Mesh *me, float r_cent[3])
|
|||
const MLoop *mloop = me->mloop;
|
||||
const MVert *mvert = me->mvert;
|
||||
zero_v3(r_cent);
|
||||
for (mpoly = me->mpoly; i--; mpoly++) {
|
||||
for (; i--; mpoly++) {
|
||||
int loopend = mpoly->loopstart + mpoly->totloop;
|
||||
for (int j = mpoly->loopstart; j < loopend; j++) {
|
||||
add_v3_v3(r_cent, mvert[mloop[j].v].co);
|
||||
|
|
|
@ -1879,12 +1879,11 @@ static const MeshElemMap *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm)
|
|||
/* WARNING! *MUST* be called in an 'loops_cache_rwlock' protected thread context! */
|
||||
static void ccgDM_recalcLoopTri(DerivedMesh *dm)
|
||||
{
|
||||
MLoopTri *mlooptri = dm->looptris.array;
|
||||
const int tottri = dm->numPolyData * 2;
|
||||
int i, poly_index;
|
||||
|
||||
DM_ensure_looptri_data(dm);
|
||||
mlooptri = dm->looptris.array_wip;
|
||||
MLoopTri *mlooptri = dm->looptris.array_wip;
|
||||
|
||||
BLI_assert(tottri == 0 || mlooptri != NULL);
|
||||
BLI_assert(poly_to_tri_count(dm->numPolyData, dm->numLoopData) == dm->looptris.num);
|
||||
|
|
|
@ -1406,9 +1406,9 @@ static int find_cell_for_point_near_edge(mpq3 p,
|
|||
int dummy_index = p_sorted_dummy - sorted_tris.begin();
|
||||
int prev_tri = (dummy_index == 0) ? sorted_tris[sorted_tris.size() - 1] :
|
||||
sorted_tris[dummy_index - 1];
|
||||
int next_tri = (dummy_index == sorted_tris.size() - 1) ? sorted_tris[0] :
|
||||
sorted_tris[dummy_index + 1];
|
||||
if (dbg_level > 0) {
|
||||
int next_tri = (dummy_index == sorted_tris.size() - 1) ? sorted_tris[0] :
|
||||
sorted_tris[dummy_index + 1];
|
||||
std::cout << "prev tri to dummy = " << prev_tri << "; next tri to dummy = " << next_tri
|
||||
<< "\n";
|
||||
}
|
||||
|
|
|
@ -3172,7 +3172,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
bool is_blend = false;
|
||||
|
||||
{
|
||||
char tool = tool_init;
|
||||
char tool;
|
||||
switch (tool_init) {
|
||||
case PAINT_BLEND_MIX:
|
||||
tool = VPAINT_TOOL_DRAW;
|
||||
|
|
|
@ -7361,7 +7361,6 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb)
|
|||
static float vertex_collide_offset(BevelParams *bp, EdgeHalf *ea)
|
||||
{
|
||||
float no_collide_offset = bp->offset + 1e6;
|
||||
float limit = no_collide_offset;
|
||||
if (bp->offset == 0.0f) {
|
||||
return no_collide_offset;
|
||||
}
|
||||
|
@ -7373,8 +7372,7 @@ static float vertex_collide_offset(BevelParams *bp, EdgeHalf *ea)
|
|||
if (kab <= 0.0f) {
|
||||
return no_collide_offset;
|
||||
}
|
||||
limit = la / kab;
|
||||
return limit;
|
||||
return la / kab;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -320,7 +320,6 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid)
|
|||
* is already allocated. */
|
||||
bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene)
|
||||
{
|
||||
const ID *id_for_copy = &scene->id;
|
||||
|
||||
if (G.debug & G_DEBUG_DEPSGRAPH_UUID) {
|
||||
SEQ_relations_check_uuids_unique_and_report(scene);
|
||||
|
@ -328,9 +327,10 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene)
|
|||
|
||||
#ifdef NESTED_ID_NASTY_WORKAROUND
|
||||
NestedIDHackTempStorage id_hack_storage;
|
||||
id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, &scene->id);
|
||||
const ID *id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, &scene->id);
|
||||
#else
|
||||
const ID *id_for_copy = &scene->id;
|
||||
#endif
|
||||
|
||||
bool result = (BKE_id_copy_ex(nullptr,
|
||||
id_for_copy,
|
||||
(ID **)&new_scene,
|
||||
|
|
|
@ -2063,9 +2063,8 @@ static void draw_armature_pose(ArmatureDrawContext *ctx)
|
|||
set_pchan_colorset(ctx, ob, pchan);
|
||||
}
|
||||
|
||||
int boneflag = bone->flag;
|
||||
/* catch exception for bone with hidden parent */
|
||||
boneflag = bone->flag;
|
||||
int boneflag = bone->flag;
|
||||
if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG))) {
|
||||
boneflag &= ~BONE_CONNECTED;
|
||||
}
|
||||
|
|
|
@ -6646,7 +6646,7 @@ void CURVE_OT_dissolve_verts(wmOperatorType *ot)
|
|||
|
||||
static bool nurb_bezt_flag_any(const Nurb *nu, const char flag_test)
|
||||
{
|
||||
BezTriple *bezt = nu->bezt;
|
||||
const BezTriple *bezt;
|
||||
int i;
|
||||
|
||||
for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) {
|
||||
|
|
|
@ -387,7 +387,6 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C),
|
|||
GPU_matrix_translate_3f(selem->location_local[0] - location_prev[0],
|
||||
selem->location_local[1] - location_prev[1],
|
||||
selem->location_local[2] - location_prev[2]);
|
||||
location_prev = selem->location_local;
|
||||
|
||||
const float radius = stroke_elem_radius(cdd, selem);
|
||||
|
||||
|
|
|
@ -281,7 +281,6 @@ void ED_gpencil_trace_data_to_strokes(Main *bmain,
|
|||
mat_mask_idx = ob->totcol - 1;
|
||||
}
|
||||
|
||||
potrace_path_t *path = st->plist;
|
||||
int n, *tag;
|
||||
potrace_dpoint_t(*c)[3];
|
||||
|
||||
|
@ -289,7 +288,7 @@ void ED_gpencil_trace_data_to_strokes(Main *bmain,
|
|||
* good results using the Potrace data. */
|
||||
const float scalef = 0.008f * scale;
|
||||
/* Draw each curve. */
|
||||
path = st->plist;
|
||||
potrace_path_t *path = st->plist;
|
||||
while (path != NULL) {
|
||||
n = path->curve.n;
|
||||
tag = path->curve.tag;
|
||||
|
|
|
@ -149,7 +149,7 @@ static void join_mesh_single(Depsgraph *depsgraph,
|
|||
mul_m4_m4m4(cmat, imat, ob_src->obmat);
|
||||
|
||||
/* transform vertex coordinates into new space */
|
||||
for (a = 0, mvert = *mvert_pp; a < me->totvert; a++, mvert++) {
|
||||
for (a = 0; a < me->totvert; a++, mvert++) {
|
||||
mul_m4_v3(cmat, mvert->co);
|
||||
}
|
||||
|
||||
|
|
|
@ -1189,9 +1189,7 @@ static SculptUndoNode *sculpt_undo_geometry_push(Object *object, SculptUndoType
|
|||
static SculptUndoNode *sculpt_undo_face_sets_push(Object *ob, SculptUndoType type)
|
||||
{
|
||||
UndoSculpt *usculpt = sculpt_undo_get_nodes();
|
||||
SculptUndoNode *unode = usculpt->nodes.first;
|
||||
|
||||
unode = MEM_callocN(sizeof(*unode), __func__);
|
||||
SculptUndoNode *unode = MEM_callocN(sizeof(*unode), __func__);
|
||||
|
||||
BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname));
|
||||
unode->type = type;
|
||||
|
|
|
@ -1235,10 +1235,8 @@ static void do_movie_proxy(void *pjv,
|
|||
float *progress)
|
||||
{
|
||||
ProxyJob *pj = pjv;
|
||||
Scene *scene = pj->scene;
|
||||
MovieClip *clip = pj->clip;
|
||||
struct MovieDistortion *distortion = NULL;
|
||||
int cfra, sfra = SFRA, efra = EFRA;
|
||||
|
||||
if (pj->index_context) {
|
||||
IMB_anim_index_rebuild(pj->index_context, stop, do_update, progress);
|
||||
|
@ -1252,8 +1250,8 @@ static void do_movie_proxy(void *pjv,
|
|||
return;
|
||||
}
|
||||
|
||||
sfra = 1;
|
||||
efra = clip->len;
|
||||
const int sfra = 1;
|
||||
const int efra = clip->len;
|
||||
|
||||
if (build_undistort_count) {
|
||||
int threads = BLI_system_thread_count();
|
||||
|
@ -1265,7 +1263,7 @@ static void do_movie_proxy(void *pjv,
|
|||
BKE_tracking_distortion_set_threads(distortion, threads);
|
||||
}
|
||||
|
||||
for (cfra = sfra; cfra <= efra; cfra++) {
|
||||
for (int cfra = sfra; cfra <= efra; cfra++) {
|
||||
BKE_movieclip_build_proxy_frame(
|
||||
clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1);
|
||||
|
||||
|
|
|
@ -1805,7 +1805,6 @@ static int graphkeys_mselect_column(bAnimContext *ac,
|
|||
KeyframeEditFunc select_cb, ok_cb;
|
||||
KeyframeEditData ked;
|
||||
tNearestVertInfo *nvi;
|
||||
float selx = (float)ac->scene->r.cfra;
|
||||
|
||||
/* find the beztriple that we're selecting, and the handle that was clicked on */
|
||||
nvi = find_nearest_fcurve_vert(ac, mval);
|
||||
|
@ -1817,7 +1816,7 @@ static int graphkeys_mselect_column(bAnimContext *ac,
|
|||
|
||||
/* get frame number on which elements should be selected */
|
||||
/* TODO: should we restrict to integer frames only? */
|
||||
selx = nvi->frame;
|
||||
const float selx = nvi->frame;
|
||||
|
||||
if (select_mode != SELECT_REPLACE) {
|
||||
/* Doesn't need to deselect anything -> Pass. */
|
||||
|
|
|
@ -1311,7 +1311,6 @@ static int image_open_exec(bContext *C, wmOperator *op)
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
ImageUser *iuser = NULL;
|
||||
ImageOpenData *iod = op->customdata;
|
||||
Image *ima = NULL;
|
||||
int frame_seq_len = 0;
|
||||
int frame_ofs = 1;
|
||||
|
@ -1345,7 +1344,7 @@ static int image_open_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* hook into UI */
|
||||
iod = op->customdata;
|
||||
ImageOpenData *iod = op->customdata;
|
||||
|
||||
if (iod->pprop.prop) {
|
||||
/* when creating new ID blocks, use is already 1, but RNA
|
||||
|
|
|
@ -134,14 +134,12 @@ static void report_textview_end(TextViewContext *UNUSED(tvc))
|
|||
static int report_textview_step(TextViewContext *tvc)
|
||||
{
|
||||
/* simple case, but no newline support */
|
||||
const Report *report = tvc->iter;
|
||||
|
||||
if (tvc->iter_char_begin <= 0) {
|
||||
tvc->iter = (void *)((Link *)tvc->iter)->prev;
|
||||
if (tvc->iter && report_textview_skip__internal(tvc)) {
|
||||
tvc->iter_tmp++;
|
||||
|
||||
report = tvc->iter;
|
||||
const Report *report = tvc->iter;
|
||||
tvc->iter_char_end = report->len; /* reset start */
|
||||
report_textview_init__internal(tvc);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
|
|||
|
||||
/* apply shrink/fatten */
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
TransData *td = tc->data;
|
||||
TransData *td;
|
||||
for (td = tc->data, i = 0; i < tc->data_len; i++, td++) {
|
||||
if (td->flag & TD_SKIP) {
|
||||
continue;
|
||||
|
|
|
@ -1072,7 +1072,7 @@ static void TargetSnapClosest(TransInfo *t)
|
|||
if (t->options & CTX_OBJECT) {
|
||||
int i;
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
TransData *td = tc->data;
|
||||
TransData *td;
|
||||
for (td = tc->data, i = 0; i < tc->data_len && td->flag & TD_SELECTED; i++, td++) {
|
||||
const BoundBox *bb = NULL;
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
|
|||
* so we assign it based on the first segment we found. */
|
||||
ec->object_ref = e->object_ref;
|
||||
|
||||
LineartEdge *new_e = e;
|
||||
LineartEdge *new_e;
|
||||
LineartVert *new_vt;
|
||||
float N[3] = {0};
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ void Shader::print_log(Span<const char *> sources, char *log, const char *stage,
|
|||
}
|
||||
/* Print line from the source file that is producing the error. */
|
||||
if ((error_line != -1) && (error_line != last_error_line || error_char != last_error_char)) {
|
||||
const char *src_line_end = src_line;
|
||||
const char *src_line_end;
|
||||
found_line_id = false;
|
||||
/* error_line is 1 based in this case. */
|
||||
int src_line_index = 1;
|
||||
|
|
|
@ -1564,9 +1564,8 @@ DNA_ReconstructInfo *DNA_reconstruct_info_create(const SDNA *oldsdna,
|
|||
ReconstructStep *steps = create_reconstruct_steps_for_struct(
|
||||
oldsdna, newsdna, compare_flags, old_struct, new_struct);
|
||||
|
||||
int steps_len = new_struct->members_len;
|
||||
/* Comment the line below to skip the compression for debugging purposes. */
|
||||
steps_len = compress_reconstruct_steps(steps, new_struct->members_len);
|
||||
const int steps_len = compress_reconstruct_steps(steps, new_struct->members_len);
|
||||
|
||||
reconstruct_info->steps[new_struct_nr] = steps;
|
||||
reconstruct_info->step_counts[new_struct_nr] = steps_len;
|
||||
|
|
|
@ -1912,10 +1912,9 @@ static void rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterat
|
|||
iter, orient_slot, sizeof(*orient_slot), ARRAY_SIZE(scene->orientation_slots), 0, NULL);
|
||||
}
|
||||
|
||||
static int rna_Scene_transform_orientation_slots_length(PointerRNA *ptr)
|
||||
static int rna_Scene_transform_orientation_slots_length(PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
Scene *scene = (Scene *)ptr->owner_id;
|
||||
return ARRAY_SIZE(scene->orientation_slots);
|
||||
return ARRAY_SIZE(((Scene *)NULL)->orientation_slots);
|
||||
}
|
||||
|
||||
static bool rna_Scene_use_audio_get(PointerRNA *ptr)
|
||||
|
|
|
@ -1072,10 +1072,9 @@ static void rna_UserDef_studiolight_solid_lights_begin(CollectionPropertyIterato
|
|||
rna_iterator_array_begin(iter, sl->light, sizeof(*sl->light), ARRAY_SIZE(sl->light), 0, NULL);
|
||||
}
|
||||
|
||||
static int rna_UserDef_studiolight_solid_lights_length(PointerRNA *ptr)
|
||||
static int rna_UserDef_studiolight_solid_lights_length(PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
StudioLight *sl = (StudioLight *)ptr->data;
|
||||
return ARRAY_SIZE(sl->light);
|
||||
return ARRAY_SIZE(((StudioLight *)NULL)->light);
|
||||
}
|
||||
|
||||
/* StudioLight.light_ambient */
|
||||
|
|
|
@ -409,7 +409,7 @@ Sequence *SEQ_add_sound_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL
|
|||
|
||||
Strip *strip = seq->strip;
|
||||
/* We only need 1 element to store the filename. */
|
||||
StripElem *se = strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
|
||||
StripElem *se = strip->stripdata = MEM_callocN(sizeof(StripElem), "stripelem");
|
||||
BLI_split_dirfile(load_data->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
|
||||
|
||||
if (seq != NULL && seq->sound != NULL) {
|
||||
|
|
|
@ -911,7 +911,10 @@ void wm_homefile_read(bContext *C,
|
|||
const char *app_template_override,
|
||||
bool *r_is_factory_startup)
|
||||
{
|
||||
Main *bmain = G_MAIN; /* Context does not always have valid main pointer here... */
|
||||
#if 0 /* UNUSED, keep as this may be needed later & the comment below isn't self evident. */
|
||||
/* Context does not always have valid main pointer here. */
|
||||
Main *bmain = G_MAIN;
|
||||
#endif
|
||||
ListBase wmbase;
|
||||
bool success = false;
|
||||
|
||||
|
@ -1170,7 +1173,7 @@ void wm_homefile_read(bContext *C,
|
|||
BLI_strncpy(U.app_template, app_template_override, sizeof(U.app_template));
|
||||
}
|
||||
|
||||
bmain = CTX_data_main(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
if (use_userdef) {
|
||||
/* check userdef before open window, keymaps etc */
|
||||
|
@ -2482,12 +2485,11 @@ static void wm_open_mainfile_ui(bContext *UNUSED(C), wmOperator *op)
|
|||
{
|
||||
struct FileRuntime *file_info = (struct FileRuntime *)&op->customdata;
|
||||
uiLayout *layout = op->layout;
|
||||
uiLayout *col = op->layout;
|
||||
const char *autoexec_text;
|
||||
|
||||
uiItemR(layout, op->ptr, "load_ui", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
if (file_info->is_untrusted) {
|
||||
autoexec_text = IFACE_("Trusted Source [Untrusted Path]");
|
||||
uiLayoutSetActive(col, false);
|
||||
|
|
Loading…
Reference in New Issue