changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / Base / Bindings / Python / __init__.py.in
blobc7a348b2a08af40ec36bde0e882d5b85fb6d5653
1 # PyOpenSG is (C) Copyright 2005-2009 by Allen Bierbaum
3 # This file is part of PyOpenSG.
5 # PyOpenSG is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option)
8 # any later version.
10 # PyOpenSG is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
13 # more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Init file for osg package.
22 # Hack to bring in all symbols OpenSG is linked against and loads from plugins
23 # Search for : setdlopenflags and RTLD_GLOBAL on google to see why
25 original_dlopen_flags = None
27 try:
28 import dl, sys
29 original_dlopen_flags = sys.getdlopenflags()
30 sys.setdlopenflags(original_dlopen_flags | dl.RTLD_GLOBAL)
31 except:
32 pass
34 # Import everything from the opensg module
35 from ${PROJECT_NAME}Py import *
37 if original_dlopen_flags:
38 sys.setdlopenflags(original_dlopen_flags)
40 def _fc_cmp(self, other):
41 """ Comparison operator for field containers. """
42 id_self = None
43 id_other = None
44 if not self is None:
45 id_self = self.getId()
46 if not other is None:
47 id_other = other.getId()
49 return cmp(id_self, id_other)
51 def _fc_hash(self):
52 if self is None:
53 return -1
54 else:
55 return self.getId()
57 for (n,c) in OSGBasePy.__dict__.iteritems():
58 if isinstance(c,type) and (${PROJECT_NAME}Py.AttachmentContainer in c.__mro__):
59 c.__cmp__ = _fc_cmp
60 c.__hash__ = _fc_hash