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.
This commit is contained in:
Lukas Tönne 2015-01-21 14:00:59 +01:00
parent f23338e107
commit f087e9930d
4 changed files with 12 additions and 3 deletions

View File

@ -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 | \

View File

@ -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;

View File

@ -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);
}

View File

@ -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},