forked from bartvdbraak/blender
code cleanup: minor changes, clang checker option for exact size matches and use vector functions.
This commit is contained in:
parent
eb66c45301
commit
456f3b318a
@ -21,6 +21,7 @@ Invocation:
|
||||
|
||||
# delay parsing functions until we need them
|
||||
USE_LAZY_INIT = True
|
||||
USE_EXACT_COMPARE = False
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# predefined function/arg sizes, handy sometimes, but not complete...
|
||||
@ -307,14 +308,24 @@ def file_check_arg_sizes(tu):
|
||||
|
||||
# testing
|
||||
# size_def = 100
|
||||
if size < size_def and size != 1:
|
||||
location = node.location
|
||||
print("%s:%d:%d: argument %d is size %d, should be %d" %
|
||||
(location.file,
|
||||
location.line,
|
||||
location.column,
|
||||
i + 1, size, size_def
|
||||
))
|
||||
if size != 1:
|
||||
if USE_EXACT_COMPARE:
|
||||
# is_err = (size != size_def) and (size != 4 and size_def != 3)
|
||||
is_err = (size != size_def)
|
||||
else:
|
||||
is_err = (size < size_def)
|
||||
|
||||
if is_err:
|
||||
location = node.location
|
||||
# if "math_color_inline.c" not in str(location.file):
|
||||
if 1:
|
||||
print("%s:%d:%d: argument %d is size %d, should be %d (from %s)" %
|
||||
(location.file,
|
||||
location.line,
|
||||
location.column,
|
||||
i + 1, size, size_def,
|
||||
args[0] # always the same but useful when running threaded
|
||||
))
|
||||
|
||||
# we dont really care what we are looking at, just scan entire file for
|
||||
# function calls.
|
||||
|
@ -49,6 +49,10 @@ def main():
|
||||
|
||||
check_commands = []
|
||||
for c, inc_dirs, defs in source_info:
|
||||
|
||||
#~if "source/blender" not in c:
|
||||
#~ continue
|
||||
|
||||
cmd = ([CHECKER_BIN] +
|
||||
CHECKER_ARGS +
|
||||
[c] +
|
||||
|
@ -495,7 +495,10 @@ int bmesh_elem_check(void *element, const char htype)
|
||||
|
||||
if (len != f->len)
|
||||
err |= (1 << 23);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BLI_assert(0);
|
||||
}
|
||||
|
||||
BMESH_ASSERT(err == 0);
|
||||
|
@ -291,7 +291,7 @@ void BM_mesh_normals_update(BMesh *bm, const bool skip_hidden)
|
||||
/* compute normalized direction vectors for each edge. directions will be
|
||||
* used below for calculating the weights of the face normals on the vertex
|
||||
* normals */
|
||||
edgevec = MEM_mallocN(sizeof(float) * 3 * bm->totedge, "BM normal computation array");
|
||||
edgevec = MEM_mallocN(sizeof(*edgevec) * bm->totedge, __func__);
|
||||
BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, index) {
|
||||
BM_elem_index_set(e, index); /* set_inline */
|
||||
|
||||
@ -609,11 +609,16 @@ void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *fu
|
||||
*/
|
||||
int BM_mesh_elem_count(BMesh *bm, const char htype)
|
||||
{
|
||||
if (htype == BM_VERT) return bm->totvert;
|
||||
else if (htype == BM_EDGE) return bm->totedge;
|
||||
else if (htype == BM_FACE) return bm->totface;
|
||||
|
||||
return 0;
|
||||
switch (htype) {
|
||||
case BM_VERT: return bm->totvert;
|
||||
case BM_EDGE: return bm->totedge;
|
||||
case BM_FACE: return bm->totface;
|
||||
default:
|
||||
{
|
||||
BLI_assert(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -455,9 +455,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
|
||||
|
||||
BKE_object_where_is_calc(scene, obedit);
|
||||
|
||||
obedit->loc[0] += offset[0];
|
||||
obedit->loc[1] += offset[1];
|
||||
obedit->loc[2] += offset[2];
|
||||
add_v3_v3(obedit->loc, offset);
|
||||
|
||||
cu = obedit->data;
|
||||
cu->vfont = BKE_vfont_builtin_get();
|
||||
|
@ -736,9 +736,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
|
||||
BKE_get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
|
||||
sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
|
||||
|
||||
ob->loc[0] = vec[0];
|
||||
ob->loc[1] = vec[1];
|
||||
ob->loc[2] = vec[2];
|
||||
copy_v3_v3(ob->loc, vec);
|
||||
}
|
||||
else if (pararm && ob->type == OB_MESH && par->type == OB_ARMATURE) {
|
||||
if (partype == PAR_ARMATURE_NAME)
|
||||
|
Loading…
Reference in New Issue
Block a user