code cleanup: define sizes of vectors for function args and use C style comments

This commit is contained in:
2012-10-15 09:11:17 +00:00
parent abff7cac7e
commit da9394f596
23 changed files with 223 additions and 217 deletions

View File

@@ -99,7 +99,7 @@ void BKE_pose_where_is_bone_tail(struct bPoseChannel *pchan);
/* get_objectspace_bone_matrix has to be removed still */ /* get_objectspace_bone_matrix has to be removed still */
void get_objectspace_bone_matrix(struct Bone *bone, float M_accumulatedMatrix[][4], int root, int posed); void get_objectspace_bone_matrix(struct Bone *bone, float M_accumulatedMatrix[][4], int root, int posed);
void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]); void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]);
void mat3_to_vec_roll(float mat[][3], float *vec, float *roll); void mat3_to_vec_roll(float mat[][3], float r_vec[3], float *r_roll);
/* Common Conversions Between Co-ordinate Spaces */ /* Common Conversions Between Co-ordinate Spaces */
void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]); void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]);

View File

@@ -108,7 +108,7 @@ void BKE_nurb_free(struct Nurb *nu);
struct Nurb *BKE_nurb_duplicate(struct Nurb *nu); struct Nurb *BKE_nurb_duplicate(struct Nurb *nu);
void BKE_nurb_test2D(struct Nurb *nu); void BKE_nurb_test2D(struct Nurb *nu);
void BKE_nurb_minmax(struct Nurb *nu, float *min, float *max); void BKE_nurb_minmax(struct Nurb *nu, float min[3], float max[3]);
void BKE_nurb_makeFaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv); void BKE_nurb_makeFaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv);
void BKE_nurb_makeCurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride); void BKE_nurb_makeCurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride);

View File

@@ -46,7 +46,7 @@ struct Lattice *BKE_lattice_add(const char *name);
struct Lattice *BKE_lattice_copy(struct Lattice *lt); struct Lattice *BKE_lattice_copy(struct Lattice *lt);
void BKE_lattice_free(struct Lattice *lt); void BKE_lattice_free(struct Lattice *lt);
void BKE_lattice_make_local(struct Lattice *lt); void BKE_lattice_make_local(struct Lattice *lt);
void calc_lat_fudu(int flag, int res, float *fu, float *du); void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
void init_latt_deform(struct Object *oblatt, struct Object *ob); void init_latt_deform(struct Object *oblatt, struct Object *ob);
void calc_latt_deform(struct Object *, float co[3], float weight); void calc_latt_deform(struct Object *, float co[3], float weight);

View File

@@ -130,7 +130,7 @@ struct Mesh *BKE_mesh_copy(struct Mesh *me);
void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd); void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd);
void BKE_mesh_make_local(struct Mesh *me); void BKE_mesh_make_local(struct Mesh *me);
void BKE_mesh_boundbox_calc(struct Mesh *me, float *loc, float *size); void BKE_mesh_boundbox_calc(struct Mesh *me, float r_loc[3], float r_size[3]);
void BKE_mesh_texspace_calc(struct Mesh *me); void BKE_mesh_texspace_calc(struct Mesh *me);
float *BKE_mesh_orco_verts_get(struct Object *ob); float *BKE_mesh_orco_verts_get(struct Object *ob);
void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert); void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert);

View File

@@ -1425,19 +1425,20 @@ void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float
* *************************************************************************** */ * *************************************************************************** */
/* Computes vector and roll based on a rotation. /* Computes vector and roll based on a rotation.
* "mat" must contain only a rotation, and no scaling. */ * "mat" must contain only a rotation, and no scaling. */
void mat3_to_vec_roll(float mat[][3], float vec[3], float *roll) void mat3_to_vec_roll(float mat[][3], float r_vec[3], float *r_roll)
{ {
if (vec) if (r_vec) {
copy_v3_v3(vec, mat[1]); copy_v3_v3(r_vec, mat[1]);
}
if (roll) { if (r_roll) {
float vecmat[3][3], vecmatinv[3][3], rollmat[3][3]; float vecmat[3][3], vecmatinv[3][3], rollmat[3][3];
vec_roll_to_mat3(mat[1], 0.0f, vecmat); vec_roll_to_mat3(mat[1], 0.0f, vecmat);
invert_m3_m3(vecmatinv, vecmat); invert_m3_m3(vecmatinv, vecmat);
mul_m3_m3m3(rollmat, vecmatinv, mat); mul_m3_m3m3(rollmat, vecmatinv, mat);
*roll = (float)atan2(rollmat[2][0], rollmat[2][2]); *r_roll = atan2f(rollmat[2][0], rollmat[2][2]);
} }
} }

View File

@@ -64,19 +64,19 @@
#include "BKE_deform.h" #include "BKE_deform.h"
void calc_lat_fudu(int flag, int res, float *fu, float *du) void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)
{ {
if (res == 1) { if (res == 1) {
*fu = 0.0; *r_fu = 0.0;
*du = 0.0; *r_du = 0.0;
} }
else if (flag & LT_GRID) { else if (flag & LT_GRID) {
*fu = -0.5f * (res - 1); *r_fu = -0.5f * (res - 1);
*du = 1.0f; *r_du = 1.0f;
} }
else { else {
*fu = -1.0f; *r_fu = -1.0f;
*du = 2.0f / (res - 1); *r_du = 2.0f / (res - 1);
} }
} }

View File

@@ -81,7 +81,8 @@ int polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float* v
return 1; return 1;
} }
float distPointToSegmentSq(const float* point, const float* a, const float* b) /* XXX, could replace with #dist_to_line_segment_v3(), or add a squared version */
float distPointToSegmentSq(const float point[3], const float a[3], const float b[3])
{ {
float abx[3], dx[3]; float abx[3], dx[3];
float d, t; float d, t;
@@ -92,12 +93,12 @@ float distPointToSegmentSq(const float* point, const float* a, const float* b)
d = abx[0] * abx[0] + abx[2] * abx[2]; d = abx[0] * abx[0] + abx[2] * abx[2];
t = abx[0] * dx[0] + abx[2] * dx[2]; t = abx[0] * dx[0] + abx[2] * dx[2];
if (d > 0) if (d > 0.0f)
t /= d; t /= d;
if (t < 0) if (t < 0.0f)
t = 0; t = 0.0f;
else if (t > 1) else if (t > 1.0f)
t = 1; t = 1.0f;
dx[0] = a[0] + t * abx[0] - point[0]; dx[0] = a[0] + t * abx[0] - point[0];
dx[2] = a[2] + t * abx[2] - point[2]; dx[2] = a[2] + t * abx[2] - point[2];
@@ -124,12 +125,12 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
verts = MEM_callocN(sizeof(float) * 3 * nverts, "buildRawVertIndicesData verts"); verts = MEM_callocN(sizeof(float) * 3 * nverts, "buildRawVertIndicesData verts");
dm->getVertCos(dm, (float(*)[3])verts); dm->getVertCos(dm, (float(*)[3])verts);
//flip coordinates /* flip coordinates */
for (vi = 0; vi < nverts; vi++) { for (vi = 0; vi < nverts; vi++) {
SWAP(float, verts[3 * vi + 1], verts[3 * vi + 2]); SWAP(float, verts[3 * vi + 1], verts[3 * vi + 2]);
} }
//calculate number of tris /* calculate number of tris */
nfaces = dm->getNumTessFaces(dm); nfaces = dm->getNumTessFaces(dm);
faces = dm->getTessFaceArray(dm); faces = dm->getTessFaceArray(dm);
ntris = nfaces; ntris = nfaces;
@@ -139,7 +140,7 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
ntris++; ntris++;
} }
//copy and transform to triangles (reorder on the run) /* copy and transform to triangles (reorder on the run) */
trisToFacesMap = MEM_callocN(sizeof(int) * ntris, "buildRawVertIndicesData trisToFacesMap"); trisToFacesMap = MEM_callocN(sizeof(int) * ntris, "buildRawVertIndicesData trisToFacesMap");
tris = MEM_callocN(sizeof(unsigned short) * 3 * ntris, "buildRawVertIndicesData tris"); tris = MEM_callocN(sizeof(unsigned short) * 3 * ntris, "buildRawVertIndicesData tris");
tri = tris; tri = tris;
@@ -158,7 +159,7 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
} }
} }
//carefully, recast data is just reference to data in derived mesh /* carefully, recast data is just reference to data in derived mesh */
*recastData = (int *)CustomData_get_layer(&dm->polyData, CD_RECAST); *recastData = (int *)CustomData_get_layer(&dm->polyData, CD_RECAST);
*nverts_r = nverts; *nverts_r = nverts;
@@ -184,7 +185,7 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
size_t i; size_t i;
int j, k; int j, k;
int nv = 0; int nv = 0;
//search border /* search border */
int tri, btri = -1; int tri, btri = -1;
int edge, bedge = -1; int edge, bedge = -1;
int dtrisNum = dmeshes[polyidx * 4 + 3]; int dtrisNum = dmeshes[polyidx * 4 + 3];
@@ -206,7 +207,7 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
} }
} }
if (btri == -1 || bedge == -1) { if (btri == -1 || bedge == -1) {
//can't find triangle with border edge /* can't find triangle with border edge */
MEM_freeN(traversedTris); MEM_freeN(traversedTris);
MEM_freeN(newPoly); MEM_freeN(newPoly);
@@ -230,11 +231,11 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
newPoly = newPolyBig; newPoly = newPolyBig;
} }
newPoly[nv++] = dtris[tri * 3 * 2 + edge]; newPoly[nv++] = dtris[tri * 3 * 2 + edge];
//move to next edge /* move to next edge */
edge = (edge + 1) % 3; edge = (edge + 1) % 3;
} }
else { else {
//move to next tri /* move to next tri */
int twinedge = -1; int twinedge = -1;
for (k = 0; k < 3; k++) { for (k = 0; k < 3; k++) {
if (dtris[neighbortri * 3 * 2 + 3 + k] == tri) { if (dtris[neighbortri * 3 * 2 + 3 + k] == tri) {
@@ -271,7 +272,7 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
allBorderTraversed = 1; allBorderTraversed = 1;
for (i = 0; i < dtrisNum; i++) { for (i = 0; i < dtrisNum; i++) {
if (traversedTris[i] == 0) { if (traversedTris[i] == 0) {
//check whether it has border edges /* check whether it has border edges */
int curpolytri = dtrisBase + i; int curpolytri = dtrisBase + i;
for (k = 0; k < 3; k++) { for (k = 0; k < 3; k++) {
unsigned short neighbortri = dtris[curpolytri * 3 * 2 + 3 + k]; unsigned short neighbortri = dtris[curpolytri * 3 * 2 + 3 + k];
@@ -298,8 +299,7 @@ returnLabel:
return 1; return 1;
} }
struct SortContext struct SortContext {
{
const int *recastData; const int *recastData;
const int *trisToFacesMap; const int *trisToFacesMap;
}; };
@@ -335,14 +335,14 @@ int buildNavMeshData(const int nverts, const float* verts,
trisMapping = MEM_callocN(sizeof(int) * ntris, "buildNavMeshData trisMapping"); trisMapping = MEM_callocN(sizeof(int) * ntris, "buildNavMeshData trisMapping");
//sort the triangles by polygon idx /* sort the triangles by polygon idx */
for (i = 0; i < ntris; i++) for (i = 0; i < ntris; i++)
trisMapping[i] = i; trisMapping[i] = i;
context.recastData = recastData; context.recastData = recastData;
context.trisToFacesMap = trisToFacesMap; context.trisToFacesMap = trisToFacesMap;
recast_qsort(trisMapping, ntris, sizeof(int), &context, compareByData); recast_qsort(trisMapping, ntris, sizeof(int), &context, compareByData);
//search first valid triangle - triangle of convex polygon /* search first valid triangle - triangle of convex polygon */
validTriStart = -1; validTriStart = -1;
for (i = 0; i < ntris; i++) { for (i = 0; i < ntris; i++) {
if (recastData[trisToFacesMap[trisMapping[i]]] > 0) { if (recastData[trisToFacesMap[trisMapping[i]]] > 0) {
@@ -358,20 +358,20 @@ int buildNavMeshData(const int nverts, const float* verts,
} }
ndtris = ntris - validTriStart; ndtris = ntris - validTriStart;
//fill dtris to faces mapping /* fill dtris to faces mapping */
dtrisToTrisMap = MEM_callocN(sizeof(int) * ndtris, "buildNavMeshData dtrisToTrisMap"); dtrisToTrisMap = MEM_callocN(sizeof(int) * ndtris, "buildNavMeshData dtrisToTrisMap");
memcpy(dtrisToTrisMap, &trisMapping[validTriStart], ndtris * sizeof(int)); memcpy(dtrisToTrisMap, &trisMapping[validTriStart], ndtris * sizeof(int));
MEM_freeN(trisMapping); MEM_freeN(trisMapping);
//create detailed mesh triangles - copy only valid triangles /* create detailed mesh triangles - copy only valid triangles
//and reserve memory for adjacency info * and reserve memory for adjacency info */
dtris = MEM_callocN(sizeof(unsigned short) * 3 * 2 * ndtris, "buildNavMeshData dtris"); dtris = MEM_callocN(sizeof(unsigned short) * 3 * 2 * ndtris, "buildNavMeshData dtris");
memset(dtris, 0xffff, sizeof(unsigned short) * 3 * 2 * ndtris); memset(dtris, 0xffff, sizeof(unsigned short) * 3 * 2 * ndtris);
for (i = 0; i < ndtris; i++) { for (i = 0; i < ndtris; i++) {
memcpy(dtris + 3 * 2 * i, tris + 3 * dtrisToTrisMap[i], sizeof(unsigned short) * 3); memcpy(dtris + 3 * 2 * i, tris + 3 * dtrisToTrisMap[i], sizeof(unsigned short) * 3);
} }
//create new recast data corresponded to dtris and renumber for continuous indices /* create new recast data corresponded to dtris and renumber for continuous indices */
prevPolyIdx = -1; prevPolyIdx = -1;
newPolyIdx = 0; newPolyIdx = 0;
dtrisToPolysMap = MEM_callocN(sizeof(int) * ndtris, "buildNavMeshData dtrisToPolysMap"); dtrisToPolysMap = MEM_callocN(sizeof(int) * ndtris, "buildNavMeshData dtrisToPolysMap");
@@ -385,10 +385,10 @@ int buildNavMeshData(const int nverts, const float* verts,
} }
//build adjacency info for detailed mesh triangles /* build adjacency info for detailed mesh triangles */
recast_buildMeshAdjacency(dtris, ndtris, nverts, 3); recast_buildMeshAdjacency(dtris, ndtris, nverts, 3);
//create detailed mesh description for each navigation polygon /* create detailed mesh description for each navigation polygon */
npolys = dtrisToPolysMap[ndtris - 1]; npolys = dtrisToPolysMap[ndtris - 1];
dmeshes = MEM_callocN(sizeof(unsigned short) * npolys * 4, "buildNavMeshData dmeshes"); dmeshes = MEM_callocN(sizeof(unsigned short) * npolys * 4, "buildNavMeshData dmeshes");
memset(dmeshes, 0, npolys * 4 * sizeof(unsigned short)); memset(dmeshes, 0, npolys * 4 * sizeof(unsigned short));
@@ -402,14 +402,14 @@ int buildNavMeshData(const int nverts, const float* verts,
return 0; return 0;
} }
dmesh = dmesh == NULL ? dmeshes : dmesh + 4; dmesh = dmesh == NULL ? dmeshes : dmesh + 4;
dmesh[2] = (unsigned short)i; //tbase dmesh[2] = (unsigned short)i; /* tbase */
dmesh[3] = 0; //tnum dmesh[3] = 0; /* tnum */
prevpolyidx = curpolyidx; prevpolyidx = curpolyidx;
} }
dmesh[3]++; dmesh[3]++;
} }
//create navigation polygons /* create navigation polygons */
vertsPerPoly = 6; vertsPerPoly = 6;
polys = MEM_callocN(sizeof(unsigned short) * npolys * vertsPerPoly * 2, "buildNavMeshData polys"); polys = MEM_callocN(sizeof(unsigned short) * npolys * vertsPerPoly * 2, "buildNavMeshData polys");
memset(polys, 0xff, sizeof(unsigned short) * vertsPerPoly * 2 * npolys); memset(polys, 0xff, sizeof(unsigned short) * vertsPerPoly * 2 * npolys);

View File

@@ -810,7 +810,7 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
int bmesh_loop_reverse(BMesh *bm, BMFace *f) int bmesh_loop_reverse(BMesh *bm, BMFace *f)
{ {
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
return bmesh_loop_reverse_loop(bm, f, f->loops.first); return bm_loop_reverse_loop(bm, f, f->loops.first);
#else #else
return bm_loop_reverse_loop(bm, f); return bm_loop_reverse_loop(bm, f);
#endif #endif
@@ -1186,13 +1186,15 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
{ {
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
BMLoopList *lst, *lst2; BMLoopList *lst, *lst2;
#else
int first_loop_f1;
#endif #endif
BMFace *f2; BMFace *f2;
BMLoop *l_iter, *l_first; BMLoop *l_iter, *l_first;
BMLoop *v1loop = NULL, *v2loop = NULL, *f1loop = NULL, *f2loop = NULL; BMLoop *v1loop = NULL, *v2loop = NULL, *f1loop = NULL, *f2loop = NULL;
BMEdge *e; BMEdge *e;
int i, len, f1len, f2len, first_loop_f1; int i, len, f1len, f2len;
/* verify that v1 and v2 are in face */ /* verify that v1 and v2 are in face */
len = f->len; len = f->len;

View File

@@ -57,7 +57,7 @@ static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER); bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER);
#ifdef USE_BMESH_HOLES #ifdef USE_BMESH_HOLES
bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), allocsize[3], allocsize[3], FALSE, FALSE); bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), 512, 512, 0);
#endif #endif
/* allocate one flag pool that we don't get rid of. */ /* allocate one flag pool that we don't get rid of. */

View File

@@ -233,7 +233,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
} }
#if 0 #if 0
//a bit of cleaner code that, alas, doens't work. /* a bit of cleaner code that, alas, doens't work. */
/* build edge tag */ /* build edge tag */
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test(bm, e->v1, BEVEL_FLAG) || BMO_elem_flag_test(bm, e->v2, BEVEL_FLAG)) { if (BMO_elem_flag_test(bm, e->v1, BEVEL_FLAG) || BMO_elem_flag_test(bm, e->v2, BEVEL_FLAG)) {

View File

@@ -1022,7 +1022,6 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
BMOIter fs_iter; /* selected faces iterator */ BMOIter fs_iter; /* selected faces iterator */
BMFace *fs; /* current face */ BMFace *fs; /* current face */
BMIter l_iter; /* iteration loop */ BMIter l_iter; /* iteration loop */
// int n;
int dir = BMO_slot_int_get(op, "dir"); int dir = BMO_slot_int_get(op, "dir");
@@ -1077,7 +1076,6 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
} }
} }
} }
} }
/**************************************************************************** * /**************************************************************************** *
@@ -1129,7 +1127,6 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
BMOIter fs_iter; /* selected faces iterator */ BMOIter fs_iter; /* selected faces iterator */
BMFace *fs; /* current face */ BMFace *fs; /* current face */
BMIter l_iter; /* iteration loop */ BMIter l_iter; /* iteration loop */
// int n;
int dir = BMO_slot_int_get(op, "dir"); int dir = BMO_slot_int_get(op, "dir");

View File

@@ -645,7 +645,7 @@ static PyGetSetDef bpy_bmface_getseters[] = {
static PyGetSetDef bpy_bmloop_getseters[] = { static PyGetSetDef bpy_bmloop_getseters[] = {
/* generic */ /* generic */
// flags are available but not used for loops. /* flags are available but not used for loops. */
// {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT}, // {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
// {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN}, // {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
{(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG}, {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},

View File

@@ -387,7 +387,7 @@ void BPy_BM_init_types_select(void)
BPy_BMEditSelSeq_Type.tp_name = "BMEditSelSeq"; BPy_BMEditSelSeq_Type.tp_name = "BMEditSelSeq";
BPy_BMEditSelIter_Type.tp_name = "BMEditSelIter"; BPy_BMEditSelIter_Type.tp_name = "BMEditSelIter";
BPy_BMEditSelSeq_Type.tp_doc = NULL; // todo BPy_BMEditSelSeq_Type.tp_doc = NULL; /* todo */
BPy_BMEditSelIter_Type.tp_doc = NULL; BPy_BMEditSelIter_Type.tp_doc = NULL;
BPy_BMEditSelSeq_Type.tp_repr = (reprfunc)NULL; BPy_BMEditSelSeq_Type.tp_repr = (reprfunc)NULL;

View File

@@ -284,7 +284,7 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
if (PyList_GET_SIZE(cb_list) > 0) { if (PyList_GET_SIZE(cb_list) > 0) {
PyGILState_STATE gilstate = PyGILState_Ensure(); PyGILState_STATE gilstate = PyGILState_Ensure();
PyObject *args = PyTuple_New(1); // save python creating each call PyObject *args = PyTuple_New(1); /* save python creating each call */
PyObject *func; PyObject *func;
PyObject *ret; PyObject *ret;
Py_ssize_t pos; Py_ssize_t pos;

View File

@@ -280,7 +280,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
} }
#if 0 // slow, with this can avoid all Py_CompileString above. #if 0 /* slow, with this can avoid all Py_CompileString above. */
/* execute expression to get a value */ /* execute expression to get a value */
retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars); retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
#else #else

View File

@@ -69,7 +69,7 @@
#include "BPY_extern.h" #include "BPY_extern.h"
#include "../generic/bpy_internal_import.h" // our own imports #include "../generic/bpy_internal_import.h" /* our own imports */
#include "../generic/py_capi_utils.h" #include "../generic/py_capi_utils.h"
/* inittab initialization functions */ /* inittab initialization functions */
@@ -180,10 +180,10 @@ void BPY_text_free_code(Text *text)
void BPY_modules_update(bContext *C) void BPY_modules_update(bContext *C)
{ {
#if 0 // slow, this runs all the time poll, draw etc 100's of time a sec. #if 0 /* slow, this runs all the time poll, draw etc 100's of time a sec. */
PyObject *mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0); PyObject *mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
PyModule_AddObject(mod, "data", BPY_rna_module()); PyModule_AddObject(mod, "data", BPY_rna_module());
PyModule_AddObject(mod, "types", BPY_rna_types()); // atm this does not need updating PyModule_AddObject(mod, "types", BPY_rna_types()); /* atm this does not need updating */
#endif #endif
/* refreshes the main struct */ /* refreshes the main struct */
@@ -268,7 +268,7 @@ void BPY_python_start(int argc, const char **argv)
Py_Initialize(); Py_Initialize();
// PySys_SetArgv(argc, argv); // broken in py3, not a huge deal // PySys_SetArgv(argc, argv); /* broken in py3, not a huge deal */
/* sigh, why do python guys not have a (char **) version anymore? */ /* sigh, why do python guys not have a (char **) version anymore? */
{ {
int i; int i;

View File

@@ -81,7 +81,7 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const short
short BPy_errors_to_report(ReportList *reports) short BPy_errors_to_report(ReportList *reports)
{ {
PyObject *pystring; PyObject *pystring;
PyObject *pystring_format = NULL; // workaround, see below PyObject *pystring_format = NULL; /* workaround, see below */
char *cstring; char *cstring;
const char *filename; const char *filename;
@@ -110,7 +110,7 @@ short BPy_errors_to_report(ReportList *reports)
cstring = _PyUnicode_AsString(pystring); cstring = _PyUnicode_AsString(pystring);
#if 0 // ARG!. workaround for a bug in blenders use of vsnprintf #if 0 /* ARG!. workaround for a bug in blenders use of vsnprintf */
BKE_reportf(reports, RPT_ERROR, "%s\nlocation:%s:%d\n", cstring, filename, lineno); BKE_reportf(reports, RPT_ERROR, "%s\nlocation:%s:%d\n", cstring, filename, lineno);
#else #else
pystring_format = PyUnicode_FromFormat(TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno); pystring_format = PyUnicode_FromFormat(TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno);
@@ -118,9 +118,10 @@ short BPy_errors_to_report(ReportList *reports)
BKE_report(reports, RPT_ERROR, cstring); BKE_report(reports, RPT_ERROR, cstring);
#endif #endif
fprintf(stderr, TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno); // not exactly needed. just for testing /* not exactly needed. just for testing */
fprintf(stderr, TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno);
Py_DECREF(pystring); Py_DECREF(pystring);
Py_DECREF(pystring_format); // workaround Py_DECREF(pystring_format); /* workaround */
return 1; return 1;
} }

View File

@@ -69,7 +69,7 @@ typedef struct SunSky {
float atm_BetaRM[3]; float atm_BetaRM[3];
} SunSky; } SunSky;
void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness, void InitSunSky(struct SunSky *sunsky, float turb, const float toSun[3], float horizon_brightness,
float spread, float sun_brightness, float sun_size, float back_scatter, float spread, float sun_brightness, float sun_size, float back_scatter,
float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace); float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace);

View File

@@ -23,4 +23,9 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
int ocean_texture(struct Tex *tex, float *texvec, struct TexResult *texres); #ifndef __TEXTURE_OCEAN_H__
#define __TEXTURE_OCEAN_H__
int ocean_texture(struct Tex *tex, const float texvec[2], struct TexResult *texres);
#endif /* __TEXTURE_OCEAN_H__ */

View File

@@ -30,8 +30,8 @@
*/ */
void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float *bbmin, float *bbmax); void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float bbmin[3], float bbmax[3]);
int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, float *co); int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, const float co[3]);
void volume_precache(Render *re); void volume_precache(Render *re);
void free_volume_precache(Render *re); void free_volume_precache(Render *re);

View File

@@ -146,7 +146,7 @@ static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta,
* sun_size, controls sun's size * sun_size, controls sun's size
* back_scatter, controls back scatter light * back_scatter, controls back scatter light
* */ * */
void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness, void InitSunSky(struct SunSky *sunsky, float turb, const float toSun[3], float horizon_brightness,
float spread, float sun_brightness, float sun_size, float back_scatter, float spread, float sun_brightness, float sun_size, float back_scatter,
float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace) float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace)
{ {

View File

@@ -55,7 +55,7 @@ extern struct Render R;
/* ***** actual texture sampling ***** */ /* ***** actual texture sampling ***** */
int ocean_texture(Tex *tex, float *texvec, TexResult *texres) int ocean_texture(Tex *tex, const float texvec[2], TexResult *texres)
{ {
OceanTex *ot = tex->ot; OceanTex *ot = tex->ot;
ModifierData *md; ModifierData *md;

View File

@@ -92,7 +92,7 @@ static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset
} }
/* Uses ray tracing to check if a point is inside or outside an ObjectInstanceRen */ /* Uses ray tracing to check if a point is inside or outside an ObjectInstanceRen */
static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co) static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), const float co[3])
{ {
Isect isect= {{0}}; Isect isect= {{0}};
float dir[3] = {0.0f, 0.0f, 1.0f}; float dir[3] = {0.0f, 0.0f, 1.0f};
@@ -118,7 +118,7 @@ static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), flo
} }
/* find the bounding box of an objectinstance in global space */ /* find the bounding box of an objectinstance in global space */
void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float *bbmin, float *bbmax) void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float bbmin[3], float bbmax[3])
{ {
ObjectRen *obr = obi->obr; ObjectRen *obr = obi->obr;
VolumePrecache *vp = obi->volume_precache; VolumePrecache *vp = obi->volume_precache;
@@ -826,7 +826,7 @@ void free_volume_precache(Render *re)
BLI_freelistN(&re->volumes); BLI_freelistN(&re->volumes);
} }
int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, float *co) int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, const float co[3])
{ {
RayObject *tree; RayObject *tree;
int inside=0; int inside=0;