[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53537] branches/soc-2008-mxcurioni: New command-line option --debug-freestyle to enable verbose debug messages
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Fri Jan 4 00:27:21 CET 2013
Revision: 53537
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53537
Author: kjym3
Date: 2013-01-03 23:27:20 +0000 (Thu, 03 Jan 2013)
Log Message:
-----------
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! :)
Modified Paths:
--------------
branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_global.h
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/AppCanvas.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/Controller.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/geometry/FastGrid.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Canvas.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Curve.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Operators.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Stroke.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/system/PythonInterpreter.h
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/BoxGrid.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/BoxGrid.h
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/Functions0D.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/GridDensityProvider.h
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/OccluderSource.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/SphericalGrid.h
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
branches/soc-2008-mxcurioni/source/blender/python/intern/bpy_app.c
branches/soc-2008-mxcurioni/source/creator/creator.c
Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py 2013-01-03 16:36:17 UTC (rev 53536)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py 2013-01-03 23:27:20 UTC (rev 53537)
@@ -1225,8 +1225,10 @@
thickness_position = linestyle.thickness_position
else:
thickness_position = "CENTER"
- print("Warning: Thickness poisition options are applied when chaining is disabled")
- print(" or the Plain chaining is used with the Same Object option enabled.")
+ import bpy
+ if bpy.app.debug_freestyle:
+ print("Warning: Thickness position options are applied when chaining is disabled")
+ print(" or the Plain chaining is used with the Same Object option enabled.")
shaders_list.append(BaseColorShader(color.r, color.g, color.b, linestyle.alpha))
shaders_list.append(BaseThicknessShader(linestyle.thickness, thickness_position,
linestyle.thickness_ratio))
Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_global.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_global.h 2013-01-03 16:36:17 UTC (rev 53536)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_global.h 2013-01-03 23:27:20 UTC (rev 53537)
@@ -132,10 +132,12 @@
G_DEBUG_EVENTS = (1 << 3), /* input/window/screen events */
G_DEBUG_HANDLERS = (1 << 4), /* events handling */
G_DEBUG_WM = (1 << 5), /* operator, undo */
- G_DEBUG_JOBS = (1 << 6) /* jobs time profiling */
+ G_DEBUG_JOBS = (1 << 6), /* jobs time profiling */
+ G_DEBUG_FREESTYLE = (1 << 7), /* freestyle messages */
};
-#define G_DEBUG_ALL (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS)
+#define G_DEBUG_ALL (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
+ G_DEBUG_FREESTYLE)
/* G.fileflags */
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/AppCanvas.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/AppCanvas.cpp 2013-01-03 16:36:17 UTC (rev 53536)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/AppCanvas.cpp 2013-01-03 23:27:20 UTC (rev 53537)
@@ -145,8 +145,12 @@
int recty = _pass_z.height;
float xfac = ((float)rectx) / ((float)(xmax - xmin));
float yfac = ((float)recty) / ((float)(ymax - ymin));
- //printf("readColorPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n", w, h, x, y, xsch, ysch,
- // xmax - xmin, ymax - ymin, rectx, recty, (int)(xfac * 100.0f));
+#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", w, h, x, y, xsch, ysch,
+ xmax - xmin, ymax - ymin, rectx, recty, (int)(xfac * 100.0f));
+ }
+#endif
int ii, jj;
for (int j = 0; j < h; j++) {
jj = (int)((y - ymin + j) * yfac);
@@ -178,8 +182,12 @@
int recty = _pass_z.height;
float xfac = ((float)rectx) / ((float)(xmax - xmin));
float yfac = ((float)recty) / ((float)(ymax - ymin));
- //printf("readDepthPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n", w, h, x, y, xsch, ysch,
- // xmax - xmin, ymax - ymin, rectx, recty, (int)(xfac * 100.0f));
+#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", w, h, x, y, xsch, ysch,
+ xmax - xmin, ymax - ymin, rectx, recty, (int)(xfac * 100.0f));
+ }
+#endif
int ii, jj;
for (int j = 0; j < h; j++) {
jj = (int)((y - ymin + j) * yfac);
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/Controller.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/Controller.cpp 2013-01-03 16:36:17 UTC (rev 53536)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/Controller.cpp 2013-01-03 23:27:20 UTC (rev 53537)
@@ -68,6 +68,8 @@
#include "../blender_interface/BlenderStrokeRenderer.h"
#include "../blender_interface/BlenderStyleModule.h"
+#include "BKE_global.h"
+
// XXX Not inside an "extern C" block???
#include "DNA_freestyle_types.h"
@@ -227,19 +229,26 @@
NodeGroup *blenderScene = loader.Load();
if (blenderScene == NULL) {
- cout << "Cannot load scene" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Cannot load scene" << endl;
+ }
return 1;
}
if (blenderScene->numberOfChildren() < 1) {
- cout << "Empty scene" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Empty scene" << endl;
+ }
blenderScene->destroy();
delete blenderScene;
return 1;
}
- cout << "Scene loaded" << endl;
- printf("Mesh cleaning : %lf\n", _Chrono.stop());
+ real duration = _Chrono.stop();
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Scene loaded" << endl;
+ printf("Mesh cleaning : %lf\n", duration);
+ }
_SceneNumFaces += loader.numFacesRead();
if (loader.minEdgeSize() < _minEdgeSize) {
@@ -267,7 +276,10 @@
blenderScene->accept(wx_builder);
_winged_edge = wx_builder.getWingedEdge();
- printf("WEdge building : %lf\n", _Chrono.stop());
+ duration = _Chrono.stop();
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ printf("WEdge building : %lf\n", duration);
+ }
#if 0
_pView->setDebug(_DebugNode);
@@ -288,9 +300,11 @@
_ListOfModels.push_back("Blender_models");
- cout << "Triangles nb : " << _SceneNumFaces << endl;
_bboxDiag = (_RootNode->bbox().getMax()-_RootNode->bbox().getMin()).norm();
- cout << "Bounding Box : " << _bboxDiag << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Triangles nb : " << _SceneNumFaces << endl;
+ cout << "Bounding Box : " << _bboxDiag << endl;
+ }
ClearRootNode();
@@ -430,37 +444,66 @@
// 3D context is on.
Vec3r vp(freestyle_viewpoint[0], freestyle_viewpoint[1], freestyle_viewpoint[2]);
- //cout << "mv" << endl;
+#if 0
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "mv" << endl;
+ }
+#endif
real mv[4][4];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
mv[i][j] = freestyle_mv[i][j];
- //cout << mv[i][j] << " ";
+#if 0
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << mv[i][j] << " ";
+ }
+#endif
}
- //cout << endl;
+#if 0
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << endl;
+ }
+#endif
}
- //cout << "\nproj" << endl;
+#if 0
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "\nproj" << endl;
+ }
+#endif
real proj[4][4];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
proj[i][j] = freestyle_proj[i][j];
- //cout << proj[i][j] << " ";
+#if 0
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << proj[i][j] << " ";
+ }
+#endif
}
- //cout << endl;
+#if 0
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << endl;
+ }
+#endif
}
int viewport[4];
for (int i = 0; i < 4; i++)
viewport[i] = freestyle_viewport[i];
- //cout << "\nfocal:" << _pView->GetFocalLength() << endl << endl;
+#if 0
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "\nfocal:" << _pView->GetFocalLength() << endl << endl;
+ }
+#endif
-
// Flag the WXEdge structure for silhouette edge detection:
//----------------------------------------------------------
- cout << "\n=== Detecting silhouette edges ===" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "\n=== Detecting silhouette edges ===" << endl;
+ }
_Chrono.start();
edgeDetector.setViewpoint(Vec3r(vp));
@@ -476,7 +519,9 @@
edgeDetector.processShapes(*_winged_edge);
real duration = _Chrono.stop();
- printf("Feature lines : %lf\n", duration);
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ printf("Feature lines : %lf\n", duration);
+ }
if (_pRenderMonitor->testBreak())
return;
@@ -500,13 +545,17 @@
#endif
sTesselator3d.setNature(_edgeTesselationNature);
- cout << "\n=== Building the view map ===" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "\n=== Building the view map ===" << endl;
+ }
_Chrono.start();
// Build View Map
_ViewMap = vmBuilder.BuildViewMap(*_winged_edge, _VisibilityAlgo, _EPSILON, _RootNode->bbox(), _SceneNumFaces);
_ViewMap->setScene3dBBox(_RootNode->bbox());
- printf("ViewMap edge count : %i\n", _ViewMap->viewedges_size());
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ printf("ViewMap edge count : %i\n", _ViewMap->viewedges_size());
+ }
// Tesselate the 3D edges:
_SilhouetteNode = sTesselator3d.Tesselate(_ViewMap);
@@ -519,7 +568,9 @@
#endif
duration = _Chrono.stop();
- printf("ViewMap building : %lf\n", duration);
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ printf("ViewMap building : %lf\n", duration);
+ }
_pView->AddSilhouette(_SilhouetteNode);
#if 0
@@ -595,8 +646,11 @@
#endif
pm = offscreenBuffer.renderPixmap(_pView->width(), _pView->height());
- if (pm.isNull())
- cout << "BuildViewMap Warning: couldn't render the steerable ViewMap" << endl;
+ if (pm.isNull()) {
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "BuildViewMap Warning: couldn't render the steerable ViewMap" << endl;
+ }
+ }
//pm.save(QString("steerable") + QString::number(i) + QString(".bmp"), "BMP");
// FIXME!! Lost of time !
qimg = pm.toImage();
@@ -770,12 +824,16 @@
if (_ViewMap == 0)
return;
- cout << "\n=== Stroke drawing ===" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "\n=== Stroke drawing ===" << endl;
+ }
_Chrono.start();
_Canvas->Draw();
real d = _Chrono.stop();
- cout << "Strokes generation : " << d << endl;
- cout << "Stroke count : " << _Canvas->stroke_count << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Strokes generation : " << d << endl;
+ cout << "Stroke count : " << _Canvas->stroke_count << endl;
+ }
resetModified();
DeleteViewMap();
}
@@ -791,11 +849,15 @@
BlenderStrokeRenderer* blenderRenderer = new BlenderStrokeRenderer(re, ++_render_count);
_Canvas->Render(blenderRenderer);
real d = _Chrono.stop();
- cout << "Temporary scene generation: " << d << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list