diff options
Diffstat (limited to 'source/blender/freestyle')
121 files changed, 1026 insertions, 923 deletions
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index c2fad9fef3a..8f9e493023c 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -548,7 +548,6 @@ set(INC ../python/intern ../render ../render/intern - ../../../extern/glew/include ../../../intern/guardedalloc # RNA_prototypes.h @@ -562,6 +561,10 @@ set(INC_SYS add_definitions(-DWITH_FREESTYLE) +if(WITH_PYTHON_MODULE) + add_definitions(-DPy_ENABLE_SHARED) +endif() + if(WITH_PYTHON_SAFETY) # For bpy_rna.h access. add_definitions(-DWITH_PYTHON_SAFETY) diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp index ee316bbf220..109afd48b1b 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.cpp +++ b/source/blender/freestyle/intern/application/AppCanvas.cpp @@ -89,7 +89,7 @@ void AppCanvas::init() void AppCanvas::postDraw() { - for (unsigned int i = 0; i < _StyleModules.size(); i++) { + for (uint i = 0; i < _StyleModules.size(); i++) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -118,8 +118,8 @@ void AppCanvas::readColorPixels(int x, int y, int w, int h, RGBImage &oImage) co int ymax = border().getMax().y(); int rectx = _pass_diffuse.width; int recty = _pass_diffuse.height; - float xfac = ((float)rectx) / ((float)(xmax - xmin)); - float yfac = ((float)recty) / ((float)(ymax - ymin)); + float xfac = float(rectx) / float(xmax - xmin); + float yfac = float(recty) / float(ymax - ymin); #if 0 if (G.debug & G_DEBUG_FREESTYLE) { printf("readColorPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n", @@ -138,12 +138,12 @@ void AppCanvas::readColorPixels(int x, int y, int w, int h, RGBImage &oImage) co #endif int ii, jj; for (int j = 0; j < h; j++) { - jj = (int)((y - ymin + j) * yfac); + jj = int((y - ymin + j) * yfac); if (jj < 0 || jj >= recty) { continue; } for (int i = 0; i < w; i++) { - ii = (int)((x - xmin + i) * xfac); + ii = int((x - xmin + i) * xfac); if (ii < 0 || ii >= rectx) { continue; } @@ -167,8 +167,8 @@ void AppCanvas::readDepthPixels(int x, int y, int w, int h, GrayImage &oImage) c int ymax = border().getMax().y(); int rectx = _pass_z.width; int recty = _pass_z.height; - float xfac = ((float)rectx) / ((float)(xmax - xmin)); - float yfac = ((float)recty) / ((float)(ymax - ymin)); + float xfac = float(rectx) / float(xmax - xmin); + float yfac = float(recty) / float(ymax - ymin); #if 0 if (G.debug & G_DEBUG_FREESTYLE) { printf("readDepthPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n", @@ -187,12 +187,12 @@ void AppCanvas::readDepthPixels(int x, int y, int w, int h, GrayImage &oImage) c #endif int ii, jj; for (int j = 0; j < h; j++) { - jj = (int)((y - ymin + j) * yfac); + jj = int((y - ymin + j) * yfac); if (jj < 0 || jj >= recty) { continue; } for (int i = 0; i < w; i++) { - ii = (int)((x - xmin + i) * xfac); + ii = int((x - xmin + i) * xfac); if (ii < 0 || ii >= rectx) { continue; } diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index cc815b5317f..670482a23a6 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -919,7 +919,7 @@ Render *Controller::RenderStrokes(Render *re, bool render) return freestyle_render; } -void Controller::InsertStyleModule(unsigned index, const char *iFileName) +void Controller::InsertStyleModule(uint index, const char *iFileName) { if (!BLI_path_extension_check(iFileName, ".py")) { cerr << "Error: Cannot load \"" << string(iFileName) << "\", unknown extension" << endl; @@ -930,13 +930,13 @@ void Controller::InsertStyleModule(unsigned index, const char *iFileName) _Canvas->InsertStyleModule(index, sm); } -void Controller::InsertStyleModule(unsigned index, const char *iName, const char *iBuffer) +void Controller::InsertStyleModule(uint index, const char *iName, const char *iBuffer) { StyleModule *sm = new BufferedStyleModule(iBuffer, iName, _inter); _Canvas->InsertStyleModule(index, sm); } -void Controller::InsertStyleModule(unsigned index, const char *iName, struct Text *iText) +void Controller::InsertStyleModule(uint index, const char *iName, struct Text *iText) { StyleModule *sm = new BlenderStyleModule(iText, iName, _inter); _Canvas->InsertStyleModule(index, sm); @@ -947,7 +947,7 @@ void Controller::AddStyleModule(const char * /*iFileName*/) //_pStyleWindow->Add(iFileName); } -void Controller::RemoveStyleModule(unsigned index) +void Controller::RemoveStyleModule(uint index) { _Canvas->RemoveStyleModule(index); } @@ -957,34 +957,34 @@ void Controller::Clear() _Canvas->Clear(); } -void Controller::ReloadStyleModule(unsigned index, const char *iFileName) +void Controller::ReloadStyleModule(uint index, const char *iFileName) { StyleModule *sm = new StyleModule(iFileName, _inter); _Canvas->ReplaceStyleModule(index, sm); } -void Controller::SwapStyleModules(unsigned i1, unsigned i2) +void Controller::SwapStyleModules(uint i1, uint i2) { _Canvas->SwapStyleModules(i1, i2); } -void Controller::toggleLayer(unsigned index, bool iDisplay) +void Controller::toggleLayer(uint index, bool iDisplay) { _Canvas->setVisible(index, iDisplay); } -void Controller::setModified(unsigned index, bool iMod) +void Controller::setModified(uint index, bool iMod) { //_pStyleWindow->setModified(index, iMod); _Canvas->setModified(index, iMod); updateCausalStyleModules(index + 1); } -void Controller::updateCausalStyleModules(unsigned index) +void Controller::updateCausalStyleModules(uint index) { - vector<unsigned> vec; + vector<uint> vec; _Canvas->causalStyleModules(vec, index); - for (vector<unsigned>::const_iterator it = vec.begin(); it != vec.end(); it++) { + for (vector<uint>::const_iterator it = vec.begin(); it != vec.end(); it++) { //_pStyleWindow->setModified(*it, true); _Canvas->setModified(*it, true); } @@ -1004,7 +1004,7 @@ NodeGroup *Controller::BuildRep(vector<ViewEdge *>::iterator vedges_begin, mat.setDiffuse(1, 1, 0.3, 1); tesselator2D.setFrsMaterial(mat); - return (tesselator2D.Tesselate(vedges_begin, vedges_end)); + return tesselator2D.Tesselate(vedges_begin, vedges_end); } void Controller::toggleEdgeTesselationNature(Nature::EdgeNature iNature) @@ -1051,14 +1051,14 @@ void Controller::displayDensityCurves(int x, int y) return; } - unsigned int i, j; + uint i, j; using densityCurve = vector<Vec3r>; vector<densityCurve> curves(svm->getNumberOfOrientations() + 1); vector<densityCurve> curvesDirection(svm->getNumberOfPyramidLevels()); // collect the curves values - unsigned nbCurves = svm->getNumberOfOrientations() + 1; - unsigned nbPoints = svm->getNumberOfPyramidLevels(); + uint nbCurves = svm->getNumberOfOrientations() + 1; + uint nbPoints = svm->getNumberOfPyramidLevels(); if (!nbPoints) { return; } diff --git a/source/blender/freestyle/intern/application/Controller.h b/source/blender/freestyle/intern/application/Controller.h index b5ef0fba1f7..8e59b277ff3 100644 --- a/source/blender/freestyle/intern/application/Controller.h +++ b/source/blender/freestyle/intern/application/Controller.h @@ -20,6 +20,10 @@ # include "MEM_guardedalloc.h" #endif +struct Depsgraph; +struct Render; +struct ViewLayer; + namespace Freestyle { class AppCanvas; diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index e76e74b89e4..0d41b5a773d 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -8,11 +8,14 @@ #include "BLI_utildefines.h" +#include "BKE_attribute.hh" #include "BKE_global.h" #include "BKE_object.h" #include <sstream> +using blender::Span; + namespace Freestyle { BlenderFileLoader::BlenderFileLoader(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph) @@ -60,16 +63,18 @@ NodeGroup *BlenderFileLoader::Load() int id = 0; const eEvaluationMode eval_mode = DEG_get_mode(_depsgraph); - DEG_OBJECT_ITER_BEGIN (_depsgraph, - ob, - DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | - DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | DEG_ITER_OBJECT_FLAG_VISIBLE | - DEG_ITER_OBJECT_FLAG_DUPLI) { + DEGObjectIterSettings deg_iter_settings{}; + deg_iter_settings.depsgraph = _depsgraph; + deg_iter_settings.flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | + DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | DEG_ITER_OBJECT_FLAG_VISIBLE | + DEG_ITER_OBJECT_FLAG_DUPLI; + DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) { break; } - if (ob->base_flag & (BASE_HOLDOUT | BASE_INDIRECT_ONLY)) { + if ((ob->base_flag & (BASE_HOLDOUT | BASE_INDIRECT_ONLY)) || + (ob->visibility_flag & OB_HOLDOUT)) { continue; } @@ -77,6 +82,11 @@ NodeGroup *BlenderFileLoader::Load() continue; } + /* Evaluated metaballs will appear as mesh objects in the iterator. */ + if (ob->type == OB_MBALL) { + continue; + } + Mesh *mesh = BKE_object_to_mesh(nullptr, ob, false); if (mesh) { @@ -264,7 +274,7 @@ void BlenderFileLoader::addTriangle(struct LoaderState *ls, #if 0 float len; #endif - unsigned int i, j; + uint i, j; IndexedFaceSet::FaceEdgeMark marks = 0; // initialize the bounding box by the first vertex @@ -372,9 +382,12 @@ int BlenderFileLoader::testDegenerateTriangle(float v1[3], float v2[3], float v3 static bool testEdgeMark(Mesh *me, const FreestyleEdge *fed, const MLoopTri *lt, int i) { - MLoop *mloop = &me->mloop[lt->tri[i]]; - MLoop *mloop_next = &me->mloop[lt->tri[(i + 1) % 3]]; - MEdge *medge = &me->medge[mloop->e]; + const Span<MEdge> edges = me->edges(); + const Span<MLoop> loops = me->loops(); + + const MLoop *mloop = &loops[lt->tri[i]]; + const MLoop *mloop_next = &loops[lt->tri[(i + 1) % 3]]; + const MEdge *medge = &edges[mloop->e]; if (!ELEM(mloop_next->v, medge->v1, medge->v2)) { /* Not an edge in the original mesh before triangulation. */ @@ -388,10 +401,15 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) { char *name = ob->id.name + 2; + const Span<MVert> mesh_verts = me->verts(); + const Span<MPoly> mesh_polys = me->polys(); + const Span<MLoop> mesh_loops = me->loops(); + // Compute loop triangles int tottri = poly_to_tri_count(me->totpoly, me->totloop); MLoopTri *mlooptri = (MLoopTri *)MEM_malloc_arrayN(tottri, sizeof(*mlooptri), __func__); - BKE_mesh_recalc_looptri(me->mloop, me->mpoly, me->mvert, me->totloop, me->totpoly, mlooptri); + BKE_mesh_recalc_looptri( + mesh_loops.data(), mesh_polys.data(), mesh_verts.data(), me->totloop, me->totpoly, mlooptri); // Compute loop normals BKE_mesh_calc_normals_split(me); @@ -402,9 +420,6 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) } // Get other mesh data - MVert *mvert = me->mvert; - MLoop *mloop = me->mloop; - MPoly *mpoly = me->mpoly; const FreestyleEdge *fed = (FreestyleEdge *)CustomData_get_layer(&me->edata, CD_FREESTYLE_EDGE); const FreestyleFace *ffa = (FreestyleFace *)CustomData_get_layer(&me->pdata, CD_FREESTYLE_FACE); @@ -422,16 +437,16 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // We count the number of triangles after the clipping by the near and far view // planes is applied (NOTE: mesh vertices are in the camera coordinate system). - unsigned numFaces = 0; + uint numFaces = 0; float v1[3], v2[3], v3[3]; float n1[3], n2[3], n3[3], facenormal[3]; int clip[3]; for (int a = 0; a < tottri; a++) { const MLoopTri *lt = &mlooptri[a]; - copy_v3_v3(v1, mvert[mloop[lt->tri[0]].v].co); - copy_v3_v3(v2, mvert[mloop[lt->tri[1]].v].co); - copy_v3_v3(v3, mvert[mloop[lt->tri[2]].v].co); + copy_v3_v3(v1, mesh_verts[mesh_loops[lt->tri[0]].v].co); + copy_v3_v3(v2, mesh_verts[mesh_loops[lt->tri[1]].v].co); + copy_v3_v3(v3, mesh_verts[mesh_loops[lt->tri[2]].v].co); mul_m4_v3(obmat, v1); mul_m4_v3(obmat, v2); @@ -457,16 +472,16 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) NodeGroup *currentMesh = new NodeGroup; NodeShape *shape = new NodeShape; - unsigned vSize = 3 * 3 * numFaces; + uint vSize = 3 * 3 * numFaces; float *vertices = new float[vSize]; - unsigned nSize = vSize; + uint nSize = vSize; float *normals = new float[nSize]; - unsigned *numVertexPerFaces = new unsigned[numFaces]; + uint *numVertexPerFaces = new uint[numFaces]; vector<Material *> meshMaterials; vector<FrsMaterial> meshFrsMaterials; IndexedFaceSet::TRIANGLES_STYLE *faceStyle = new IndexedFaceSet::TRIANGLES_STYLE[numFaces]; - unsigned i; + uint i; for (i = 0; i < numFaces; i++) { faceStyle[i] = IndexedFaceSet::TRIANGLES; numVertexPerFaces[i] = 3; @@ -474,11 +489,11 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) IndexedFaceSet::FaceEdgeMark *faceEdgeMarks = new IndexedFaceSet::FaceEdgeMark[numFaces]; - unsigned viSize = 3 * numFaces; - unsigned *VIndices = new unsigned[viSize]; - unsigned niSize = viSize; - unsigned *NIndices = new unsigned[niSize]; - unsigned *MIndices = new unsigned[viSize]; // Material Indices + uint viSize = 3 * numFaces; + uint *VIndices = new uint[viSize]; + uint niSize = viSize; + uint *NIndices = new uint[niSize]; + uint *MIndices = new uint[viSize]; // Material Indices struct LoaderState ls; ls.pv = vertices; @@ -492,16 +507,19 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) FrsMaterial tmpMat; + const blender::VArray<int> material_indices = me->attributes().lookup_or_default<int>( + "material_index", ATTR_DOMAIN_FACE, 0); + // We parse the vlak nodes again and import meshes while applying the clipping // by the near and far view planes. for (int a = 0; a < tottri; a++) { const MLoopTri *lt = &mlooptri[a]; - const MPoly *mp = &mpoly[lt->poly]; - Material *mat = BKE_object_material_get(ob, mp->mat_nr + 1); + const MPoly *mp = &mesh_polys[lt->poly]; + Material *mat = BKE_object_material_get(ob, material_indices[lt->poly] + 1); - copy_v3_v3(v1, mvert[mloop[lt->tri[0]].v].co); - copy_v3_v3(v2, mvert[mloop[lt->tri[1]].v].co); - copy_v3_v3(v3, mvert[mloop[lt->tri[2]].v].co); + copy_v3_v3(v1, mesh_verts[mesh_loops[lt->tri[0]].v].co); + copy_v3_v3(v2, mesh_verts[mesh_loops[lt->tri[1]].v].co); + copy_v3_v3(v3, mesh_verts[mesh_loops[lt->tri[2]].v].co); mul_m4_v3(obmat, v1); mul_m4_v3(obmat, v2); @@ -532,7 +550,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) copy_v3_v3(n3, facenormal); } - unsigned int numTris = countClippedFaces(v1, v2, v3, clip); + uint numTris = countClippedFaces(v1, v2, v3, clip); if (numTris == 0) { continue; } @@ -561,7 +579,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) } else { // find if the Blender material is already in the list - unsigned int i = 0; + uint i = 0; bool found = false; for (vector<Material *>::iterator it = meshMaterials.begin(), itend = meshMaterials.end(); @@ -607,22 +625,22 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // We might have several times the same vertex. We want a clean // shape with no real-vertex. Here, we are making a cleaning pass. float *cleanVertices = nullptr; - unsigned int cvSize; - unsigned int *cleanVIndices = nullptr; + uint cvSize; + uint *cleanVIndices = nullptr; GeomCleaner::CleanIndexedVertexArray( vertices, vSize, VIndices, viSize, &cleanVertices, &cvSize, &cleanVIndices); float *cleanNormals = nullptr; - unsigned int cnSize; - unsigned int *cleanNIndices = nullptr; + uint cnSize; + uint *cleanNIndices = nullptr; GeomCleaner::CleanIndexedVertexArray( normals, nSize, NIndices, niSize, &cleanNormals, &cnSize, &cleanNIndices); // format materials array FrsMaterial **marray = new FrsMaterial *[meshFrsMaterials.size()]; - unsigned int mindex = 0; + uint mindex = 0; for (vector<FrsMaterial>::iterator m = meshFrsMaterials.begin(), mend = meshFrsMaterials.end(); m != mend; ++m) { @@ -645,7 +663,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // addressed later in WShape::MakeFace(). vector<detri_t> detriList; Vec3r zero(0.0, 0.0, 0.0); - unsigned vi0, vi1, vi2; + uint vi0, vi1, vi2; for (i = 0; i < viSize; i += 3) { detri_t detri; vi0 = cleanVIndices[i]; @@ -678,7 +696,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) detri.v = zero; detri.n = 0; - for (unsigned int j = 0; j < viSize; j += 3) { + for (uint j = 0; j < viSize; j += 3) { if (i == j) { continue; } @@ -737,7 +755,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) if (G.debug & G_DEBUG_FREESTYLE) { printf("Warning: Object %s contains %lu degenerated triangle%s (strokes may be incorrect)\n", name, - (long unsigned int)detriList.size(), + ulong(detriList.size()), (detriList.size() > 1) ? "s" : ""); } } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 979673fd736..64e7be5169c 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -32,6 +32,7 @@ #include "BKE_idprop.h" #include "BKE_layer.h" #include "BKE_lib_id.h" /* free_libblock */ +#include "BKE_main.h" #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_node.h" @@ -127,7 +128,8 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) view_layer->layflag = SCE_LAY_SOLID; // Camera - Object *object_camera = BKE_object_add(freestyle_bmain, view_layer, OB_CAMERA, nullptr); + Object *object_camera = BKE_object_add( + freestyle_bmain, freestyle_scene, view_layer, OB_CAMERA, nullptr); Camera *camera = (Camera *)object_camera->data; camera->type = CAM_ORTHO; @@ -185,9 +187,9 @@ float BlenderStrokeRenderer::get_stroke_vertex_z() const return -z; } -unsigned int BlenderStrokeRenderer::get_stroke_mesh_id() const +uint BlenderStrokeRenderer::get_stroke_mesh_id() const { - unsigned mesh_id = _mesh_id; + uint mesh_id = _mesh_id; BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this); self->_mesh_id--; return mesh_id; @@ -217,12 +219,12 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, break; } } + ma->nodetree = ntree; } else { - ntree = ntreeAddTree(nullptr, "stroke_shader", "ShaderNodeTree"); + ntree = ntreeAddTreeEmbedded(nullptr, &ma->id, "stroke_shader", "ShaderNodeTree"); } - ma->nodetree = ntree; - ma->use_nodes = 1; + ma->use_nodes = true; ma->blend_method = MA_BM_HASHED; bNode *input_attr_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_ATTRIBUTE); @@ -231,7 +233,7 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, storage = (NodeShaderAttribute *)input_attr_color->storage; BLI_strncpy(storage->name, "Color", sizeof(storage->name)); - bNode *mix_rgb_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_RGB); + bNode *mix_rgb_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_RGB_LEGACY); mix_rgb_color->custom1 = MA_RAMP_BLEND; // Mix mix_rgb_color->locx = 200.0f; mix_rgb_color->locy = -200.0f; @@ -245,7 +247,7 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, storage = (NodeShaderAttribute *)input_attr_alpha->storage; BLI_strncpy(storage->name, "Alpha", sizeof(storage->name)); - bNode *mix_rgb_alpha = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_RGB); + bNode *mix_rgb_alpha = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_RGB_LEGACY); mix_rgb_alpha->custom1 = MA_RAMP_BLEND; // Mix mix_rgb_alpha->locx = 600.0f; mix_rgb_alpha->locy = 300.0f; @@ -575,43 +577,36 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) mesh->totloop = group->totloop; mesh->totcol = group->materials.size(); - mesh->mvert = (MVert *)CustomData_add_layer( - &mesh->vdata, CD_MVERT, CD_CALLOC, nullptr, mesh->totvert); - mesh->medge = (MEdge *)CustomData_add_layer( - &mesh->edata, CD_MEDGE, CD_CALLOC, nullptr, mesh->totedge); - mesh->mpoly = (MPoly *)CustomData_add_layer( - &mesh->pdata, CD_MPOLY, CD_CALLOC, nullptr, mesh->totpoly); - mesh->mloop = (MLoop *)CustomData_add_layer( - &mesh->ldata, CD_MLOOP, CD_CALLOC, nullptr, mesh->totloop); - - MVert *vertices = mesh->mvert; - MEdge *edges = mesh->medge; - MPoly *polys = mesh->mpoly; - MLoop *loops = mesh->mloop; + MVert *verts = (MVert *)CustomData_add_layer( + &mesh->vdata, CD_MVERT, CD_SET_DEFAULT, nullptr, mesh->totvert); + MEdge *edges = (MEdge *)CustomData_add_layer( + &mesh->edata, CD_MEDGE, CD_SET_DEFAULT, nullptr, mesh->totedge); + MPoly *polys = (MPoly *)CustomData_add_layer( + &mesh->pdata, CD_MPOLY, CD_SET_DEFAULT, nullptr, mesh->totpoly); + MLoop *loops = (MLoop *)CustomData_add_layer( + &mesh->ldata, CD_MLOOP, CD_SET_DEFAULT, nullptr, mesh->totloop); + int *material_indices = (int *)CustomData_add_layer_named( + &mesh->pdata, CD_PROP_INT32, CD_SET_DEFAULT, nullptr, mesh->totpoly, "material_index"); MLoopUV *loopsuv[2] = {nullptr}; if (hasTex) { // First UV layer - CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, uvNames[0]); + loopsuv[0] = static_cast<MLoopUV *>(CustomData_add_layer_named( + &mesh->ldata, CD_MLOOPUV, CD_SET_DEFAULT, nullptr, mesh->totloop, uvNames[0])); CustomData_set_layer_active(&mesh->ldata, CD_MLOOPUV, 0); - BKE_mesh_update_customdata_pointers(mesh, true); - loopsuv[0] = mesh->mloopuv; // Second UV layer - CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, uvNames[1]); + loopsuv[1] = static_cast<MLoopUV *>(CustomData_add_layer_named( + &mesh->ldata, CD_MLOOPUV, CD_SET_DEFAULT, nullptr, mesh->totloop, uvNames[1])); CustomData_set_layer_active(&mesh->ldata, CD_MLOOPUV, 1); - BKE_mesh_update_customdata_pointers(mesh, true); - loopsuv[1] = mesh->mloopuv; } // colors and transparency (the latter represented by grayscale colors) MLoopCol *colors = (MLoopCol *)CustomData_add_layer_named( - &mesh->ldata, CD_PROP_BYTE_COLOR, CD_CALLOC, nullptr, mesh->totloop, "Color"); + &mesh->ldata, CD_PROP_BYTE_COLOR, CD_SET_DEFAULT, nullptr, mesh->totloop, "Color"); MLoopCol *transp = (MLoopCol *)CustomData_add_layer_named( - &mesh->ldata, CD_PROP_BYTE_COLOR, CD_CALLOC, nullptr, mesh->totloop, "Alpha"); - mesh->mloopcol = colors; + &mesh->ldata, CD_PROP_BYTE_COLOR, CD_SET_DEFAULT, nullptr, mesh->totloop, "Alpha"); + CustomData_set_layer_active(&mesh->ldata, CD_PROP_BYTE_COLOR, 0); mesh->mat = (Material **)MEM_mallocN(sizeof(Material *) * mesh->totcol, "MaterialList"); for (const auto item : group->materials.items()) { @@ -669,19 +664,19 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) else { if (!visible) { // first vertex - vertices->co[0] = svRep[0]->point2d()[0]; - vertices->co[1] = svRep[0]->point2d()[1]; - vertices->co[2] = get_stroke_vertex_z(); + verts->co[0] = svRep[0]->point2d()[0]; + verts->co[1] = svRep[0]->point2d()[1]; + verts->co[2] = get_stroke_vertex_z(); - ++vertices; + ++verts; ++vertex_index; // second vertex - vertices->co[0] = svRep[1]->point2d()[0]; - vertices->co[1] = svRep[1]->point2d()[1]; - vertices->co[2] = get_stroke_vertex_z(); + verts->co[0] = svRep[1]->point2d()[0]; + verts->co[1] = svRep[1]->point2d()[1]; + verts->co[2] = get_stroke_vertex_z(); - ++vertices; + ++verts; ++vertex_index; // first edge @@ -693,10 +688,10 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) visible = true; // vertex - vertices->co[0] = svRep[2]->point2d()[0]; - vertices->co[1] = svRep[2]->point2d()[1]; - vertices->co[2] = get_stroke_vertex_z(); - ++vertices; + verts->co[0] = svRep[2]->point2d()[0]; + verts->co[1] = svRep[2]->point2d()[1]; + verts->co[2] = get_stroke_vertex_z(); + ++verts; ++vertex_index; // edges @@ -713,7 +708,8 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) // poly polys->loopstart = loop_index; polys->totloop = 3; - polys->mat_nr = matnr; + *material_indices = matnr; + ++material_indices; ++polys; // Even and odd loops connect triangles vertices differently @@ -816,7 +812,7 @@ Object *BlenderStrokeRenderer::NewMesh() const { Object *ob; char name[MAX_ID_NAME]; - unsigned int mesh_id = get_stroke_mesh_id(); + uint mesh_id = get_stroke_mesh_id(); BLI_snprintf(name, MAX_ID_NAME, "0%08xOB", mesh_id); ob = BKE_object_add_only_object(freestyle_bmain, OB_MESH, name); diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index b7aae20a5ea..06365c3799f 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -596,7 +596,7 @@ void FRS_init_stroke_renderer(Render *re) controller->ResetRenderCount(); } -void FRS_begin_stroke_rendering(Render *UNUSED(re)) +void FRS_begin_stroke_rendering(Render * /*re*/) { } diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp index b12b189853c..30eece55d5f 100644 --- a/source/blender/freestyle/intern/geometry/Bezier.cpp +++ b/source/blender/freestyle/intern/geometry/Bezier.cpp @@ -50,7 +50,7 @@ void BezierCurveSegment::Build() y[3] = p0->y(); int nvertices = 12; - float increment = 1.0 / (float)nvertices; + float increment = 1.0 / float(nvertices); float t = 0.0f; for (int i = 0; i <= nvertices; ++i) { _Vertices.emplace_back((x[3] + t * (x[2] + t * (x[1] + t * x[0]))), diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp index 442087040bc..24ecacbad2a 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.cpp +++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp @@ -20,7 +20,7 @@ void FastGrid::clear() return; } - for (unsigned int i = 0; i < _cells_size; i++) { + for (uint i = 0; i < _cells_size; i++) { if (_cells[i]) { delete _cells[i]; } @@ -32,7 +32,7 @@ void FastGrid::clear() Grid::clear(); } -void FastGrid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb) +void FastGrid::configure(const Vec3r &orig, const Vec3r &size, uint nb) { Grid::configure(orig, size, nb); _cells_size = _cells_nb[0] * _cells_nb[1] * _cells_nb[2]; diff --git a/source/blender/freestyle/intern/geometry/FastGrid.h b/source/blender/freestyle/intern/geometry/FastGrid.h index 3d9ec6a64ca..b835e109faa 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.h +++ b/source/blender/freestyle/intern/geometry/FastGrid.h @@ -12,7 +12,7 @@ namespace Freestyle { /** Class to define a regular grid used for ray casting computations - * We don't use a hashtable here. The grid is explicitly stored for faster computations. + * We don't use a hash-table here. The grid is explicitly stored for faster computations. * However, this might result in significant increase in memory usage * (compared to the regular grid). */ @@ -31,7 +31,7 @@ class FastGrid : public Grid { /** * clears the grid - * Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells. + * Deletes all the cells, clears the hash-table, resets size, size of cell, number of cells. */ virtual void clear(); diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index eb53fd1257c..0d47665c6d3 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -12,6 +12,8 @@ #include "FitCurve.h" +#include "BLI_sys_types.h" + using namespace std; namespace Freestyle { @@ -45,7 +47,7 @@ static double V2SquaredLength(Vector2 *a) /* returns length of input vector */ static double V2Length(Vector2 *a) { - return (sqrt(V2SquaredLength(a))); + return sqrt(V2SquaredLength(a)); } static Vector2 *V2Scale(Vector2 *v, double newlen) @@ -69,7 +71,7 @@ static double V2DistanceBetween2Points(Vector2 *a, Vector2 *b) { double dx = (*a)[0] - (*b)[0]; double dy = (*a)[1] - (*b)[1]; - return (sqrt((dx * dx) + (dy * dy))); + return sqrt((dx * dx) + (dy * dy)); } /* return vector sum c = a+b */ @@ -273,7 +275,7 @@ static Vector2 BezierII(int degree, Vector2 *V, double t) Vector2 *Vtemp; /* Local copy of control points */ /* Copy array */ - Vtemp = (Vector2 *)malloc((unsigned)((degree + 1) * sizeof(Vector2))); + Vtemp = (Vector2 *)malloc(uint((degree + 1) * sizeof(Vector2))); for (i = 0; i <= degree; i++) { Vtemp[i] = V[i]; } @@ -376,7 +378,7 @@ static double *ChordLengthParameterize(Vector2 *d, int first, int last) int i; double *u; /* Parameterization */ - u = (double *)malloc((unsigned)(last - first + 1) * sizeof(double)); + u = (double *)malloc(uint(last - first + 1) * sizeof(double)); u[0] = 0.0; for (i = first + 1; i <= last; i++) { diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp index 116154650f3..db6816bf045 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp @@ -25,20 +25,22 @@ #include "BKE_global.h" +#include "BLI_sys_types.h" + using namespace std; namespace Freestyle { void GeomCleaner::SortIndexedVertexArray(const float *iVertices, - unsigned iVSize, - const unsigned *iIndices, - unsigned iISize, + uint iVSize, + const uint *iIndices, + uint iISize, float **oVertices, - unsigned **oIndices) + uint **oIndices) { // First, we build a list of IndexVertex: list<IndexedVertex> indexedVertices; - unsigned i; + uint i; for (i = 0; i < iVSize; i += 3) { indexedVertices.emplace_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3); } @@ -47,11 +49,11 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, indexedVertices.sort(); // build the indices mapping array: - unsigned *mapIndices = new unsigned[iVSize / 3]; + uint *mapIndices = new uint[iVSize / 3]; *oVertices = new float[iVSize]; list<IndexedVertex>::iterator iv; - unsigned newIndex = 0; - unsigned vIndex = 0; + uint newIndex = 0; + uint vIndex = 0; for (iv = indexedVertices.begin(); iv != indexedVertices.end(); iv++) { // Build the final results: (*oVertices)[vIndex] = iv->x(); @@ -64,7 +66,7 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, } // Build the final index array: - *oIndices = new unsigned[iISize]; + *oIndices = new uint[iISize]; for (i = 0; i < iISize; i++) { (*oIndices)[i] = 3 * mapIndices[iIndices[i] / 3]; } @@ -73,21 +75,21 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, } void GeomCleaner::CompressIndexedVertexArray(const float *iVertices, - unsigned iVSize, - const unsigned *iIndices, - unsigned iISize, + uint iVSize, + const uint *iIndices, + uint iISize, float **oVertices, - unsigned *oVSize, - unsigned **oIndices) + uint *oVSize, + uint **oIndices) { // First, we build a list of IndexVertex: vector<Vec3f> vertices; - unsigned i; + uint i; for (i = 0; i < iVSize; i += 3) { vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]); } - unsigned *mapVertex = new unsigned[iVSize]; + uint *mapVertex = new uint[iVSize]; vector<Vec3f>::iterator v = vertices.begin(); vector<Vec3f> compressedVertices; @@ -123,7 +125,7 @@ void GeomCleaner::CompressIndexedVertexArray(const float *iVertices, } // Map the index array: - *oIndices = new unsigned[iISize]; + *oIndices = new uint[iISize]; for (i = 0; i < iISize; i++) { (*oIndices)[i] = 3 * mapVertex[iIndices[i] / 3]; } @@ -132,16 +134,16 @@ void GeomCleaner::CompressIndexedVertexArray(const float *iVertices, } void GeomCleaner::SortAndCompressIndexedVertexArray(const float *iVertices, - unsigned iVSize, - const unsigned *iIndices, - unsigned iISize, + uint iVSize, + const uint *iIndices, + uint iISize, float **oVertices, - unsigned *oVSize, - unsigned **oIndices) + uint *oVSize, + uint **oIndices) { // tmp arrays used to store the sorted data: float *tmpVertices; - unsigned *tmpIndices; + uint *tmpIndices; Chronometer chrono; // Sort data @@ -172,35 +174,35 @@ struct GeomCleanerHasher { #define _MOD 2147483647UL inline size_t operator()(const Vec3r &p) const { - size_t res = ((unsigned long)(p[0] * _MUL)) % _MOD; - res = ((res + (unsigned long)(p[1]) * _MUL)) % _MOD; - return ((res + (unsigned long)(p[2]) * _MUL)) % _MOD; + size_t res = ulong(p[0] * _MUL) % _MOD; + res = (res + ulong(p[1]) * _MUL) % _MOD; + return (res + ulong(p[2]) * _MUL) % _MOD; } #undef _MUL #undef _MOD }; void GeomCleaner::CleanIndexedVertexArray(const float *iVertices, - unsigned iVSize, - const unsigned *iIndices, - unsigned iISize, + uint iVSize, + const uint *iIndices, + uint iISize, float **oVertices, - unsigned *oVSize, - unsigned **oIndices) + uint *oVSize, + uint **oIndices) { - using cleanHashTable = map<Vec3f, unsigned>; + using cleanHashTable = map<Vec3f, uint>; vector<Vec3f> vertices; - unsigned i; + uint i; for (i = 0; i < iVSize; i += 3) { vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]); } cleanHashTable ht; - vector<unsigned> newIndices; + vector<uint> newIndices; vector<Vec3f> newVertices; // elimination of needless points - unsigned currentIndex = 0; + uint currentIndex = 0; vector<Vec3f>::const_iterator v = vertices.begin(); vector<Vec3f>::const_iterator end = vertices.end(); cleanHashTable::const_iterator found; @@ -230,7 +232,7 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices, } // map new indices: - *oIndices = new unsigned[iISize]; + *oIndices = new uint[iISize]; for (i = 0; i < iISize; i++) { (*oIndices)[i] = 3 * newIndices[iIndices[i] / 3]; } diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp index ca1fb63ec64..b8beeed5880 100644 --- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp +++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp @@ -7,10 +7,12 @@ #include "GeomUtils.h" +#include "BLI_sys_types.h" + namespace Freestyle::GeomUtils { // This internal procedure is defined below. -bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n); +bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, uint n); bool intersect2dSeg2dArea(const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B) { @@ -607,9 +609,9 @@ void transformVertex(const Vec3r &vert, const Matrix44r &matrix, Vec3r &res) { HVec3r hvert(vert), res_tmp; real scale; - for (unsigned int j = 0; j < 4; j++) { + for (uint j = 0; j < 4; j++) { scale = hvert[j]; - for (unsigned int i = 0; i < 4; i++) { + for (uint i = 0; i < 4; i++) { res_tmp[i] += matrix(i, j) * scale; } } @@ -631,9 +633,9 @@ void transformVertices(const vector<Vec3r> &vertices, const Matrix44r &trans, ve Vec3r rotateVector(const Matrix44r &mat, const Vec3r &v) { Vec3r res; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { res[i] = 0; - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { res[i] += mat(i, j) * v[j]; } } @@ -718,9 +720,9 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4] model_view_matrix[1][3], model_view_matrix[2][3], }; - for (unsigned short i = 0; i < 3; i++) { + for (ushort i = 0; i < 3; i++) { q[i] = 0.0; - for (unsigned short j = 0; j < 3; j++) { + for (ushort j = 0; j < 3; j++) { q[i] += model_view_matrix[j][i] * (p[j] - translation[j]); } } @@ -739,7 +741,7 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4] #define PERP(u, v) ((u)[0] * (v)[1] - (u)[1] * (v)[0]) // 2D perp product -inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n) +inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, uint n) { if (seg[0] == seg[1]) { return false; @@ -751,7 +753,7 @@ inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n) Vec2r dseg = seg[1] - seg[0]; // the segment direction vector Vec2r e; // edge vector - for (unsigned int i = 0; i < n; i++) { // process polygon edge poly[i]poly[i+1] + for (uint i = 0; i < n; i++) { // process polygon edge poly[i]poly[i+1] e = poly[i + 1] - poly[i]; N = PERP(e, seg[0] - poly[i]); D = -PERP(e, dseg); @@ -790,7 +792,7 @@ inline bool overlapPlaneBox(Vec3r &normal, real d, Vec3r &maxbox) { Vec3r vmin, vmax; - for (unsigned int q = X; q <= Z; q++) { + for (uint q = X; q <= Z; q++) { if (normal[q] > 0.0f) { vmin[q] = -maxbox[q]; vmax[q] = maxbox[q]; @@ -814,8 +816,8 @@ inline void fromCoordAToCoordB(const Vec3r &p, Vec3r &q, const real transform[4] HVec3r hp(p); HVec3r hq(0, 0, 0, 0); - for (unsigned int i = 0; i < 4; i++) { - for (unsigned int j = 0; j < 4; j++) { + for (uint i = 0; i < 4; i++) { + for (uint j = 0; j < 4; j++) { hq[i] += transform[i][j] * hp[j]; } } @@ -825,7 +827,7 @@ inline void fromCoordAToCoordB(const Vec3r &p, Vec3r &q, const real transform[4] return; } - for (unsigned int k = 0; k < 3; k++) { + for (uint k = 0; k < 3; k++) { q[k] = hq[k] / hq[3]; } } diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp index 2b2272959e4..a2620aa25d7 100644 --- a/source/blender/freestyle/intern/geometry/Grid.cpp +++ b/source/blender/freestyle/intern/geometry/Grid.cpp @@ -36,7 +36,7 @@ void firstIntersectionGridVisitor::examineOccluder(Polygon3r *occ) // check whether the edge and the polygon plane are coincident: //------------------------------------------------------------- // first let us compute the plane equation. - Vec3r v1(((occ)->getVertices())[0]); + Vec3r v1((occ)->getVertices()[0]); Vec3d normal((occ)->getNormal()); // soc unused - double d = -(v1 * normal); @@ -93,7 +93,7 @@ void Grid::clear() //_ray_occluders.clear(); } -void Grid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb) +void Grid::configure(const Vec3r &orig, const Vec3r &size, uint nb) { _orig = orig; Vec3r tmpSize = size; @@ -125,9 +125,9 @@ void Grid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb) real edge = pow(cell_vol, 1.0 / 3.0); // We compute the number of cells par edge such as we cover at least the whole box. - unsigned i; + uint i; for (i = 0; i < 3; i++) { - _cells_nb[i] = (unsigned)floor(tmpSize[i] / edge) + 1; + _cells_nb[i] = uint(floor(tmpSize[i] / edge)) + 1; } _size = tmpSize; @@ -161,7 +161,7 @@ void Grid::insertOccluder(Polygon3r *occluder) // overlapping with the triangle in order to only fill in the ones really overlapping the // triangle. - unsigned i, x, y, z; + uint i, x, y, z; vector<Vec3r>::const_iterator it; Vec3u coord; @@ -225,10 +225,10 @@ bool Grid::nextRayCell(Vec3u ¤t_cell, Vec3u &next_cell) { next_cell = current_cell; real t_min, t; - unsigned i; + uint i; - t_min = FLT_MAX; // init tmin with handle of the case where one or 2 _u[i] = 0. - unsigned coord = 0; // predominant coord(0=x, 1=y, 2=z) + t_min = FLT_MAX; // init tmin with handle of the case where one or 2 _u[i] = 0. + uint coord = 0; // predominant coord(0=x, 1=y, 2=z) // using a parametric equation of a line : B = A + t u, we find the tx, ty and tz respectively // corresponding to the intersections with the plans: @@ -280,10 +280,7 @@ bool Grid::nextRayCell(Vec3u ¤t_cell, Vec3u &next_cell) return true; } -void Grid::castRay(const Vec3r &orig, - const Vec3r &end, - OccludersSet &occluders, - unsigned timestamp) +void Grid::castRay(const Vec3r &orig, const Vec3r &end, OccludersSet &occluders, uint timestamp) { initRay(orig, end, timestamp); allOccludersGridVisitor visitor(occluders); @@ -293,7 +290,7 @@ void Grid::castRay(const Vec3r &orig, void Grid::castInfiniteRay(const Vec3r &orig, const Vec3r &dir, OccludersSet &occluders, - unsigned timestamp) + uint timestamp) { Vec3r end = Vec3r(orig + FLT_MAX * dir / dir.norm()); bool inter = initInfiniteRay(orig, dir, timestamp); @@ -305,7 +302,7 @@ void Grid::castInfiniteRay(const Vec3r &orig, } Polygon3r *Grid::castRayToFindFirstIntersection( - const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, unsigned timestamp) + const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, uint timestamp) { Polygon3r *occluder = nullptr; Vec3r end = Vec3r(orig + FLT_MAX * dir / dir.norm()); @@ -325,7 +322,7 @@ Polygon3r *Grid::castRayToFindFirstIntersection( return occluder; } -void Grid::initRay(const Vec3r &orig, const Vec3r &end, unsigned timestamp) +void Grid::initRay(const Vec3r &orig, const Vec3r &end, uint timestamp) { _ray_dir = end - orig; _t_end = _ray_dir.norm(); @@ -333,15 +330,15 @@ void Grid::initRay(const Vec3r &orig, const Vec3r &end, unsigned timestamp) _ray_dir.normalize(); _timestamp = timestamp; - for (unsigned i = 0; i < 3; i++) { - _current_cell[i] = (unsigned)floor((orig[i] - _orig[i]) / _cell_size[i]); + for (uint i = 0; i < 3; i++) { + _current_cell[i] = uint(floor((orig[i] - _orig[i]) / _cell_size[i])); // soc unused - unsigned u = _current_cell[i]; _pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i]; } //_ray_occluders.clear(); } -bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timestamp) +bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, uint timestamp) { _ray_dir = dir; _t_end = FLT_MAX; @@ -354,8 +351,8 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta Vec3r boxMax(_orig + _size); BBox<Vec3r> box(boxMin, boxMax); if (box.inside(orig)) { - for (unsigned int i = 0; i < 3; i++) { - _current_cell[i] = (unsigned int)floor((orig[i] - _orig[i]) / _cell_size[i]); + for (uint i = 0; i < 3; i++) { + _current_cell[i] = uint(floor((orig[i] - _orig[i]) / _cell_size[i])); // soc unused - unsigned u = _current_cell[i]; _pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i]; } @@ -366,8 +363,8 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta if (GeomUtils::intersectRayBBox(orig, _ray_dir, boxMin, boxMax, 0, _t_end, tmin, tmax)) { BLI_assert(tmin != -1.0); Vec3r newOrig = orig + tmin * _ray_dir; - for (unsigned int i = 0; i < 3; i++) { - _current_cell[i] = (unsigned)floor((newOrig[i] - _orig[i]) / _cell_size[i]); + for (uint i = 0; i < 3; i++) { + _current_cell[i] = uint(floor((newOrig[i] - _orig[i]) / _cell_size[i])); if (_current_cell[i] == _cells_nb[i]) { _current_cell[i] = _cells_nb[i] - 1; } diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h index c25594e620f..d66982eef52 100644 --- a/source/blender/freestyle/intern/geometry/Grid.h +++ b/source/blender/freestyle/intern/geometry/Grid.h @@ -187,7 +187,7 @@ class Grid { } /** clears the grid - * Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells. + * Deletes all the cells, clears the hash-table, resets size, size of cell, number of cells. */ virtual void clear(); diff --git a/source/blender/freestyle/intern/geometry/HashGrid.cpp b/source/blender/freestyle/intern/geometry/HashGrid.cpp index c86aa4fd22c..46ce9184951 100644 --- a/source/blender/freestyle/intern/geometry/HashGrid.cpp +++ b/source/blender/freestyle/intern/geometry/HashGrid.cpp @@ -7,6 +7,8 @@ #include "HashGrid.h" +#include "BLI_sys_types.h" + namespace Freestyle { void HashGrid::clear() @@ -22,7 +24,7 @@ void HashGrid::clear() Grid::clear(); } -void HashGrid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb) +void HashGrid::configure(const Vec3r &orig, const Vec3r &size, uint nb) { Grid::configure(orig, size, nb); } diff --git a/source/blender/freestyle/intern/geometry/HashGrid.h b/source/blender/freestyle/intern/geometry/HashGrid.h index b08334d3474..18eeb579d07 100644 --- a/source/blender/freestyle/intern/geometry/HashGrid.h +++ b/source/blender/freestyle/intern/geometry/HashGrid.h @@ -52,7 +52,7 @@ class HashGrid : public Grid { } /** clears the grid - * Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells. + * Deletes all the cells, clears the hash-table, resets size, size of cell, number of cells. */ virtual void clear(); diff --git a/source/blender/freestyle/intern/geometry/Noise.cpp b/source/blender/freestyle/intern/geometry/Noise.cpp index d8a09bd8ab7..04e271f7a5b 100644 --- a/source/blender/freestyle/intern/geometry/Noise.cpp +++ b/source/blender/freestyle/intern/geometry/Noise.cpp @@ -12,6 +12,7 @@ #include "BLI_compiler_attrs.h" #include "BLI_rand.h" +#include "BLI_sys_types.h" #include "Noise.h" @@ -45,7 +46,7 @@ namespace Freestyle { (t) = (i) + (N); \ (r0) = modff((t), &(u)); \ (r1) = (r0)-1.0; \ - (b0) = ((int)(u)) & BM; \ + (b0) = int(u) & BM; \ (b1) = ((b0) + 1) & BM; \ } \ (void)0 @@ -69,7 +70,7 @@ static void normalize3(float v[3]) v[2] = v[2] / s; } -float Noise::turbulence1(float arg, float freq, float amp, unsigned oct) +float Noise::turbulence1(float arg, float freq, float amp, uint oct) { float t; float vec; @@ -81,7 +82,7 @@ float Noise::turbulence1(float arg, float freq, float amp, unsigned oct) return t; } -float Noise::turbulence2(Vec2f &v, float freq, float amp, unsigned oct) +float Noise::turbulence2(Vec2f &v, float freq, float amp, uint oct) { float t; Vec2f vec; @@ -94,7 +95,7 @@ float Noise::turbulence2(Vec2f &v, float freq, float amp, unsigned oct) return t; } -float Noise::turbulence3(Vec3f &v, float freq, float amp, unsigned oct) +float Noise::turbulence3(Vec3f &v, float freq, float amp, uint oct) { float t; Vec3f vec; @@ -229,15 +230,15 @@ Noise::Noise(long seed) for (i = 0; i < _NOISE_B; i++) { p[i] = i; - g1[i] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B; + g1[i] = float((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B; for (j = 0; j < 2; j++) { - g2[i][j] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B; + g2[i][j] = float((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B; } normalize2(g2[i]); for (j = 0; j < 3; j++) { - g3[i][j] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B; + g3[i][j] = float((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B; } normalize3(g3[i]); } diff --git a/source/blender/freestyle/intern/image/GaussianFilter.cpp b/source/blender/freestyle/intern/image/GaussianFilter.cpp index 7e523311d4c..421b739197b 100644 --- a/source/blender/freestyle/intern/image/GaussianFilter.cpp +++ b/source/blender/freestyle/intern/image/GaussianFilter.cpp @@ -46,7 +46,7 @@ GaussianFilter::~GaussianFilter() int GaussianFilter::computeMaskSize(float sigma) { - int maskSize = (int)floor(4 * sigma) + 1; + int maskSize = int(floor(4 * sigma)) + 1; if (0 == (maskSize % 2)) { ++maskSize; } diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp index 2a555a22915..bc68d17a1f9 100644 --- a/source/blender/freestyle/intern/image/ImagePyramid.cpp +++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp @@ -11,6 +11,8 @@ #include "Image.h" #include "ImagePyramid.h" +#include "BLI_sys_types.h" + using namespace std; namespace Freestyle { @@ -54,9 +56,9 @@ float ImagePyramid::pixel(int x, int y, int level) if (0 == level) { return img->pixel(x, y); } - unsigned int i = 1 << level; - unsigned int sx = x >> level; - unsigned int sy = y >> level; + uint i = 1 << level; + uint sx = x >> level; + uint sy = y >> level; if (sx >= img->width()) { sx = img->width() - 1; } @@ -96,7 +98,7 @@ float ImagePyramid::pixel(int x, int y, int level) else { P2 = P1; } - return (1.0f / (float)(1 << (2 * level))) * (C * P1 + D * P2); + return (1.0f / float(1 << (2 * level))) * (C * P1 + D * P2); } int ImagePyramid::width(int level) @@ -109,13 +111,13 @@ int ImagePyramid::height(int level) return _levels[level]->height(); } -GaussianPyramid::GaussianPyramid(const GrayImage &level0, unsigned nbLevels, float iSigma) +GaussianPyramid::GaussianPyramid(const GrayImage &level0, uint nbLevels, float iSigma) { _sigma = iSigma; BuildPyramid(level0, nbLevels); } -GaussianPyramid::GaussianPyramid(GrayImage *level0, unsigned nbLevels, float iSigma) +GaussianPyramid::GaussianPyramid(GrayImage *level0, uint nbLevels, float iSigma) { _sigma = iSigma; BuildPyramid(level0, nbLevels); @@ -126,27 +128,27 @@ GaussianPyramid::GaussianPyramid(const GaussianPyramid &iBrother) : ImagePyramid _sigma = iBrother._sigma; } -void GaussianPyramid::BuildPyramid(const GrayImage &level0, unsigned nbLevels) +void GaussianPyramid::BuildPyramid(const GrayImage &level0, uint nbLevels) { GrayImage *pLevel = new GrayImage(level0); BuildPyramid(pLevel, nbLevels); } -void GaussianPyramid::BuildPyramid(GrayImage *level0, unsigned nbLevels) +void GaussianPyramid::BuildPyramid(GrayImage *level0, uint nbLevels) { GrayImage *pLevel = level0; _levels.push_back(pLevel); GaussianFilter gf(_sigma); // build the nbLevels: - unsigned w = pLevel->width(); - unsigned h = pLevel->height(); + uint w = pLevel->width(); + uint h = pLevel->height(); if (nbLevels != 0) { - for (unsigned int i = 0; i < nbLevels; ++i) { // soc + for (uint i = 0; i < nbLevels; ++i) { // soc w = pLevel->width() >> 1; h = pLevel->height() >> 1; GrayImage *img = new GrayImage(w, h); - for (unsigned int y = 0; y < h; ++y) { - for (unsigned int x = 0; x < w; ++x) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x) { float v = gf.getSmoothedPixel<GrayImage>(pLevel, 2 * x, 2 * y); img->setPixel(x, y, v); } @@ -160,8 +162,8 @@ void GaussianPyramid::BuildPyramid(GrayImage *level0, unsigned nbLevels) w = pLevel->width() >> 1; h = pLevel->height() >> 1; GrayImage *img = new GrayImage(w, h); - for (unsigned int y = 0; y < h; ++y) { - for (unsigned int x = 0; x < w; ++x) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x) { float v = gf.getSmoothedPixel<GrayImage>(pLevel, 2 * x, 2 * y); img->setPixel(x, y, v); } diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp index 6669c021f27..6b23565a23e 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp @@ -120,7 +120,7 @@ PyDoc_STRVAR(BinaryPredicate0D_name_doc, "\n" ":type: str"); -static PyObject *BinaryPredicate0D_name_get(BPy_BinaryPredicate0D *self, void *UNUSED(closure)) +static PyObject *BinaryPredicate0D_name_get(BPy_BinaryPredicate0D *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index 496900a712b..9e3e5979871 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -155,7 +155,7 @@ PyDoc_STRVAR(BinaryPredicate1D_name_doc, "\n" ":type: str"); -static PyObject *BinaryPredicate1D_name_get(BPy_BinaryPredicate1D *self, void *UNUSED(closure)) +static PyObject *BinaryPredicate1D_name_get(BPy_BinaryPredicate1D *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp index 16b08722fb2..d79c2f4d9b0 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp @@ -9,6 +9,8 @@ #include "../stroke/ContextFunctions.h" +#include "BLI_sys_types.h" + using namespace Freestyle; #ifdef __cplusplus @@ -98,7 +100,7 @@ static PyObject *ContextFunctions_load_map(PyObject * /*self*/, PyObject *args, { static const char *kwlist[] = {"file_name", "map_name", "num_levels", "sigma", nullptr}; char *fileName, *mapName; - unsigned nbLevels = 4; + uint nbLevels = 4; float sigma = 1.0; if (!PyArg_ParseTupleAndKeywords( @@ -135,7 +137,7 @@ static PyObject *ContextFunctions_read_map_pixel(PyObject * /*self*/, static const char *kwlist[] = {"map_name", "level", "x", "y", nullptr}; char *mapName; int level; - unsigned x, y; + uint x, y; if (!PyArg_ParseTupleAndKeywords( args, kwds, "siII", (char **)kwlist, &mapName, &level, &x, &y)) { @@ -167,7 +169,7 @@ static PyObject *ContextFunctions_read_complete_view_map_pixel(PyObject * /*self { static const char *kwlist[] = {"level", "x", "y", nullptr}; int level; - unsigned x, y; + uint x, y; if (!PyArg_ParseTupleAndKeywords(args, kwds, "iII", (char **)kwlist, &level, &x, &y)) { return nullptr; @@ -201,7 +203,7 @@ static PyObject *ContextFunctions_read_directional_view_map_pixel(PyObject * /*s { static const char *kwlist[] = {"orientation", "level", "x", "y", nullptr}; int orientation, level; - unsigned x, y; + uint x, y; if (!PyArg_ParseTupleAndKeywords( args, kwds, "iiII", (char **)kwlist, &orientation, &level, &x, &y)) { diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 02ed3f463c7..0701b1c4ef3 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -236,7 +236,7 @@ PyObject *BPy_FEdge_from_FEdge(FEdge &fe) return py_fe; } -PyObject *BPy_Nature_from_Nature(unsigned short n) +PyObject *BPy_Nature_from_Nature(ushort n) { PyObject *args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index 96bab8c2028..237f1802026 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -200,7 +200,7 @@ static PyObject *Freestyle_evaluateColorRamp(PyObject * /*self*/, PyObject *args ColorBand *coba; float in, out[4]; - if (!(PyArg_ParseTuple(args, "O!f", &pyrna_struct_Type, &py_srna, &in))) { + if (!PyArg_ParseTuple(args, "O!f", &pyrna_struct_Type, &py_srna, &in)) { return nullptr; } if (!RNA_struct_is_a(py_srna->ptr.type, &RNA_ColorRamp)) { @@ -239,7 +239,7 @@ static PyObject *Freestyle_evaluateCurveMappingF(PyObject * /*self*/, PyObject * int cur; float value; - if (!(PyArg_ParseTuple(args, "O!if", &pyrna_struct_Type, &py_srna, &cur, &value))) { + if (!PyArg_ParseTuple(args, "O!if", &pyrna_struct_Type, &py_srna, &cur, &value)) { return nullptr; } if (!RNA_struct_is_a(py_srna->ptr.type, &RNA_CurveMapping)) { @@ -531,7 +531,7 @@ PyObject *Freestyle_Init(void) const char *const path = BKE_appdir_folder_id(BLENDER_SYSTEM_SCRIPTS, "freestyle"); if (path) { char modpath[FILE_MAX]; - BLI_join_dirfile(modpath, sizeof(modpath), path, "modules"); + BLI_path_join(modpath, sizeof(modpath), path, "modules"); PyObject *sys_path = PySys_GetObject("path"); /* borrow */ PyObject *py_modpath = PyUnicode_FromString(modpath); PyList_Append(sys_path, py_modpath); diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index bd37e84761e..7f71bbf1fdd 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -282,7 +282,7 @@ static Mathutils_Callback FrsMaterial_mathutils_cb = { FrsMaterial_mathutils_set_index, }; -static unsigned char FrsMaterial_mathutils_cb_index = -1; +static uchar FrsMaterial_mathutils_cb_index = -1; void FrsMaterial_mathutils_register_callback() { @@ -296,13 +296,13 @@ PyDoc_STRVAR(FrsMaterial_line_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *FrsMaterial_line_get(BPy_FrsMaterial *self, void *UNUSED(closure)) +static PyObject *FrsMaterial_line_get(BPy_FrsMaterial *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_LINE); } -static int FrsMaterial_line_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) +static int FrsMaterial_line_set(BPy_FrsMaterial *self, PyObject *value, void * /*closure*/) { float color[4]; if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { @@ -317,13 +317,13 @@ PyDoc_STRVAR(FrsMaterial_diffuse_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *FrsMaterial_diffuse_get(BPy_FrsMaterial *self, void *UNUSED(closure)) +static PyObject *FrsMaterial_diffuse_get(BPy_FrsMaterial *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_DIFFUSE); } -static int FrsMaterial_diffuse_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) +static int FrsMaterial_diffuse_set(BPy_FrsMaterial *self, PyObject *value, void * /*closure*/) { float color[4]; if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { @@ -338,13 +338,13 @@ PyDoc_STRVAR(FrsMaterial_specular_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *FrsMaterial_specular_get(BPy_FrsMaterial *self, void *UNUSED(closure)) +static PyObject *FrsMaterial_specular_get(BPy_FrsMaterial *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_SPECULAR); } -static int FrsMaterial_specular_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) +static int FrsMaterial_specular_set(BPy_FrsMaterial *self, PyObject *value, void * /*closure*/) { float color[4]; if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { @@ -359,13 +359,13 @@ PyDoc_STRVAR(FrsMaterial_ambient_doc, "\n" ":type: :class:`mathutils.Color`"); -static PyObject *FrsMaterial_ambient_get(BPy_FrsMaterial *self, void *UNUSED(closure)) +static PyObject *FrsMaterial_ambient_get(BPy_FrsMaterial *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_AMBIENT); } -static int FrsMaterial_ambient_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) +static int FrsMaterial_ambient_set(BPy_FrsMaterial *self, PyObject *value, void * /*closure*/) { float color[4]; if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { @@ -380,13 +380,13 @@ PyDoc_STRVAR(FrsMaterial_emission_doc, "\n" ":type: :class:`mathutils.Color`"); -static PyObject *FrsMaterial_emission_get(BPy_FrsMaterial *self, void *UNUSED(closure)) +static PyObject *FrsMaterial_emission_get(BPy_FrsMaterial *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_EMISSION); } -static int FrsMaterial_emission_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) +static int FrsMaterial_emission_set(BPy_FrsMaterial *self, PyObject *value, void * /*closure*/) { float color[4]; if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { @@ -401,12 +401,12 @@ PyDoc_STRVAR(FrsMaterial_shininess_doc, "\n" ":type: float"); -static PyObject *FrsMaterial_shininess_get(BPy_FrsMaterial *self, void *UNUSED(closure)) +static PyObject *FrsMaterial_shininess_get(BPy_FrsMaterial *self, void * /*closure*/) { return PyFloat_FromDouble(self->m->shininess()); } -static int FrsMaterial_shininess_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) +static int FrsMaterial_shininess_set(BPy_FrsMaterial *self, PyObject *value, void * /*closure*/) { float scalar; if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { @@ -423,12 +423,12 @@ PyDoc_STRVAR(FrsMaterial_priority_doc, "\n" ":type: int"); -static PyObject *FrsMaterial_priority_get(BPy_FrsMaterial *self, void *UNUSED(closure)) +static PyObject *FrsMaterial_priority_get(BPy_FrsMaterial *self, void * /*closure*/) { return PyLong_FromLong(self->m->priority()); } -static int FrsMaterial_priority_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) +static int FrsMaterial_priority_set(BPy_FrsMaterial *self, PyObject *value, void * /*closure*/) { int scalar; if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { @@ -517,7 +517,7 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, static Py_hash_t FrsMaterial_hash(PyObject *self) { - return (Py_uhash_t)BLI_hash_mm2((const unsigned char *)self, sizeof(*self), 0); + return (Py_uhash_t)BLI_hash_mm2((const uchar *)self, sizeof(*self), 0); } /*-----------------------BPy_FrsMaterial type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 5bdc8ce16e8..684edb26a97 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -9,6 +9,8 @@ #include "../system/RandGen.h" +#include "BLI_sys_types.h" + #include <sstream> #ifdef __cplusplus @@ -109,7 +111,7 @@ static PyObject *FrsNoise_turbulence_smooth(BPy_FrsNoise *self, PyObject *args, static const char *kwlist[] = {"v", "oct", nullptr}; double x; // NOTE: this has to be a double (not float) - unsigned nbOctaves = 8; + uint nbOctaves = 8; if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|I", (char **)kwlist, &x, &nbOctaves)) { return nullptr; @@ -121,7 +123,7 @@ static PyObject *FrsNoise_turbulence1(BPy_FrsNoise *self, PyObject *args, PyObje { static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; float f1, f2, f3; - unsigned int i = 4; + uint i = 4; if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|I", (char **)kwlist, &f1, &f2, &f3, &i)) { return nullptr; @@ -150,7 +152,7 @@ static PyObject *FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObje static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; - unsigned int i = 4; + uint i = 4; Vec2f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { @@ -186,7 +188,7 @@ static PyObject *FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObje static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; - unsigned int i = 4; + uint i = 4; Vec3f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { diff --git a/source/blender/freestyle/intern/python/BPy_Id.cpp b/source/blender/freestyle/intern/python/BPy_Id.cpp index fd665f56189..66880d6185c 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.cpp +++ b/source/blender/freestyle/intern/python/BPy_Id.cpp @@ -97,7 +97,7 @@ static PyObject *Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) case Py_GT: return PyBool_from_bool(!(o1->id->operator<(*(o2->id)) || o1->id->operator==(*(o2->id)))); case Py_GE: - return PyBool_from_bool(!(o1->id->operator<(*(o2->id)))); + return PyBool_from_bool(!o1->id->operator<(*(o2->id))); } Py_RETURN_NONE; } @@ -109,12 +109,12 @@ PyDoc_STRVAR(Id_first_doc, "\n" ":type: int"); -static PyObject *Id_first_get(BPy_Id *self, void *UNUSED(closure)) +static PyObject *Id_first_get(BPy_Id *self, void * /*closure*/) { return PyLong_FromLong(self->id->getFirst()); } -static int Id_first_set(BPy_Id *self, PyObject *value, void *UNUSED(closure)) +static int Id_first_set(BPy_Id *self, PyObject *value, void * /*closure*/) { int scalar; if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { @@ -130,12 +130,12 @@ PyDoc_STRVAR(Id_second_doc, "\n" ":type: int"); -static PyObject *Id_second_get(BPy_Id *self, void *UNUSED(closure)) +static PyObject *Id_second_get(BPy_Id *self, void * /*closure*/) { return PyLong_FromLong(self->id->getSecond()); } -static int Id_second_set(BPy_Id *self, PyObject *value, void *UNUSED(closure)) +static int Id_second_set(BPy_Id *self, PyObject *value, void * /*closure*/) { int scalar; if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index fc7581a93c0..711cf9c6bab 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -12,6 +12,8 @@ #include "UnaryFunction0D/BPy_UnaryFunction0DFloat.h" #include "UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -82,8 +84,8 @@ static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObj return PyFloat_FromDouble(res); } if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { - UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; - unsigned int res = integrate(*fun, it, it_end, t); + UnaryFunction0D<uint> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; + uint res = integrate(*fun, it, it_end, t); return PyLong_FromLong(res); } diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp index c87e58e954b..083fdbf58db 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp @@ -159,7 +159,7 @@ PyDoc_STRVAR(Interface0D_name_doc, "\n" ":type: str"); -static PyObject *Interface0D_name_get(BPy_Interface0D *self, void *UNUSED(closure)) +static PyObject *Interface0D_name_get(BPy_Interface0D *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } @@ -169,7 +169,7 @@ PyDoc_STRVAR(Interface0D_point_3d_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *Interface0D_point_3d_get(BPy_Interface0D *self, void *UNUSED(closure)) +static PyObject *Interface0D_point_3d_get(BPy_Interface0D *self, void * /*closure*/) { Vec3f p(self->if0D->getPoint3D()); if (PyErr_Occurred()) { @@ -183,7 +183,7 @@ PyDoc_STRVAR(Interface0D_projected_x_doc, "\n" ":type: float"); -static PyObject *Interface0D_projected_x_get(BPy_Interface0D *self, void *UNUSED(closure)) +static PyObject *Interface0D_projected_x_get(BPy_Interface0D *self, void * /*closure*/) { real x = self->if0D->getProjectedX(); if (PyErr_Occurred()) { @@ -197,7 +197,7 @@ PyDoc_STRVAR(Interface0D_projected_y_doc, "\n" ":type: float"); -static PyObject *Interface0D_projected_y_get(BPy_Interface0D *self, void *UNUSED(closure)) +static PyObject *Interface0D_projected_y_get(BPy_Interface0D *self, void * /*closure*/) { real y = self->if0D->getProjectedY(); if (PyErr_Occurred()) { @@ -211,7 +211,7 @@ PyDoc_STRVAR(Interface0D_projected_z_doc, "\n" ":type: float"); -static PyObject *Interface0D_projected_z_get(BPy_Interface0D *self, void *UNUSED(closure)) +static PyObject *Interface0D_projected_z_get(BPy_Interface0D *self, void * /*closure*/) { real z = self->if0D->getProjectedZ(); if (PyErr_Occurred()) { @@ -225,7 +225,7 @@ PyDoc_STRVAR(Interface0D_point_2d_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *Interface0D_point_2d_get(BPy_Interface0D *self, void *UNUSED(closure)) +static PyObject *Interface0D_point_2d_get(BPy_Interface0D *self, void * /*closure*/) { Vec2f p(self->if0D->getPoint2D()); if (PyErr_Occurred()) { @@ -239,7 +239,7 @@ PyDoc_STRVAR(Interface0D_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *Interface0D_id_get(BPy_Interface0D *self, void *UNUSED(closure)) +static PyObject *Interface0D_id_get(BPy_Interface0D *self, void * /*closure*/) { Id id(self->if0D->getId()); if (PyErr_Occurred()) { @@ -253,7 +253,7 @@ PyDoc_STRVAR(Interface0D_nature_doc, "\n" ":type: :class:`Nature`"); -static PyObject *Interface0D_nature_get(BPy_Interface0D *self, void *UNUSED(closure)) +static PyObject *Interface0D_nature_get(BPy_Interface0D *self, void * /*closure*/) { Nature::VertexNature nature = self->if0D->getNature(); if (PyErr_Occurred()) { diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index fbe81d26e79..d636fb4e6b8 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -234,7 +234,7 @@ PyDoc_STRVAR(Interface1D_name_doc, "\n" ":type: str"); -static PyObject *Interface1D_name_get(BPy_Interface1D *self, void *UNUSED(closure)) +static PyObject *Interface1D_name_get(BPy_Interface1D *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } @@ -244,7 +244,7 @@ PyDoc_STRVAR(Interface1D_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *Interface1D_id_get(BPy_Interface1D *self, void *UNUSED(closure)) +static PyObject *Interface1D_id_get(BPy_Interface1D *self, void * /*closure*/) { Id id(self->if1D->getId()); if (PyErr_Occurred()) { @@ -258,7 +258,7 @@ PyDoc_STRVAR(Interface1D_nature_doc, "\n" ":type: :class:`Nature`"); -static PyObject *Interface1D_nature_get(BPy_Interface1D *self, void *UNUSED(closure)) +static PyObject *Interface1D_nature_get(BPy_Interface1D *self, void * /*closure*/) { Nature::VertexNature nature = self->if1D->getNature(); if (PyErr_Occurred()) { @@ -272,13 +272,13 @@ PyDoc_STRVAR(Interface1D_length_2d_doc, "\n" ":type: float"); -static PyObject *Interface1D_length_2d_get(BPy_Interface1D *self, void *UNUSED(closure)) +static PyObject *Interface1D_length_2d_get(BPy_Interface1D *self, void * /*closure*/) { real length = self->if1D->getLength2D(); if (PyErr_Occurred()) { return nullptr; } - return PyFloat_FromDouble((double)length); + return PyFloat_FromDouble(double(length)); } PyDoc_STRVAR(Interface1D_time_stamp_doc, @@ -286,14 +286,12 @@ PyDoc_STRVAR(Interface1D_time_stamp_doc, "\n" ":type: int"); -static PyObject *Interface1D_time_stamp_get(BPy_Interface1D *self, void *UNUSED(closure)) +static PyObject *Interface1D_time_stamp_get(BPy_Interface1D *self, void * /*closure*/) { return PyLong_FromLong(self->if1D->getTimeStamp()); } -static int Interface1D_time_stamp_set(BPy_Interface1D *self, - PyObject *value, - void *UNUSED(closure)) +static int Interface1D_time_stamp_set(BPy_Interface1D *self, PyObject *value, void * /*closure*/) { int timestamp; diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index 35e6dd5536e..b167faa15e5 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -177,7 +177,7 @@ PyDoc_STRVAR(Iterator_name_doc, "\n" ":type: str"); -static PyObject *Iterator_name_get(BPy_Iterator *self, void *UNUSED(closure)) +static PyObject *Iterator_name_get(BPy_Iterator *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } @@ -187,7 +187,7 @@ PyDoc_STRVAR(Iterator_is_begin_doc, "\n" ":type: bool"); -static PyObject *Iterator_is_begin_get(BPy_Iterator *self, void *UNUSED(closure)) +static PyObject *Iterator_is_begin_get(BPy_Iterator *self, void * /*closure*/) { return PyBool_from_bool(self->it->isBegin()); } @@ -197,7 +197,7 @@ PyDoc_STRVAR(Iterator_is_end_doc, "\n" ":type: bool"); -static PyObject *Iterator_is_end_get(BPy_Iterator *self, void *UNUSED(closure)) +static PyObject *Iterator_is_end_get(BPy_Iterator *self, void * /*closure*/) { return PyBool_from_bool(self->it->isEnd()); } diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 20fd091c249..860573016f2 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -16,6 +16,8 @@ #include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h" #include "UnaryFunction1D/BPy_UnaryFunction1DVoid.h" +#include "BLI_sys_types.h" + #include <sstream> #ifdef __cplusplus @@ -585,7 +587,7 @@ static PyObject *Operators_get_viewedge_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; @@ -612,7 +614,7 @@ static PyObject *Operators_get_chain_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; @@ -639,7 +641,7 @@ static PyObject *Operators_get_stroke_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index fb72ed0ca62..92867e36479 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -12,6 +12,8 @@ #include "Interface0D/BPy_SVertex.h" #include "Interface1D/BPy_FEdge.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -155,13 +157,13 @@ PyDoc_STRVAR(SShape_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *SShape_id_get(BPy_SShape *self, void *UNUSED(closure)) +static PyObject *SShape_id_get(BPy_SShape *self, void * /*closure*/) { Id id(self->ss->getId()); return BPy_Id_from_Id(id); // return a copy } -static int SShape_id_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure)) +static int SShape_id_set(BPy_SShape *self, PyObject *value, void * /*closure*/) { if (!BPy_Id_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an Id"); @@ -176,12 +178,12 @@ PyDoc_STRVAR(SShape_name_doc, "\n" ":type: str"); -static PyObject *SShape_name_get(BPy_SShape *self, void *UNUSED(closure)) +static PyObject *SShape_name_get(BPy_SShape *self, void * /*closure*/) { return PyUnicode_FromString(self->ss->getName().c_str()); } -static int SShape_name_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure)) +static int SShape_name_set(BPy_SShape *self, PyObject *value, void * /*closure*/) { if (!PyUnicode_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a string"); @@ -197,13 +199,13 @@ PyDoc_STRVAR(SShape_bbox_doc, "\n" ":type: :class:`BBox`"); -static PyObject *SShape_bbox_get(BPy_SShape *self, void *UNUSED(closure)) +static PyObject *SShape_bbox_get(BPy_SShape *self, void * /*closure*/) { BBox<Vec3r> bb(self->ss->bbox()); return BPy_BBox_from_BBox(bb); // return a copy } -static int SShape_bbox_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure)) +static int SShape_bbox_set(BPy_SShape *self, PyObject *value, void * /*closure*/) { if (!BPy_BBox_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a BBox"); @@ -218,13 +220,13 @@ PyDoc_STRVAR(SShape_vertices_doc, "\n" ":type: List of :class:`SVertex` objects"); -static PyObject *SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure)) +static PyObject *SShape_vertices_get(BPy_SShape *self, void * /*closure*/) { vector<SVertex *> vertices = self->ss->getVertexList(); vector<SVertex *>::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + uint i = 0; for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it))); @@ -238,13 +240,13 @@ PyDoc_STRVAR(SShape_edges_doc, "\n" ":type: List of :class:`FEdge` objects"); -static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure)) +static PyObject *SShape_edges_get(BPy_SShape *self, void * /*closure*/) { vector<FEdge *> edges = self->ss->getEdgeList(); vector<FEdge *>::iterator it; PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + uint i = 0; for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it))); diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 7dddf90f2b3..c68c30f9602 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -531,7 +531,7 @@ static Mathutils_Callback StrokeAttribute_mathutils_cb = { StrokeAttribute_mathutils_set_index, }; -static unsigned char StrokeAttribute_mathutils_cb_index = -1; +static uchar StrokeAttribute_mathutils_cb_index = -1; void StrokeAttribute_mathutils_register_callback() { @@ -545,14 +545,14 @@ PyDoc_STRVAR(StrokeAttribute_alpha_doc, "\n" ":type: float"); -static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) +static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void * /*closure*/) { return PyFloat_FromDouble(self->sa->getAlpha()); } static int StrokeAttribute_alpha_set(BPy_StrokeAttribute *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { float scalar; if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { @@ -569,7 +569,7 @@ PyDoc_STRVAR(StrokeAttribute_color_doc, "\n" ":type: :class:`mathutils.Color`"); -static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) +static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void * /*closure*/) { return Color_CreatePyObject_cb( (PyObject *)self, StrokeAttribute_mathutils_cb_index, MATHUTILS_SUBTYPE_COLOR); @@ -577,7 +577,7 @@ static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUS static int StrokeAttribute_color_set(BPy_StrokeAttribute *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { float v[3]; if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { @@ -594,7 +594,7 @@ PyDoc_STRVAR(StrokeAttribute_thickness_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) +static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 2, StrokeAttribute_mathutils_cb_index, MATHUTILS_SUBTYPE_THICKNESS); @@ -602,7 +602,7 @@ static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void * static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { float v[2]; if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) { @@ -617,14 +617,14 @@ PyDoc_STRVAR(StrokeAttribute_visible_doc, "\n" ":type: bool"); -static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) +static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void * /*closure*/) { return PyBool_from_bool(self->sa->isVisible()); } static int StrokeAttribute_visible_set(BPy_StrokeAttribute *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!PyBool_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be boolean"); diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index 2e1e7157b83..f9e1d0e86d3 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -253,7 +253,7 @@ PyDoc_STRVAR(StrokeShader_name_doc, "\n" ":type: str"); -static PyObject *StrokeShader_name_get(BPy_StrokeShader *self, void *UNUSED(closure)) +static PyObject *StrokeShader_name_get(BPy_StrokeShader *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp index 20941df20be..cf70c989054 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp @@ -91,7 +91,7 @@ PyDoc_STRVAR(UnaryFunction0D_name_doc, "\n" ":type: str"); -static PyObject *UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void *UNUSED(closure)) +static PyObject *UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp index 6c2877428a7..65604de1f83 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp @@ -85,7 +85,7 @@ PyDoc_STRVAR(UnaryFunction1D_name_doc, "\n" ":type: str"); -static PyObject *UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void *UNUSED(closure)) +static PyObject *UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index fe70658fd17..b8169aae9cd 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -134,7 +134,7 @@ PyDoc_STRVAR(UnaryPredicate0D_name_doc, "\n" ":type: str"); -static PyObject *UnaryPredicate0D_name_get(BPy_UnaryPredicate0D *self, void *UNUSED(closure)) +static PyObject *UnaryPredicate0D_name_get(BPy_UnaryPredicate0D *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index a42f8bc6963..94ff12a4b56 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -192,7 +192,7 @@ PyDoc_STRVAR(UnaryPredicate1D_name_doc, "\n" ":type: str"); -static PyObject *UnaryPredicate1D_name_get(BPy_UnaryPredicate1D *self, void *UNUSED(closure)) +static PyObject *UnaryPredicate1D_name_get(BPy_UnaryPredicate1D *self, void * /*closure*/) { return PyUnicode_FromString(Py_TYPE(self)->tp_name); } diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp index 075e5220e43..bc000c5f1a7 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp @@ -141,12 +141,12 @@ PyDoc_STRVAR(ViewMap_scene_bbox_doc, "\n" ":type: :class:`BBox`"); -static PyObject *ViewMap_scene_bbox_get(BPy_ViewMap *self, void *UNUSED(closure)) +static PyObject *ViewMap_scene_bbox_get(BPy_ViewMap *self, void * /*closure*/) { return BPy_BBox_from_BBox(self->vm->getScene3dBBox()); } -static int ViewMap_scene_bbox_set(BPy_ViewMap *self, PyObject *value, void *UNUSED(closure)) +static int ViewMap_scene_bbox_set(BPy_ViewMap *self, PyObject *value, void * /*closure*/) { if (!BPy_BBox_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a BBox"); diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 806739239de..130526ac309 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -11,6 +11,8 @@ #include "Interface0D/BPy_ViewVertex.h" #include "Interface1D/BPy_ViewEdge.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -163,7 +165,7 @@ PyDoc_STRVAR(ViewShape_sshape_doc, "\n" ":type: :class:`SShape`"); -static PyObject *ViewShape_sshape_get(BPy_ViewShape *self, void *UNUSED(closure)) +static PyObject *ViewShape_sshape_get(BPy_ViewShape *self, void * /*closure*/) { SShape *ss = self->vs->sshape(); if (!ss) { @@ -172,7 +174,7 @@ static PyObject *ViewShape_sshape_get(BPy_ViewShape *self, void *UNUSED(closure) return BPy_SShape_from_SShape(*ss); } -static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure)) +static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void * /*closure*/) { if (!BPy_SShape_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an SShape"); @@ -195,12 +197,12 @@ PyDoc_STRVAR(ViewShape_vertices_doc, "\n" ":type: List of :class:`ViewVertex` objects"); -static PyObject *ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closure)) +static PyObject *ViewShape_vertices_get(BPy_ViewShape *self, void * /*closure*/) { vector<ViewVertex *> vertices = self->vs->vertices(); vector<ViewVertex *>::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + uint i = 0; for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, Any_BPy_ViewVertex_from_ViewVertex(*(*it))); @@ -208,7 +210,7 @@ static PyObject *ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closur return py_vertices; } -static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure)) +static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void * /*closure*/) { PyObject *item; vector<ViewVertex *> v; @@ -219,7 +221,7 @@ static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UN } v.reserve(PyList_GET_SIZE(value)); - for (unsigned int i = 0; i < PyList_GET_SIZE(value); i++) { + for (uint i = 0; i < PyList_GET_SIZE(value); i++) { item = PyList_GET_ITEM(value, i); if (BPy_ViewVertex_Check(item)) { v.push_back(((BPy_ViewVertex *)item)->vv); @@ -238,12 +240,12 @@ PyDoc_STRVAR(ViewShape_edges_doc, "\n" ":type: List of :class:`ViewEdge` objects"); -static PyObject *ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure)) +static PyObject *ViewShape_edges_get(BPy_ViewShape *self, void * /*closure*/) { vector<ViewEdge *> edges = self->vs->edges(); vector<ViewEdge *>::iterator it; PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + uint i = 0; for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, BPy_ViewEdge_from_ViewEdge(*(*it))); @@ -251,7 +253,7 @@ static PyObject *ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure)) return py_edges; } -static int ViewShape_edges_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure)) +static int ViewShape_edges_set(BPy_ViewShape *self, PyObject *value, void * /*closure*/) { PyObject *item; vector<ViewEdge *> v; @@ -281,7 +283,7 @@ PyDoc_STRVAR(ViewShape_name_doc, "\n" ":type: str"); -static PyObject *ViewShape_name_get(BPy_ViewShape *self, void *UNUSED(closure)) +static PyObject *ViewShape_name_get(BPy_ViewShape *self, void * /*closure*/) { return PyUnicode_FromString(self->vs->getName().c_str()); } @@ -291,7 +293,7 @@ PyDoc_STRVAR(ViewShape_library_path_doc, "\n" ":type: str, or None if the ViewShape is not part of a library"); -static PyObject *ViewShape_library_path_get(BPy_ViewShape *self, void *UNUSED(closure)) +static PyObject *ViewShape_library_path_get(BPy_ViewShape *self, void * /*closure*/) { return PyUnicode_FromString(self->vs->getLibraryPath().c_str()); } @@ -301,7 +303,7 @@ PyDoc_STRVAR(ViewShape_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *ViewShape_id_get(BPy_ViewShape *self, void *UNUSED(closure)) +static PyObject *ViewShape_id_get(BPy_ViewShape *self, void * /*closure*/) { Id id(self->vs->getId()); return BPy_Id_from_Id(id); // return a copy diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp index 752b498a302..40df2033221 100644 --- a/source/blender/freestyle/intern/python/Director.cpp +++ b/source/blender/freestyle/intern/python/Director.cpp @@ -42,6 +42,8 @@ #include "UnaryFunction1D/BPy_UnaryFunction1DVec3f.h" #include "UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h" +#include "BLI_sys_types.h" + using namespace Freestyle; // BinaryPredicate0D: __call__ @@ -254,7 +256,7 @@ int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0D ((UnaryFunction0D<FrsMaterial> *)uf0D)->result = *(((BPy_FrsMaterial *)result)->m); } else if (BPy_UnaryFunction0DUnsigned_Check(obj)) { - ((UnaryFunction0D<unsigned> *)uf0D)->result = PyLong_AsLong(result); + ((UnaryFunction0D<uint> *)uf0D)->result = PyLong_AsLong(result); } else if (BPy_UnaryFunction0DVec2f_Check(obj)) { Vec2f vec; @@ -312,7 +314,7 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D ((UnaryFunction1D<float> *)uf1D)->result = PyFloat_AsDouble(result); } else if (BPy_UnaryFunction1DUnsigned_Check(obj)) { - ((UnaryFunction1D<unsigned> *)uf1D)->result = PyLong_AsLong(result); + ((UnaryFunction1D<uint> *)uf1D)->result = PyLong_AsLong(result); } else if (BPy_UnaryFunction1DVec2f_Check(obj)) { Vec2f vec; diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index 2b6d40e1710..a4067be3dc1 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -123,7 +123,7 @@ PyDoc_STRVAR(CurvePoint_first_svertex_doc, "\n" ":type: :class:`SVertex`"); -static PyObject *CurvePoint_first_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure)) +static PyObject *CurvePoint_first_svertex_get(BPy_CurvePoint *self, void * /*closure*/) { SVertex *A = self->cp->A(); if (A) { @@ -132,9 +132,7 @@ static PyObject *CurvePoint_first_svertex_get(BPy_CurvePoint *self, void *UNUSED Py_RETURN_NONE; } -static int CurvePoint_first_svertex_set(BPy_CurvePoint *self, - PyObject *value, - void *UNUSED(closure)) +static int CurvePoint_first_svertex_set(BPy_CurvePoint *self, PyObject *value, void * /*closure*/) { if (!BPy_SVertex_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); @@ -149,7 +147,7 @@ PyDoc_STRVAR(CurvePoint_second_svertex_doc, "\n" ":type: :class:`SVertex`"); -static PyObject *CurvePoint_second_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure)) +static PyObject *CurvePoint_second_svertex_get(BPy_CurvePoint *self, void * /*closure*/) { SVertex *B = self->cp->B(); if (B) { @@ -158,9 +156,7 @@ static PyObject *CurvePoint_second_svertex_get(BPy_CurvePoint *self, void *UNUSE Py_RETURN_NONE; } -static int CurvePoint_second_svertex_set(BPy_CurvePoint *self, - PyObject *value, - void *UNUSED(closure)) +static int CurvePoint_second_svertex_set(BPy_CurvePoint *self, PyObject *value, void * /*closure*/) { if (!BPy_SVertex_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); @@ -176,7 +172,7 @@ PyDoc_STRVAR(CurvePoint_fedge_doc, "\n" ":type: :class:`FEdge`"); -static PyObject *CurvePoint_fedge_get(BPy_CurvePoint *self, void *UNUSED(closure)) +static PyObject *CurvePoint_fedge_get(BPy_CurvePoint *self, void * /*closure*/) { SVertex *A = self->cp->A(); Interface0D *B = (Interface0D *)self->cp->B(); @@ -192,12 +188,12 @@ PyDoc_STRVAR(CurvePoint_t2d_doc, "\n" ":type: float"); -static PyObject *CurvePoint_t2d_get(BPy_CurvePoint *self, void *UNUSED(closure)) +static PyObject *CurvePoint_t2d_get(BPy_CurvePoint *self, void * /*closure*/) { return PyFloat_FromDouble(self->cp->t2d()); } -static int CurvePoint_t2d_set(BPy_CurvePoint *self, PyObject *value, void *UNUSED(closure)) +static int CurvePoint_t2d_set(BPy_CurvePoint *self, PyObject *value, void * /*closure*/) { float scalar; if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index ff59e5b1a10..55faebc509c 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -10,6 +10,8 @@ #include "../BPy_Id.h" #include "../Interface1D/BPy_FEdge.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -251,7 +253,7 @@ static Mathutils_Callback SVertex_mathutils_cb = { SVertex_mathutils_set_index, }; -static unsigned char SVertex_mathutils_cb_index = -1; +static uchar SVertex_mathutils_cb_index = -1; void SVertex_mathutils_register_callback() { @@ -265,13 +267,13 @@ PyDoc_STRVAR(SVertex_point_3d_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *SVertex_point_3d_get(BPy_SVertex *self, void *UNUSED(closure)) +static PyObject *SVertex_point_3d_get(BPy_SVertex *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 3, SVertex_mathutils_cb_index, MATHUTILS_SUBTYPE_POINT3D); } -static int SVertex_point_3d_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure)) +static int SVertex_point_3d_set(BPy_SVertex *self, PyObject *value, void * /*closure*/) { float v[3]; if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { @@ -287,13 +289,13 @@ PyDoc_STRVAR(SVertex_point_2d_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *SVertex_point_2d_get(BPy_SVertex *self, void *UNUSED(closure)) +static PyObject *SVertex_point_2d_get(BPy_SVertex *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 3, SVertex_mathutils_cb_index, MATHUTILS_SUBTYPE_POINT2D); } -static int SVertex_point_2d_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure)) +static int SVertex_point_2d_set(BPy_SVertex *self, PyObject *value, void * /*closure*/) { float v[3]; if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { @@ -309,13 +311,13 @@ PyDoc_STRVAR(SVertex_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *SVertex_id_get(BPy_SVertex *self, void *UNUSED(closure)) +static PyObject *SVertex_id_get(BPy_SVertex *self, void * /*closure*/) { Id id(self->sv->getId()); return BPy_Id_from_Id(id); // return a copy } -static int SVertex_id_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure)) +static int SVertex_id_set(BPy_SVertex *self, PyObject *value, void * /*closure*/) { if (!BPy_Id_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an Id"); @@ -332,13 +334,13 @@ PyDoc_STRVAR(SVertex_normals_doc, "\n" ":type: list of :class:`mathutils.Vector` objects"); -static PyObject *SVertex_normals_get(BPy_SVertex *self, void *UNUSED(closure)) +static PyObject *SVertex_normals_get(BPy_SVertex *self, void * /*closure*/) { PyObject *py_normals; set<Vec3r> normals = self->sv->normals(); set<Vec3r>::iterator it; py_normals = PyList_New(normals.size()); - unsigned int i = 0; + uint i = 0; for (it = normals.begin(); it != normals.end(); it++) { Vec3r v(*it); @@ -352,7 +354,7 @@ PyDoc_STRVAR(SVertex_normals_size_doc, "\n" ":type: int"); -static PyObject *SVertex_normals_size_get(BPy_SVertex *self, void *UNUSED(closure)) +static PyObject *SVertex_normals_size_get(BPy_SVertex *self, void * /*closure*/) { return PyLong_FromLong(self->sv->normalsSize()); } @@ -363,7 +365,7 @@ PyDoc_STRVAR(SVertex_viewvertex_doc, "\n" ":type: :class:`ViewVertex`"); -static PyObject *SVertex_viewvertex_get(BPy_SVertex *self, void *UNUSED(closure)) +static PyObject *SVertex_viewvertex_get(BPy_SVertex *self, void * /*closure*/) { ViewVertex *vv = self->sv->viewvertex(); if (vv) { @@ -385,7 +387,7 @@ PyDoc_STRVAR(SVertex_curvatures_doc, "\n" ":type: tuple"); -static PyObject *SVertex_curvatures_get(BPy_SVertex *self, void *UNUSED(closure)) +static PyObject *SVertex_curvatures_get(BPy_SVertex *self, void * /*closure*/) { const CurvatureInfo *info = self->sv->getCurvatureInfo(); if (!info) { diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp index 4695d61af9c..7b9e7bd213a 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp @@ -118,7 +118,7 @@ PyDoc_STRVAR(ViewVertex_nature_doc, "\n" ":type: :class:`Nature`"); -static PyObject *ViewVertex_nature_get(BPy_ViewVertex *self, void *UNUSED(closure)) +static PyObject *ViewVertex_nature_get(BPy_ViewVertex *self, void * /*closure*/) { Nature::VertexNature nature = self->vv->getNature(); if (PyErr_Occurred()) { @@ -127,7 +127,7 @@ static PyObject *ViewVertex_nature_get(BPy_ViewVertex *self, void *UNUSED(closur return BPy_Nature_from_Nature(nature); // return a copy } -static int ViewVertex_nature_set(BPy_ViewVertex *self, PyObject *value, void *UNUSED(closure)) +static int ViewVertex_nature_set(BPy_ViewVertex *self, PyObject *value, void * /*closure*/) { if (!BPy_Nature_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a Nature"); diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 1c1d8bf032a..35eb95c6f23 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -153,8 +153,8 @@ static int StrokeVertex_mathutils_check(BaseMathObject *bmo) static int StrokeVertex_mathutils_get(BaseMathObject *bmo, int /*subtype*/) { BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; - bmo->data[0] = (float)self->sv->x(); - bmo->data[1] = (float)self->sv->y(); + bmo->data[0] = float(self->sv->x()); + bmo->data[1] = float(self->sv->y()); return 0; } @@ -171,10 +171,10 @@ static int StrokeVertex_mathutils_get_index(BaseMathObject *bmo, int /*subtype*/ BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; switch (index) { case 0: - bmo->data[0] = (float)self->sv->x(); + bmo->data[0] = float(self->sv->x()); break; case 1: - bmo->data[1] = (float)self->sv->y(); + bmo->data[1] = float(self->sv->y()); break; default: return -1; @@ -206,7 +206,7 @@ static Mathutils_Callback StrokeVertex_mathutils_cb = { StrokeVertex_mathutils_set_index, }; -static unsigned char StrokeVertex_mathutils_cb_index = -1; +static uchar StrokeVertex_mathutils_cb_index = -1; void StrokeVertex_mathutils_register_callback() { @@ -220,14 +220,12 @@ PyDoc_STRVAR(StrokeVertex_attribute_doc, "\n" ":type: :class:`StrokeAttribute`"); -static PyObject *StrokeVertex_attribute_get(BPy_StrokeVertex *self, void *UNUSED(closure)) +static PyObject *StrokeVertex_attribute_get(BPy_StrokeVertex *self, void * /*closure*/) { return BPy_StrokeAttribute_from_StrokeAttribute(self->sv->attribute()); } -static int StrokeVertex_attribute_set(BPy_StrokeVertex *self, - PyObject *value, - void *UNUSED(closure)) +static int StrokeVertex_attribute_set(BPy_StrokeVertex *self, PyObject *value, void * /*closure*/) { if (!BPy_StrokeAttribute_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a StrokeAttribute object"); @@ -242,15 +240,14 @@ PyDoc_STRVAR(StrokeVertex_curvilinear_abscissa_doc, "\n" ":type: float"); -static PyObject *StrokeVertex_curvilinear_abscissa_get(BPy_StrokeVertex *self, - void *UNUSED(closure)) +static PyObject *StrokeVertex_curvilinear_abscissa_get(BPy_StrokeVertex *self, void * /*closure*/) { return PyFloat_FromDouble(self->sv->curvilinearAbscissa()); } static int StrokeVertex_curvilinear_abscissa_set(BPy_StrokeVertex *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { float scalar; if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { @@ -267,12 +264,12 @@ PyDoc_STRVAR(StrokeVertex_point_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *StrokeVertex_point_get(BPy_StrokeVertex *self, void *UNUSED(closure)) +static PyObject *StrokeVertex_point_get(BPy_StrokeVertex *self, void * /*closure*/) { return Vector_CreatePyObject_cb((PyObject *)self, 2, StrokeVertex_mathutils_cb_index, 0); } -static int StrokeVertex_point_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure)) +static int StrokeVertex_point_set(BPy_StrokeVertex *self, PyObject *value, void * /*closure*/) { float v[2]; if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) { @@ -289,14 +286,14 @@ PyDoc_STRVAR(StrokeVertex_stroke_length_doc, "\n" ":type: float"); -static PyObject *StrokeVertex_stroke_length_get(BPy_StrokeVertex *self, void *UNUSED(closure)) +static PyObject *StrokeVertex_stroke_length_get(BPy_StrokeVertex *self, void * /*closure*/) { return PyFloat_FromDouble(self->sv->strokeLength()); } static int StrokeVertex_stroke_length_set(BPy_StrokeVertex *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { float scalar; if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { @@ -313,7 +310,7 @@ PyDoc_STRVAR(StrokeVertex_u_doc, "\n" ":type: float"); -static PyObject *StrokeVertex_u_get(BPy_StrokeVertex *self, void *UNUSED(closure)) +static PyObject *StrokeVertex_u_get(BPy_StrokeVertex *self, void * /*closure*/) { return PyFloat_FromDouble(self->sv->u()); } diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp index de9748d41c1..59fead5f70c 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp @@ -63,7 +63,7 @@ PyDoc_STRVAR(NonTVertex_svertex_doc, "\n" ":type: :class:`SVertex`"); -static PyObject *NonTVertex_svertex_get(BPy_NonTVertex *self, void *UNUSED(closure)) +static PyObject *NonTVertex_svertex_get(BPy_NonTVertex *self, void * /*closure*/) { SVertex *v = self->ntv->svertex(); if (v) { @@ -72,7 +72,7 @@ static PyObject *NonTVertex_svertex_get(BPy_NonTVertex *self, void *UNUSED(closu Py_RETURN_NONE; } -static int NonTVertex_svertex_set(BPy_NonTVertex *self, PyObject *value, void *UNUSED(closure)) +static int NonTVertex_svertex_set(BPy_NonTVertex *self, PyObject *value, void * /*closure*/) { if (!BPy_SVertex_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp index 8dc76c1c448..ca4908cae7b 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp @@ -122,7 +122,7 @@ PyDoc_STRVAR(TVertex_front_svertex_doc, "\n" ":type: :class:`SVertex`"); -static PyObject *TVertex_front_svertex_get(BPy_TVertex *self, void *UNUSED(closure)) +static PyObject *TVertex_front_svertex_get(BPy_TVertex *self, void * /*closure*/) { SVertex *v = self->tv->frontSVertex(); if (v) { @@ -131,7 +131,7 @@ static PyObject *TVertex_front_svertex_get(BPy_TVertex *self, void *UNUSED(closu Py_RETURN_NONE; } -static int TVertex_front_svertex_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure)) +static int TVertex_front_svertex_set(BPy_TVertex *self, PyObject *value, void * /*closure*/) { if (!BPy_SVertex_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); @@ -146,7 +146,7 @@ PyDoc_STRVAR(TVertex_back_svertex_doc, "\n" ":type: :class:`SVertex`"); -static PyObject *TVertex_back_svertex_get(BPy_TVertex *self, void *UNUSED(closure)) +static PyObject *TVertex_back_svertex_get(BPy_TVertex *self, void * /*closure*/) { SVertex *v = self->tv->backSVertex(); if (v) { @@ -155,7 +155,7 @@ static PyObject *TVertex_back_svertex_get(BPy_TVertex *self, void *UNUSED(closur Py_RETURN_NONE; } -static int TVertex_back_svertex_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure)) +static int TVertex_back_svertex_set(BPy_TVertex *self, PyObject *value, void * /*closure*/) { if (!BPy_SVertex_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); @@ -170,13 +170,13 @@ PyDoc_STRVAR(TVertex_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *TVertex_id_get(BPy_TVertex *self, void *UNUSED(closure)) +static PyObject *TVertex_id_get(BPy_TVertex *self, void * /*closure*/) { Id id(self->tv->getId()); return BPy_Id_from_Id(id); // return a copy } -static int TVertex_id_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure)) +static int TVertex_id_set(BPy_TVertex *self, PyObject *value, void * /*closure*/) { if (!BPy_Id_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an Id"); diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp index db4ce6a8162..f73c4a8fed5 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp @@ -125,7 +125,7 @@ PyDoc_STRVAR(FEdge_first_svertex_doc, "\n" ":type: :class:`SVertex`"); -static PyObject *FEdge_first_svertex_get(BPy_FEdge *self, void *UNUSED(closure)) +static PyObject *FEdge_first_svertex_get(BPy_FEdge *self, void * /*closure*/) { SVertex *A = self->fe->vertexA(); if (A) { @@ -134,7 +134,7 @@ static PyObject *FEdge_first_svertex_get(BPy_FEdge *self, void *UNUSED(closure)) Py_RETURN_NONE; } -static int FEdge_first_svertex_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) +static int FEdge_first_svertex_set(BPy_FEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_SVertex_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); @@ -149,7 +149,7 @@ PyDoc_STRVAR(FEdge_second_svertex_doc, "\n" ":type: :class:`SVertex`"); -static PyObject *FEdge_second_svertex_get(BPy_FEdge *self, void *UNUSED(closure)) +static PyObject *FEdge_second_svertex_get(BPy_FEdge *self, void * /*closure*/) { SVertex *B = self->fe->vertexB(); if (B) { @@ -158,7 +158,7 @@ static PyObject *FEdge_second_svertex_get(BPy_FEdge *self, void *UNUSED(closure) Py_RETURN_NONE; } -static int FEdge_second_svertex_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) +static int FEdge_second_svertex_set(BPy_FEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_SVertex_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); @@ -174,7 +174,7 @@ PyDoc_STRVAR(FEdge_next_fedge_doc, "\n" ":type: :class:`FEdge`"); -static PyObject *FEdge_next_fedge_get(BPy_FEdge *self, void *UNUSED(closure)) +static PyObject *FEdge_next_fedge_get(BPy_FEdge *self, void * /*closure*/) { FEdge *fe = self->fe->nextEdge(); if (fe) { @@ -183,7 +183,7 @@ static PyObject *FEdge_next_fedge_get(BPy_FEdge *self, void *UNUSED(closure)) Py_RETURN_NONE; } -static int FEdge_next_fedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) +static int FEdge_next_fedge_set(BPy_FEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_FEdge_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an FEdge"); @@ -199,7 +199,7 @@ PyDoc_STRVAR(FEdge_previous_fedge_doc, "\n" ":type: :class:`FEdge`"); -static PyObject *FEdge_previous_fedge_get(BPy_FEdge *self, void *UNUSED(closure)) +static PyObject *FEdge_previous_fedge_get(BPy_FEdge *self, void * /*closure*/) { FEdge *fe = self->fe->previousEdge(); if (fe) { @@ -208,7 +208,7 @@ static PyObject *FEdge_previous_fedge_get(BPy_FEdge *self, void *UNUSED(closure) Py_RETURN_NONE; } -static int FEdge_previous_fedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) +static int FEdge_previous_fedge_set(BPy_FEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_FEdge_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an FEdge"); @@ -223,7 +223,7 @@ PyDoc_STRVAR(FEdge_viewedge_doc, "\n" ":type: :class:`ViewEdge`"); -static PyObject *FEdge_viewedge_get(BPy_FEdge *self, void *UNUSED(closure)) +static PyObject *FEdge_viewedge_get(BPy_FEdge *self, void * /*closure*/) { ViewEdge *ve = self->fe->viewedge(); if (ve) { @@ -232,7 +232,7 @@ static PyObject *FEdge_viewedge_get(BPy_FEdge *self, void *UNUSED(closure)) Py_RETURN_NONE; } -static int FEdge_viewedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) +static int FEdge_viewedge_set(BPy_FEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_ViewEdge_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an ViewEdge"); @@ -247,12 +247,12 @@ PyDoc_STRVAR(FEdge_is_smooth_doc, "\n" ":type: bool"); -static PyObject *FEdge_is_smooth_get(BPy_FEdge *self, void *UNUSED(closure)) +static PyObject *FEdge_is_smooth_get(BPy_FEdge *self, void * /*closure*/) { return PyBool_from_bool(self->fe->isSmooth()); } -static int FEdge_is_smooth_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) +static int FEdge_is_smooth_set(BPy_FEdge *self, PyObject *value, void * /*closure*/) { if (!PyBool_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be boolean"); @@ -267,13 +267,13 @@ PyDoc_STRVAR(FEdge_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *FEdge_id_get(BPy_FEdge *self, void *UNUSED(closure)) +static PyObject *FEdge_id_get(BPy_FEdge *self, void * /*closure*/) { Id id(self->fe->getId()); return BPy_Id_from_Id(id); // return a copy } -static int FEdge_id_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) +static int FEdge_id_set(BPy_FEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_Id_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an Id"); @@ -288,12 +288,12 @@ PyDoc_STRVAR(FEdge_nature_doc, "\n" ":type: :class:`Nature`"); -static PyObject *FEdge_nature_get(BPy_FEdge *self, void *UNUSED(closure)) +static PyObject *FEdge_nature_get(BPy_FEdge *self, void * /*closure*/) { return BPy_Nature_from_Nature(self->fe->getNature()); } -static int FEdge_nature_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) +static int FEdge_nature_set(BPy_FEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_Nature_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a Nature"); diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index 726e9f44956..1e69ae65605 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -146,7 +146,7 @@ PyDoc_STRVAR(FrsCurve_is_empty_doc, "\n" ":type: bool"); -static PyObject *FrsCurve_is_empty_get(BPy_FrsCurve *self, void *UNUSED(closure)) +static PyObject *FrsCurve_is_empty_get(BPy_FrsCurve *self, void * /*closure*/) { return PyBool_from_bool(self->c->empty()); } @@ -156,7 +156,7 @@ PyDoc_STRVAR(FrsCurve_segments_size_doc, "\n" ":type: int"); -static PyObject *FrsCurve_segments_size_get(BPy_FrsCurve *self, void *UNUSED(closure)) +static PyObject *FrsCurve_segments_size_get(BPy_FrsCurve *self, void * /*closure*/) { return PyLong_FromLong(self->c->nSegments()); } diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 57c00ab1b99..6f90406d74d 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -13,6 +13,8 @@ #include "../Interface0D/CurvePoint/BPy_StrokeVertex.h" #include "../Iterator/BPy_StrokeVertexIterator.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -351,12 +353,12 @@ PyDoc_STRVAR(Stroke_medium_type_doc, "\n" ":type: :class:`MediumType`"); -static PyObject *Stroke_medium_type_get(BPy_Stroke *self, void *UNUSED(closure)) +static PyObject *Stroke_medium_type_get(BPy_Stroke *self, void * /*closure*/) { return BPy_MediumType_from_MediumType(self->s->getMediumType()); } -static int Stroke_medium_type_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) +static int Stroke_medium_type_set(BPy_Stroke *self, PyObject *value, void * /*closure*/) { if (!BPy_MediumType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a MediumType"); @@ -371,14 +373,14 @@ PyDoc_STRVAR(Stroke_texture_id_doc, "\n" ":type: int"); -static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure)) +static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void * /*closure*/) { return PyLong_FromLong(self->s->getTextureId()); } -static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) +static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void * /*closure*/) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } @@ -391,12 +393,12 @@ PyDoc_STRVAR(Stroke_tips_doc, "\n" ":type: bool"); -static PyObject *Stroke_tips_get(BPy_Stroke *self, void *UNUSED(closure)) +static PyObject *Stroke_tips_get(BPy_Stroke *self, void * /*closure*/) { return PyBool_from_bool(self->s->hasTips()); } -static int Stroke_tips_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) +static int Stroke_tips_set(BPy_Stroke *self, PyObject *value, void * /*closure*/) { if (!PyBool_Check(value)) { return -1; @@ -410,12 +412,12 @@ PyDoc_STRVAR(Stroke_length_2d_doc, "\n" ":type: float"); -static PyObject *Stroke_length_2d_get(BPy_Stroke *self, void *UNUSED(closure)) +static PyObject *Stroke_length_2d_get(BPy_Stroke *self, void * /*closure*/) { return PyFloat_FromDouble(self->s->getLength2D()); } -static int Stroke_length_2d_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) +static int Stroke_length_2d_set(BPy_Stroke *self, PyObject *value, void * /*closure*/) { float scalar; if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { @@ -432,13 +434,13 @@ PyDoc_STRVAR(Stroke_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *Stroke_id_get(BPy_Stroke *self, void *UNUSED(closure)) +static PyObject *Stroke_id_get(BPy_Stroke *self, void * /*closure*/) { Id id(self->s->getId()); return BPy_Id_from_Id(id); // return a copy } -static int Stroke_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) +static int Stroke_id_set(BPy_Stroke *self, PyObject *value, void * /*closure*/) { if (!BPy_Id_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an Id"); diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index 5a58a09d346..1ad8c503782 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -85,7 +85,7 @@ PyDoc_STRVAR(ViewEdge_first_viewvertex_doc, "\n" ":type: :class:`ViewVertex`"); -static PyObject *ViewEdge_first_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_first_viewvertex_get(BPy_ViewEdge *self, void * /*closure*/) { ViewVertex *v = self->ve->A(); if (v) { @@ -94,9 +94,7 @@ static PyObject *ViewEdge_first_viewvertex_get(BPy_ViewEdge *self, void *UNUSED( Py_RETURN_NONE; } -static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self, - PyObject *value, - void *UNUSED(closure)) +static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_ViewVertex_Check(value)) { return -1; @@ -110,7 +108,7 @@ PyDoc_STRVAR(ViewEdge_last_viewvertex_doc, "\n" ":type: :class:`ViewVertex`"); -static PyObject *ViewEdge_last_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_last_viewvertex_get(BPy_ViewEdge *self, void * /*closure*/) { ViewVertex *v = self->ve->B(); if (v) { @@ -119,7 +117,7 @@ static PyObject *ViewEdge_last_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(c Py_RETURN_NONE; } -static int ViewEdge_last_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_last_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_ViewVertex_Check(value)) { return -1; @@ -133,7 +131,7 @@ PyDoc_STRVAR(ViewEdge_first_fedge_doc, "\n" ":type: :class:`FEdge`"); -static PyObject *ViewEdge_first_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_first_fedge_get(BPy_ViewEdge *self, void * /*closure*/) { FEdge *fe = self->ve->fedgeA(); if (fe) { @@ -142,7 +140,7 @@ static PyObject *ViewEdge_first_fedge_get(BPy_ViewEdge *self, void *UNUSED(closu Py_RETURN_NONE; } -static int ViewEdge_first_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_first_fedge_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_FEdge_Check(value)) { return -1; @@ -156,7 +154,7 @@ PyDoc_STRVAR(ViewEdge_last_fedge_doc, "\n" ":type: :class:`FEdge`"); -static PyObject *ViewEdge_last_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_last_fedge_get(BPy_ViewEdge *self, void * /*closure*/) { FEdge *fe = self->ve->fedgeB(); if (fe) { @@ -165,7 +163,7 @@ static PyObject *ViewEdge_last_fedge_get(BPy_ViewEdge *self, void *UNUSED(closur Py_RETURN_NONE; } -static int ViewEdge_last_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_last_fedge_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_FEdge_Check(value)) { return -1; @@ -179,7 +177,7 @@ PyDoc_STRVAR(ViewEdge_viewshape_doc, "\n" ":type: :class:`ViewShape`"); -static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void * /*closure*/) { ViewShape *vs = self->ve->viewShape(); if (vs) { @@ -188,7 +186,7 @@ static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure Py_RETURN_NONE; } -static int ViewEdge_viewshape_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_viewshape_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_ViewShape_Check(value)) { return -1; @@ -203,7 +201,7 @@ PyDoc_STRVAR(ViewEdge_occludee_doc, "\n" ":type: :class:`ViewShape`"); -static PyObject *ViewEdge_occludee_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_occludee_get(BPy_ViewEdge *self, void * /*closure*/) { ViewShape *vs = self->ve->aShape(); if (vs) { @@ -212,7 +210,7 @@ static PyObject *ViewEdge_occludee_get(BPy_ViewEdge *self, void *UNUSED(closure) Py_RETURN_NONE; } -static int ViewEdge_occludee_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_occludee_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_ViewShape_Check(value)) { return -1; @@ -226,7 +224,7 @@ PyDoc_STRVAR(ViewEdge_is_closed_doc, "\n" ":type: bool"); -static PyObject *ViewEdge_is_closed_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_is_closed_get(BPy_ViewEdge *self, void * /*closure*/) { return PyBool_from_bool(self->ve->isClosed()); } @@ -236,13 +234,13 @@ PyDoc_STRVAR(ViewEdge_id_doc, "\n" ":type: :class:`Id`"); -static PyObject *ViewEdge_id_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_id_get(BPy_ViewEdge *self, void * /*closure*/) { Id id(self->ve->getId()); return BPy_Id_from_Id(id); // return a copy } -static int ViewEdge_id_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_id_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_Id_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an Id"); @@ -257,12 +255,12 @@ PyDoc_STRVAR(ViewEdge_nature_doc, "\n" ":type: :class:`Nature`"); -static PyObject *ViewEdge_nature_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_nature_get(BPy_ViewEdge *self, void * /*closure*/) { return BPy_Nature_from_Nature(self->ve->getNature()); } -static int ViewEdge_nature_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_nature_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { if (!BPy_Nature_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a Nature"); @@ -277,12 +275,12 @@ PyDoc_STRVAR(ViewEdge_qi_doc, "\n" ":type: int"); -static PyObject *ViewEdge_qi_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_qi_get(BPy_ViewEdge *self, void * /*closure*/) { return PyLong_FromLong(self->ve->qi()); } -static int ViewEdge_qi_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_qi_set(BPy_ViewEdge *self, PyObject *value, void * /*closure*/) { int qi; @@ -298,14 +296,14 @@ PyDoc_STRVAR(ViewEdge_chaining_time_stamp_doc, "\n" ":type: int"); -static PyObject *ViewEdge_chaining_time_stamp_get(BPy_ViewEdge *self, void *UNUSED(closure)) +static PyObject *ViewEdge_chaining_time_stamp_get(BPy_ViewEdge *self, void * /*closure*/) { return PyLong_FromLong(self->ve->getChainingTimeStamp()); } static int ViewEdge_chaining_time_stamp_set(BPy_ViewEdge *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { int timestamp; diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index 840f49ff345..aae8d5514c9 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -9,6 +9,8 @@ #include "../../BPy_Convert.h" #include "../../Interface0D/BPy_SVertex.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -178,7 +180,7 @@ static Mathutils_Callback FEdgeSharp_mathutils_cb = { FEdgeSharp_mathutils_set_index, }; -static unsigned char FEdgeSharp_mathutils_cb_index = -1; +static uchar FEdgeSharp_mathutils_cb_index = -1; void FEdgeSharp_mathutils_register_callback() { @@ -193,15 +195,13 @@ PyDoc_STRVAR(FEdgeSharp_normal_right_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *FEdgeSharp_normal_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) +static PyObject *FEdgeSharp_normal_right_get(BPy_FEdgeSharp *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_A); } -static int FEdgeSharp_normal_right_set(BPy_FEdgeSharp *self, - PyObject *value, - void *UNUSED(closure)) +static int FEdgeSharp_normal_right_set(BPy_FEdgeSharp *self, PyObject *value, void * /*closure*/) { float v[3]; if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { @@ -217,13 +217,13 @@ PyDoc_STRVAR(FEdgeSharp_normal_left_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *FEdgeSharp_normal_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) +static PyObject *FEdgeSharp_normal_left_get(BPy_FEdgeSharp *self, void * /*closure*/) { return Vector_CreatePyObject_cb( (PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_B); } -static int FEdgeSharp_normal_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSharp_normal_left_set(BPy_FEdgeSharp *self, PyObject *value, void * /*closure*/) { float v[3]; if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { @@ -241,16 +241,16 @@ PyDoc_STRVAR(FEdgeSharp_material_index_right_doc, "\n" ":type: int"); -static PyObject *FEdgeSharp_material_index_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) +static PyObject *FEdgeSharp_material_index_right_get(BPy_FEdgeSharp *self, void * /*closure*/) { return PyLong_FromLong(self->fes->aFrsMaterialIndex()); } static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } @@ -263,16 +263,16 @@ PyDoc_STRVAR(FEdgeSharp_material_index_left_doc, "\n" ":type: int"); -static PyObject *FEdgeSharp_material_index_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) +static PyObject *FEdgeSharp_material_index_left_get(BPy_FEdgeSharp *self, void * /*closure*/) { return PyLong_FromLong(self->fes->bFrsMaterialIndex()); } static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } @@ -286,7 +286,7 @@ PyDoc_STRVAR(FEdgeSharp_material_right_doc, "\n" ":type: :class:`Material`"); -static PyObject *FEdgeSharp_material_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) +static PyObject *FEdgeSharp_material_right_get(BPy_FEdgeSharp *self, void * /*closure*/) { return BPy_FrsMaterial_from_FrsMaterial(self->fes->aFrsMaterial()); } @@ -296,7 +296,7 @@ PyDoc_STRVAR(FEdgeSharp_material_left_doc, "\n" ":type: :class:`Material`"); -static PyObject *FEdgeSharp_material_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) +static PyObject *FEdgeSharp_material_left_get(BPy_FEdgeSharp *self, void * /*closure*/) { return BPy_FrsMaterial_from_FrsMaterial(self->fes->bFrsMaterial()); } @@ -308,14 +308,14 @@ PyDoc_STRVAR(FEdgeSharp_face_mark_right_doc, "\n" ":type: bool"); -static PyObject *FEdgeSharp_face_mark_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) +static PyObject *FEdgeSharp_face_mark_right_get(BPy_FEdgeSharp *self, void * /*closure*/) { return PyBool_from_bool(self->fes->aFaceMark()); } static int FEdgeSharp_face_mark_right_set(BPy_FEdgeSharp *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!PyBool_Check(value)) { return -1; @@ -329,14 +329,12 @@ PyDoc_STRVAR(FEdgeSharp_face_mark_left_doc, "\n" ":type: bool"); -static PyObject *FEdgeSharp_face_mark_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) +static PyObject *FEdgeSharp_face_mark_left_get(BPy_FEdgeSharp *self, void * /*closure*/) { return PyBool_from_bool(self->fes->bFaceMark()); } -static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self, - PyObject *value, - void *UNUSED(closure)) +static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self, PyObject *value, void * /*closure*/) { if (!PyBool_Check(value)) { return -1; diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index bf62d5bd31d..6516ad8af9c 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -9,6 +9,8 @@ #include "../../BPy_Convert.h" #include "../../Interface0D/BPy_SVertex.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -129,7 +131,7 @@ static Mathutils_Callback FEdgeSmooth_mathutils_cb = { FEdgeSmooth_mathutils_set_index, }; -static unsigned char FEdgeSmooth_mathutils_cb_index = -1; +static uchar FEdgeSmooth_mathutils_cb_index = -1; void FEdgeSmooth_mathutils_register_callback() { @@ -143,12 +145,12 @@ PyDoc_STRVAR(FEdgeSmooth_normal_doc, "\n" ":type: :class:`mathutils.Vector`"); -static PyObject *FEdgeSmooth_normal_get(BPy_FEdgeSmooth *self, void *UNUSED(closure)) +static PyObject *FEdgeSmooth_normal_get(BPy_FEdgeSmooth *self, void * /*closure*/) { return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSmooth_mathutils_cb_index, 0); } -static int FEdgeSmooth_normal_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSmooth_normal_set(BPy_FEdgeSmooth *self, PyObject *value, void * /*closure*/) { float v[3]; if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { @@ -164,16 +166,16 @@ PyDoc_STRVAR(FEdgeSmooth_material_index_doc, "\n" ":type: int"); -static PyObject *FEdgeSmooth_material_index_get(BPy_FEdgeSmooth *self, void *UNUSED(closure)) +static PyObject *FEdgeSmooth_material_index_get(BPy_FEdgeSmooth *self, void * /*closure*/) { return PyLong_FromLong(self->fes->frs_materialIndex()); } static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } @@ -186,7 +188,7 @@ PyDoc_STRVAR(FEdgeSmooth_material_doc, "\n" ":type: :class:`Material`"); -static PyObject *FEdgeSmooth_material_get(BPy_FEdgeSmooth *self, void *UNUSED(closure)) +static PyObject *FEdgeSmooth_material_get(BPy_FEdgeSmooth *self, void * /*closure*/) { return BPy_FrsMaterial_from_FrsMaterial(self->fes->frs_material()); } @@ -196,12 +198,12 @@ PyDoc_STRVAR(FEdgeSmooth_face_mark_doc, "\n" ":type: bool"); -static PyObject *FEdgeSmooth_face_mark_get(BPy_FEdgeSmooth *self, void *UNUSED(closure)) +static PyObject *FEdgeSmooth_face_mark_get(BPy_FEdgeSmooth *self, void * /*closure*/) { return PyBool_from_bool(self->fes->faceMark()); } -static int FEdgeSmooth_face_mark_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSmooth_face_mark_set(BPy_FEdgeSmooth *self, PyObject *value, void * /*closure*/) { if (!PyBool_Check(value)) { return -1; diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp index 80b5cd4ba3b..883eb3b0beb 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp @@ -124,7 +124,7 @@ PyDoc_STRVAR(AdjacencyIterator_object_doc, "\n" ":type: :class:`ViewEdge`"); -static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void *UNUSED(closure)) +static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void * /*closure*/) { if (self->a_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); @@ -143,8 +143,7 @@ PyDoc_STRVAR(AdjacencyIterator_is_incoming_doc, "\n" ":type: bool"); -static PyObject *AdjacencyIterator_is_incoming_get(BPy_AdjacencyIterator *self, - void *UNUSED(closure)) +static PyObject *AdjacencyIterator_is_incoming_get(BPy_AdjacencyIterator *self, void * /*closure*/) { if (self->a_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index b4b3fd2bf1f..c38a8a9314c 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp @@ -176,7 +176,7 @@ PyDoc_STRVAR(ChainingIterator_object_doc, "\n" ":type: :class:`ViewEdge`"); -static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void *UNUSED(closure)) +static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void * /*closure*/) { if (self->c_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); @@ -195,8 +195,7 @@ PyDoc_STRVAR(ChainingIterator_next_vertex_doc, "\n" ":type: :class:`ViewVertex`"); -static PyObject *ChainingIterator_next_vertex_get(BPy_ChainingIterator *self, - void *UNUSED(closure)) +static PyObject *ChainingIterator_next_vertex_get(BPy_ChainingIterator *self, void * /*closure*/) { ViewVertex *v = self->c_it->getVertex(); if (v) { @@ -212,7 +211,7 @@ PyDoc_STRVAR(ChainingIterator_is_incrementing_doc, ":type: bool"); static PyObject *ChainingIterator_is_incrementing_get(BPy_ChainingIterator *self, - void *UNUSED(closure)) + void * /*closure*/) { return PyBool_from_bool(self->c_it->isIncrementing()); } diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp index e39439dc0b1..c5b7d0f96da 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp @@ -76,7 +76,7 @@ PyDoc_STRVAR(CurvePointIterator_object_doc, "\n" ":type: :class:`CurvePoint`"); -static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, void *UNUSED(closure)) +static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, void * /*closure*/) { if (self->cp_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); @@ -90,7 +90,7 @@ PyDoc_STRVAR(CurvePointIterator_t_doc, "\n" ":type: float"); -static PyObject *CurvePointIterator_t_get(BPy_CurvePointIterator *self, void *UNUSED(closure)) +static PyObject *CurvePointIterator_t_get(BPy_CurvePointIterator *self, void * /*closure*/) { return PyFloat_FromDouble(self->cp_it->t()); } @@ -100,7 +100,7 @@ PyDoc_STRVAR(CurvePointIterator_u_doc, "\n" ":type: float"); -static PyObject *CurvePointIterator_u_get(BPy_CurvePointIterator *self, void *UNUSED(closure)) +static PyObject *CurvePointIterator_u_get(BPy_CurvePointIterator *self, void * /*closure*/) { return PyFloat_FromDouble(self->cp_it->u()); } diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index def217bb278..6e4b1832c72 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -133,8 +133,7 @@ PyDoc_STRVAR(Interface0DIterator_object_doc, "\n" ":type: :class:`Interface0D` or one of its subclasses."); -static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, - void *UNUSED(closure)) +static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, void * /*closure*/) { if (self->if0D_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); @@ -148,7 +147,7 @@ PyDoc_STRVAR(Interface0DIterator_t_doc, "\n" ":type: float"); -static PyObject *Interface0DIterator_t_get(BPy_Interface0DIterator *self, void *UNUSED(closure)) +static PyObject *Interface0DIterator_t_get(BPy_Interface0DIterator *self, void * /*closure*/) { return PyFloat_FromDouble(self->if0D_it->t()); } @@ -158,7 +157,7 @@ PyDoc_STRVAR(Interface0DIterator_u_doc, "\n" ":type: float"); -static PyObject *Interface0DIterator_u_get(BPy_Interface0DIterator *self, void *UNUSED(closure)) +static PyObject *Interface0DIterator_u_get(BPy_Interface0DIterator *self, void * /*closure*/) { return PyFloat_FromDouble(self->if0D_it->u()); } @@ -169,8 +168,7 @@ PyDoc_STRVAR(Interface0DIterator_at_last_doc, "\n" ":type: bool"); -static PyObject *Interface0DIterator_at_last_get(BPy_Interface0DIterator *self, - void *UNUSED(closure)) +static PyObject *Interface0DIterator_at_last_get(BPy_Interface0DIterator *self, void * /*closure*/) { return PyBool_from_bool(self->if0D_it->atLast()); } diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp index 922f979b4cb..09b40dc01e3 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp @@ -99,7 +99,7 @@ PyDoc_STRVAR(SVertexIterator_object_doc, "\n" ":type: :class:`SVertex`"); -static PyObject *SVertexIterator_object_get(BPy_SVertexIterator *self, void *UNUSED(closure)) +static PyObject *SVertexIterator_object_get(BPy_SVertexIterator *self, void * /*closure*/) { if (self->sv_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); @@ -117,7 +117,7 @@ PyDoc_STRVAR(SVertexIterator_t_doc, "\n" ":type: float"); -static PyObject *SVertexIterator_t_get(BPy_SVertexIterator *self, void *UNUSED(closure)) +static PyObject *SVertexIterator_t_get(BPy_SVertexIterator *self, void * /*closure*/) { return PyFloat_FromDouble(self->sv_it->t()); } @@ -127,7 +127,7 @@ PyDoc_STRVAR(SVertexIterator_u_doc, "\n" ":type: float"); -static PyObject *SVertexIterator_u_get(BPy_SVertexIterator *self, void *UNUSED(closure)) +static PyObject *SVertexIterator_u_get(BPy_SVertexIterator *self, void * /*closure*/) { return PyFloat_FromDouble(self->sv_it->u()); } diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp index 2a9efcdded4..4cfaa51d794 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp @@ -206,7 +206,7 @@ PyDoc_STRVAR(StrokeVertexIterator_object_doc, ":type: :class:`StrokeVertex`"); static PyObject *StrokeVertexIterator_object_get(BPy_StrokeVertexIterator *self, - void *UNUSED(closure)) + void * /*closure*/) { if (self->sv_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); @@ -224,7 +224,7 @@ PyDoc_STRVAR(StrokeVertexIterator_t_doc, "\n" ":type: float"); -static PyObject *StrokeVertexIterator_t_get(BPy_StrokeVertexIterator *self, void *UNUSED(closure)) +static PyObject *StrokeVertexIterator_t_get(BPy_StrokeVertexIterator *self, void * /*closure*/) { return PyFloat_FromDouble(self->sv_it->t()); } @@ -234,7 +234,7 @@ PyDoc_STRVAR(StrokeVertexIterator_u_doc, "\n" ":type: float"); -static PyObject *StrokeVertexIterator_u_get(BPy_StrokeVertexIterator *self, void *UNUSED(closure)) +static PyObject *StrokeVertexIterator_u_get(BPy_StrokeVertexIterator *self, void * /*closure*/) { return PyFloat_FromDouble(self->sv_it->u()); } diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp index 634d4d6434b..937a7103c66 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -104,7 +104,7 @@ PyDoc_STRVAR(ViewEdgeIterator_object_doc, "\n" ":type: :class:`ViewEdge`"); -static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure)) +static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void * /*closure*/) { if (!self->ve_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); @@ -122,8 +122,7 @@ PyDoc_STRVAR(ViewEdgeIterator_current_edge_doc, "\n" ":type: :class:`ViewEdge`"); -static PyObject *ViewEdgeIterator_current_edge_get(BPy_ViewEdgeIterator *self, - void *UNUSED(closure)) +static PyObject *ViewEdgeIterator_current_edge_get(BPy_ViewEdgeIterator *self, void * /*closure*/) { ViewEdge *ve = self->ve_it->getCurrentEdge(); if (ve) { @@ -134,7 +133,7 @@ static PyObject *ViewEdgeIterator_current_edge_get(BPy_ViewEdgeIterator *self, static int ViewEdgeIterator_current_edge_set(BPy_ViewEdgeIterator *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_ViewEdge_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a ViewEdge"); @@ -153,15 +152,14 @@ PyDoc_STRVAR(ViewEdgeIterator_orientation_doc, "\n" ":type: bool"); -static PyObject *ViewEdgeIterator_orientation_get(BPy_ViewEdgeIterator *self, - void *UNUSED(closure)) +static PyObject *ViewEdgeIterator_orientation_get(BPy_ViewEdgeIterator *self, void * /*closure*/) { return PyBool_from_bool(self->ve_it->getOrientation()); } static int ViewEdgeIterator_orientation_set(BPy_ViewEdgeIterator *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!PyBool_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a boolean"); @@ -176,7 +174,7 @@ PyDoc_STRVAR(ViewEdgeIterator_begin_doc, "\n" ":type: :class:`ViewEdge`"); -static PyObject *ViewEdgeIterator_begin_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure)) +static PyObject *ViewEdgeIterator_begin_get(BPy_ViewEdgeIterator *self, void * /*closure*/) { ViewEdge *ve = self->ve_it->getBegin(); if (ve) { @@ -187,7 +185,7 @@ static PyObject *ViewEdgeIterator_begin_get(BPy_ViewEdgeIterator *self, void *UN static int ViewEdgeIterator_begin_set(BPy_ViewEdgeIterator *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_ViewEdge_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a ViewEdge"); diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp index 504c43a8542..f503494b898 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -107,7 +107,7 @@ PyDoc_STRVAR(orientedViewEdgeIterator_object_doc, ":type: (:class:`ViewEdge`, bool)"); static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterator *self, - void *UNUSED(closure)) + void * /*closure*/) { if (self->ove_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index be1b9f42ce4..8faefd085d6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -11,6 +11,8 @@ #include "UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -64,7 +66,7 @@ static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; } - self->uf0D_unsigned = new UnaryFunction0D<unsigned int>(); + self->uf0D_unsigned = new UnaryFunction0D<uint>(); self->uf0D_unsigned->py_uf0D = (PyObject *)self; return 0; } @@ -93,7 +95,7 @@ static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *s return nullptr; } - if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>)) { + if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<uint>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return nullptr; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 6d17f6debdf..7f5b98da223 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -11,6 +11,8 @@ #include "UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -106,9 +108,9 @@ static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVect return nullptr; } - const unsigned int list_len = self->uf0D_vectorviewshape->result.size(); + const uint list_len = self->uf0D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { + for (uint i = 0; i < list_len; i++) { ViewShape *v = self->uf0D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index f0435ea1294..82362704119 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -8,6 +8,8 @@ #include "../../../stroke/AdvancedFunctions0D.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -47,7 +49,7 @@ static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0 PyObject *kwds) { static const char *kwlist[] = {"orientation", "level", nullptr}; - unsigned int u; + uint u; int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", (char **)kwlist, &u, &i)) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index 4e4e4d31385..3fe84b3a76f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -223,14 +223,14 @@ PyDoc_STRVAR(integration_type_doc, "\n" ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DDouble *self, void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DDouble *self, void * /*closure*/) { return BPy_IntegrationType_from_IntegrationType(self->uf1D_double->getIntegrationType()); } static int integration_type_set(BPy_UnaryFunction1DDouble *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_IntegrationType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index ce654de8bc0..33f534e9860 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -130,14 +130,14 @@ PyDoc_STRVAR(integration_type_doc, "\n" ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DEdgeNature *self, void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DEdgeNature *self, void * /*closure*/) { return BPy_IntegrationType_from_IntegrationType(self->uf1D_edgenature->getIntegrationType()); } static int integration_type_set(BPy_UnaryFunction1DEdgeNature *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_IntegrationType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index 83958dbb3d7..c18bbff53c5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -119,14 +119,14 @@ PyDoc_STRVAR(integration_type_doc, "\n" ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DFloat *self, void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DFloat *self, void * /*closure*/) { return BPy_IntegrationType_from_IntegrationType(self->uf1D_float->getIntegrationType()); } static int integration_type_set(BPy_UnaryFunction1DFloat *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_IntegrationType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index e9023d90b42..800a5da1978 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -12,6 +12,8 @@ #include "UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -74,11 +76,10 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, } if (!obj) { - self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(); + self->uf1D_unsigned = new UnaryFunction1D<uint>(); } else { - self->uf1D_unsigned = new UnaryFunction1D<unsigned int>( - IntegrationType_from_BPy_IntegrationType(obj)); + self->uf1D_unsigned = new UnaryFunction1D<uint>(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_unsigned->py_uf1D = (PyObject *)self; @@ -109,7 +110,7 @@ static PyObject *UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *s return nullptr; } - if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<unsigned int>)) { + if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<uint>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return nullptr; } @@ -130,14 +131,14 @@ PyDoc_STRVAR(integration_type_doc, "\n" ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DUnsigned *self, void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DUnsigned *self, void * /*closure*/) { return BPy_IntegrationType_from_IntegrationType(self->uf1D_unsigned->getIntegrationType()); } static int integration_type_set(BPy_UnaryFunction1DUnsigned *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_IntegrationType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index c7bd84b0d18..bc76a83515b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -134,14 +134,14 @@ PyDoc_STRVAR(integration_type_doc, "\n" ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DVec2f *self, void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DVec2f *self, void * /*closure*/) { return BPy_IntegrationType_from_IntegrationType(self->uf1D_vec2f->getIntegrationType()); } static int integration_type_set(BPy_UnaryFunction1DVec2f *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_IntegrationType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 1eced4cd9f1..7a5521f7571 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -127,14 +127,14 @@ PyDoc_STRVAR(integration_type_doc, "\n" ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DVec3f *self, void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DVec3f *self, void * /*closure*/) { return BPy_IntegrationType_from_IntegrationType(self->uf1D_vec3f->getIntegrationType()); } static int integration_type_set(BPy_UnaryFunction1DVec3f *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_IntegrationType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index df504b1cdaa..fa15983f0d3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -14,6 +14,8 @@ #include "UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h" #include "UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -136,9 +138,9 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect return nullptr; } - const unsigned int list_len = self->uf1D_vectorviewshape->result.size(); + const uint list_len = self->uf1D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { + for (uint i = 0; i < list_len; i++) { ViewShape *v = self->uf1D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } @@ -153,8 +155,7 @@ PyDoc_STRVAR(integration_type_doc, "\n" ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DVectorViewShape *self, - void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DVectorViewShape *self, void * /*closure*/) { return BPy_IntegrationType_from_IntegrationType( self->uf1D_vectorviewshape->getIntegrationType()); @@ -162,7 +163,7 @@ static PyObject *integration_type_get(BPy_UnaryFunction1DVectorViewShape *self, static int integration_type_set(BPy_UnaryFunction1DVectorViewShape *self, PyObject *value, - void *UNUSED(closure)) + void * /*closure*/) { if (!BPy_IntegrationType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index 84152b8141f..7f952f1c991 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -142,14 +142,12 @@ PyDoc_STRVAR(integration_type_doc, "\n" ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DVoid *self, void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DVoid *self, void * /*closure*/) { return BPy_IntegrationType_from_IntegrationType(self->uf1D_void->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DVoid *self, - PyObject *value, - void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DVoid *self, PyObject *value, void * /*closure*/) { if (!BPy_IntegrationType_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp index c4d4aedc954..d1479f27935 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -10,6 +10,8 @@ #include "../../BPy_Convert.h" #include "../../BPy_IntegrationType.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -67,7 +69,7 @@ static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDen { static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", nullptr}; PyObject *obj = nullptr; - unsigned int u1, u2; + uint u1, u2; float f = 2.0; if (!PyArg_ParseTupleAndKeywords( diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp index 2f22e435017..99c688985f5 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp @@ -6,6 +6,8 @@ #include "BPy_EqualToChainingTimeStampUP1D.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -42,7 +44,7 @@ static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1 PyObject *kwds) { static const char *kwlist[] = {"ts", nullptr}; - unsigned u; + uint u; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) { return -1; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp index dd7a3f3baa3..48365507d1a 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp @@ -6,6 +6,8 @@ #include "BPy_EqualToTimeStampUP1D.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -41,7 +43,7 @@ static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D *self, PyObject *kwds) { static const char *kwlist[] = {"ts", nullptr}; - unsigned u; + uint u; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) { return -1; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp index 773e6c8dfb2..b410ee14831 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp @@ -6,6 +6,8 @@ #include "BPy_ShapeUP1D.h" +#include "BLI_sys_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -42,7 +44,7 @@ static char ShapeUP1D___doc__[] = static int ShapeUP1D___init__(BPy_ShapeUP1D *self, PyObject *args, PyObject *kwds) { static const char *kwlist[] = {"first", "second", nullptr}; - unsigned u1, u2 = 0; + uint u1, u2 = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2)) { return -1; diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp index d02ff6990a5..39dbf4b87a9 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp @@ -7,6 +7,8 @@ #include "IndexedFaceSet.h" +#include "BLI_sys_types.h" + namespace Freestyle { IndexedFaceSet::IndexedFaceSet() @@ -34,26 +36,26 @@ IndexedFaceSet::IndexedFaceSet() } IndexedFaceSet::IndexedFaceSet(float *iVertices, - unsigned iVSize, + uint iVSize, float *iNormals, - unsigned iNSize, + uint iNSize, FrsMaterial **iMaterials, - unsigned iMSize, + uint iMSize, float *iTexCoords, - unsigned iTSize, - unsigned iNumFaces, - unsigned *iNumVertexPerFace, + uint iTSize, + uint iNumFaces, + uint *iNumVertexPerFace, TRIANGLES_STYLE *iFaceStyle, FaceEdgeMark *iFaceEdgeMarks, - unsigned *iVIndices, - unsigned iVISize, - unsigned *iNIndices, - unsigned iNISize, - unsigned *iMIndices, - unsigned iMISize, - unsigned *iTIndices, - unsigned iTISize, - unsigned iCopy) + uint *iVIndices, + uint iVISize, + uint *iNIndices, + uint iNISize, + uint *iMIndices, + uint iMISize, + uint *iTIndices, + uint iTISize, + uint iCopy) { if (1 == iCopy) { _VSize = iVSize; @@ -68,7 +70,7 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, _FrsMaterials = nullptr; if (iMaterials) { _FrsMaterials = new FrsMaterial *[_MSize]; - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { _FrsMaterials[i] = new FrsMaterial(*(iMaterials[i])); } } @@ -80,8 +82,8 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, } _NumFaces = iNumFaces; - _NumVertexPerFace = new unsigned[_NumFaces]; - memcpy(_NumVertexPerFace, iNumVertexPerFace, _NumFaces * sizeof(unsigned)); + _NumVertexPerFace = new uint[_NumFaces]; + memcpy(_NumVertexPerFace, iNumVertexPerFace, _NumFaces * sizeof(uint)); _FaceStyle = new TRIANGLES_STYLE[_NumFaces]; memcpy(_FaceStyle, iFaceStyle, _NumFaces * sizeof(TRIANGLES_STYLE)); @@ -90,24 +92,24 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, memcpy(_FaceEdgeMarks, iFaceEdgeMarks, _NumFaces * sizeof(FaceEdgeMark)); _VISize = iVISize; - _VIndices = new unsigned[_VISize]; - memcpy(_VIndices, iVIndices, _VISize * sizeof(unsigned)); + _VIndices = new uint[_VISize]; + memcpy(_VIndices, iVIndices, _VISize * sizeof(uint)); _NISize = iNISize; - _NIndices = new unsigned[_NISize]; - memcpy(_NIndices, iNIndices, _NISize * sizeof(unsigned)); + _NIndices = new uint[_NISize]; + memcpy(_NIndices, iNIndices, _NISize * sizeof(uint)); _MISize = iMISize; _MIndices = nullptr; if (iMIndices) { - _MIndices = new unsigned[_MISize]; - memcpy(_MIndices, iMIndices, _MISize * sizeof(unsigned)); + _MIndices = new uint[_MISize]; + memcpy(_MIndices, iMIndices, _MISize * sizeof(uint)); } _TISize = iTISize; _TIndices = nullptr; if (_TISize) { - _TIndices = new unsigned[_TISize]; - memcpy(_TIndices, iTIndices, _TISize * sizeof(unsigned)); + _TIndices = new uint[_TISize]; + memcpy(_TIndices, iTIndices, _TISize * sizeof(uint)); } } else { @@ -161,7 +163,7 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) _MSize = iBrother.msize(); if (_MSize) { _FrsMaterials = new FrsMaterial *[_MSize]; - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { _FrsMaterials[i] = new FrsMaterial(*(iBrother._FrsMaterials[i])); } } @@ -177,8 +179,8 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) } _NumFaces = iBrother.numFaces(); - _NumVertexPerFace = new unsigned[_NumFaces]; - memcpy(_NumVertexPerFace, iBrother.numVertexPerFaces(), _NumFaces * sizeof(unsigned)); + _NumVertexPerFace = new uint[_NumFaces]; + memcpy(_NumVertexPerFace, iBrother.numVertexPerFaces(), _NumFaces * sizeof(uint)); _FaceStyle = new TRIANGLES_STYLE[_NumFaces]; memcpy(_FaceStyle, iBrother.trianglesStyle(), _NumFaces * sizeof(TRIANGLES_STYLE)); @@ -187,17 +189,17 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) memcpy(_FaceEdgeMarks, iBrother.faceEdgeMarks(), _NumFaces * sizeof(FaceEdgeMark)); _VISize = iBrother.visize(); - _VIndices = new unsigned[_VISize]; - memcpy(_VIndices, iBrother.vindices(), _VISize * sizeof(unsigned)); + _VIndices = new uint[_VISize]; + memcpy(_VIndices, iBrother.vindices(), _VISize * sizeof(uint)); _NISize = iBrother.nisize(); - _NIndices = new unsigned[_NISize]; - memcpy(_NIndices, iBrother.nindices(), _NISize * sizeof(unsigned)); + _NIndices = new uint[_NISize]; + memcpy(_NIndices, iBrother.nindices(), _NISize * sizeof(uint)); _MISize = iBrother.misize(); if (_MISize) { - _MIndices = new unsigned[_MISize]; - memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(unsigned)); + _MIndices = new uint[_MISize]; + memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(uint)); } else { _MIndices = nullptr; @@ -206,8 +208,8 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) _TISize = iBrother.tisize(); _TIndices = nullptr; if (_TISize) { - _TIndices = new unsigned[_TISize]; - memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(unsigned)); + _TIndices = new uint[_TISize]; + memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(uint)); } } @@ -224,7 +226,7 @@ IndexedFaceSet::~IndexedFaceSet() } if (nullptr != _FrsMaterials) { - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { delete _FrsMaterials[i]; } delete[] _FrsMaterials; @@ -290,7 +292,7 @@ void IndexedFaceSet::ComputeBBox() // parse all the coordinates to find the Xmax, YMax, ZMax float *v = _Vertices; - for (unsigned int i = 0; i < (_VSize / 3); ++i) { + for (uint i = 0; i < (_VSize / 3); ++i) { if (*v > XMax) { XMax = *v; } diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp index 31101e988e5..0089f68ce2d 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp +++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp @@ -9,6 +9,7 @@ #include "NodeTransform.h" #include "BLI_math.h" +#include "BLI_sys_types.h" namespace Freestyle { @@ -122,7 +123,7 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) // Computes the transform iBBox HVec3r tbox[8]; - unsigned int i; + uint i; for (i = 0; i < 8; i++) { tbox[i] = _Matrix * box[i]; } @@ -130,7 +131,7 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) Vec3r newMin(tbox[0]); Vec3r newMax(tbox[0]); for (i = 0; i < 8; i++) { - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { if (newMin[j] > tbox[i][j]) { newMin[j] = tbox[i][j]; } @@ -147,9 +148,9 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) bool NodeTransform::isScaled(const Matrix44r &M) { - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { real norm = 0; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { norm += M(i, j) * M(i, j); } if ((norm > 1.01) || (norm < 0.99)) { diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp index af41421fa72..0ab83003514 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp @@ -6,6 +6,8 @@ #include "SceneHash.h" +#include "BLI_sys_types.h" + #include <sstream> namespace Freestyle { @@ -20,38 +22,38 @@ string SceneHash::toString() void SceneHash::visitNodeViewLayer(NodeViewLayer &node) { struct RenderData *r = &node.scene().r; - adler32((unsigned char *)&r->xsch, sizeof(r->xsch)); // resolution_x - adler32((unsigned char *)&r->ysch, sizeof(r->ysch)); // resolution_y - adler32((unsigned char *)&r->size, sizeof(r->size)); // resolution_percentage + adler32((uchar *)&r->xsch, sizeof(r->xsch)); // resolution_x + adler32((uchar *)&r->ysch, sizeof(r->ysch)); // resolution_y + adler32((uchar *)&r->size, sizeof(r->size)); // resolution_percentage struct FreestyleConfig *config = &node.sceneLayer().freestyle_config; - adler32((unsigned char *)&config->flags, sizeof(config->flags)); - adler32((unsigned char *)&config->crease_angle, sizeof(config->crease_angle)); - adler32((unsigned char *)&config->sphere_radius, sizeof(config->sphere_radius)); - adler32((unsigned char *)&config->dkr_epsilon, sizeof(config->dkr_epsilon)); + adler32((uchar *)&config->flags, sizeof(config->flags)); + adler32((uchar *)&config->crease_angle, sizeof(config->crease_angle)); + adler32((uchar *)&config->sphere_radius, sizeof(config->sphere_radius)); + adler32((uchar *)&config->dkr_epsilon, sizeof(config->dkr_epsilon)); } void SceneHash::visitNodeCamera(NodeCamera &cam) { double *proj = cam.projectionMatrix(); for (int i = 0; i < 16; i++) { - adler32((unsigned char *)&proj[i], sizeof(double)); + adler32((uchar *)&proj[i], sizeof(double)); } } void SceneHash::visitIndexedFaceSet(IndexedFaceSet &ifs) { const float *v = ifs.vertices(); - const unsigned n = ifs.vsize(); + const uint n = ifs.vsize(); - for (unsigned i = 0; i < n; i++) { - adler32((unsigned char *)&v[i], sizeof(v[i])); + for (uint i = 0; i < n; i++) { + adler32((uchar *)&v[i], sizeof(v[i])); } } static const int MOD_ADLER = 65521; -void SceneHash::adler32(const unsigned char *data, int size) +void SceneHash::adler32(const uchar *data, int size) { uint32_t sum1 = _sum & 0xffff; uint32_t sum2 = (_sum >> 16) & 0xffff; diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp index 623b6b0e2bf..4a2b6979985 100644 --- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp +++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp @@ -10,6 +10,8 @@ #include "IndexedFaceSet.h" #include "ScenePrettyPrinter.h" +#include "BLI_sys_types.h" + namespace Freestyle { #define VISIT(CLASS) \ @@ -25,42 +27,42 @@ VISIT(NodeLight) VISIT(NodeDrawingStyle) VISIT(NodeTransform) -void ScenePrettyPrinter::visitNodeShapeBefore(NodeShape &UNUSED(shape)) +void ScenePrettyPrinter::visitNodeShapeBefore(NodeShape & /*shape*/) { increaseSpace(); } -void ScenePrettyPrinter::visitNodeShapeAfter(NodeShape &UNUSED(shape)) +void ScenePrettyPrinter::visitNodeShapeAfter(NodeShape & /*shape*/) { decreaseSpace(); } -void ScenePrettyPrinter::visitNodeGroupBefore(NodeGroup &UNUSED(group)) +void ScenePrettyPrinter::visitNodeGroupBefore(NodeGroup & /*group*/) { increaseSpace(); } -void ScenePrettyPrinter::visitNodeGroupAfter(NodeGroup &UNUSED(group)) +void ScenePrettyPrinter::visitNodeGroupAfter(NodeGroup & /*group*/) { decreaseSpace(); } -void ScenePrettyPrinter::visitNodeDrawingStyleBefore(NodeDrawingStyle &UNUSED(style)) +void ScenePrettyPrinter::visitNodeDrawingStyleBefore(NodeDrawingStyle & /*style*/) { increaseSpace(); } -void ScenePrettyPrinter::visitNodeDrawingStyleAfter(NodeDrawingStyle &UNUSED(style)) +void ScenePrettyPrinter::visitNodeDrawingStyleAfter(NodeDrawingStyle & /*style*/) { decreaseSpace(); } -void ScenePrettyPrinter::visitNodeTransformBefore(NodeTransform &UNUSED(transform)) +void ScenePrettyPrinter::visitNodeTransformBefore(NodeTransform & /*transform*/) { increaseSpace(); } -void ScenePrettyPrinter::visitNodeTransformAfter(NodeTransform &UNUSED(transform)) +void ScenePrettyPrinter::visitNodeTransformAfter(NodeTransform & /*transform*/) { decreaseSpace(); } @@ -73,11 +75,11 @@ VISIT(VertexRep) void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet &ifs) { const float *vertices = ifs.vertices(); - unsigned vsize = ifs.vsize(); + uint vsize = ifs.vsize(); _ofs << _space << "IndexedFaceSet" << endl; const float *p = vertices; - for (unsigned int i = 0; i < vsize / 3; i++) { + for (uint i = 0; i < vsize / 3; i++) { _ofs << _space << " " << setw(3) << setfill('0') << i << ": " << p[0] << ", " << p[1] << ", " << p[2] << endl; p += 3; diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp index 0bd2b960de3..37f5fb5cfbb 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp @@ -25,13 +25,13 @@ int DensityF0D::operator()(Interface0DIterator &iter) } RGBImage image; - canvas->readColorPixels((int)iter->getProjectedX() - bound, - (int)iter->getProjectedY() - bound, + canvas->readColorPixels(int(iter->getProjectedX()) - bound, + int(iter->getProjectedY()) - bound, _filter.maskSize(), _filter.maskSize(), image); result = _filter.getSmoothedPixel<RGBImage>( - &image, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + &image, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -48,13 +48,13 @@ int LocalAverageDepthF0D::operator()(Interface0DIterator &iter) } GrayImage image; - iViewer->readDepthPixels((int)iter->getProjectedX() - bound, - (int)iter->getProjectedY() - bound, + iViewer->readDepthPixels(int(iter->getProjectedX()) - bound, + int(iter->getProjectedY()) - bound, _filter.maskSize(), _filter.maskSize(), image); result = _filter.getSmoothedPixel( - &image, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + &image, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -63,7 +63,7 @@ int ReadMapPixelF0D::operator()(Interface0DIterator &iter) { Canvas *canvas = Canvas::getInstance(); result = canvas->readMapPixel( - _mapName, _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + _mapName, _level, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -71,7 +71,7 @@ int ReadSteerableViewMapPixelF0D::operator()(Interface0DIterator &iter) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); result = svm->readSteerableViewMapPixel( - _orientation, _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + _orientation, _level, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -79,7 +79,7 @@ int ReadCompleteViewMapPixelF0D::operator()(Interface0DIterator &iter) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); result = svm->readCompleteViewMapPixel( - _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + _level, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -87,12 +87,12 @@ int GetViewMapGradientNormF0D::operator()(Interface0DIterator &iter) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); float pxy = svm->readCompleteViewMapPixel( - _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + _level, int(iter->getProjectedX()), int(iter->getProjectedY())); float gx = svm->readCompleteViewMapPixel( - _level, (int)iter->getProjectedX() + _step, (int)iter->getProjectedY()) - + _level, int(iter->getProjectedX()) + _step, int(iter->getProjectedY())) - pxy; float gy = svm->readCompleteViewMapPixel( - _level, (int)iter->getProjectedX(), (int)iter->getProjectedY() + _step) - + _level, int(iter->getProjectedX()), int(iter->getProjectedY()) + _step) - pxy; result = Vec2f(gx, gy).norm(); return 0; diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp index a759cc333f1..a221e0e8bbd 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp @@ -10,6 +10,8 @@ #include "../view_map/SteerableViewMap.h" +#include "BLI_sys_types.h" + namespace Freestyle::Functions1D { int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) @@ -19,7 +21,7 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) Interface0DIterator itnext = it; ++itnext; FEdge *fe; - unsigned nSVM; + uint nSVM; vector<float> values; while (!itnext.isEnd()) { @@ -38,14 +40,14 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) } Vec2r m((i0D.getProjectedX() + i0Dnext.getProjectedX()) / 2.0, (i0D.getProjectedY() + i0Dnext.getProjectedY()) / 2.0); - values.push_back(svm->readSteerableViewMapPixel(nSVM, _level, (int)m[0], (int)m[1])); + values.push_back(svm->readSteerableViewMapPixel(nSVM, _level, int(m[0]), int(m[1]))); ++it; ++itnext; } float res, res_tmp; vector<float>::iterator v = values.begin(), vend = values.end(); - unsigned size = 1; + uint size = 1; switch (_integration) { case MIN: res = *v; diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp index 5530026b7ec..6508c95f2b4 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp @@ -11,6 +11,8 @@ #include "../system/PseudoNoise.h" #include "../system/RandGen.h" +#include "BLI_sys_types.h" + namespace Freestyle { ///////////////////////////////////////// @@ -71,7 +73,7 @@ int CalligraphicShader::shade(Stroke &ioStroke) const // ///////////////////////////////////////// -static const unsigned NB_VALUE_NOISE = 512; +static const uint NB_VALUE_NOISE = 512; SpatialNoiseShader::SpatialNoiseShader( float iAmount, float ixScale, int nbOctave, bool smooth, bool pureRandom) diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index c801dc70114..e77ba63f3d6 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -23,6 +23,8 @@ #include "BKE_global.h" +#include "BLI_sys_types.h" + #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -80,11 +82,11 @@ int IncreasingThicknessShader::shade(Stroke &stroke) const for (i = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v, ++i) { float t; - if (i < (float)n / 2.0f) { - t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * _ThicknessMax; + if (i < float(n) / 2.0f) { + t = (1.0 - float(i) / float(n)) * _ThicknessMin + float(i) / float(n) * _ThicknessMax; } else { - t = (1.0 - (float)i / (float)n) * _ThicknessMax + (float)i / (float)n * _ThicknessMin; + t = (1.0 - float(i) / float(n)) * _ThicknessMax + float(i) / float(n) * _ThicknessMin; } v->attribute().setThickness(t / 2.0, t / 2.0); } @@ -102,11 +104,11 @@ int ConstrainedIncreasingThicknessShader::shade(Stroke &stroke) const // XXX Why not using an if/else here? Else, if last condition is true, everything else is // computed for nothing! float t; - if (i < (float)n / 2.0f) { - t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * maxT; + if (i < float(n) / 2.0f) { + t = (1.0 - float(i) / float(n)) * _ThicknessMin + float(i) / float(n) * maxT; } else { - t = (1.0 - (float)i / (float)n) * maxT + (float)i / (float)n * _ThicknessMin; + t = (1.0 - float(i) / float(n)) * maxT + float(i) / float(n) * _ThicknessMin; } v->attribute().setThickness(t / 2.0, t / 2.0); if (i == n - 1) { @@ -152,18 +154,18 @@ int LengthDependingThicknessShader::shade(Stroke &stroke) const return 0; } -static const unsigned NB_VALUE_NOISE = 512; +static const uint NB_VALUE_NOISE = 512; ThicknessNoiseShader::ThicknessNoiseShader() { _amplitude = 1.0f; - _scale = 1.0f / 2.0f / (float)NB_VALUE_NOISE; + _scale = 1.0f / 2.0f / float(NB_VALUE_NOISE); } ThicknessNoiseShader::ThicknessNoiseShader(float iAmplitude, float iPeriod) { _amplitude = iAmplitude; - _scale = 1.0f / iPeriod / (float)NB_VALUE_NOISE; + _scale = 1.0f / iPeriod / float(NB_VALUE_NOISE); } int ThicknessNoiseShader::shade(Stroke &stroke) const @@ -213,8 +215,8 @@ int IncreasingColorShader::shade(Stroke &stroke) const for (yo = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v, ++yo) { for (int i = 0; i < 4; ++i) { - newcolor[i] = (1.0 - (float)yo / (float)n) * _colorMin[i] + - (float)yo / (float)n * _colorMax[i]; + newcolor[i] = (1.0 - float(yo) / float(n)) * _colorMin[i] + + float(yo) / float(n) * _colorMax[i]; } v->attribute().setColor(newcolor[0], newcolor[1], newcolor[2]); v->attribute().setAlpha(newcolor[3]); @@ -243,13 +245,13 @@ int MaterialColorShader::shade(Stroke &stroke) const ColorNoiseShader::ColorNoiseShader() { _amplitude = 1.0f; - _scale = 1.0f / 2.0f / (float)NB_VALUE_NOISE; + _scale = 1.0f / 2.0f / float(NB_VALUE_NOISE); } ColorNoiseShader::ColorNoiseShader(float iAmplitude, float iPeriod) { _amplitude = iAmplitude; - _scale = 1.0f / iPeriod / (float)NB_VALUE_NOISE; + _scale = 1.0f / iPeriod / float(NB_VALUE_NOISE); } int ColorNoiseShader::shade(Stroke &stroke) const @@ -373,7 +375,7 @@ int BezierCurveShader::shade(Stroke &stroke) const ++v; for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) { if (!((fabs(v->x() - (previous)->x()) < M_EPSILON) && - ((fabs(v->y() - (previous)->y()) < M_EPSILON)))) { + (fabs(v->y() - (previous)->y()) < M_EPSILON))) { data.emplace_back(v->x(), v->y()); } previous = v; @@ -395,7 +397,7 @@ int BezierCurveShader::shade(Stroke &stroke) const p = segmentsVertices.begin(); ++p; for (pend = segmentsVertices.end(); p != pend; ++p) { - CurveVertices.push_back((*p)); + CurveVertices.push_back(*p); } } @@ -467,7 +469,7 @@ int BezierCurveShader::shade(Stroke &stroke) const vector<StrokeAttribute>::iterator a = attributes.begin(), aend = attributes.end(); int index = 0; - int index1 = (int)floor((float)originalSize / 2.0); + int index1 = int(floor(float(originalSize) / 2.0)); int index2 = index1 + nExtraVertex; for (it = stroke.strokeVerticesBegin(), itend = stroke.strokeVerticesEnd(); (it != itend) && (a != aend); @@ -614,7 +616,7 @@ int GuidingLinesShader::shade(Stroke &stroke) const n[0] = -n[0]; n[1] = -n[1]; } - float offset = (piece.error()) / 2.0f * _offset; + float offset = piece.error() / 2.0f * _offset; StrokeInternal::StrokeVertexIterator v, vend; for (v = a, vend = stroke.strokeVerticesEnd(); v != vend; ++v) { v->setPoint(piece.A.x() + v->u() * u.x() + n.x() * offset, @@ -660,13 +662,13 @@ int TipRemoverShader::shade(Stroke &stroke) const vector<StrokeVertex *>::iterator sv, svend; for (sv = verticesToRemove.begin(), svend = verticesToRemove.end(); sv != svend; ++sv) { - stroke.RemoveVertex((*sv)); + stroke.RemoveVertex(*sv); } // Resample so that our new stroke have the same number of vertices than before stroke.Resample(originalSize); - if ((int)stroke.strokeVerticesSize() != originalSize) { // soc + if (int(stroke.strokeVerticesSize()) != originalSize) { // soc cerr << "Warning: resampling problem" << endl; } diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 68a18323621..741fad592cf 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -22,6 +22,8 @@ #include "../view_map/SteerableViewMap.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" // soc #include <qimage.h> @@ -91,7 +93,7 @@ void Canvas::Draw() preDraw(); TimeStamp *timestamp = TimeStamp::instance(); - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { _current_sm = _StyleModules[i]; if (i < _Layers.size() && _Layers[i]) { @@ -169,11 +171,11 @@ void Canvas::PushBackStyleModule(StyleModule *iStyleModule) _Layers.push_back(layer); } -void Canvas::InsertStyleModule(unsigned index, StyleModule *iStyleModule) +void Canvas::InsertStyleModule(uint index, StyleModule *iStyleModule) { - unsigned size = _StyleModules.size(); + uint size = _StyleModules.size(); StrokeLayer *layer = new StrokeLayer(); - if ((_StyleModules.empty()) || (index == size)) { + if (_StyleModules.empty() || (index == size)) { _StyleModules.push_back(iStyleModule); _Layers.push_back(layer); return; @@ -182,9 +184,9 @@ void Canvas::InsertStyleModule(unsigned index, StyleModule *iStyleModule) _Layers.insert(_Layers.begin() + index, layer); } -void Canvas::RemoveStyleModule(unsigned index) +void Canvas::RemoveStyleModule(uint index) { - unsigned int i = 0; + uint i = 0; if (!_StyleModules.empty()) { for (deque<StyleModule *>::iterator s = _StyleModules.begin(), send = _StyleModules.end(); s != send; @@ -216,7 +218,7 @@ void Canvas::RemoveStyleModule(unsigned index) } } -void Canvas::SwapStyleModules(unsigned i1, unsigned i2) +void Canvas::SwapStyleModules(uint i1, uint i2) { StyleModule *tmp; tmp = _StyleModules[i1]; @@ -229,9 +231,9 @@ void Canvas::SwapStyleModules(unsigned i1, unsigned i2) _Layers[i2] = tmp2; } -void Canvas::ReplaceStyleModule(unsigned index, StyleModule *iStyleModule) +void Canvas::ReplaceStyleModule(uint index, StyleModule *iStyleModule) { - unsigned i = 0; + uint i = 0; for (deque<StyleModule *>::iterator s = _StyleModules.begin(), send = _StyleModules.end(); s != send; ++s, ++i) { @@ -245,29 +247,29 @@ void Canvas::ReplaceStyleModule(unsigned index, StyleModule *iStyleModule) } } -void Canvas::setVisible(unsigned index, bool iVisible) +void Canvas::setVisible(uint index, bool iVisible) { _StyleModules[index]->setDisplayed(iVisible); } -void Canvas::setModified(unsigned index, bool iMod) +void Canvas::setModified(uint index, bool iMod) { _StyleModules[index]->setModified(iMod); } void Canvas::resetModified(bool iMod /* = false */) { - unsigned int size = _StyleModules.size(); - for (unsigned int i = 0; i < size; ++i) { + uint size = _StyleModules.size(); + for (uint i = 0; i < size; ++i) { setModified(i, iMod); } } -void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index) +void Canvas::causalStyleModules(vector<uint> &vec, uint index) { - unsigned int size = _StyleModules.size(); + uint size = _StyleModules.size(); - for (unsigned int i = index; i < size; ++i) { + for (uint i = index; i < size; ++i) { if (_StyleModules[i]->getCausal()) { vec.push_back(i); } @@ -276,7 +278,7 @@ void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index) void Canvas::Render(const StrokeRenderer *iRenderer) { - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -286,7 +288,7 @@ void Canvas::Render(const StrokeRenderer *iRenderer) void Canvas::RenderBasic(const StrokeRenderer *iRenderer) { - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -294,10 +296,7 @@ void Canvas::RenderBasic(const StrokeRenderer *iRenderer) } } -void Canvas::loadMap(const char *iFileName, - const char *iMapName, - unsigned int iNbLevels, - float iSigma) +void Canvas::loadMap(const char *iFileName, const char *iMapName, uint iNbLevels, float iSigma) { // check whether this map was already loaded: if (!_maps.empty()) { diff --git a/source/blender/freestyle/intern/stroke/Chain.cpp b/source/blender/freestyle/intern/stroke/Chain.cpp index 3778727da37..b3f4d4547e9 100644 --- a/source/blender/freestyle/intern/stroke/Chain.cpp +++ b/source/blender/freestyle/intern/stroke/Chain.cpp @@ -120,7 +120,7 @@ void Chain::push_viewedge_front(ViewEdge *iViewEdge, bool orientation) } do { current = (*v)->point2d(); - Curve::push_vertex_front((*v)); + Curve::push_vertex_front(*v); //_Length += (current - previous).norm(); previous = current; if (orientation) { diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp index 453eea58c93..87aabf71636 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp @@ -26,7 +26,7 @@ bool AdjacencyIterator::isIncoming() const int AdjacencyIterator::increment() { ++_internalIterator; - while ((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first))) { + while (!_internalIterator.isEnd() && !isValid((*_internalIterator).first)) { ++_internalIterator; } return 0; diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp index e50b5f0b242..cd37a5f893d 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp @@ -12,19 +12,21 @@ #include "../system/TimeStamp.h" +#include "BLI_sys_types.h" + namespace Freestyle::ContextFunctions { -unsigned GetTimeStampCF() +uint GetTimeStampCF() { return TimeStamp::instance()->getTimeStamp(); } -unsigned GetCanvasWidthCF() +uint GetCanvasWidthCF() { return Canvas::getInstance()->width(); } -unsigned GetCanvasHeightCF() +uint GetCanvasHeightCF() { return Canvas::getInstance()->height(); } @@ -34,24 +36,24 @@ BBox<Vec2i> GetBorderCF() return Canvas::getInstance()->border(); } -void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels, float iSigma) +void LoadMapCF(const char *iFileName, const char *iMapName, uint iNbLevels, float iSigma) { return Canvas::getInstance()->loadMap(iFileName, iMapName, iNbLevels, iSigma); } -float ReadMapPixelCF(const char *iMapName, int level, unsigned x, unsigned y) +float ReadMapPixelCF(const char *iMapName, int level, uint x, uint y) { Canvas *canvas = Canvas::getInstance(); return canvas->readMapPixel(iMapName, level, x, y); } -float ReadCompleteViewMapPixelCF(int level, unsigned x, unsigned y) +float ReadCompleteViewMapPixelCF(int level, uint x, uint y) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); return svm->readCompleteViewMapPixel(level, x, y); } -float ReadDirectionalViewMapPixelCF(int iOrientation, int level, unsigned x, unsigned y) +float ReadDirectionalViewMapPixelCF(int iOrientation, int level, uint x, uint y) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); return svm->readSteerableViewMapPixel(iOrientation, level, x, y); diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index ee9fa33285f..93524e6ebe5 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -14,6 +14,8 @@ #include "Stroke.h" #include "StrokeIterators.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { @@ -73,7 +75,7 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, return 0; } - unsigned id = 0; + uint id = 0; ViewEdge *edge; I1DContainer new_chains_set; @@ -137,7 +139,7 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &p return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -318,7 +320,7 @@ int Operators::bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred) return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -421,7 +423,7 @@ int Operators::bidirectionalChain(ChainingIterator &it) return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -873,7 +875,7 @@ static int __recursiveSplit(Chain *_curve, ++it; // real mean = 0.0f; // soc unused - real variance = 0.0f; - unsigned count = 0; + uint count = 0; CurveInternal::CurvePointIterator next = it; ++next; diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index 101b89d720a..66a31d02a9b 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -486,11 +486,11 @@ void Stroke::setLength(float iLength) float Stroke::ComputeSampling(int iNVertices) { - if (iNVertices <= (int)_Vertices.size()) { // soc + if (iNVertices <= int(_Vertices.size())) { // soc return _sampling; } - float sampling = _Length / (float)(iNVertices - _Vertices.size() + 1); + float sampling = _Length / float(iNVertices - _Vertices.size() + 1); return sampling; } @@ -542,8 +542,8 @@ int Stroke::Resample(int iNPoints) Vec2r b((next)->getPoint()); Vec2r vec_tmp(b - a); real norm_var = vec_tmp.norm(); - int numberOfPointsToAdd = (int)floor(NPointsToAdd * norm_var / _Length); - float csampling = norm_var / (float)(numberOfPointsToAdd + 1); + int numberOfPointsToAdd = int(floor(NPointsToAdd * norm_var / _Length)); + float csampling = norm_var / float(numberOfPointsToAdd + 1); strokeSegments.emplace_back(it, next, norm_var, numberOfPointsToAdd, csampling); N += numberOfPointsToAdd; meanlength += norm_var; @@ -551,7 +551,7 @@ int Stroke::Resample(int iNPoints) ++it; ++next; } - meanlength /= (float)nsegments; + meanlength /= float(nsegments); // if we don't have enough points let's resample finer some segments bool checkEveryone = false; @@ -571,7 +571,7 @@ int Stroke::Resample(int iNPoints) } // resample s->_n = s->_n + 1; - s->_sampling = s->_length / (float)(s->_n + 1); + s->_sampling = s->_length / float(s->_n + 1); s->_resampled = resampled = true; N++; if (N == NPointsToAdd) { @@ -593,14 +593,14 @@ int Stroke::Resample(int iNPoints) for (vector<StrokeSegment>::iterator s = strokeSegments.begin(), send = strokeSegments.end(); s != send; ++s) { - newVertices.push_back(&(*(s->_begin))); + newVertices.push_back(&*(s->_begin)); if (s->_sampling < _sampling) { _sampling = s->_sampling; } t = s->_sampling / s->_length; for (int i = 0; i < s->_n; ++i) { - newVertex = new StrokeVertex(&(*(s->_begin)), &(*(s->_end)), t); + newVertex = new StrokeVertex(&*(s->_begin), &*(s->_end), t); newVertices.push_back(newVertex); t += s->_sampling / s->_length; } diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp index 35ee41adbaf..095cb74d607 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp @@ -9,6 +9,8 @@ #include "../geometry/GeomUtils.h" +#include "BLI_sys_types.h" + using namespace std; namespace Freestyle { @@ -69,12 +71,12 @@ void TextureManager::load() _hasLoadedTextures = true; } -unsigned TextureManager::getBrushTextureIndex(string name, Stroke::MediumType iType) +uint TextureManager::getBrushTextureIndex(string name, Stroke::MediumType iType) { BrushTexture bt(name, iType); brushesMap::iterator b = _brushesMap.find(bt); if (b == _brushesMap.end()) { - unsigned texId = loadBrush(name, iType); + uint texId = loadBrush(name, iType); _brushesMap[bt] = texId; return texId; // XXX! diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index e8ff46df731..89567d7e780 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -360,7 +360,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices) } } - if (i != 2 * (int)iStrokeVertices.size()) { + if (i != 2 * int(iStrokeVertices.size())) { if (G.debug & G_DEBUG_FREESTYLE) { cout << "Warning: problem with stripe size\n"; } @@ -837,11 +837,11 @@ void StrokeRep::create() bool first = true; bool end = false; while (v != vend) { - while ((v != vend) && (!(*v).attribute().isVisible())) { + while ((v != vend) && !(*v).attribute().isVisible()) { ++v; first = false; } - while ((v != vend) && ((*v).attribute().isVisible())) { + while ((v != vend) && (*v).attribute().isVisible()) { strip.push_back(&(*v)); ++v; } @@ -852,7 +852,7 @@ void StrokeRep::create() else { end = true; } - if ((!strip.empty()) && (strip.size() > 1)) { + if (!strip.empty() && (strip.size() > 1)) { _strips.push_back(new Strip(strip, _hasTex, first, end, _textureStep)); strip.clear(); } diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp index 2dce6140c3f..07ba45b81ab 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp @@ -64,7 +64,7 @@ NodeGroup *StrokeTesselator::Tesselate(StrokeVertexIterator begin, StrokeVertexI tshape->setFrsMaterial(_FrsMaterial); for (StrokeVertexIterator c = begin, cend = end; c != cend; c++) { - tshape->AddRep(Tesselate((*c))); + tshape->AddRep(Tesselate(*c)); } return group; diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp index ad2950c73a9..98115691f52 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.cpp +++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp @@ -11,11 +11,11 @@ #include "PseudoNoise.h" #include "RandGen.h" -static int modf_to_index(Freestyle::real x, unsigned int range) +static int modf_to_index(Freestyle::real x, uint range) { if (isfinite(x)) { Freestyle::real tmp; - int i = abs((int)(modf(x, &tmp) * range)); + int i = abs(int(modf(x, &tmp) * range)); BLI_assert(i >= 0 && i < range); return i; } @@ -30,7 +30,7 @@ real PseudoNoise::_values[]; void PseudoNoise::init(long seed) { RandGen::srand48(seed); - for (unsigned int i = 0; i < NB_VALUE_NOISE; i++) { + for (uint i = 0; i < NB_VALUE_NOISE; i++) { _values[i] = -1.0 + 2.0 * RandGen::drand48(); } } @@ -79,22 +79,22 @@ real PseudoNoise::smoothNoise(real x) return (x0 * y0 + x1 * y1 + x2 * y2 + x3 * y3) / (y0 + y1 + y2 + y3); } -real PseudoNoise::turbulenceSmooth(real x, unsigned nbOctave) +real PseudoNoise::turbulenceSmooth(real x, uint nbOctave) { real y = 0; real k = 1.0; - for (unsigned int i = 0; i < nbOctave; i++) { + for (uint i = 0; i < nbOctave; i++) { y = y + k * smoothNoise(x * k); k = k / 2.0; } return y; } -real PseudoNoise::turbulenceLinear(real x, unsigned nbOctave) +real PseudoNoise::turbulenceLinear(real x, uint nbOctave) { real y = 0; real k = 1.0; - for (unsigned int i = 0; i < nbOctave; i++) { + for (uint i = 0; i < nbOctave; i++) { y = y + k * linearNoise(x * k); k = k / 2.0; } diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp index d18d53c767f..b2161480c74 100644 --- a/source/blender/freestyle/intern/system/RandGen.cpp +++ b/source/blender/freestyle/intern/system/RandGen.cpp @@ -7,6 +7,8 @@ #include "RandGen.h" +#include "BLI_sys_types.h" + namespace Freestyle { // @@ -15,7 +17,7 @@ namespace Freestyle { /////////////////////////////////////////////////////////////////////////////// #define N 16 -#define MASK ((unsigned)(1 << (N - 1)) + (1 << (N - 1)) - 1) +#define MASK (uint(1 << (N - 1)) + (1 << (N - 1)) - 1) #define X0 0x330E #define X1 0xABCD #define X2 0x1234 @@ -27,18 +29,18 @@ namespace Freestyle { # define HI_BIT (1L << (2 * N - 1)) #endif -#define LOW(x) ((unsigned)(x)&MASK) +#define LOW(x) (uint(x) & MASK) #define HIGH(x) LOW((x) >> N) #define MUL(x, y, z) \ { \ - long l = (long)(x) * (long)(y); \ + long l = long(x) * long(y); \ (z)[0] = LOW(l); \ (z)[1] = HIGH(l); \ } \ ((void)0) -#define CARRY(x, y) ((unsigned long)((long)(x) + (long)(y)) > MASK) +#define CARRY(x, y) (ulong(long(x) + long(y)) > MASK) #define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y))) #define SET3(x, x0, x1, x2) ((x)[0] = (x0), (x)[1] = (x1), (x)[2] = (x2)) #if 0 // XXX, unused @@ -70,17 +72,17 @@ namespace Freestyle { } #endif -static unsigned x[3] = { +static uint x[3] = { X0, X1, X2, }; -static unsigned a[3] = { +static uint a[3] = { A0, A1, A2, }; -static unsigned c = C; +static uint c = C; // // Methods implementation @@ -101,7 +103,7 @@ void RandGen::srand48(long seedval) void RandGen::next() { - unsigned p[2], q[2], r[2], carry0, carry1; + uint p[2], q[2], r[2], carry0, carry1; MUL(a[0], x[0], p); ADDEQU(p[0], c, carry0); diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp index 1ecd5a2126d..fbd85815da1 100644 --- a/source/blender/freestyle/intern/system/StringUtils.cpp +++ b/source/blender/freestyle/intern/system/StringUtils.cpp @@ -10,6 +10,8 @@ #include "StringUtils.h" #include "FreestyleConfig.h" +#include "BLI_sys_types.h" + namespace Freestyle::StringUtils { void getPathName(const string &path, const string &base, vector<string> &pathnames) @@ -17,13 +19,13 @@ void getPathName(const string &path, const string &base, vector<string> &pathnam string dir; string res; char cleaned[FILE_MAX]; - unsigned size = path.size(); + uint size = path.size(); pathnames.push_back(base); - for (unsigned int pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size; + for (uint pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size; pos = sep + 1, sep = path.find(Config::PATH_SEP, pos)) { - if (sep == (unsigned)string::npos) { + if (sep == uint(string::npos)) { sep = size; } diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp index ad2ebb737a5..f4619e6e85f 100644 --- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp @@ -7,13 +7,15 @@ #include "ArbitraryGridDensityProvider.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &source, const real proscenium[4], - unsigned numCells) + uint numCells) : GridDensityProvider(source), numCells(numCells) { initialize(proscenium); @@ -22,7 +24,7 @@ ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &sourc ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &source, const BBox<Vec3r> &bbox, const GridHelpers::Transform &transform, - unsigned numCells) + uint numCells) : GridDensityProvider(source), numCells(numCells) { real proscenium[4]; @@ -31,8 +33,7 @@ ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &sourc initialize(proscenium); } -ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &source, - unsigned numCells) +ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource &source, uint numCells) : GridDensityProvider(source), numCells(numCells) { real proscenium[4]; @@ -76,7 +77,7 @@ void ArbitraryGridDensityProvider::initialize(const real proscenium[4]) _cellOrigin[1] = ((proscenium[2] + proscenium[3]) / 2.0) - (_cellsY / 2.0) * _cellSize; } -ArbitraryGridDensityProviderFactory::ArbitraryGridDensityProviderFactory(unsigned numCells) +ArbitraryGridDensityProviderFactory::ArbitraryGridDensityProviderFactory(uint numCells) : numCells(numCells) { } diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp index 6b66ce17373..b984d5dba29 100644 --- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp @@ -7,6 +7,8 @@ #include "AverageAreaGridDensityProvider.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { @@ -48,7 +50,7 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s float prosceniumHeight = (proscenium[3] - proscenium[2]); real cellArea = 0.0; - unsigned numFaces = 0; + uint numFaces = 0; for (source.begin(); source.isValid(); source.next()) { Polygon3r &poly(source.getGridSpacePolygon()); Vec3r min, max; @@ -66,7 +68,7 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s } _cellSize = sqrt(cellArea); - unsigned maxCells = 931; // * 1.1 = 1024 + uint maxCells = 931; // * 1.1 = 1024 if (std::max(prosceniumWidth, prosceniumHeight) / _cellSize > maxCells) { if (G.debug & G_DEBUG_FREESTYLE) { cout << "Scene-dependent cell size (" << _cellSize << " square) is too small." << endl; diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp index c8a6f0a0a3e..4464aab6419 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp +++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp @@ -10,6 +10,8 @@ #include "BoxGrid.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" using namespace std; @@ -127,7 +129,7 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, ++f) { if ((*f)->isInImage()) { Vec3r point = transform((*f)->center3d()); - unsigned int i, j; + uint i, j; getCellCoordinates(point, i, j); if (_cells[i * _cellsY + j] == nullptr) { // This is an uninitialized cell @@ -149,8 +151,8 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, void BoxGrid::distributePolygons(OccluderSource &source) { - unsigned long nFaces = 0; - unsigned long nKeptFaces = 0; + ulong nFaces = 0; + ulong nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { OccluderData *occluder = nullptr; @@ -186,15 +188,15 @@ void BoxGrid::reorganizeCells() } } -void BoxGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y) +void BoxGrid::getCellCoordinates(const Vec3r &point, uint &x, uint &y) { - x = min(_cellsX - 1, (unsigned)floor(max((double)0.0f, point[0] - _cellOrigin[0]) / _cellSize)); - y = min(_cellsY - 1, (unsigned)floor(max((double)0.0f, point[1] - _cellOrigin[1]) / _cellSize)); + x = min(_cellsX - 1, uint(floor(max(double(0.0f), point[0] - _cellOrigin[0]) / _cellSize))); + y = min(_cellsY - 1, uint(floor(max(double(0.0f), point[1] - _cellOrigin[1]) / _cellSize))); } BoxGrid::Cell *BoxGrid::findCell(const Vec3r &point) { - unsigned int x, y; + uint x, y; getCellCoordinates(point, x, y); return _cells[x * _cellsY + y]; } diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index 8ae6bec2fb2..c1afb6de881 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -9,6 +9,8 @@ #include "../geometry/GridHelpers.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { @@ -56,7 +58,7 @@ bool CulledOccluderSource::next() void CulledOccluderSource::getOccluderProscenium(real proscenium[4]) { - for (unsigned int i = 0; i < 4; ++i) { + for (uint i = 0; i < 4; ++i) { proscenium[i] = gridSpaceOccluderProscenium[i]; } } diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index cd36e4b0fe9..b7e805f8767 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -12,6 +12,8 @@ #include "../geometry/GeomUtils.h" #include "../geometry/normal_cycle.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { @@ -318,8 +320,8 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge) WXFace *fA = (WXFace *)iEdge->GetaOEdge()->GetaFace(); WXFace *fB = (WXFace *)iEdge->GetaOEdge()->GetbFace(); - if ((fA->front()) ^ - (fB->front())) { // fA->visible XOR fB->visible (true if one is 0 and the other is 1) + if (fA->front() ^ + fB->front()) { // fA->visible XOR fB->visible (true if one is 0 and the other is 1) // The only edges we want to set as silhouette edges in this way are the ones with 2 different // normals for 1 vertex for these two faces //-------------------- @@ -420,8 +422,8 @@ void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace) WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE | Nature::VALLEY, false); iFace->AddSmoothLayer(flayer); - unsigned int numVertices = iFace->numberOfVertices(); - for (unsigned int i = 0; i < numVertices; ++i) { + uint numVertices = iFace->numberOfVertices(); + for (uint i = 0; i < numVertices; ++i) { WVertex *wv = iFace->GetVertex(i); WXVertex *wxv = dynamic_cast<WXVertex *>(wv); flayer->PushDotP(wxv->curvatures()->K1); @@ -570,8 +572,8 @@ void FEdgeXDetector::ProcessSuggestiveContourFace(WXFace *iFace) WXFaceLayer *faceLayer = new WXFaceLayer(iFace, Nature::SUGGESTIVE_CONTOUR, true); iFace->AddSmoothLayer(faceLayer); - unsigned int numVertices = iFace->numberOfVertices(); - for (unsigned int i = 0; i < numVertices; ++i) { + uint numVertices = iFace->numberOfVertices(); + for (uint i = 0; i < numVertices; ++i) { WVertex *wv = iFace->GetVertex(i); WXVertex *wxv = dynamic_cast<WXVertex *>(wv); faceLayer->PushDotP(wxv->curvatures()->Kr); @@ -618,7 +620,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) // Compute the derivative value at each vertex of the face, and add it in a vector. vector<real> kr_derivatives; - unsigned vertices_nb = iFace->numberOfVertices(); + uint vertices_nb = iFace->numberOfVertices(); WXVertex *v, *opposite_vertex_a, *opposite_vertex_b; WXFace *wxf; WOEdge *opposite_edge; @@ -626,8 +628,8 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) GeomUtils::intersection_test res; real kr(0), kr1(0), kr2(0), t; - for (unsigned int i = 0; i < vertices_nb; ++i) { - v = (WXVertex *)(iFace->GetVertex(i)); + for (uint i = 0; i < vertices_nb; ++i) { + v = (WXVertex *)iFace->GetVertex(i); // v is a singular vertex, skip it. if (v->isBoundary()) { diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index a461f368859..aaafc5c884a 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -8,6 +8,8 @@ #include "Functions0D.h" #include "ViewMap.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" using namespace std; @@ -105,14 +107,14 @@ void getOccludersF0D(Interface0DIterator &it, set<ViewShape *> &oOccluders) occluder_container::const_iterator oitend = ve1->occluders_end(); for (; oit != oitend; ++oit) { - oOccluders.insert((*oit)); + oOccluders.insert(*oit); } if (ve2 != nullptr) { oit = ve2->occluders_begin(); oitend = ve2->occluders_end(); for (; oit != oitend; ++oit) { - oOccluders.insert((*oit)); + oOccluders.insert(*oit); } } } @@ -202,12 +204,12 @@ int Curvature2DAngleF0D::operator()(Interface0DIterator &iter) { Interface0DIterator tmp1 = iter, tmp2 = iter; ++tmp2; - unsigned count = 1; - while ((!tmp1.isBegin()) && (count < 3)) { + uint count = 1; + while (!tmp1.isBegin() && (count < 3)) { --tmp1; ++count; } - while ((!tmp2.isEnd()) && (count < 3)) { + while (!tmp2.isEnd() && (count < 3)) { ++tmp2; ++count; } @@ -319,7 +321,7 @@ int QuantitativeInvisibilityF0D::operator()(Interface0DIterator &iter) { ViewEdge *ve1, *ve2; getViewEdges(iter, ve1, ve2); - unsigned int qi1, qi2; + uint qi1, qi2; qi1 = ve1->qi(); if (ve2 != nullptr) { qi2 = ve2->qi(); @@ -355,7 +357,7 @@ int GetOccludersF0D::operator()(Interface0DIterator &iter) // vsOccluders.insert(vsOccluders.begin(), occluders.begin(), occluders.end()); for (set<ViewShape *>::iterator it = occluders.begin(), itend = occluders.end(); it != itend; ++it) { - result.push_back((*it)); + result.push_back(*it); } return 0; } diff --git a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp index f5a6a5ed5a9..40fa8387637 100644 --- a/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp +++ b/source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp @@ -7,10 +7,12 @@ #include "HeuristicGridDensityProviderFactory.h" +#include "BLI_sys_types.h" + namespace Freestyle { HeuristicGridDensityProviderFactory::HeuristicGridDensityProviderFactory(real sizeFactor, - unsigned numFaces) + uint numFaces) : sizeFactor(sizeFactor), numFaces(numFaces) { } diff --git a/source/blender/freestyle/intern/view_map/Interface0D.cpp b/source/blender/freestyle/intern/view_map/Interface0D.cpp index 8c5e762d147..a7e767cc551 100644 --- a/source/blender/freestyle/intern/view_map/Interface0D.cpp +++ b/source/blender/freestyle/intern/view_map/Interface0D.cpp @@ -62,7 +62,7 @@ Geometry::Vec2r Interface0D::getPoint2D() const return 0; } -FEdge *Interface0D::getFEdge(Interface0D &UNUSED(element)) +FEdge *Interface0D::getFEdge(Interface0D & /*element*/) { PyErr_SetString(PyExc_TypeError, "method getFEdge() not properly overridden"); return nullptr; diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.cpp b/source/blender/freestyle/intern/view_map/OccluderSource.cpp index 378b017b504..7ac5de9abbc 100644 --- a/source/blender/freestyle/intern/view_map/OccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/OccluderSource.cpp @@ -9,6 +9,8 @@ #include "OccluderSource.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { @@ -114,7 +116,7 @@ void OccluderSource::getOccluderProscenium(real proscenium[4]) real OccluderSource::averageOccluderArea() { real area = 0.0; - unsigned numFaces = 0; + uint numFaces = 0; for (begin(); isValid(); next()) { Vec3r min, max; cachedPolygon.getBBox(min, max); diff --git a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp index 0fde521d315..af6924eea6e 100644 --- a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp @@ -7,13 +7,15 @@ #include "Pow23GridDensityProvider.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, const real proscenium[4], - unsigned numFaces) + uint numFaces) : GridDensityProvider(source), numFaces(numFaces) { initialize(proscenium); @@ -22,7 +24,7 @@ Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, const BBox<Vec3r> &bbox, const GridHelpers::Transform &transform, - unsigned numFaces) + uint numFaces) : GridDensityProvider(source), numFaces(numFaces) { real proscenium[4]; @@ -31,7 +33,7 @@ Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, initialize(proscenium); } -Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, unsigned numFaces) +Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource &source, uint numFaces) : GridDensityProvider(source), numFaces(numFaces) { real proscenium[4]; @@ -75,7 +77,7 @@ void Pow23GridDensityProvider::initialize(const real proscenium[4]) _cellOrigin[1] = ((proscenium[2] + proscenium[3]) / 2.0) - (_cellsY / 2.0) * _cellSize; } -Pow23GridDensityProviderFactory::Pow23GridDensityProviderFactory(unsigned numFaces) +Pow23GridDensityProviderFactory::Pow23GridDensityProviderFactory(uint numFaces) : numFaces(numFaces) { } diff --git a/source/blender/freestyle/intern/view_map/Silhouette.cpp b/source/blender/freestyle/intern/view_map/Silhouette.cpp index 54e0626a7af..2398e82aca7 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.cpp +++ b/source/blender/freestyle/intern/view_map/Silhouette.cpp @@ -297,7 +297,7 @@ real FEdge::z_discontinuity() const z_discontinuity_functor<SVertex> _functor; Evaluate<SVertex, z_discontinuity_functor<SVertex>>(&_functor, iCombination, result); #endif - Vec3r middle((_VertexB->point3d() - _VertexA->point3d())); + Vec3r middle(_VertexB->point3d() - _VertexA->point3d()); middle /= 2; Vec3r disc_vec(middle - _occludeeIntersection); real res = disc_vec.norm() / bboxsize; diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index dfe6bfdd0cf..ce4c8fcd453 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -14,6 +14,8 @@ #include "../geometry/GeomUtils.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" using namespace std; @@ -66,7 +68,7 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], const int iViewport[4], real iFocal) { - unsigned int i, j; + uint i, j; _translation[0] = iModelViewMatrix[3][0]; _translation[1] = iModelViewMatrix[3][1]; _translation[2] = iModelViewMatrix[3][2]; @@ -88,7 +90,7 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { _transform[i][j] = 0; - for (unsigned int k = 0; k < 4; k++) { + for (uint k = 0; k < 4; k++) { _transform[i][j] += _projectionMatrix[i][k] * _modelViewMatrix[k][j]; } } diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 2a7637eb350..bb4dbd17f70 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -10,6 +10,8 @@ #include "SphericalGrid.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" using namespace std; @@ -124,7 +126,7 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/, ++f) { if ((*f)->isInImage()) { Vec3r point = SphericalGrid::Transform::sphericalProjection((*f)->center3d()); - unsigned i, j; + uint i, j; getCellCoordinates(point, i, j); if (_cells[i * _cellsY + j] == nullptr) { // This is an uninitialized cell @@ -146,8 +148,8 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/, void SphericalGrid::distributePolygons(OccluderSource &source) { - unsigned long nFaces = 0; - unsigned long nKeptFaces = 0; + ulong nFaces = 0; + ulong nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { OccluderData *occluder = nullptr; @@ -182,15 +184,15 @@ void SphericalGrid::reorganizeCells() } } -void SphericalGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y) +void SphericalGrid::getCellCoordinates(const Vec3r &point, uint &x, uint &y) { - x = min(_cellsX - 1, (unsigned)floor(max((double)0.0f, point[0] - _cellOrigin[0]) / _cellSize)); - y = min(_cellsY - 1, (unsigned)floor(max((double)0.0f, point[1] - _cellOrigin[1]) / _cellSize)); + x = min(_cellsX - 1, uint(floor(max(double(0.0f), point[0] - _cellOrigin[0]) / _cellSize))); + y = min(_cellsY - 1, uint(floor(max(double(0.0f), point[1] - _cellOrigin[1]) / _cellSize))); } SphericalGrid::Cell *SphericalGrid::findCell(const Vec3r &point) { - unsigned x, y; + uint x, y; getCellCoordinates(point, x, y); return _cells[x * _cellsY + y]; } diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 1211b55e8e1..20472599835 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -16,8 +16,10 @@ #include "../image/Image.h" #include "../image/ImagePyramid.h" -#include "BKE_global.h" #include "BLI_math.h" +#include "BLI_sys_types.h" + +#include "BKE_global.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -26,13 +28,13 @@ namespace Freestyle { using namespace Geometry; -SteerableViewMap::SteerableViewMap(unsigned int nbOrientations) +SteerableViewMap::SteerableViewMap(uint nbOrientations) { _nbOrientations = nbOrientations; - _bound = cos(M_PI / (float)_nbOrientations); - for (unsigned int i = 0; i < _nbOrientations; ++i) { - _directions.emplace_back(cos((float)i * M_PI / (float)_nbOrientations), - sin((float)i * M_PI / (float)_nbOrientations)); + _bound = cos(M_PI / float(_nbOrientations)); + for (uint i = 0; i < _nbOrientations; ++i) { + _directions.emplace_back(cos(float(i) * M_PI / float(_nbOrientations)), + sin(float(i) * M_PI / float(_nbOrientations))); } Build(); } @@ -47,7 +49,7 @@ void SteerableViewMap::Build() SteerableViewMap::SteerableViewMap(const SteerableViewMap &iBrother) { _nbOrientations = iBrother._nbOrientations; - unsigned int i; + uint i; _bound = iBrother._bound; _directions = iBrother._directions; _mapping = iBrother._mapping; @@ -66,7 +68,7 @@ SteerableViewMap::~SteerableViewMap() void SteerableViewMap::Clear() { - unsigned int i; + uint i; if (_imagesPyramids) { for (i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i]) { @@ -77,8 +79,7 @@ void SteerableViewMap::Clear() _imagesPyramids = nullptr; } if (!_mapping.empty()) { - for (map<unsigned int, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); - m != mend; + for (map<uint, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); m != mend; ++m) { delete[](*m).second; } @@ -92,7 +93,7 @@ void SteerableViewMap::Reset() Build(); } -double SteerableViewMap::ComputeWeight(const Vec2d &dir, unsigned i) +double SteerableViewMap::ComputeWeight(const Vec2d &dir, uint i) { double dotp = fabs(dir * _directions[i]); if (dotp < _bound) { @@ -102,14 +103,14 @@ double SteerableViewMap::ComputeWeight(const Vec2d &dir, unsigned i) dotp = 1.0; } - return cos((float)_nbOrientations / 2.0 * acos(dotp)); + return cos(float(_nbOrientations) / 2.0 * acos(dotp)); } double *SteerableViewMap::AddFEdge(FEdge *iFEdge) { - unsigned i; - unsigned id = iFEdge->getId().getFirst(); - map<unsigned int, double *>::iterator o = _mapping.find(id); + uint i; + uint id = iFEdge->getId().getFirst(); + map<uint, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { return (*o).second; } @@ -132,7 +133,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge) return res; } -unsigned SteerableViewMap::getSVMNumber(Vec2f dir) +uint SteerableViewMap::getSVMNumber(Vec2f dir) { // soc unsigned res = 0; real norm = dir.norm(); @@ -141,8 +142,8 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) } dir /= norm; double maxw = 0.0f; - unsigned winner = _nbOrientations + 1; - for (unsigned int i = 0; i < _nbOrientations; ++i) { + uint winner = _nbOrientations + 1; + for (uint i = 0; i < _nbOrientations; ++i) { double w = ComputeWeight(dir, i); if (w > maxw) { maxw = w; @@ -152,14 +153,14 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) return winner; } -unsigned SteerableViewMap::getSVMNumber(unsigned id) +uint SteerableViewMap::getSVMNumber(uint id) { - map<unsigned int, double *>::iterator o = _mapping.find(id); + map<uint, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { double *wvalues = (*o).second; double maxw = 0.0; - unsigned winner = _nbOrientations + 1; - for (unsigned i = 0; i < _nbOrientations; ++i) { + uint winner = _nbOrientations + 1; + for (uint i = 0; i < _nbOrientations; ++i) { double w = wvalues[i]; if (w > maxw) { maxw = w; @@ -173,10 +174,10 @@ unsigned SteerableViewMap::getSVMNumber(unsigned id) void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases, bool copy, - unsigned iNbLevels, + uint iNbLevels, float iSigma) { - for (unsigned int i = 0; i <= _nbOrientations; ++i) { + for (uint i = 0; i <= _nbOrientations; ++i) { ImagePyramid *svm = (_imagesPyramids)[i]; delete svm; if (copy) { @@ -189,7 +190,7 @@ void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases, } } -float SteerableViewMap::readSteerableViewMapPixel(unsigned iOrientation, int iLevel, int x, int y) +float SteerableViewMap::readSteerableViewMapPixel(uint iOrientation, int iLevel, int x, int y) { ImagePyramid *pyramid = _imagesPyramids[iOrientation]; if (!pyramid) { @@ -215,7 +216,7 @@ float SteerableViewMap::readCompleteViewMapPixel(int iLevel, int x, int y) return readSteerableViewMapPixel(_nbOrientations, iLevel, x, y); } -unsigned int SteerableViewMap::getNumberOfPyramidLevels() const +uint SteerableViewMap::getNumberOfPyramidLevels() const { if (_imagesPyramids[0]) { return _imagesPyramids[0]->getNumberOfLevels(); @@ -225,7 +226,7 @@ unsigned int SteerableViewMap::getNumberOfPyramidLevels() const void SteerableViewMap::saveSteerableViewMap() const { - for (unsigned int i = 0; i <= _nbOrientations; ++i) { + for (uint i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i] == nullptr) { cerr << "SteerableViewMap warning: orientation " << i << " of steerable View Map whas not been computed yet" << endl; @@ -247,7 +248,7 @@ void SteerableViewMap::saveSteerableViewMap() const for (int y = 0; y < oh; ++y) { // soc for (int x = 0; x < ow; ++x) { // soc - int c = (int)(coeff * _imagesPyramids[i]->pixel(x, y, j)); + int c = int(coeff * _imagesPyramids[i]->pixel(x, y, j)); if (c > 255) { c = 255; } diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index 81e7abf6d5c..fcb157a4e60 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -13,6 +13,8 @@ #include "../winged_edge/WXEdge.h" +#include "BLI_sys_types.h" + using namespace std; namespace Freestyle { @@ -57,7 +59,7 @@ void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape, WXFace *wxf; for (wf = wfaces.begin(), wfend = wfaces.end(); wf != wfend; wf++) { wxf = dynamic_cast<WXFace *>(*wf); - if (false == ((wxf))->hasSmoothEdges()) { // does it contain at least one smooth edge ? + if (false == (wxf)->hasSmoothEdges()) { // does it contain at least one smooth edge ? continue; } // parse all smooth layers: @@ -68,7 +70,7 @@ void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape, if (!(*sl)->hasSmoothEdge()) { continue; } - if (stopSmoothViewEdge((*sl))) { // has it been parsed already ? + if (stopSmoothViewEdge(*sl)) { // has it been parsed already ? continue; } // here we know that we're dealing with a face layer that has not been processed yet and that @@ -128,7 +130,7 @@ ViewEdge *ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer &iFaceLayer) // bidirectional chaining. // first direction list<OWXFaceLayer> facesChain; - unsigned size = 0; + uint size = 0; while (!stopSmoothViewEdge(currentFace.fl)) { facesChain.push_back(currentFace); ++size; @@ -210,7 +212,7 @@ ViewEdge *ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge &iWEdge) ViewEdge *newVEdge = new ViewEdge; newVEdge->setId(_currentViewId); ++_currentViewId; - unsigned size = 0; + uint size = 0; _pCurrentVShape->AddEdge(newVEdge); @@ -350,7 +352,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer) vector<WXFaceLayer *> sameNatureLayers; nextFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know how to deal with several edges of same nature on a single face - if ((sameNatureLayers.empty()) || (sameNatureLayers.size() != 1)) { + if (sameNatureLayers.empty() || (sameNatureLayers.size() != 1)) { return OWXFaceLayer(nullptr, true); } @@ -431,7 +433,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa vector<WXFaceLayer *> sameNatureLayers; previousFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know how to deal with several edges of same nature on a single face - if ((sameNatureLayers.empty()) || (sameNatureLayers.size() != 1)) { + if (sameNatureLayers.empty() || (sameNatureLayers.size() != 1)) { return OWXFaceLayer(nullptr, true); } @@ -685,26 +687,26 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe) // get the faces normals and the material indices Vec3r normalA, normalB; - unsigned matA(0), matB(0); + uint matA(0), matB(0); bool faceMarkA = false, faceMarkB = false; if (iwe.order) { - normalB = (iwe.e->GetbFace()->GetNormal()); - matB = (iwe.e->GetbFace()->frs_materialIndex()); - faceMarkB = (iwe.e->GetbFace()->GetMark()); + normalB = iwe.e->GetbFace()->GetNormal(); + matB = iwe.e->GetbFace()->frs_materialIndex(); + faceMarkB = iwe.e->GetbFace()->GetMark(); if (!(iwe.e->nature() & Nature::BORDER)) { - normalA = (iwe.e->GetaFace()->GetNormal()); - matA = (iwe.e->GetaFace()->frs_materialIndex()); - faceMarkA = (iwe.e->GetaFace()->GetMark()); + normalA = iwe.e->GetaFace()->GetNormal(); + matA = iwe.e->GetaFace()->frs_materialIndex(); + faceMarkA = iwe.e->GetaFace()->GetMark(); } } else { - normalA = (iwe.e->GetbFace()->GetNormal()); - matA = (iwe.e->GetbFace()->frs_materialIndex()); - faceMarkA = (iwe.e->GetbFace()->GetMark()); + normalA = iwe.e->GetbFace()->GetNormal(); + matA = iwe.e->GetbFace()->frs_materialIndex(); + faceMarkA = iwe.e->GetbFace()->GetMark(); if (!(iwe.e->nature() & Nature::BORDER)) { - normalB = (iwe.e->GetaFace()->GetNormal()); - matB = (iwe.e->GetaFace()->frs_materialIndex()); - faceMarkB = (iwe.e->GetaFace()->GetMark()); + normalB = iwe.e->GetaFace()->GetNormal(); + matB = iwe.e->GetaFace()->frs_materialIndex(); + faceMarkB = iwe.e->GetaFace()->GetMark(); } } // Creates the corresponding feature edge diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index b26a833b32e..09432aa4ac7 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -13,6 +13,8 @@ #include "../geometry/GeomUtils.h" +#include "BLI_sys_types.h" + namespace Freestyle { /**********************************/ @@ -73,7 +75,7 @@ void ViewMap::Clean() } } -ViewShape *ViewMap::viewShape(unsigned id) +ViewShape *ViewMap::viewShape(uint id) { int index = _shapeIdToIndex[id]; return _VShapes[index]; @@ -398,7 +400,7 @@ void TVertex::setBackEdgeB(ViewEdge *iBackEdgeB, bool incoming) void TVertex::Replace(ViewEdge *iOld, ViewEdge *iNew) { - // theoritically, we only replace edges for which this + // theoretically, we only replace edges for which this // view vertex is the B vertex if ((iOld == _FrontEdgeA.first) && (_FrontEdgeA.first->B() == this)) { _FrontEdgeA.first = iNew; @@ -770,7 +772,7 @@ ViewShape::~ViewShape() { _Vertices.clear(); - if (!(_Edges.empty())) { + if (!_Edges.empty()) { for (vector<ViewEdge *>::iterator e = _Edges.begin(), eend = _Edges.end(); e != eend; e++) { delete (*e); } diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 5642a80e77f..9c2919b0ca8 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -24,6 +24,8 @@ #include "../winged_edge/WFillGrid.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { @@ -73,7 +75,7 @@ static void findOccludee(FEdge *fe, #endif oface = occluders.getWFace(); Polygon3r *p = occluders.getCameraSpacePolygon(); - real d = -((p->getVertices())[0] * p->getNormal()); + real d = -(p->getVertices()[0] * p->getNormal()); real t, t_u, t_v; if (nullptr != face) { @@ -286,7 +288,7 @@ static int computeVisibility(ViewMap *viewMap, << ", norm: " << p1.getNormal() << endl; } #else - real d = -((p->getVertices())[0] * p->getNormal()); + real d = -(p->getVertices()[0] * p->getNormal()); #endif if (face) { @@ -430,12 +432,12 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, int nSamples = 0; vector<WFace *> wFaces; WFace *wFace = nullptr; - unsigned count = 0; - unsigned count_step = (unsigned)ceil(0.01f * vedges.size()); - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; + uint count = 0; + uint count_step = uint(ceil(0.01f * vedges.size())); + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (iRenderMonitor) { if (iRenderMonitor->testBreak()) { @@ -445,7 +447,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, stringstream ss; ss << "Freestyle: Visibility computations " << (100 * count / vedges.size()) << "%"; iRenderMonitor->setInfo(ss.str()); - iRenderMonitor->progress((float)count / vedges.size()); + iRenderMonitor->progress(float(count) / vedges.size()); } count++; } @@ -582,7 +584,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, // ViewEdge // qi -- // Find the minimum value that is >= the majority of the QI - for (unsigned count = 0, i = 0; i < 256; ++i) { + for (uint count = 0, i = 0; i < 256; ++i) { count += qiClasses[i]; if (count >= qiMajority) { (*ve)->setQI(i); @@ -595,7 +597,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) { - (*ve)->AddOccluder((*o)); + (*ve)->AddOccluder(*o); } #if LOGGING if (_global.debug & G_DEBUG_FREESTYLE) { @@ -607,7 +609,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, #endif // occludee -- if (!wFaces.empty()) { - if (wFaces.size() <= (float)nSamples / 2.0f) { + if (wFaces.size() <= float(nSamples) / 2.0f) { (*ve)->setaShape(nullptr); } else { @@ -623,7 +625,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, stringstream ss; ss << "Freestyle: Visibility computations " << (100 * count / vedges.size()) << "%"; iRenderMonitor->setInfo(ss.str()); - iRenderMonitor->progress((float)count / vedges.size()); + iRenderMonitor->progress(float(count) / vedges.size()); } } @@ -639,10 +641,10 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, int nSamples = 0; vector<WFace *> wFaces; WFace *wFace = nullptr; - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (iRenderMonitor && iRenderMonitor->testBreak()) { break; @@ -786,7 +788,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) { - (*ve)->AddOccluder((*o)); + (*ve)->AddOccluder(*o); } #if LOGGING if (_global.debug & G_DEBUG_FREESTYLE) { @@ -796,7 +798,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, #endif // occludee -- if (!wFaces.empty()) { - if (wFaces.size() <= (float)nSamples / 2.0f) { + if (wFaces.size() <= float(nSamples) / 2.0f) { (*ve)->setaShape(nullptr); } else { @@ -816,13 +818,13 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) vector<ViewEdge *> &vedges = ioViewMap->ViewEdges(); FEdge *fe, *festart; - unsigned nSamples = 0; + uint nSamples = 0; vector<WFace *> wFaces; WFace *wFace = nullptr; - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; bool even_test; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { // Find an edge to test @@ -925,7 +927,7 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) { - (*ve)->AddOccluder((*o)); + (*ve)->AddOccluder(*o); } // occludee -- @@ -950,7 +952,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) vector<ViewEdge *> &vedges = ioViewMap->ViewEdges(); FEdge *fe; - unsigned qi = 0; + uint qi = 0; WFace *wFace = nullptr; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { @@ -1003,11 +1005,11 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) } } -void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, unsigned int sceneNumFaces) +void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, uint sceneNumFaces) { _Grid->clear(); Vec3r size; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { size[i] = fabs(bbox.getMax()[i] - bbox.getMin()[i]); // let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells // intersections. @@ -1032,7 +1034,7 @@ ViewMap *ViewMapBuilder::BuildViewMap(WingedEdge &we, visibility_algo iAlgo, real epsilon, const BBox<Vec3r> &bbox, - unsigned int sceneNumFaces) + uint sceneNumFaces) { _ViewMap = new ViewMap; _currentId = 1; @@ -1289,7 +1291,7 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap) if (_pRenderMonitor && _pRenderMonitor->testBreak()) { break; } - if ((!((*ve)->getNature() & Nature::SILHOUETTE)) || (!((*ve)->fedgeA()->isSmooth()))) { + if (!((*ve)->getNature() & Nature::SILHOUETTE) || !(*ve)->fedgeA()->isSmooth()) { continue; } FEdge *fe = (*ve)->fedgeA(); @@ -1435,7 +1437,7 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge &we, const BBox<Vec3r> &bbox, - unsigned int sceneNumFaces, + uint sceneNumFaces, visibility_algo iAlgo, real epsilon) { @@ -1531,19 +1533,19 @@ void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, } } -static const unsigned gProgressBarMaxSteps = 10; -static const unsigned gProgressBarMinSize = 2000; +static const uint gProgressBarMaxSteps = 10; +static const uint gProgressBarMinSize = 2000; void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilon) { vector<ViewEdge *> &vedges = ioViewMap->ViewEdges(); bool progressBarDisplay = false; - unsigned progressBarStep = 0; - unsigned vEdgesSize = vedges.size(); - unsigned fEdgesSize = ioViewMap->FEdges().size(); + uint progressBarStep = 0; + uint vEdgesSize = vedges.size(); + uint fEdgesSize = ioViewMap->FEdges().size(); if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { - unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); + uint progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Computing Ray casting Visibility"); @@ -1552,16 +1554,16 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo progressBarDisplay = true; } - unsigned counter = progressBarStep; + uint counter = progressBarStep; FEdge *fe, *festart; int nSamples = 0; vector<Polygon3r *> aFaces; Polygon3r *aFace = nullptr; - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; - static unsigned timestamp = 1; + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; + static uint timestamp = 1; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) { break; @@ -1658,7 +1660,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo // occluders -- for (set<ViewShape *>::iterator o = occluders.begin(), oend = occluders.end(); o != oend; ++o) { - (*ve)->AddOccluder((*o)); + (*ve)->AddOccluder(*o); } #if LOGGING if (_global.debug & G_DEBUG_FREESTYLE) { @@ -1668,7 +1670,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo #endif // occludee -- if (!aFaces.empty()) { - if (aFaces.size() <= (float)nSamples / 2.0f) { + if (aFaces.size() <= float(nSamples) / 2.0f) { (*ve)->setaShape(nullptr); } else { @@ -1695,12 +1697,12 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep { vector<ViewEdge *> &vedges = ioViewMap->ViewEdges(); bool progressBarDisplay = false; - unsigned progressBarStep = 0; - unsigned vEdgesSize = vedges.size(); - unsigned fEdgesSize = ioViewMap->FEdges().size(); + uint progressBarStep = 0; + uint vEdgesSize = vedges.size(); + uint fEdgesSize = ioViewMap->FEdges().size(); if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { - unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); + uint progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Computing Ray casting Visibility"); @@ -1709,16 +1711,16 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep progressBarDisplay = true; } - unsigned counter = progressBarStep; + uint counter = progressBarStep; FEdge *fe, *festart; - unsigned nSamples = 0; + uint nSamples = 0; vector<Polygon3r *> aFaces; Polygon3r *aFace = nullptr; - unsigned tmpQI = 0; - unsigned qiClasses[256]; - unsigned maxIndex, maxCard; - unsigned qiMajority; - static unsigned timestamp = 1; + uint tmpQI = 0; + uint qiClasses[256]; + uint maxIndex, maxCard; + uint qiMajority; + static uint timestamp = 1; bool even_test; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) { @@ -1828,12 +1830,12 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea { vector<ViewEdge *> &vedges = ioViewMap->ViewEdges(); bool progressBarDisplay = false; - unsigned progressBarStep = 0; - unsigned vEdgesSize = vedges.size(); - unsigned fEdgesSize = ioViewMap->FEdges().size(); + uint progressBarStep = 0; + uint vEdgesSize = vedges.size(); + uint fEdgesSize = ioViewMap->FEdges().size(); if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { - unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); + uint progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Computing Ray casting Visibility"); @@ -1842,11 +1844,11 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea progressBarDisplay = true; } - unsigned counter = progressBarStep; + uint counter = progressBarStep; FEdge *fe; - unsigned qi = 0; + uint qi = 0; Polygon3r *aFace = nullptr; - static unsigned timestamp = 1; + static uint timestamp = 1; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) { break; @@ -1882,7 +1884,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3r **oaPolygon, - unsigned timestamp, + uint timestamp, Vec3r &u, Vec3r &A, Vec3r &origin, @@ -1916,7 +1918,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, //------------------------------------------------------------- // first let us compute the plane equation. oface = (WFace *)(*p)->userdata; - Vec3r v1(((*p)->getVertices())[0]); + Vec3r v1((*p)->getVertices()[0]); Vec3r normal((*p)->getNormal()); real d = -(v1 * normal); real t, t_u, t_v; @@ -1986,7 +1988,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, } void ViewMapBuilder::FindOccludee( - FEdge *fe, Grid *iGrid, real epsilon, Polygon3r **oaPolygon, unsigned timestamp) + FEdge *fe, Grid *iGrid, real epsilon, Polygon3r **oaPolygon, uint timestamp) { OccludersSet occluders; @@ -2030,7 +2032,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, real epsilon, set<ViewShape *> &oOccluders, Polygon3r **oaPolygon, - unsigned timestamp) + uint timestamp) { OccludersSet occluders; int qi = 0; @@ -2115,7 +2117,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, << "\t\t\tand ray " << vp << " * " << u << " (center " << center << ")" << endl; } #endif - Vec3r v1(((*p)->getVertices())[0]); + Vec3r v1((*p)->getVertices()[0]); Vec3r normal((*p)->getNormal()); real d = -(v1 * normal); real t, t_u, t_v; @@ -2270,7 +2272,7 @@ struct less_SVertex2D { { Vec3r A = x->point2D(); Vec3r B = y->point2D(); - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { if (fabs(A[i] - B[i]) < epsilon) { continue; } @@ -2313,8 +2315,8 @@ struct silhouette_binary_rule : public binary_rule<segment, segment> { FEdge *f1 = s1.edge(); FEdge *f2 = s2.edge(); - if ((!(((f1)->getNature() & Nature::SILHOUETTE) || ((f1)->getNature() & Nature::BORDER))) && - (!(((f2)->getNature() & Nature::SILHOUETTE) || ((f2)->getNature() & Nature::BORDER)))) { + if (!(((f1)->getNature() & Nature::SILHOUETTE) || ((f1)->getNature() & Nature::BORDER)) && + !(((f2)->getNature() & Nature::SILHOUETTE) || ((f2)->getNature() & Nature::BORDER))) { return false; } @@ -2326,8 +2328,8 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi { vector<SVertex *> &svertices = ioViewMap->SVertices(); bool progressBarDisplay = false; - unsigned sVerticesSize = svertices.size(); - unsigned fEdgesSize = ioViewMap->FEdges().size(); + uint sVerticesSize = svertices.size(); + uint fEdgesSize = ioViewMap->FEdges().size(); #if 0 if (_global.debug & G_DEBUG_FREESTYLE) { ViewMap::fedges_container &fedges = ioViewMap->FEdges(); @@ -2338,10 +2340,10 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi } } #endif - unsigned progressBarStep = 0; + uint progressBarStep = 0; if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { - unsigned progressBarSteps = min(gProgressBarMaxSteps, sVerticesSize); + uint progressBarSteps = min(gProgressBarMaxSteps, sVerticesSize); progressBarStep = sVerticesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Computing Sweep Line Intersections"); @@ -2350,7 +2352,7 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi progressBarDisplay = true; } - unsigned counter = progressBarStep; + uint counter = progressBarStep; sort(svertices.begin(), svertices.end(), less_SVertex2D(epsilon)); @@ -2500,8 +2502,8 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi progressBarStep = 0; if (progressBarDisplay) { - unsigned iEdgesSize = iedges.size(); - unsigned progressBarSteps = min(gProgressBarMaxSteps, iEdgesSize); + uint iEdgesSize = iedges.size(); + uint progressBarSteps = min(gProgressBarMaxSteps, iEdgesSize); progressBarStep = iEdgesSize / progressBarSteps; _pProgressBar->reset(); _pProgressBar->setLabelText("Splitting intersected edges"); diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp b/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp index 75b716ee9da..86c264892e0 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp @@ -19,7 +19,7 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewMap *iViewMap) return Tesselate(viewedges.begin(), viewedges.end()); } -NodeGroup *ViewMapTesselator::Tesselate(WShape *UNUSED(iWShape)) +NodeGroup *ViewMapTesselator::Tesselate(WShape * /*iWShape*/) { return nullptr; } diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp index 9086593a945..36c06fde78e 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp +++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp @@ -38,7 +38,7 @@ static bool angle_obtuse(WVertex *v, WFace *f) // FIXME // WVvertex is useless but kept for history reasons -static bool triangle_obtuse(WVertex *UNUSED(v), WFace *f) +static bool triangle_obtuse(WVertex * /*v*/, WFace *f) { bool b = false; for (int i = 0; i < 3; i++) { @@ -80,7 +80,7 @@ static real angle_from_cotan(WVertex *vo, WVertex *v1, WVertex *v2) /* NOTE(Ray Jones): I assume this is what they mean by using #atan2. */ /* tan = denom/udotv = y/x (see man page for atan2) */ - return (fabs(atan2(denom, udotv))); + return fabs(atan2(denom, udotv)); } bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh) diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index 8b9388caa86..3082988bd36 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -9,6 +9,8 @@ #include "WEdge.h" +#include "BLI_sys_types.h" + namespace Freestyle { /** Temporary structures */ @@ -451,7 +453,7 @@ WShape *WFace::getShape() * * **********************************/ -unsigned WShape::_SceneCurrentId = 0; +uint WShape::_SceneCurrentId = 0; WShape *WShape::duplicate() { @@ -500,7 +502,7 @@ WShape::WShape(WShape &iBrother) for (v = _VertexList.begin(); v != vend; ++v) { const vector<WEdge *> &vedgeList = (*v)->GetEdges(); vector<WEdge *> newvedgelist; - unsigned int i; + uint i; for (i = 0; i < vedgeList.size(); i++) { WEdge *current = vedgeList[i]; edgedata *currentvedata = (edgedata *)current->userdata; @@ -536,11 +538,11 @@ WShape::WShape(WShape &iBrother) fend = _FaceList.end(); for (f = _FaceList.begin(); f != fend; ++f) { - unsigned int i; + uint i; const vector<WOEdge *> &oedgeList = (*f)->getEdgeList(); vector<WOEdge *> newoedgelist; - unsigned int n = oedgeList.size(); + uint n = oedgeList.size(); for (i = 0; i < n; i++) { WOEdge *current = oedgeList[i]; oedgedata *currentoedata = (oedgedata *)current->userdata; @@ -585,7 +587,7 @@ WShape::WShape(WShape &iBrother) WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, vector<bool> &iFaceEdgeMarksList, - unsigned iMaterial) + uint iMaterial) { // allocate the new face WFace *face = instanciateFace(); @@ -601,7 +603,7 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, vector<Vec3f> &iNormalsList, vector<Vec2f> &iTexCoordsList, vector<bool> &iFaceEdgeMarksList, - unsigned iMaterial) + uint iMaterial) { // allocate the new face WFace *face = MakeFace(iVertexList, iFaceEdgeMarksList, iMaterial); @@ -620,7 +622,7 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, vector<bool> &iFaceEdgeMarksList, - unsigned iMaterial, + uint iMaterial, WFace *face) { int id = _FaceList.size(); diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index b18d232dbbe..6838060b44e 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -6,6 +6,9 @@ */ #include "WXEdge.h" + +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { @@ -18,7 +21,7 @@ namespace Freestyle { * * **********************************/ -unsigned int WXFaceLayer::Get0VertexIndex() const +uint WXFaceLayer::Get0VertexIndex() const { int i = 0; int nEdges = _pWXFace->numberOfEdges(); @@ -29,7 +32,7 @@ unsigned int WXFaceLayer::Get0VertexIndex() const } return -1; } -unsigned int WXFaceLayer::GetSmoothEdgeIndex() const +uint WXFaceLayer::GetSmoothEdgeIndex() const { int i = 0; int nEdges = _pWXFace->numberOfEdges(); @@ -64,7 +67,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() bool ok = false; vector<int> cuspEdgesIndices; int indexStart, indexEnd; - unsigned nedges = _pWXFace->numberOfEdges(); + uint nedges = _pWXFace->numberOfEdges(); if (_nNullDotP == nedges) { _pSmoothEdge = nullptr; return _pSmoothEdge; @@ -118,8 +121,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() _pSmoothEdge = nullptr; return nullptr; } - unsigned index0 = Get0VertexIndex(); // retrieve the 0 vertex index - unsigned nedges = _pWXFace->numberOfEdges(); + uint index0 = Get0VertexIndex(); // retrieve the 0 vertex index + uint nedges = _pWXFace->numberOfEdges(); if (_DotP[cuspEdgesIndices[0]] > 0.0f) { woea = _pWXFace->GetOEdge(cuspEdgesIndices[0]); woeb = _pWXFace->GetOEdge(index0); @@ -243,7 +246,7 @@ void WXFace::ComputeCenter() ++wv) { center += (*wv)->GetVertex(); } - center /= (float)iVertexList.size(); + center /= float(iVertexList.size()); setCenter(center); } @@ -257,7 +260,7 @@ void WXFace::ComputeCenter() WFace *WXShape::MakeFace(vector<WVertex *> &iVertexList, vector<bool> &iFaceEdgeMarksList, - unsigned iMaterialIndex) + uint iMaterialIndex) { WFace *face = WShape::MakeFace(iVertexList, iFaceEdgeMarksList, iMaterialIndex); if (!face) { @@ -270,7 +273,7 @@ WFace *WXShape::MakeFace(vector<WVertex *> &iVertexList, ++wv) { center += (*wv)->GetVertex(); } - center /= (float)iVertexList.size(); + center /= float(iVertexList.size()); ((WXFace *)face)->setCenter(center); return face; @@ -280,7 +283,7 @@ WFace *WXShape::MakeFace(vector<WVertex *> &iVertexList, vector<Vec3f> &iNormalsList, vector<Vec2f> &iTexCoordsList, vector<bool> &iFaceEdgeMarksList, - unsigned iMaterialIndex) + uint iMaterialIndex) { WFace *face = WShape::MakeFace( iVertexList, iNormalsList, iTexCoordsList, iFaceEdgeMarksList, iMaterialIndex); diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp index 3a5cdbc663c..e22de505472 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp @@ -9,6 +9,8 @@ #include "WXEdgeBuilder.h" #include "WXEdge.h" +#include "BLI_sys_types.h" + namespace Freestyle { void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs) @@ -27,10 +29,10 @@ void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs) // ifs.setId(shape->GetId()); } -void WXEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize) +void WXEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, uint vsize) { WXVertex *vertex; - for (unsigned int i = 0; i < vsize; i += 3) { + for (uint i = 0; i < vsize; i += 3) { vertex = new WXVertex(Vec3f(vertices[i], vertices[i + 1], vertices[i + 2])); vertex->setId(i / 3); shape.AddVertex(vertex); diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index 0a3ab97717b..ce6054830f3 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -14,6 +14,8 @@ #include "../scene_graph/NodeShape.h" +#include "BLI_sys_types.h" + using namespace std; namespace Freestyle { @@ -35,7 +37,7 @@ void WingedEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs) void WingedEdgeBuilder::visitNodeShape(NodeShape &ns) { // Sets the current material to iShapeode->material: - _current_frs_material = &(ns.frs_material()); + _current_frs_material = &ns.frs_material(); } void WingedEdgeBuilder::visitNodeTransform(NodeTransform &tn) @@ -50,7 +52,7 @@ void WingedEdgeBuilder::visitNodeTransform(NodeTransform &tn) _current_matrix = new_matrix; } -void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform &UNUSED(transform)) +void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform & /*transform*/) { delete _current_matrix; @@ -65,8 +67,8 @@ void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform &UNUSED(transform) bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) { - unsigned int vsize = ifs.vsize(); - unsigned int nsize = ifs.nsize(); + uint vsize = ifs.vsize(); + uint nsize = ifs.nsize(); // soc unused - unsigned tsize = ifs.tsize(); const float *vertices = ifs.vertices(); @@ -94,7 +96,7 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) vector<FrsMaterial> frs_materials; if (ifs.msize()) { const FrsMaterial *const *mats = ifs.frs_materials(); - for (unsigned i = 0; i < ifs.msize(); ++i) { + for (uint i = 0; i < ifs.msize(); ++i) { frs_materials.push_back(*(mats[i])); } shape.setFrsMaterials(frs_materials); @@ -117,21 +119,21 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) // create a WVertex for each vertex buildWVertices(shape, new_vertices, vsize); - const unsigned int *vindices = ifs.vindices(); - const unsigned int *nindices = ifs.nindices(); - const unsigned int *tindices = nullptr; + const uint *vindices = ifs.vindices(); + const uint *nindices = ifs.nindices(); + const uint *tindices = nullptr; if (ifs.tsize()) { tindices = ifs.tindices(); } - const unsigned int *mindices = nullptr; + const uint *mindices = nullptr; if (ifs.msize()) { mindices = ifs.mindices(); } - const unsigned int *numVertexPerFace = ifs.numVertexPerFaces(); - const unsigned int numfaces = ifs.numFaces(); + const uint *numVertexPerFace = ifs.numVertexPerFaces(); + const uint numfaces = ifs.numFaces(); - for (unsigned int index = 0; index < numfaces; index++) { + for (uint index = 0; index < numfaces; index++) { switch (faceStyle[index]) { case IndexedFaceSet::TRIANGLE_STRIP: buildTriangleStrip(new_vertices, @@ -228,10 +230,10 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) return true; } -void WingedEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize) +void WingedEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, uint vsize) { WVertex *vertex; - for (unsigned int i = 0; i < vsize; i += 3) { + for (uint i = 0; i < vsize; i += 3) { vertex = new WVertex(Vec3f(vertices[i], vertices[i + 1], vertices[i + 2])); vertex->setId(i / 3); shape.AddVertex(vertex); @@ -243,15 +245,15 @@ void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/, vector<FrsMaterial> & /*iMaterials*/, const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, - const unsigned *vindices, - const unsigned *nindices, - const unsigned *mindices, - const unsigned *tindices, - const unsigned nvertices) + const uint *vindices, + const uint *nindices, + const uint *mindices, + const uint *tindices, + const uint nvertices) { - unsigned nDoneVertices = 2; // number of vertices already treated - unsigned nTriangle = 0; // number of the triangle currently being treated - // int nVertex = 0; // vertex number + uint nDoneVertices = 2; /* Number of vertices already treated. */ + uint nTriangle = 0; /* Number of the triangle currently being treated. */ + // int nVertex = 0; /* Vertex number. */ WShape *currentShape = _current_wshape; // the current shape being built vector<WVertex *> triangleVertices; @@ -340,11 +342,11 @@ void WingedEdgeBuilder::buildTriangleFan(const float * /*vertices*/, vector<FrsMaterial> & /*iMaterials*/, const float * /*texCoords*/, const IndexedFaceSet::FaceEdgeMark * /*iFaceEdgeMarks*/, - const unsigned * /*vindices*/, - const unsigned * /*nindices*/, - const unsigned * /*mindices*/, - const unsigned * /*tindices*/, - const unsigned /*nvertices*/) + const uint * /*vindices*/, + const uint * /*nindices*/, + const uint * /*mindices*/, + const uint * /*tindices*/, + const uint /*nvertices*/) { // Nothing to be done } @@ -354,11 +356,11 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, vector<FrsMaterial> & /*iMaterials*/, const float *texCoords, const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, - const unsigned *vindices, - const unsigned *nindices, - const unsigned *mindices, - const unsigned *tindices, - const unsigned nvertices) + const uint *vindices, + const uint *nindices, + const uint *mindices, + const uint *tindices, + const uint nvertices) { WShape *currentShape = _current_wshape; // the current shape begin built vector<WVertex *> triangleVertices; @@ -367,7 +369,7 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, vector<bool> triangleFaceEdgeMarks; // Each triplet of vertices is considered as an independent triangle - for (unsigned int i = 0; i < nvertices / 3; i++) { + for (uint i = 0; i < nvertices / 3; i++) { triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 1] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 2] / 3]); @@ -405,17 +407,17 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, } void WingedEdgeBuilder::transformVertices(const float *vertices, - unsigned vsize, + uint vsize, const Matrix44r &transform, float *res) { const float *v = vertices; float *pv = res; - for (unsigned int i = 0; i < vsize / 3; i++) { + for (uint i = 0; i < vsize / 3; i++) { HVec3r hv_tmp(v[0], v[1], v[2]); HVec3r hv(transform * hv_tmp); - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { pv[j] = hv[j] / hv[3]; } v += 3; @@ -424,17 +426,17 @@ void WingedEdgeBuilder::transformVertices(const float *vertices, } void WingedEdgeBuilder::transformNormals(const float *normals, - unsigned nsize, + uint nsize, const Matrix44r &transform, float *res) { const float *n = normals; float *pn = res; - for (unsigned int i = 0; i < nsize / 3; i++) { + for (uint i = 0; i < nsize / 3; i++) { Vec3r hn(n[0], n[1], n[2]); hn = GeomUtils::rotateVector(transform, hn); - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { pn[j] = hn[j]; } n += 3; |