Revision: 15732 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15732 Author: mxcurioni Date: 2008-07-24 10:29:48 +0200 (Thu, 24 Jul 2008)
Log Message: ----------- soc-2008-mxcurioni: added (without testing) the following classes: BBox, SShape, ViewShape. Also corrected a few typos (Get#->get#). Modified Paths: -------------- branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Freestyle.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_SShape.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_ViewShape.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/ChainingIterators.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/CurveIterators.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Operators.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/StrokeIterators.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/swig/ModuleWrapper.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/Interface0D.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/Silhouette.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMap.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMapIO.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMapIterators.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/Curvature.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WEdge.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WEdge.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WXEdge.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/python/Freestyle.py Added Paths: ----------- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Material.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_SShape.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_ViewShape.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript =================================================================== --- branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript 2008-07-24 07:06:27 UTC (rev 15731) +++ branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript 2008-07-24 08:29:48 UTC (rev 15732) @@ -62,27 +62,38 @@ python_sources = [ prefix + '/BPy_Freestyle.cpp', prefix + '/BPy_Convert.cpp', + prefix + '/BPy_BBox.cpp', prefix + '/BPy_BinaryPredicate0D.cpp', prefix + '/BPy_BinaryPredicate1D.cpp', prefix + '/BPy_Id.cpp', prefix + '/BPy_IntegrationType.cpp', prefix + '/BPy_Interface0D.cpp', - prefix + '/Interface0D/BPy_CurvePoint.cpp', - prefix + '/Interface0D/CurvePoint/BPy_StrokeVertex.cpp', - prefix + '/Interface0D/BPy_SVertex.cpp', - prefix + '/Interface0D/BPy_ViewVertex.cpp', + prefix + '/Interface0D/BPy_CurvePoint.cpp', + prefix + '/Interface0D/CurvePoint/BPy_StrokeVertex.cpp', + prefix + '/Interface0D/BPy_SVertex.cpp', + prefix + '/Interface0D/BPy_ViewVertex.cpp', prefix + '/BPy_Interface1D.cpp', - prefix + '/Interface1D/BPy_FEdge.cpp', - prefix + '/Interface1D/BPy_Stroke.cpp', + prefix + '/Interface1D/BPy_FEdge.cpp', + prefix + '/Interface1D/BPy_Stroke.cpp', + prefix + '/Interface1D/BPy_ViewEdge.cpp', prefix + '/BPy_Iterator.cpp', + prefix + '/Iterator/BPy_AdjacencyIterator.cpp', + prefix + '/Iterator/BPy_Interface0DIterator.cpp', + prefix + '/Iterator/BPy_CurvePointIterator.cpp', + prefix + '/Iterator/BPy_StrokeVertexIterator.cpp', + prefix + '/Iterator/BPy_SVertexIterator.cpp', + prefix + '/Iterator/BPy_orientedViewEdgeIterator.cpp', + prefix + '/Iterator/BPy_ViewEdgeIterator.cpp', prefix + '/BPy_MediumType.cpp', prefix + '/BPy_Nature.cpp', + prefix + '/BPy_SShape.cpp', prefix + '/BPy_StrokeAttribute.cpp', prefix + '/BPy_StrokeShader.cpp', prefix + '/BPy_UnaryFunction0D.cpp', prefix + '/BPy_UnaryFunction1D.cpp', prefix + '/BPy_UnaryPredicate0D.cpp', prefix + '/BPy_UnaryPredicate1D.cpp', + prefix + '/BPy_ViewShape.cpp' ] sources = system_sources + image_sources + geometry_sources + scene_graph_sources \ Added: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.cpp =================================================================== --- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.cpp (rev 0) +++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.cpp 2008-07-24 08:29:48 UTC (rev 15732) @@ -0,0 +1,142 @@ +#include "BPy_BBox.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for BBox instance -----------*/ +static int BBox___init__(BPy_BBox *self, PyObject *args, PyObject *kwds); +static void BBox___dealloc__(BPy_BBox *self); +static PyObject * BBox___repr__(BPy_BBox *self); + +/*----------------------BBox instance definitions ----------------------------*/ +static PyMethodDef BPy_BBox_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_BBox type definition ------------------------------*/ + +PyTypeObject BBox_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "BBox", /* tp_name */ + sizeof( BPy_BBox ), /* tp_basicsize */ + 0, /* tp_itemsize */ + + /* methods */ + (destructor)BBox___dealloc__, /* tp_dealloc */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ + (reprfunc)BBox___repr__, /* tp_repr */ + + /* Method suites for standard classes */ + + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ + + /* More standard operations (here for binary compatibility) */ + + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ + + /* Functions to access object as input/output buffer */ + NULL, /* PyBufferProcs *tp_as_buffer; */ + + /*** Flags to define presence of optional/expanded features ***/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ + + NULL, /* char *tp_doc; Documentation string */ + /*** Assigned meaning in release 2.0 ***/ + /* call function for all accessible objects */ + NULL, /* traverseproc tp_traverse; */ + + /* delete references to contained objects */ + NULL, /* inquiry tp_clear; */ + + /*** Assigned meaning in release 2.1 ***/ + /*** rich comparisons ***/ + NULL, /* richcmpfunc tp_richcompare; */ + + /*** weak reference enabler ***/ + 0, /* long tp_weaklistoffset; */ + + /*** Added in release 2.2 ***/ + /* Iterators */ + NULL, /* getiterfunc tp_iter; */ + NULL, /* iternextfunc tp_iternext; */ + + /*** Attribute descriptor and subclassing stuff ***/ + BPy_BBox_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)BBox___init__, /* initproc tp_init; */ + NULL, /* allocfunc tp_alloc; */ + PyType_GenericNew, /* newfunc tp_new; */ + + /* Low-level free-memory routine */ + NULL, /* freefunc tp_free; */ + + /* For PyObject_IS_GC */ + NULL, /* inquiry tp_is_gc; */ + NULL, /* PyObject *tp_bases; */ + + /* method resolution order */ + NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_cache; */ + NULL, /* PyObject *tp_subclasses; */ + NULL, /* PyObject *tp_weaklist; */ + NULL +}; + +//-------------------MODULE INITIALIZATION-------------------------------- +PyMODINIT_FUNC BBox_Init( PyObject *module ) +{ + if( module == NULL ) + return; + + if( PyType_Ready( &BBox_Type ) < 0 ) + return; + + Py_INCREF( &BBox_Type ); + PyModule_AddObject(module, "BBox", (PyObject *)&BBox_Type); +} + +//------------------------INSTANCE METHODS ---------------------------------- + +int BBox___init__(BPy_BBox *self, PyObject *args, PyObject *kwds) +{ + self->bb = new BBox< Vec3r>(); + return 0; +} + +void BBox___dealloc__(BPy_BBox* self) +{ + delete self->bb; + self->ob_type->tp_free((PyObject*)self); +} + + +PyObject * BBox___repr__(BPy_BBox* self) +{ + return PyString_FromFormat("BBox - address: %p", self->bb ); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif Added: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.h =================================================================== --- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.h (rev 0) +++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_BBox.h 2008-07-24 08:29:48 UTC (rev 15732) @@ -0,0 +1,38 @@ +#ifndef FREESTYLE_PYTHON_BBOX_H +#define FREESTYLE_PYTHON_BBOX_H + +#include "../geometry/BBox.h" +#include "../geometry/Geom.h" +using namespace Geometry; + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject BBox_Type; + +#define BPy_BBox_Check(v) (( (PyObject *) v)->ob_type == &BBox_Type) + +/*---------------------------Python BPy_BBox structure definition----------*/ +typedef struct { + PyObject_HEAD + BBox<Vec3r> *bb; +} BPy_BBox; + +/*---------------------------Python BPy_BBox visible prototypes-----------*/ + +PyMODINIT_FUNC BBox_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_BBOX_H */ Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp =================================================================== --- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp 2008-07-24 07:06:27 UTC (rev 15731) +++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp 2008-07-24 08:29:48 UTC (rev 15732) @@ -105,6 +105,37 @@ return py_sv; } +PyObject * BPy_ViewVertex_from_ViewVertex_ptr( ViewVertex *vv ) { + PyObject *py_vv = ViewVertex_Type.tp_new( &ViewVertex_Type, 0, 0 ); + ((BPy_ViewVertex *) py_vv)->vv = vv; + ((BPy_ViewVertex *) py_vv)->py_if0D.if0D = ((BPy_ViewVertex *) py_vv)->vv; + + return py_vv; +} + +PyObject * BPy_BBox_from_BBox( BBox< Vec3r > &bb ) { + PyObject *py_bb = BBox_Type.tp_new( &BBox_Type, 0, 0 ); + ((BPy_BBox *) py_bb)->bb = new BBox< Vec3r >( bb ); + + return py_bb; +} + +PyObject * BPy_ViewEdge_from_ViewEdge( ViewEdge& ve ) { + PyObject *py_ve = ViewEdge_Type.tp_new( &ViewEdge_Type, 0, 0 ); + ((BPy_ViewEdge *) py_ve)->ve = new ViewEdge( ve ); + ((BPy_ViewEdge *) py_ve)->py_if1D.if1D = ((BPy_ViewEdge *) py_ve)->ve; + + return py_ve; +} + +PyObject * BPy_SShape_from_SShape( SShape& ss ) { + PyObject *py_ss = SShape_Type.tp_new( &SShape_Type, 0, 0 ); + ((BPy_SShape *) py_ss)->ss = new SShape( ss ); + + return py_ss; +} + + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h =================================================================== @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs