From ec78eb353f71341f84999f47a7222becaadb8598 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Thu, 3 Jan 2013 23:27:20 +0000 Subject: New command-line option --debug-freestyle to enable verbose debug messages on the console during Freestyle rendering. The debug prints are turned off by default now. Errors are still printed on the console. A patch set implementing this functionality was provided by Bastien Montagne. Many thanks! :) --- .../intern/view_map/AverageAreaGridDensityProvider.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp') diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp index 4832d08f2bc..d293ed8189f 100644 --- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp @@ -34,6 +34,8 @@ #include "AverageAreaGridDensityProvider.h" +#include "BKE_global.h" + AverageAreaGridDensityProvider::AverageAreaGridDensityProvider(OccluderSource& source, const real proscenium[4], real sizeFactor) : GridDensityProvider(source) @@ -76,16 +78,22 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s cellArea += (max[0] - min[0]) * (max[1] - min[1]); ++numFaces; } - cout << "Total area: " << cellArea << ". Number of faces: " << numFaces << "." << endl; + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Total area: " << cellArea << ". Number of faces: " << numFaces << "." << endl; + } cellArea /= numFaces; cellArea *= sizeFactor; - cout << "Building grid with average area " << cellArea << endl; + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Building grid with average area " << cellArea << endl; + } _cellSize = sqrt(cellArea); // Now we know how many cells make each side of our grid _cellsX = ceil(prosceniumWidth / _cellSize); _cellsY = ceil(prosceniumHeight / _cellSize); - cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; + if (G.debug & G_DEBUG_FREESTYLE) { + cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; + } // Make sure the grid exceeds the proscenium by a small amount float safetyZone = 0.1f; @@ -95,7 +103,9 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s if (_cellsY * _cellSize < prosceniumHeight * (1.0 + safetyZone)) { _cellsY = prosceniumHeight * (1.0 + safetyZone) / _cellSize; } - cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; + if (G.debug & G_DEBUG_FREESTYLE) { + cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; + } // Find grid origin _cellOrigin[0] = ((proscenium[0] + proscenium[1]) / 2.0) - (_cellsX / 2.0) * _cellSize; -- cgit v1.2.3