diff options
Diffstat (limited to 'source/blender/freestyle/intern')
49 files changed, 117 insertions, 186 deletions
diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp index 1f3aea65e24..5681c65e5d2 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.cpp +++ b/source/blender/freestyle/intern/application/AppCanvas.cpp @@ -18,18 +18,17 @@ * \ingroup freestyle */ -/* clang-format off */ -#include "Controller.h" +#include "AppCanvas.h" +#include "AppConfig.h" #include "AppView.h" +#include "Controller.h" + #include "../image/Image.h" -#include "../system/TimeStamp.h" #include "../stroke/StrokeRenderer.h" -#include "AppCanvas.h" -#include "AppConfig.h" #include "../stroke/StyleModule.h" +#include "../system/TimeStamp.h" #include "../system/StringUtils.h" -/* clang-format on */ namespace Freestyle { AppCanvas::AppCanvas() : Canvas() diff --git a/source/blender/freestyle/intern/application/AppConfig.h b/source/blender/freestyle/intern/application/AppConfig.h index 725b29e7dd8..34f5d220cfe 100644 --- a/source/blender/freestyle/intern/application/AppConfig.h +++ b/source/blender/freestyle/intern/application/AppConfig.h @@ -22,15 +22,14 @@ * \brief Configuration file */ -/* clang-format off */ -#include <string> #include <algorithm> +#include <string> + #include "../system/Precision.h" #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ using namespace std; diff --git a/source/blender/freestyle/intern/application/AppView.cpp b/source/blender/freestyle/intern/application/AppView.cpp index 771d4b0fca8..0956d33a20e 100644 --- a/source/blender/freestyle/intern/application/AppView.cpp +++ b/source/blender/freestyle/intern/application/AppView.cpp @@ -18,20 +18,20 @@ * \ingroup freestyle */ -/* clang-format off */ #include <iostream> -#include "Controller.h" #include "AppConfig.h" #include "AppView.h" -#include "../view_map/Silhouette.h" -#include "../view_map/ViewMap.h" +#include "Controller.h" + #include "../scene_graph/LineRep.h" #include "../scene_graph/NodeLight.h" #include "../scene_graph/NodeShape.h" #include "../scene_graph/VertexRep.h" #include "../stroke/Canvas.h" #include "../system/StringUtils.h" +#include "../view_map/Silhouette.h" +#include "../view_map/ViewMap.h" extern "C" { #include "BLI_blenlib.h" @@ -46,7 +46,6 @@ extern "C" { #include "FRS_freestyle.h" } -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/application/AppView.h b/source/blender/freestyle/intern/application/AppView.h index 4c60b1515f3..6009f2b0e50 100644 --- a/source/blender/freestyle/intern/application/AppView.h +++ b/source/blender/freestyle/intern/application/AppView.h @@ -21,10 +21,10 @@ * \ingroup freestyle */ -/* clang-format off */ #include "AppConfig.h" -#include "../geometry/Geom.h" + #include "../geometry/BBox.h" +#include "../geometry/Geom.h" #include "../scene_graph/NodeDrawingStyle.h" #include "../system/Precision.h" @@ -33,7 +33,6 @@ #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index f7da64624e0..253d62ea3dc 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -18,18 +18,17 @@ * \ingroup freestyle */ -/* clang-format off */ extern "C" { #include <Python.h> } -#include <string> -#include <fstream> #include <float.h> +#include <fstream> +#include <string> -#include "AppView.h" #include "AppCanvas.h" #include "AppConfig.h" +#include "AppView.h" #include "Controller.h" #include "../image/Image.h" @@ -42,12 +41,12 @@ extern "C" { #include "../scene_graph/VertexRep.h" #include "../stroke/PSStrokeRenderer.h" -#include "../stroke/TextStrokeRenderer.h" #include "../stroke/StrokeTesselator.h" #include "../stroke/StyleModule.h" +#include "../stroke/TextStrokeRenderer.h" -#include "../system/StringUtils.h" #include "../system/PythonInterpreter.h" +#include "../system/StringUtils.h" #include "../view_map/SteerableViewMap.h" #include "../view_map/ViewMap.h" @@ -56,21 +55,20 @@ extern "C" { #include "../winged_edge/Curvature.h" #include "../winged_edge/WEdge.h" -#include "../winged_edge/WingedEdgeBuilder.h" #include "../winged_edge/WXEdgeBuilder.h" +#include "../winged_edge/WingedEdgeBuilder.h" #include "../blender_interface/BlenderFileLoader.h" #include "../blender_interface/BlenderStrokeRenderer.h" #include "../blender_interface/BlenderStyleModule.h" #include "BKE_global.h" -#include "BLI_utildefines.h" #include "BLI_path_util.h" +#include "BLI_utildefines.h" #include "DNA_freestyle_types.h" #include "FRS_freestyle.h" -/* clang-format off */ namespace Freestyle { @@ -349,7 +347,7 @@ int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph soc string basename((const char *)qfi.fileName().toAscii().data()); char cleaned[FILE_MAX]; BLI_strncpy(cleaned, iFileName, FILE_MAX); - BLI_cleanup_path(NULL, cleaned); + BLI_path_normalize(NULL, cleaned); string basename = string(cleaned); #endif @@ -925,19 +923,16 @@ Render *Controller::RenderStrokes(Render *re, bool render) cout << "Stroke rendering : " << d << endl; uintptr_t mem_in_use = MEM_get_memory_in_use(); - uintptr_t mmap_in_use = MEM_get_mapped_memory_in_use(); uintptr_t peak_memory = MEM_get_peak_memory(); - float megs_used_memory = (mem_in_use - mmap_in_use) / (1024.0 * 1024.0); - float mmap_used_memory = (mmap_in_use) / (1024.0 * 1024.0); + float megs_used_memory = (mem_in_use) / (1024.0 * 1024.0); float megs_peak_memory = (peak_memory) / (1024.0 * 1024.0); - printf("%d objs, %d verts, %d faces, mem %.2fM (%.2fM, peak %.2fM)\n", + printf("%d objs, %d verts, %d faces, mem %.2fM (peak %.2fM)\n", totmesh, freestyle_render->i.totvert, freestyle_render->i.totface, megs_used_memory, - mmap_used_memory, megs_peak_memory); } delete blenderRenderer; diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index f49a664096a..7bceb036846 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -85,6 +85,7 @@ NodeGroup *BlenderFileLoader::Load() #endif int id = 0; + const eEvaluationMode eval_mode = DEG_get_mode(_depsgraph); DEG_OBJECT_ITER_BEGIN (_depsgraph, ob, @@ -99,6 +100,10 @@ NodeGroup *BlenderFileLoader::Load() continue; } + if (!(BKE_object_visibility(ob, eval_mode) & OB_VISIBLE_SELF)) { + continue; + } + Mesh *mesh = BKE_object_to_mesh(NULL, ob, false); if (mesh) { diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h index fe93b179eb6..ad6379d5f52 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h @@ -21,9 +21,8 @@ * \ingroup freestyle */ -/* clang-format off */ -#include <string.h> #include <float.h> +#include <string.h> #include "../geometry/BBox.h" #include "../geometry/Geom.h" @@ -31,8 +30,8 @@ #include "../geometry/GeomUtils.h" #include "../scene_graph/IndexedFaceSet.h" #include "../scene_graph/NodeGroup.h" -#include "../scene_graph/NodeTransform.h" #include "../scene_graph/NodeShape.h" +#include "../scene_graph/NodeTransform.h" #include "../system/FreestyleConfig.h" #include "../system/RenderMonitor.h" @@ -64,7 +63,6 @@ extern "C" { #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index a61bad7cf8a..68b5b4baeca 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -18,7 +18,6 @@ * \ingroup freestyle */ -/* clang-format off */ #include "BlenderStrokeRenderer.h" #include "../application/AppConfig.h" @@ -26,7 +25,6 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "RNA_access.h" #include "RNA_types.h" @@ -65,10 +63,8 @@ extern "C" { #include "RE_pipeline.h" #include "render_types.h" -} #include <limits.h> -/* clang-format on */ namespace Freestyle { @@ -465,7 +461,7 @@ void BlenderStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const vector<StrokeGroup *> *groups = hasTex ? &self->texturedStrokeGroups : &self->strokeGroups; StrokeGroup *group; if (groups->empty() || !(groups->back()->totvert + totvert < MESH_MAX_VERTS && - groups->back()->totcol + 1 < MAXMAT)) { + groups->back()->materials.size() + 1 < MAXMAT)) { group = new StrokeGroup; groups->push_back(group); } @@ -477,7 +473,10 @@ void BlenderStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const group->totedge += totedge; group->totpoly += totpoly; group->totloop += totloop; - group->totcol++; + + if (!group->materials.contains(ma)) { + group->materials.add_new(ma, group->materials.size()); + } } // Check if the triangle is visible (i.e., within the render image boundary) @@ -589,7 +588,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) mesh->totedge = group->totedge; mesh->totpoly = group->totpoly; mesh->totloop = group->totloop; - mesh->totcol = group->totcol; + mesh->totcol = group->materials.size(); mesh->mvert = (MVert *)CustomData_add_layer( &mesh->vdata, CD_MVERT, CD_CALLOC, NULL, mesh->totvert); @@ -630,12 +629,20 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) mesh->mloopcol = colors; mesh->mat = (Material **)MEM_mallocN(sizeof(Material *) * mesh->totcol, "MaterialList"); + for (const auto &item : group->materials.items()) { + Material *material = item.key; + const int matnr = item.value; + mesh->mat[matnr] = material; + if (material) { + id_us_plus(&material->id); + } + } //////////////////// // Data copy //////////////////// - int vertex_index = 0, edge_index = 0, loop_index = 0, material_index = 0; + int vertex_index = 0, edge_index = 0, loop_index = 0; int visible_faces, visible_segments; bool visible; Strip::vertex_container::iterator v[3]; @@ -646,8 +653,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) itend = group->strokes.end(); it != itend; ++it) { - mesh->mat[material_index] = (*it)->getMaterial(); - id_us_plus(&mesh->mat[material_index]->id); + const int matnr = group->materials.lookup_default((*it)->getMaterial(), 0); vector<Strip *> &strips = (*it)->getStrips(); for (vector<Strip *>::const_iterator s = strips.begin(), send = strips.end(); s != send; ++s) { @@ -729,7 +735,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) // poly polys->loopstart = loop_index; polys->totloop = 3; - polys->mat_nr = material_index; + polys->mat_nr = matnr; ++polys; // Even and odd loops connect triangles vertices differently @@ -814,8 +820,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) } } // loop over strip vertices } // loop over strips - material_index++; - } // loop over strokes + } // loop over strokes BKE_object_materials_test(freestyle_bmain, object_mesh, (ID *)mesh); @@ -823,7 +828,6 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) BLI_assert(mesh->totvert == vertex_index); BLI_assert(mesh->totedge == edge_index); BLI_assert(mesh->totloop == loop_index); - BLI_assert(mesh->totcol == material_index); BKE_mesh_validate(mesh, true, true); #endif } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h index c333319ada1..ee29519c849 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h @@ -21,6 +21,8 @@ * \ingroup freestyle */ +#include "BLI_map.hh" + #include "../stroke/StrokeRenderer.h" #include "../system/FreestyleConfig.h" @@ -50,15 +52,15 @@ class BlenderStrokeRenderer : public StrokeRenderer { Object *NewMesh() const; struct StrokeGroup { - explicit StrokeGroup() : totvert(0), totedge(0), totpoly(0), totloop(0), totcol(0) + explicit StrokeGroup() : totvert(0), totedge(0), totpoly(0), totloop(0) { } vector<StrokeRep *> strokes; + BLI::Map<Material *, int> materials; int totvert; int totedge; int totpoly; int totloop; - int totcol; }; vector<StrokeGroup *> strokeGroups, texturedStrokeGroups; diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h b/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h index a4beb1c119c..95612a42722 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h @@ -24,11 +24,9 @@ #include "../stroke/StyleModule.h" #include "../system/PythonInterpreter.h" -extern "C" { #include "BLI_utildefines.h" // BLI_assert() struct Text; -} namespace Freestyle { diff --git a/source/blender/freestyle/intern/geometry/BBox.h b/source/blender/freestyle/intern/geometry/BBox.h index 0031a7ce860..a8965e63451 100644 --- a/source/blender/freestyle/intern/geometry/BBox.h +++ b/source/blender/freestyle/intern/geometry/BBox.h @@ -22,16 +22,14 @@ * \brief A class to hold a bounding box */ -/* clang-format off */ -#include <stdlib.h> #include <algorithm> +#include <stdlib.h> #include "BLI_utildefines.h" #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index bfc5e16aa2a..b60de93c4a1 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -20,13 +20,11 @@ * \brief from "Graphics Gems", Academic Press, 1990 */ -/* clang-format off */ #include <cstdlib> // for malloc and free -#include <stdio.h> #include <math.h> +#include <stdio.h> #include "FitCurve.h" -/* clang-format on */ using namespace std; diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp index a7db17a4015..76e63764e4d 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp @@ -19,7 +19,6 @@ * \brief Class to define a cleaner of geometry providing a set of useful tools */ -/* clang-format off */ #if 0 # if defined(__GNUC__) && (__GNUC__ >= 3) // hash_map is not part of the C++ standard anymore; @@ -30,16 +29,15 @@ # endif #endif -#include <stdio.h> #include <list> #include <map> +#include <stdio.h> #include "GeomCleaner.h" #include "../system/TimeUtils.h" #include "BKE_global.h" -/* clang-format on */ using namespace std; diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h index 0a9fa5dc85a..c1a8dcdb370 100644 --- a/source/blender/freestyle/intern/geometry/Grid.h +++ b/source/blender/freestyle/intern/geometry/Grid.h @@ -33,9 +33,7 @@ #include "../system/FreestyleConfig.h" -extern "C" { #include "BLI_utildefines.h" -} #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" diff --git a/source/blender/freestyle/intern/geometry/normal_cycle.cpp b/source/blender/freestyle/intern/geometry/normal_cycle.cpp index 5820bdc4865..d02b5cc2d5b 100644 --- a/source/blender/freestyle/intern/geometry/normal_cycle.cpp +++ b/source/blender/freestyle/intern/geometry/normal_cycle.cpp @@ -29,10 +29,8 @@ * \ingroup freestyle */ -/* clang-format off */ -#include "matrix_util.h" #include "normal_cycle.h" -/* clang-format on */ +#include "matrix_util.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/image/GaussianFilter.h b/source/blender/freestyle/intern/image/GaussianFilter.h index f8e2524fa4f..625e357eddf 100644 --- a/source/blender/freestyle/intern/image/GaussianFilter.h +++ b/source/blender/freestyle/intern/image/GaussianFilter.h @@ -27,9 +27,7 @@ #include "../system/FreestyleConfig.h" -extern "C" { #include "BLI_math.h" -} #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" diff --git a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h index f220bbfd6f1..2339abe9aed 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h +++ b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h @@ -24,9 +24,7 @@ #include "Node.h" -extern "C" { #include "DNA_scene_types.h" /* for Scene and ViewLayer */ -} using namespace std; diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 8159279a846..4386e64345f 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -19,7 +19,6 @@ * \brief Class to define a canvas designed to draw style modules */ -/* clang-format off */ #include <sstream> #include <vector> @@ -27,13 +26,13 @@ #include "StrokeRenderer.h" #include "StyleModule.h" -#include "../image/Image.h" #include "../image/GaussianFilter.h" +#include "../image/Image.h" #include "../image/ImagePyramid.h" #include "../system/FreestyleConfig.h" -#include "../system/TimeStamp.h" #include "../system/PseudoNoise.h" +#include "../system/TimeStamp.h" #include "../view_map/SteerableViewMap.h" @@ -42,11 +41,8 @@ // soc #include <qimage.h> // soc #include <QString> -extern "C" { #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -} -/* clang-format on */ using namespace std; diff --git a/source/blender/freestyle/intern/stroke/Chain.cpp b/source/blender/freestyle/intern/stroke/Chain.cpp index 94c0b753985..562ca32be78 100644 --- a/source/blender/freestyle/intern/stroke/Chain.cpp +++ b/source/blender/freestyle/intern/stroke/Chain.cpp @@ -19,12 +19,10 @@ * \brief Class to define a chain of viewedges. */ -/* clang-format off */ #include "Chain.h" -#include "../view_map/ViewMapIterators.h" #include "../view_map/ViewMapAdvancedIterators.h" -/* clang-format on */ +#include "../view_map/ViewMapIterators.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h index 569ca6fcf1d..36611a4a009 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.h +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h @@ -22,7 +22,6 @@ * \brief Chaining iterators */ -/* clang-format off */ #include <iostream> #include "Predicates1D.h" @@ -30,9 +29,8 @@ #include "../system/Iterator.h" #include "../view_map/ViewMap.h" -#include "../view_map/ViewMapIterators.h" #include "../view_map/ViewMapAdvancedIterators.h" -/* clang-format on */ +#include "../view_map/ViewMapIterators.h" // using namespace ViewEdgeInternal; diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index 294f332d48d..02a1d32953d 100644 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -19,16 +19,14 @@ * \brief Class to define a container for curves */ -/* clang-format off */ #include <stdio.h> /* printf */ #include "Curve.h" -#include "CurveIterators.h" #include "CurveAdvancedIterators.h" +#include "CurveIterators.h" #include "BKE_global.h" #include "BLI_utildefines.h" -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h index 662222524f1..4ac4c04774e 100644 --- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h @@ -22,6 +22,7 @@ * \brief Iterators used to iterate over the elements of the Curve. Can't be used in python */ +#include "CurveIterators.h" #include "Stroke.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index b0d3f26bce4..25954c7ecbf 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -19,18 +19,16 @@ * \brief Class gathering stroke creation algorithms */ -/* clang-format off */ #include <algorithm> #include <stdexcept> -#include "Operators.h" #include "Canvas.h" +#include "CurveIterators.h" +#include "Operators.h" #include "Stroke.h" #include "StrokeIterators.h" -#include "CurveIterators.h" #include "BKE_global.h" -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp index ff43e5986b3..c2c263696bc 100644 --- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp @@ -19,10 +19,8 @@ * \brief Class to define the Postscript rendering of a stroke */ -/* clang-format off */ -#include "Canvas.h" #include "PSStrokeRenderer.h" -/* clang-format on */ +#include "Canvas.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h index d549e960bd9..0ad4c69f869 100644 --- a/source/blender/freestyle/intern/stroke/Predicates1D.h +++ b/source/blender/freestyle/intern/stroke/Predicates1D.h @@ -22,20 +22,18 @@ * \brief Class gathering stroke creation algorithms */ -/* clang-format off */ #include <string> #include "AdvancedFunctions1D.h" #include "../system/TimeStamp.h" -#include "../view_map/Interface1D.h" #include "../view_map/Functions1D.h" +#include "../view_map/Interface1D.h" #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index 0bd25c20ca5..2f29eac83b1 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -19,15 +19,13 @@ * \brief Classes to define a stroke */ -/* clang-format off */ #include "Stroke.h" -#include "StrokeIterators.h" #include "StrokeAdvancedIterators.h" +#include "StrokeIterators.h" #include "StrokeRenderer.h" #include "BKE_global.h" #include "BKE_node.h" -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h index ccf5773a4c8..b8c96533a1c 100644 --- a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h @@ -23,6 +23,7 @@ */ #include "Stroke.h" +#include "StrokeIterators.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/StrokeLayer.cpp b/source/blender/freestyle/intern/stroke/StrokeLayer.cpp index 95598654dfe..9d12067512c 100644 --- a/source/blender/freestyle/intern/stroke/StrokeLayer.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeLayer.cpp @@ -19,11 +19,9 @@ * \brief Class to define a layer of strokes. */ -/* clang-format off */ +#include "StrokeLayer.h" #include "Canvas.h" #include "Stroke.h" -#include "StrokeLayer.h" -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.h b/source/blender/freestyle/intern/stroke/StrokeRenderer.h index 615d59ce6aa..67deb5eebf3 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.h @@ -22,10 +22,9 @@ * \brief Classes to render a stroke with OpenGL */ -/* clang-format off */ +#include <algorithm> #include <map> #include <string.h> -#include <algorithm> #include <utility> #include <vector> @@ -37,7 +36,6 @@ #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index 81e69c6e34c..661c144476c 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -19,15 +19,13 @@ * \brief Class to define the representation of a stroke (for display purpose) */ -/* clang-format off */ +#include "StrokeRep.h" #include "Stroke.h" -#include "StrokeIterators.h" #include "StrokeAdvancedIterators.h" +#include "StrokeIterators.h" #include "StrokeRenderer.h" -#include "StrokeRep.h" #include "BKE_global.h" -/* clang-format on */ using namespace std; diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.h b/source/blender/freestyle/intern/stroke/StrokeRep.h index b2bfb805ee6..d6ee1d01279 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.h +++ b/source/blender/freestyle/intern/stroke/StrokeRep.h @@ -30,10 +30,8 @@ # include "MEM_guardedalloc.h" #endif -extern "C" { #include "DNA_material_types.h" // for MAX_MTEX struct bNodeTree; -} namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp index 4f58827e941..e9a50067d4d 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp @@ -19,14 +19,12 @@ * \brief Class to build a Node Tree designed to be displayed from a set of strokes structure. */ -/* clang-format off */ -#include "StrokeAdvancedIterators.h" #include "StrokeTesselator.h" +#include "StrokeAdvancedIterators.h" -#include "../scene_graph/OrientedLineRep.h" #include "../scene_graph/NodeGroup.h" #include "../scene_graph/NodeShape.h" -/* clang-format on */ +#include "../scene_graph/OrientedLineRep.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h index 4669067c3f5..c6497aba808 100644 --- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h @@ -34,11 +34,11 @@ #ifndef TEXTSTROKERENDERER_H #define TEXTSTROKERENDERER_H -/* clang-format off */ +#include <fstream> + #include "StrokeRenderer.h" + #include "../system/FreestyleConfig.h" -#include <fstream> -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h index 785bc0f4330..4bc6ba9db38 100644 --- a/source/blender/freestyle/intern/system/PythonInterpreter.h +++ b/source/blender/freestyle/intern/system/PythonInterpreter.h @@ -22,15 +22,14 @@ * \brief Python Interpreter */ -/* clang-format off */ #include <iostream> extern "C" { #include <Python.h> } -#include "StringUtils.h" #include "Interpreter.h" +#include "StringUtils.h" #include "MEM_guardedalloc.h" @@ -49,7 +48,6 @@ extern "C" { #include "bpy_capi_utils.h" } -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp index 58d84010574..90210f33a25 100644 --- a/source/blender/freestyle/intern/system/StringUtils.cpp +++ b/source/blender/freestyle/intern/system/StringUtils.cpp @@ -19,12 +19,10 @@ * \brief String utilities */ -/* clang-format off */ // soc #include <qfileinfo.h> -#include "FreestyleConfig.h" #include "StringUtils.h" -/* clang-format on */ +#include "FreestyleConfig.h" namespace Freestyle { @@ -48,7 +46,7 @@ void getPathName(const string &path, const string &base, vector<string> &pathnam dir = path.substr(pos, sep - pos); BLI_strncpy(cleaned, dir.c_str(), FILE_MAX); - BLI_cleanup_path(NULL, cleaned); + BLI_path_normalize(NULL, cleaned); res = string(cleaned); if (!base.empty()) { diff --git a/source/blender/freestyle/intern/system/StringUtils.h b/source/blender/freestyle/intern/system/StringUtils.h index 16944e47335..aeacddd64c8 100644 --- a/source/blender/freestyle/intern/system/StringUtils.h +++ b/source/blender/freestyle/intern/system/StringUtils.h @@ -22,7 +22,6 @@ * \brief String utilities */ -/* clang-format off */ #include <cstring> #include <iostream> #include <sstream> @@ -30,10 +29,9 @@ #include <vector> extern "C" { -#include "BLI_string.h" #include "BLI_path_util.h" +#include "BLI_string.h" } -/* clang-format on */ using namespace std; diff --git a/source/blender/freestyle/intern/view_map/GridDensityProvider.h b/source/blender/freestyle/intern/view_map/GridDensityProvider.h index 26b76006686..290d5b0cfba 100644 --- a/source/blender/freestyle/intern/view_map/GridDensityProvider.h +++ b/source/blender/freestyle/intern/view_map/GridDensityProvider.h @@ -22,10 +22,9 @@ * \brief Class to define a cell grid surrounding the projected image of a scene */ -/* clang-format off */ -#include <stdexcept> #include <algorithm> #include <memory> +#include <stdexcept> #include "AutoPtrHelper.h" #include "OccluderSource.h" @@ -37,7 +36,6 @@ #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index 648eb4e453d..8503836e0ca 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -1592,15 +1592,15 @@ class SShape { /*! Splits an edge into several edges. * The edge's vertices are passed rather than the edge itself. This way, all feature edges - * (SILHOUETTE, CREASE, BORDER) are splitted in the same time. The processed edges are flagged as - * done (using the userdata flag).One single new vertex is created whereas several splitted edges + * (SILHOUETTE, CREASE, BORDER) are split in the same time. The processed edges are flagged as + * done (using the user-data flag).One single new vertex is created whereas several split edges * might created for the different kinds of edges. These new elements are added to the lists * maintained by the shape. * New chains are also created. * ioA - * The first vertex for the edge that gets splitted + * The first vertex for the edge that gets split. * ioB - * The second vertex for the edge that gets splitted + * The second vertex for the edge that gets split. * iParameters * A vector containing 2D real vectors indicating the parameters giving the intersections * coordinates in 3D and in 2D. These intersections points must be sorted from B to A. Each diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index 2c7560259fe..46d4389ea83 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -20,9 +20,8 @@ * implies that this geom engine has as member data the viewpoint, transformations, projections... */ -/* clang-format off */ -#include <cstring> #include <cstdio> +#include <cstring> #include "Silhouette.h" #include "SilhouetteGeomEngine.h" @@ -30,7 +29,6 @@ #include "../geometry/GeomUtils.h" #include "BKE_global.h" -/* clang-format on */ using namespace std; diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h index 3c1ca3b5992..e9074580fb9 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.h +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h @@ -24,7 +24,6 @@ #define SPHERICAL_GRID_LOGGING 0 -/* clang-format off */ // I would like to avoid using deque because including ViewMap.h and <deque> or <vector> separately // results in redefinitions of identifiers. ViewMap.h already includes <vector> so it should be a // safe fall-back. @@ -35,9 +34,9 @@ #include "OccluderSource.h" #include "ViewMap.h" -#include "../geometry/Polygon.h" #include "../geometry/BBox.h" #include "../geometry/GridHelpers.h" +#include "../geometry/Polygon.h" #include "../system/PointerSequence.h" @@ -48,7 +47,6 @@ #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index fd8f7958e83..efda4b7fd2a 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -20,7 +20,6 @@ * to. */ -/* clang-format off */ #include <sstream> #include "Silhouette.h" @@ -28,17 +27,14 @@ #include "../geometry/Geom.h" -#include "../image/ImagePyramid.h" #include "../image/Image.h" +#include "../image/ImagePyramid.h" #include "BKE_global.h" #include "BLI_math.h" -extern "C" { #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -} -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index 5ea28e4ac41..47c6c3a1f6a 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -19,15 +19,13 @@ * \brief Classes to define a View Map (ViewVertex, ViewEdge, etc.) */ -/* clang-format off */ #include <float.h> #include "ViewMap.h" -#include "ViewMapIterators.h" #include "ViewMapAdvancedIterators.h" +#include "ViewMapIterators.h" #include "../geometry/GeomUtils.h" -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h index 525073af919..2ff46e353f3 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h @@ -24,6 +24,7 @@ */ #include "ViewMap.h" +#include "ViewMapIterators.h" #include "../system/Iterator.h" //soc diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 681237399a8..40ab3ada777 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -19,11 +19,10 @@ * \brief Class to build silhouette edges from a Winged-Edge structure */ -/* clang-format off */ #include <algorithm> #include <memory> -#include <stdexcept> #include <sstream> +#include <stdexcept> #include "FRS_freestyle.h" @@ -34,13 +33,12 @@ #include "SphericalGrid.h" #include "ViewMapBuilder.h" -#include "../geometry/GridHelpers.h" #include "../geometry/GeomUtils.h" +#include "../geometry/GridHelpers.h" #include "../winged_edge/WFillGrid.h" #include "BKE_global.h" -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h index 33ef6858541..b6bf51618d8 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h +++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h @@ -22,13 +22,12 @@ * \brief Class to build a Node Tree designed to be displayed from a Silhouette View Map structure. */ -/* clang-format off */ #include "Silhouette.h" #include "ViewMap.h" #include "../scene_graph/LineRep.h" -#include "../scene_graph/NodeShape.h" #include "../scene_graph/NodeGroup.h" +#include "../scene_graph/NodeShape.h" #include "../scene_graph/OrientedLineRep.h" #include "../scene_graph/VertexRep.h" @@ -37,7 +36,6 @@ #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif -/* clang-format on */ namespace Freestyle { diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp index 591d6518741..96b313d4e01 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp +++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp @@ -105,16 +105,16 @@ static real angle_from_cotan(WVertex *vo, WVertex *v1, WVertex *v2) } /*! gts_vertex_mean_curvature_normal: - * @v: a #WVertex. - * @s: a #GtsSurface. - * @Kh: the Mean Curvature Normal at @v. + * \param v: a #WVertex. + * \param s: a #GtsSurface. + * \param Kh: the Mean Curvature Normal at \a v. * - * Computes the Discrete Mean Curvature Normal approximation at @v. - * The mean curvature at @v is half the magnitude of the vector @Kh. + * Computes the Discrete Mean Curvature Normal approximation at \a v. + * The mean curvature at \a v is half the magnitude of the vector \a Kh. * * Note: the normal computed is not unit length, and may point either into or out of the surface, - * depending on the curvature at @v. It is the responsibility of the caller of the function to use - * the mean curvature normal appropriately. + * depending on the curvature at \a v. It is the responsibility of the caller of the function to + * use the mean curvature normal appropriately. * * This approximation is from the paper: * Discrete Differential-Geometry Operators for Triangulated 2-Manifolds @@ -176,11 +176,11 @@ bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh) } /*! gts_vertex_gaussian_curvature: - * @v: a #WVertex. - * @s: a #GtsSurface. - * @Kg: the Discrete Gaussian Curvature approximation at @v. + * \param v: a #WVertex. + * \param s: a #GtsSurface. + * \param Kg: the Discrete Gaussian Curvature approximation at \a v. * - * Computes the Discrete Gaussian Curvature approximation at @v. + * Computes the Discrete Gaussian Curvature approximation at \a v. * * This approximation is from the paper: * Discrete Differential-Geometry Operators for Triangulated 2-Manifolds @@ -280,16 +280,16 @@ static void eigenvector(real a, real b, real c, Vec3r e) } /*! gts_vertex_principal_directions: - * @v: a #WVertex. - * @s: a #GtsSurface. - * @Kh: mean curvature normal (a #Vec3r). - * @Kg: Gaussian curvature (a real). - * @e1: first principal curvature direction (direction of largest curvature). - * @e2: second principal curvature direction. + * \param v: a #WVertex. + * \param s: a #GtsSurface. + * \param Kh: mean curvature normal (a #Vec3r). + * \param Kg: Gaussian curvature (a real). + * \param e1: first principal curvature direction (direction of largest curvature). + * \param e2: second principal curvature direction. * - * Computes the principal curvature directions at a point given @Kh and @Kg, the mean curvature - * normal and Gaussian curvatures at that point, computed with gts_vertex_mean_curvature_normal() - * and gts_vertex_gaussian_curvature(), respectively. + * Computes the principal curvature directions at a point given \a Kh and \a Kg, + * the mean curvature normal and Gaussian curvatures at that point, computed with + * gts_vertex_mean_curvature_normal() and gts_vertex_gaussian_curvature(), respectively. * * Note that this computation is very approximate and tends to be unstable. Smoothing of the * surface or the principal directions may be necessary to achieve reasonable results. diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp index b6dfb183d0f..f54b54f5a3a 100644 --- a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp +++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp @@ -19,10 +19,8 @@ * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures) */ -/* clang-format off */ -#include "WEdge.h" #include "WFillGrid.h" -/* clang-format on */ +#include "WEdge.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp index 2fa9e51fa7f..e1cb1c29f63 100644 --- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp +++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp @@ -19,10 +19,8 @@ * \brief Class to fill in a grid from a SceneGraph (uses only the WingedEdge structures) */ -/* clang-format off */ -#include "WEdge.h" #include "WSFillGrid.h" -/* clang-format on */ +#include "WEdge.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp index e6062a605ba..9be3da4420b 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp @@ -20,10 +20,8 @@ * info (silhouette etc...)) structure from a polygonal model */ -/* clang-format off */ -#include "WXEdge.h" #include "WXEdgeBuilder.h" -/* clang-format on */ +#include "WXEdge.h" namespace Freestyle { |