mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
add TypeHandle::make()
This commit is contained in:
parent
a4f2f54cd4
commit
fc74ddace3
@ -19,6 +19,26 @@
|
||||
// This is initialized to zero by static initialization.
|
||||
TypeHandle TypeHandle::_none;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: TypeHandle::make
|
||||
// Access: Published
|
||||
// Description: This special method allows coercion to a TypeHandle
|
||||
// from a Python class object or instance. It simply
|
||||
// attempts to call classobj.getClassType(), and returns
|
||||
// that value (or raises an exception if that method
|
||||
// doesn't work).
|
||||
//
|
||||
// This method allows a Python class object to be used
|
||||
// anywhere a TypeHandle is expected by the C++
|
||||
// interface.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PyObject *TypeHandle::
|
||||
make(PyObject *classobj) {
|
||||
return PyObject_CallMethod(classobj, (char *)"getClassType", (char *)"");
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: TypeHandle::get_memory_usage
|
||||
|
@ -65,6 +65,10 @@
|
||||
|
||||
class TypedObject;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
#include "Python.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : TypeHandle
|
||||
// Description : TypeHandle is the identifier used to differentiate
|
||||
@ -98,6 +102,10 @@ PUBLISHED:
|
||||
INLINE TypeHandle();
|
||||
INLINE TypeHandle(const TypeHandle ©);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
static PyObject *make(PyObject *classobj);
|
||||
#endif // HAVE_PYTHON
|
||||
|
||||
INLINE bool operator == (const TypeHandle &other) const;
|
||||
INLINE bool operator != (const TypeHandle &other) const;
|
||||
INLINE bool operator < (const TypeHandle &other) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user