diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-16 21:41:29 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-16 21:43:53 +0300 |
commit | 81022000063c1fe84d85e8de416d8ab0c2c4c516 (patch) | |
tree | 01db45c9a9f3e87b107b2d61904080261cecf730 /source/blender/blenkernel | |
parent | feaf846f93913840b523843c63ef67dfa82379cc (diff) |
Cleanup/sanitize usages of G.debug_value.
There was no documentation at all, some very bad practices (like using
G.debug_value > 0 as some sort of global debug print switch), and even
an overlapping use of '1' value...
Also, python setter did not check for valid range (since this is a
short, not an int).
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 9 |
2 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index b2991679775..97e23a952db 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -73,7 +73,21 @@ typedef struct Global { /* to indicate render is busy, prevent renderwindow events etc */ bool is_rendering; - /* debug value, can be set from the UI and python, used for testing nonstandard features */ + /* Debug value, can be set from the UI and python, used for testing nonstandard features. + * DO NOT abuse it with generic checks like `if (G.debug_value > 0)`. Do not use it as bitflags. + * Only precise specific values should be checked for, to avoid unpredictable side-effects. + * Please document here the value(s) you are using (or a range of values reserved to some area). + * * -16384 and below: Reserved for python (add-ons) usage. + * * -1: Disable faster motion paths computation (since 08/2018). + * * 1 - 30: EEVEE debug/stats values (01/2018). + * * 101: Enable UI debug drawing of fullscreen area's corner widget (10/2014). + * * 527: Old mysterious switch in behavior of MeshDeform modifier (before 04/2010). + * * 777: Enable UI node panel's sockets polling (11/2011). + * * 799: Enable some mysterious new depsgraph behavior (05/2015). + * * 1112: Disable new Cloth internal springs hanlding (09/2014). + * * 1234: Disable new dyntopo code fixing skinny faces generation (04/2015). + * * 16384 and above: Reserved for python (add-ons) usage. + */ short debug_value; /* saved to the blend file as FileGlobal.globalf, diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 30b5d92bdb7..47afef444cf 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -515,8 +515,9 @@ void cloth_free_modifier(ClothModifierData *clmd ) void cloth_free_modifier_extern(ClothModifierData *clmd ) { Cloth *cloth = NULL; - if (G.debug_value > 0) + if (G.debug & G_DEBUG_SIMDATA) { printf("cloth_free_modifier_extern\n"); + } if ( !clmd ) return; @@ -524,8 +525,9 @@ void cloth_free_modifier_extern(ClothModifierData *clmd ) cloth = clmd->clothObject; if ( cloth ) { - if (G.debug_value > 0) + if (G.debug & G_DEBUG_SIMDATA) { printf("cloth_free_modifier_extern in\n"); + } BPH_cloth_solver_free(clmd); @@ -728,8 +730,9 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, Mesh *mesh, fl // If we have a clothObject, free it. if ( clmd->clothObject != NULL ) { cloth_free_modifier ( clmd ); - if (G.debug_value > 0) + if (G.debug & G_DEBUG_SIMDATA) { printf("cloth_free_modifier cloth_from_object\n"); + } } // Allocate a new cloth object. |