[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45300] trunk/blender: move debug flag into its own global var (G.debug), split up debug options.

Campbell Barton ideasman42 at gmail.com
Sat Mar 31 02:59:22 CEST 2012


Revision: 45300
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45300
Author:   campbellbarton
Date:     2012-03-31 00:59:17 +0000 (Sat, 31 Mar 2012)
Log Message:
-----------
move debug flag into its own global var (G.debug), split up debug options.
  --debug
  --debug-ffmpeg
  --debug-python
  --debug-events
  --debug-wm

This makes debug output easier to read - event debug prints would flood output too much before.

For convenience:
  --debug-all turns all debug flags on (works as --debug did before).

also removed some redundant whitespace in debug prints and prefix some prints with __func__ to give some context.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/addon_utils.py
    trunk/blender/release/scripts/modules/bpy/utils.py
    trunk/blender/release/scripts/modules/console_python.py
    trunk/blender/source/blender/blenfont/intern/blf_lang.c
    trunk/blender/source/blender/blenkernel/BKE_global.h
    trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
    trunk/blender/source/blender/blenkernel/intern/anim_sys.c
    trunk/blender/source/blender/blenkernel/intern/blender.c
    trunk/blender/source/blender/blenkernel/intern/bmfont.c
    trunk/blender/source/blender/blenkernel/intern/constraint.c
    trunk/blender/source/blender/blenkernel/intern/depsgraph.c
    trunk/blender/source/blender/blenkernel/intern/fcurve.c
    trunk/blender/source/blender/blenkernel/intern/fmodifier.c
    trunk/blender/source/blender/blenkernel/intern/gpencil.c
    trunk/blender/source/blender/blenkernel/intern/ipo.c
    trunk/blender/source/blender/blenkernel/intern/library.c
    trunk/blender/source/blender/blenkernel/intern/nla.c
    trunk/blender/source/blender/blenkernel/intern/object.c
    trunk/blender/source/blender/blenkernel/intern/ocean.c
    trunk/blender/source/blender/blenkernel/intern/particle_system.c
    trunk/blender/source/blender/blenkernel/intern/pointcache.c
    trunk/blender/source/blender/blenkernel/intern/softbody.c
    trunk/blender/source/blender/blenlib/intern/path_util.c
    trunk/blender/source/blender/blenloader/intern/readblenentry.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/collada/AnimationImporter.cpp
    trunk/blender/source/blender/collada/DocumentImporter.cpp
    trunk/blender/source/blender/collada/ImageExporter.cpp
    trunk/blender/source/blender/collada/MeshImporter.cpp
    trunk/blender/source/blender/editors/animation/anim_channels_edit.c
    trunk/blender/source/blender/editors/animation/anim_filter.c
    trunk/blender/source/blender/editors/animation/anim_markers.c
    trunk/blender/source/blender/editors/animation/fmodifier_ui.c
    trunk/blender/source/blender/editors/animation/keyframes_draw.c
    trunk/blender/source/blender/editors/animation/keyframing.c
    trunk/blender/source/blender/editors/armature/editarmature.c
    trunk/blender/source/blender/editors/armature/editarmature_retarget.c
    trunk/blender/source/blender/editors/armature/reeb.c
    trunk/blender/source/blender/editors/curve/editcurve.c
    trunk/blender/source/blender/editors/gpencil/drawgpencil.c
    trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
    trunk/blender/source/blender/editors/interface/interface_anim.c
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/editors/interface/interface_icons.c
    trunk/blender/source/blender/editors/interface/interface_ops.c
    trunk/blender/source/blender/editors/interface/interface_style.c
    trunk/blender/source/blender/editors/interface/view2d.c
    trunk/blender/source/blender/editors/object/object_constraint.c
    trunk/blender/source/blender/editors/object/object_relations.c
    trunk/blender/source/blender/editors/physics/particle_edit.c
    trunk/blender/source/blender/editors/physics/particle_object.c
    trunk/blender/source/blender/editors/physics/physics_fluid.c
    trunk/blender/source/blender/editors/render/render_internal.c
    trunk/blender/source/blender/editors/screen/area.c
    trunk/blender/source/blender/editors/screen/screen_edit.c
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_undo.c
    trunk/blender/source/blender/editors/space_action/action_select.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c
    trunk/blender/source/blender/editors/space_nla/nla_channels.c
    trunk/blender/source/blender/editors/space_nla/nla_edit.c
    trunk/blender/source/blender/editors/space_nla/nla_select.c
    trunk/blender/source/blender/editors/space_node/node_edit.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/editors/util/editmode_undo.c
    trunk/blender/source/blender/editors/util/undo.c
    trunk/blender/source/blender/gpu/intern/gpu_codegen.c
    trunk/blender/source/blender/gpu/intern/gpu_extensions.c
    trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c
    trunk/blender/source/blender/imbuf/intern/tiff.c
    trunk/blender/source/blender/imbuf/intern/util.c
    trunk/blender/source/blender/makesdna/intern/dna_genfile.c
    trunk/blender/source/blender/makesdna/intern/makesdna.c
    trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
    trunk/blender/source/blender/makesrna/intern/rna_screen.c
    trunk/blender/source/blender/nodes/composite/node_composite_tree.c
    trunk/blender/source/blender/python/intern/bpy_app.c
    trunk/blender/source/blender/python/intern/bpy_interface.c
    trunk/blender/source/blender/python/intern/bpy_rna.c
    trunk/blender/source/blender/python/intern/bpy_rna_array.c
    trunk/blender/source/blender/render/intern/raytrace/rayobject_octree.cpp
    trunk/blender/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
    trunk/blender/source/blender/render/intern/raytrace/reorganize.h
    trunk/blender/source/blender/render/intern/raytrace/svbvh.h
    trunk/blender/source/blender/render/intern/source/convertblender.c
    trunk/blender/source/blender/render/intern/source/volume_precache.c
    trunk/blender/source/blender/windowmanager/intern/wm_cursors.c
    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
    trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c
    trunk/blender/source/blender/windowmanager/intern/wm_subwindow.c
    trunk/blender/source/blender/windowmanager/intern/wm_window.c
    trunk/blender/source/creator/creator.c
    trunk/blender/source/gameengine/GamePlayer/common/bmfont.cpp
    trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
    trunk/blender/source/gameengine/GamePlayer/xembed/UnixShell.c
    trunk/blender/source/gameengine/Ketsji/KX_NavMeshObject.cpp

Modified: trunk/blender/release/scripts/modules/addon_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/addon_utils.py	2012-03-30 20:31:40 UTC (rev 45299)
+++ trunk/blender/release/scripts/modules/addon_utils.py	2012-03-31 00:59:17 UTC (rev 45300)
@@ -65,7 +65,7 @@
     def fake_module(mod_name, mod_path, speedy=True, force_support=None):
         global error_encoding
 
-        if _bpy.app.debug:
+        if _bpy.app.debug_python:
             print("fake_module", mod_path, mod_name)
         import ast
         ModuleType = type(ast)
@@ -284,7 +284,7 @@
 
     mod.__addon_enabled__ = True
 
-    if _bpy.app.debug:
+    if _bpy.app.debug_python:
         print("\taddon_utils.enable", mod.__name__)
 
     return mod
@@ -323,7 +323,7 @@
             if addon:
                 addons.remove(addon)
 
-    if _bpy.app.debug:
+    if _bpy.app.debug_python:
         print("\taddon_utils.disable", module_name)
 
 

Modified: trunk/blender/release/scripts/modules/bpy/utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/utils.py	2012-03-30 20:31:40 UTC (rev 45299)
+++ trunk/blender/release/scripts/modules/bpy/utils.py	2012-03-31 00:59:17 UTC (rev 45300)
@@ -57,7 +57,7 @@
 
 
 def _test_import(module_name, loaded_modules):
-    use_time = _bpy.app.debug
+    use_time = _bpy.app.debug_python
 
     if module_name in loaded_modules:
         return None
@@ -126,7 +126,7 @@
        as modules.
     :type refresh_scripts: bool
     """
-    use_time = _bpy.app.debug
+    use_time = _bpy.app.debug_python
 
     prefs = _bpy.context.user_preferences
 
@@ -426,7 +426,7 @@
 def keyconfig_set(filepath):
     from os.path import basename, splitext
 
-    if _bpy.app.debug:
+    if _bpy.app.debug_python:
         print("loading preset:", filepath)
 
     keyconfigs = _bpy.context.window_manager.keyconfigs

Modified: trunk/blender/release/scripts/modules/console_python.py
===================================================================
--- trunk/blender/release/scripts/modules/console_python.py	2012-03-30 20:31:40 UTC (rev 45299)
+++ trunk/blender/release/scripts/modules/console_python.py	2012-03-31 00:59:17 UTC (rev 45300)
@@ -246,7 +246,7 @@
                 line=line,
                 cursor=current_line.current_character,
                 namespace=console.locals,
-                private=bpy.app.debug)
+                private=bpy.app.debug_python)
 
         line_new = result[0]
         current_line.body, current_line.current_character, scrollback = result

Modified: trunk/blender/source/blender/blenfont/intern/blf_lang.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_lang.c	2012-03-30 20:31:40 UTC (rev 45299)
+++ trunk/blender/source/blender/blenfont/intern/blf_lang.c	2012-03-31 00:59:17 UTC (rev 45300)
@@ -192,7 +192,7 @@
 	locreturn = setlocale(LC_ALL, long_locale);
 
 	if (locreturn == NULL) {
-		if (G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("Could not change locale to %s\n", long_locale);
 
 		ok = 0;
@@ -209,14 +209,14 @@
 			get_language_variable("LANGUAGE", default_language, sizeof(default_language));
 
 		if (short_locale[0]) {
-			if (G.f & G_DEBUG)
+			if (G.debug & G_DEBUG)
 				printf("Setting LANG= and LANGUAGE to %s\n", short_locale);
 
 			BLI_setenv("LANG", short_locale);
 			BLI_setenv("LANGUAGE", short_locale);
 		}
 		else {
-			if (G.f & G_DEBUG)
+			if (G.debug & G_DEBUG)
 				printf("Setting LANG=%s and LANGUAGE=%s\n", default_lang, default_language);
 
 			BLI_setenv("LANG", default_lang);
@@ -238,7 +238,7 @@
 
 				get_language(long_locale, default_lang, language, sizeof(language));
 
-				if (G.f & G_DEBUG) {
+				if (G.debug & G_DEBUG) {
 					if (short_locale[0])
 						printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
 					else

Modified: trunk/blender/source/blender/blenkernel/BKE_global.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_global.h	2012-03-30 20:31:40 UTC (rev 45299)
+++ trunk/blender/source/blender/blenkernel/BKE_global.h	2012-03-31 00:59:17 UTC (rev 45300)
@@ -69,6 +69,7 @@
 
 	short rt;
 	int f;
+	int debug;
 
 	/* Used for BMesh transformations */
 	struct BME_Glob *editBMesh;
@@ -104,16 +105,26 @@
 
 /* #define G_FACESELECT	(1 <<  8) use (mesh->editflag & ME_EDIT_PAINT_MASK) */
 
-#define G_DEBUG			(1 << 12)
 #define G_SCRIPT_AUTOEXEC (1 << 13)
 #define G_SCRIPT_OVERRIDE_PREF (1 << 14) /* when this flag is set ignore the userprefs */
-#define G_DEBUG_FFMPEG		(1 << 15)
 
 /* #define G_NOFROZEN	(1 << 17) also removed */
 /* #define G_GREASEPENCIL 	(1 << 17)   also removed */
 
 /* #define G_AUTOMATKEYS	(1 << 30)   also removed */
 
+/* G.debug */
+enum {
+	G_DEBUG =           (1 << 0), /* general debug flag, print more info in unexpected cases */
+	G_DEBUG_FFMPEG =    (1 << 1),
+	G_DEBUG_PYTHON =    (1 << 2), /* extra python info */
+	G_DEBUG_EVENTS =    (1 << 3), /* input/window/screen events */
+	G_DEBUG_WM =        (1 << 4)  /* operator, undo */
+};
+
+#define G_DEBUG_ALL  (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM)
+
+
 /* G.fileflags */
 
 #define G_AUTOPACK               (1 << 0)

Modified: trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c	2012-03-30 20:31:40 UTC (rev 45299)
+++ trunk/blender/source/blender/blenkernel/intern/DerivedMesh.c	2012-03-31 00:59:17 UTC (rev 45300)
@@ -445,7 +445,7 @@
 		                            numTex, numCol, hasPCol, hasOrigSpace);
 	}
 
-	if (G.f & G_DEBUG)
+	if (G.debug & G_DEBUG)
 		printf("Updated tessellated customdata of dm %p\n", dm);
 
 	dm->dirty &= ~DM_DIRTY_TESS_CDLAYERS;

Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2012-03-30 20:31:40 UTC (rev 45299)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2012-03-31 00:59:17 UTC (rev 45300)
@@ -399,7 +399,7 @@
 	
 	/* sanity checks */
 	if (ELEM3(NULL, srcAct, dstAct, basepath)) {
-		if (G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG) {
 			printf("ERROR: action_partition_fcurves_by_basepath(%p, %p, %p) has insufficient info to work with\n",
 					(void *)srcAct, (void *)dstAct, (void *)basepath);
 		}
@@ -480,7 +480,7 @@
 	
 	/* sanity checks */
 	if (ELEM(NULL, srcID, dstID)) {
-		if (G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("ERROR: no source or destination ID to separate AnimData with\n");
 		return;
 	}
@@ -490,7 +490,7 @@
 	dstAdt = BKE_id_add_animdata(dstID);
 	
 	if (ELEM(NULL, srcAdt, dstAdt)) {
-		if (G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("ERROR: no AnimData for this pair of ID's\n");
 		return;
 	}
@@ -980,20 +980,20 @@
 	
 	/* sanity checks */
 	if (ELEM(NULL, ks, rna_path)) {
-		printf("ERROR: no Keying Set and/or RNA Path to add path with \n");
+		printf("ERROR: no Keying Set and/or RNA Path to add path with\n");
 		return NULL;
 	}
 	
 	/* ID is required for all types of KeyingSets */
 	if (id == NULL) {
-		printf("ERROR: No ID provided for Keying Set Path. \n");
+		printf("ERROR: No ID provided for Keying Set Path\n");
 		return NULL;
 	}
 	
 	/* don't add if there is already a matching KS_Path in the KeyingSet */
 	if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, groupmode)) {
-		if (G.f & G_DEBUG)
-			printf("ERROR: destination already exists in Keying Set \n");
+		if (G.debug & G_DEBUG)
+			printf("ERROR: destination already exists in Keying Set\n");
 		return NULL;
 	}
 	
@@ -1138,8 +1138,8 @@
 			int array_len= RNA_property_array_length(&new_ptr, prop);
 			
 			if (array_len && array_index >= array_len) {
-				if (G.f & G_DEBUG) {
-					printf("Animato: Invalid array index. ID = '%s',  '%s[%d]', array length is %d \n",
+				if (G.debug & G_DEBUG) {
+					printf("Animato: Invalid array index. ID = '%s',  '%s[%d]', array length is %d\n",
 						(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>",
 						path, array_index, array_len-1);
 				}
@@ -1211,8 +1211,8 @@
 		/* failed to get path */
 		// XXX don't tag as failed yet though, as there are some legit situations (Action Constraint) 
 		// where some channels will not exist, but shouldn't lock up Action
-		if (G.f & G_DEBUG) {
-			printf("Animato: Invalid path. ID = '%s',  '%s[%d]' \n",
+		if (G.debug & G_DEBUG) {
+			printf("Animato: Invalid path. ID = '%s',  '%s[%d]'\n",
 				(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>", 
 				path, array_index);
 		}
@@ -1326,7 +1326,7 @@
 	}
 	else if (act->idroot != idcode) {
 		/* only report this error if debug mode is enabled (to save performance everywhere else) */
-		if (G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG) {
 			printf("AnimSys Safety Check Failed: Action '%s' is not meant to be used from ID-Blocks of type %d such as '%s'\n",
 				act->id.name+2, idcode, id->name);
 		}
@@ -1592,12 +1592,12 @@
 	
 		/* a valid property must be available, and it must be animatable */
 	if (RNA_path_resolve(ptr, path, &new_ptr, &prop) == 0) {
-		if (G.f & G_DEBUG) printf("NLA Strip Eval: Cannot resolve path \n");
+		if (G.debug & G_DEBUG) printf("NLA Strip Eval: Cannot resolve path\n");
 		return NULL;
 	}
 		/* only ok if animatable */
 	else if (RNA_property_animateable(&new_ptr, prop) == 0) {
-		if (G.f & G_DEBUG) printf("NLA Strip Eval: Property not animatable \n");
+		if (G.debug & G_DEBUG) printf("NLA Strip Eval: Property not animatable\n");
 		return NULL;
 	}
 	
@@ -2252,8 +2252,8 @@
 {
 	ID *id;
 
-	if (G.f & G_DEBUG)
-		printf("Evaluate all animation - %f \n", ctime);
+	if (G.debug & G_DEBUG)
+		printf("Evaluate all animation - %f\n", ctime);
 	
 	/* macros for less typing 
 	 *	- only evaluate animation data for id if it has users (and not just fake ones)
@@ -2295,7 +2295,7 @@
 	 * set correctly, so this optimization must be skipped in that case...
 	 */
 	if ((main->action.first == NULL) && (main->curve.first == NULL)) {
-		if (G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("\tNo Actions, so no animation needs to be evaluated...\n");
 			
 		return;

Modified: trunk/blender/source/blender/blenkernel/intern/blender.c

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list