[PATCH] Make OpenGL constants pickleable
Joshua Root <[email protected]>
| Newsgroups | gmane.comp.python.opengl.devel |
|---|---|
| Message-ID | <[email protected]> |
Makes it possible to store pickled renderable objects that have e.g. GL_TRIANGLES as part of their state. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ PyOpenGL Homepage http://pyopengl.sourceforge.net _______________________________________________ PyOpenGL-Devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyopengl-devel
constant.py.diff
(text/plain, 631 B)
--- PyOpenGL-3.0.0a6.orig/OpenGL/constant.py 2006-12-17 08:27:29.000000000 +1100
+++ PyOpenGL-3.0.0a6/OpenGL/constant.py 2007-10-06 03:09:22.000000000 +1000
@@ -33,8 +33,16 @@
class IntConstant( Constant, int ):
"""Integer constant sub-class"""
__slots__ = ('name',)
+ def __getstate__(self):
+ return self.name
+ def __setstate__(self, st):
+ self.name = st
class FloatConstant( Constant, float ):
"""Float constant sub-class"""
__slots__ = ('name',)
+ def __getstate__(self):
+ return self.name
+ def __setstate__(self, st):
+ self.name = st
class StringConstant( Constant, str ):
"""Float constant sub-class"""