diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-15 09:33:12 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-15 09:33:12 +0400 |
commit | cc1a6b398da9bd2cec78c4242c5b205f079aa4a6 (patch) | |
tree | a6ba9f201180b00df1375612f73fd8ccc0d0b56d /source/blender/freestyle/SConscript | |
parent | 96e52b09da9c808a6d10526f2115178e8499ebec (diff) |
soc-2008-mxcurioni: reimplemented the initialization/allocation for base classes. The Python object type tp_new slot is now set to PyType_GenericNew, instead of the former custom functions. As a note, by default, Python does not set this slot: it is therefore mandatory for the base classes. For children classes, only __init__ is needed.
To make our base classes subclasses, the Py_TPFLAGS_BASETYPE flag was added to the object type tp_flags slot.
Finally, I began to implement CurvePoint, descendant of Interface0D. This commit allowed me to verify that my SWIG replacement method works: interfaces are well taken into account by children. For a test, use the following code:
================================
import Blender
from Blender import Freestyle
from Blender.Freestyle import *
print Interface0D()
print CurvePoint()
================================
The __repr__ method is only implemented in Interface0D:
PyObject * Interface0D___repr__(BPy_Interface0D* self)
{
return PyString_FromFormat("type: %s - address: %p", self->if0D->getExactTypeName().c_str(), self->if0D );}
and the result is of the form:
type: Interface0D - address: 0x18e5ccc0
type: CurvePoint - address: 0x18e473f0
As you can see, the correct getExactTypeName of the class is called.
Diffstat (limited to 'source/blender/freestyle/SConscript')
-rw-r--r-- | source/blender/freestyle/SConscript | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/freestyle/SConscript b/source/blender/freestyle/SConscript index 98a66e272be..f54c12470a6 100644 --- a/source/blender/freestyle/SConscript +++ b/source/blender/freestyle/SConscript @@ -66,6 +66,7 @@ python_sources = [ prefix + '/BinaryPredicate1D.cpp', prefix + '/Id.cpp', prefix + '/Interface0D.cpp', + prefix + '/Interface0D/CurvePoint.cpp', prefix + '/Interface1D.cpp' ] |