Commit: f087e9930d5b8c876206af117ce085dec0ec4578
Author: Lukas Tönne
Date:   Wed Jan 21 14:00:59 2015 +0100
Branches: master
https://developer.blender.org/rBf087e9930d5b8c876206af117ce085dec0ec4578

Added new debug flag which can be used to lazy-init the SimDebug drawing.

A development addon can be used now to enable the debug drawing, without
the need to add UI code for this in the release files.

The SimDebug feature should also get an overall build flag and use
function stubs unless enabled. That way any possibility of overhead in
releases is eliminated.

===================================================================

M       source/blender/blenkernel/BKE_global.h
M       source/blender/blenkernel/intern/effect.c
M       source/blender/editors/space_view3d/view3d_draw.c
M       source/blender/python/intern/bpy_app.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_global.h 
b/source/blender/blenkernel/BKE_global.h
index e70689b..57003ff 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -126,6 +126,7 @@ enum {
        G_DEBUG_JOBS =      (1 << 6), /* jobs time profiling */
        G_DEBUG_FREESTYLE = (1 << 7), /* freestyle messages */
        G_DEBUG_DEPSGRAPH = (1 << 8), /* depsgraph messages */
+       G_DEBUG_SIMDATA =   (1 << 9), /* sim debug data display */
 };
 
 #define G_DEBUG_ALL  (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | 
G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
diff --git a/source/blender/blenkernel/intern/effect.c 
b/source/blender/blenkernel/intern/effect.c
index c896fa2..9c3e78d 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -63,6 +63,7 @@
 #include "BKE_DerivedMesh.h"
 #include "BKE_cdderivedmesh.h"
 #include "BKE_effect.h"
+#include "BKE_global.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
 #include "BKE_particle.h"
@@ -1124,8 +1125,13 @@ void BKE_sim_debug_data_add_element(int type, const 
float v1[3], const float v2[
 {
        unsigned int category_hash = BLI_ghashutil_strhash_p(category);
        SimDebugElement *elem;
-       if (!_sim_debug_data)
-               return;
+       
+       if (!_sim_debug_data) {
+               if (G.debug & G_DEBUG_SIMDATA)
+                       BKE_sim_debug_data_set_enabled(true);
+               else
+                       return;
+       }
        
        elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element");
        elem->type = type;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c 
b/source/blender/editors/space_view3d/view3d_draw.c
index ed30c87..88cabcc 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3584,7 +3584,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
 #ifdef DEBUG_DRAW
                bl_debug_draw();
 #endif
-               draw_sim_debug_data(scene, v3d, ar);
+               if (G.debug & G_DEBUG_SIMDATA)
+                       draw_sim_debug_data(scene, v3d, ar);
                
                ED_region_pixelspace(ar);
        }
diff --git a/source/blender/python/intern/bpy_app.c 
b/source/blender/python/intern/bpy_app.c
index 678fd62..cca4191 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -283,6 +283,7 @@ static PyGetSetDef bpy_app_getsets[] = {
        {(char *)"debug_handlers",  bpy_app_debug_get, bpy_app_debug_set, (char 
*)bpy_app_debug_doc, (void *)G_DEBUG_HANDLERS},
        {(char *)"debug_wm",        bpy_app_debug_get, bpy_app_debug_set, (char 
*)bpy_app_debug_doc, (void *)G_DEBUG_WM},
        {(char *)"debug_depsgraph", bpy_app_debug_get, bpy_app_debug_set, (char 
*)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH},
+       {(char *)"debug_simdata",   bpy_app_debug_get, bpy_app_debug_set, (char 
*)bpy_app_debug_doc, (void *)G_DEBUG_SIMDATA},
 
        {(char *)"debug_value", bpy_app_debug_value_get, 
bpy_app_debug_value_set, (char *)bpy_app_debug_value_doc, NULL},
        {(char *)"tempdir", bpy_app_tempdir_get, NULL, (char 
*)bpy_app_tempdir_doc, NULL},

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to