[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54194] trunk/blender/release/scripts/ modules/bpy_types.py: Fix #34016: add backwards compatibility for deprecated region.callback_add
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue Jan 29 22:35:01 CET 2013
Revision: 54194
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54194
Author: blendix
Date: 2013-01-29 21:34:58 +0000 (Tue, 29 Jan 2013)
Log Message:
-----------
Fix #34016: add backwards compatibility for deprecated region.callback_add
python function, this keep addons working. It's better to use the new function
but might as well avoid breaking compatibility here.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bpy_types.py
Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py 2013-01-29 20:49:40 UTC (rev 54193)
+++ trunk/blender/release/scripts/modules/bpy_types.py 2013-01-29 21:34:58 UTC (rev 54194)
@@ -737,3 +737,21 @@
self.path_menu(bpy.utils.preset_paths(self.preset_subdir),
self.preset_operator,
filter_ext=lambda ext: ext.lower() in {".py", ".xml"})
+
+class Region(StructRNA):
+ __slots__ = ()
+
+ def callback_add(self, cb, args, draw_mode):
+ """
+ Append a draw function to this region,
+ deprecated, instead use bpy.types.SpaceView3D.draw_handler_add
+ """
+ for area in self.id_data.areas:
+ for region in area.regions:
+ if region == self:
+ spacetype = type(area.spaces[0])
+ return spacetype.draw_handler_add(cb, args, self.type,
+ draw_mode)
+
+ return None
+
More information about the Bf-blender-cvs
mailing list