Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rwxr-xr-xsource/blender/freestyle/intern/image/Image.h44
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.cpp61
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.h25
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface1D.cpp45
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp103
-rw-r--r--source/blender/freestyle/intern/python/Director.h32
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp1
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp2
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h2
-rwxr-xr-xsource/blender/freestyle/intern/stroke/Operators.cpp4
-rwxr-xr-xsource/blender/freestyle/intern/stroke/Operators.h2
-rwxr-xr-xsource/blender/freestyle/intern/stroke/Predicates1D.h2
-rwxr-xr-xsource/blender/freestyle/intern/stroke/Stroke.cpp6
-rwxr-xr-xsource/blender/freestyle/intern/view_map/Functions0D.h19
-rwxr-xr-xsource/blender/freestyle/intern/view_map/Functions1D.h70
-rwxr-xr-xsource/blender/freestyle/intern/view_map/Interface1D.h46
32 files changed, 379 insertions, 117 deletions
diff --git a/source/blender/freestyle/intern/image/Image.h b/source/blender/freestyle/intern/image/Image.h
index 83d6785e32f..e1e47c0ec43 100755
--- a/source/blender/freestyle/intern/image/Image.h
+++ b/source/blender/freestyle/intern/image/Image.h
@@ -44,12 +44,12 @@
* size w*h, and access these pixels using x,y coordinates
* specified in the whole image coordinate system.
*/
-class Image
+class FrsImage
{
public:
/*! Default constructor */
- Image() {
+ FrsImage() {
_storedWidth = 0;
_storedHeight = 0;
_width = 0;
@@ -59,7 +59,7 @@ class Image
}
/*! Copy constructor */
- Image(const Image& brother) {
+ FrsImage(const FrsImage& brother) {
_storedWidth = brother._storedWidth;
_storedHeight = brother._storedHeight;
_width = brother._width;
@@ -68,10 +68,10 @@ class Image
_Oy = brother._Oy;
}
- /*! Builds an image from its width and height.
+ /*! Builds an FrsImage from its width and height.
* The memory is allocated consequently.
*/
- Image(unsigned w, unsigned h) {
+ FrsImage(unsigned w, unsigned h) {
_width = w;
_height = h;
_storedWidth = w;
@@ -98,7 +98,7 @@ class Image
* The x-abscissa of the origin of the rectangle that will actually
* be stored.
*/
- Image(unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) {
+ FrsImage(unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) {
_width = w;
_height = h;
_storedWidth = sw;
@@ -108,7 +108,7 @@ class Image
}
/*! Operator= */
- Image& operator=(const Image& brother) {
+ FrsImage& operator=(const FrsImage& brother) {
_width = brother._width;
_height = brother._height;
_storedWidth = brother._storedWidth;
@@ -119,7 +119,7 @@ class Image
}
/*! Destructor */
- virtual ~Image() {}
+ virtual ~FrsImage() {}
/*! Returns the width of the complete image */
inline unsigned width() const {
@@ -181,24 +181,24 @@ class Image
//
///////////////////////////////////////////////////////////////////////////////
-class RGBImage : public Image
+class RGBImage : public FrsImage
{
public:
- RGBImage() : Image() {
+ RGBImage() : FrsImage() {
_rgb = 0;
}
- RGBImage(const RGBImage& brother) : Image(brother) {
+ RGBImage(const RGBImage& brother) : FrsImage(brother) {
_rgb = new float[3 * _storedWidth * _storedHeight];
memcpy(_rgb, brother._rgb, 3 * _storedWidth * _storedHeight * sizeof(float));
}
- RGBImage(unsigned w, unsigned h) : Image(w, h) {
+ RGBImage(unsigned w, unsigned h) : FrsImage(w, h) {
_rgb = new float[3 * _width * _height];
}
- RGBImage(float* rgb, unsigned w, unsigned h) : Image(w, h) {
+ RGBImage(float* rgb, unsigned w, unsigned h) : FrsImage(w, h) {
_rgb = new float[3 * _width * _height];
memcpy(_rgb, rgb, 3 * _width * _height * sizeof(float));
}
@@ -218,13 +218,13 @@ class RGBImage : public Image
* \param sh
* The height of the part of the image we want to store and work on
*/
- RGBImage(float* rgb, unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) : Image(w, h, sw, sh, ox, oy) {
+ RGBImage(float* rgb, unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) : FrsImage(w, h, sw, sh, ox, oy) {
_rgb = new float[3 * _storedWidth * _storedHeight];
memcpy(_rgb, rgb, 3 * _storedWidth * _storedHeight * sizeof(float));
}
RGBImage& operator=(const RGBImage& brother) {
- dynamic_cast<Image&>(*this) = brother;
+ dynamic_cast<FrsImage&>(*this) = brother;
_rgb = new float[3 * _storedWidth * _storedHeight];
memcpy(_rgb, brother._rgb, 3 * _storedWidth * _storedHeight * sizeof(float));
return* this;
@@ -296,25 +296,25 @@ class RGBImage : public Image
//
///////////////////////////////////////////////////////////////////////////////
-class GrayImage : public Image
+class GrayImage : public FrsImage
{
public:
- GrayImage() : Image() {
+ GrayImage() : FrsImage() {
_lvl = 0;
}
- GrayImage(const GrayImage& brother) : Image(brother) {
+ GrayImage(const GrayImage& brother) : FrsImage(brother) {
_lvl = new float[_storedWidth*_storedHeight];
memcpy(_lvl, brother._lvl, _storedWidth*_storedHeight*sizeof(*_lvl));
}
/*! Builds an empty gray image */
- GrayImage(unsigned w, unsigned h) : Image(w, h) {
+ GrayImage(unsigned w, unsigned h) : FrsImage(w, h) {
_lvl = new float[_width*_height];
}
- GrayImage(float* lvl, unsigned w, unsigned h) : Image(w, h) {
+ GrayImage(float* lvl, unsigned w, unsigned h) : FrsImage(w, h) {
_lvl = new float[_width*_height];
memcpy(_lvl, lvl, _width*_height*sizeof(*_lvl));
}
@@ -334,13 +334,13 @@ class GrayImage : public Image
* \param sh
* The height of the part of the image we want to store and work on
*/
- GrayImage(float* lvl, unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) : Image(w, h, sw, sh, ox, oy) {
+ GrayImage(float* lvl, unsigned w, unsigned h, unsigned sw, unsigned sh, unsigned ox, unsigned oy) : FrsImage(w, h, sw, sh, ox, oy) {
_lvl = new float[_storedWidth*_storedHeight];
memcpy(_lvl, lvl, _storedWidth*_storedHeight*sizeof(float));
}
GrayImage& operator=(const GrayImage& brother) {
- dynamic_cast<Image&>(*this) = brother;
+ dynamic_cast<FrsImage&>(*this) = brother;
_lvl = new float[_storedWidth * _storedHeight];
memcpy(_lvl, brother._lvl, _storedWidth * _storedHeight * sizeof(float));
return *this;
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp
index e7d98440683..a1c26aaf622 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp
@@ -39,14 +39,15 @@ extern "C" {
///////////////////////////////////////////////////////////////////////////////////////////
+//==============================
+// C++ => Python
+//==============================
+
PyObject * PyBool_from_bool( bool b ){
return PyBool_FromLong( b ? 1 : 0);
}
-bool bool_from_PyBool( PyObject *b ) {
- return b == Py_True;
-}
PyObject * Vector_from_Vec2f( Vec2f& vec ) {
float vec_data[2]; // because vec->_coord is protected
@@ -224,19 +225,6 @@ PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewE
return py_dve;
}
-
-//==============================
-// Constants
-//==============================
-
-IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) {
- return static_cast<IntegrationType>( PyInt_AsLong(obj) );
-}
-
-Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ) {
- return static_cast<Stroke::MediumType>( PyInt_AsLong(obj) );
-}
-
//==============================
// Iterators
//==============================
@@ -323,7 +311,48 @@ PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator( ChainSilhou
}
+//==============================
+// Python => C++
+//==============================
+
+bool bool_from_PyBool( PyObject *b ) {
+ return b == Py_True;
+}
+
+IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) {
+ return static_cast<IntegrationType>( PyInt_AsLong(obj) );
+}
+
+Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ) {
+ return static_cast<Stroke::MediumType>( PyInt_AsLong(obj) );
+}
+Nature::EdgeNature EdgeNature_from_BPy_Nature( PyObject* obj ) {
+ return static_cast<Nature::EdgeNature>( PyInt_AsLong(obj) );
+}
+
+Vec2f * Vec2f_ptr_from_Vector( PyObject* obj ) {
+ float x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
+ float y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
+
+ return new Vec2f(x,y);
+}
+
+Vec3f * Vec3f_ptr_from_Vector( PyObject* obj ) {
+ float x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
+ float y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
+ float z = PyFloat_AsDouble( PyObject_GetAttrString(obj,"z") );
+
+ return new Vec3f(x,y,z);
+}
+
+Vec3r * Vec3r_ptr_from_Vector( PyObject* obj ) {
+ double x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
+ double y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
+ double z = PyFloat_AsDouble( PyObject_GetAttrString(obj,"z") );
+
+ return new Vec3r(x,y,z);
+}
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h
index 4bfaf4c1e17..5bfdef56278 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.h
+++ b/source/blender/freestyle/intern/python/BPy_Convert.h
@@ -23,6 +23,9 @@ using namespace Geometry;
// Material
#include "../scene_graph/Material.h"
+// Nature::VertexNature, Nature::EdgeNature
+#include "../winged_edge/Nature.h"
+
// Stroke, StrokeAttribute, StrokeVertex
#include "../stroke/Stroke.h"
@@ -58,16 +61,15 @@ extern "C" {
#include "api2_2x/vector.h"
#include "api2_2x/gen_utils.h"
-PyObject * PyBool_from_bool( bool b );
-bool bool_from_PyBool( PyObject *b );
+//==============================
+// C++ => Python
+//==============================
+PyObject * PyBool_from_bool( bool b );
PyObject * Vector_from_Vec2f( Vec2f& v );
PyObject * Vector_from_Vec3f( Vec3f& v );
PyObject * Vector_from_Vec3r( Vec3r& v );
-IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj );
-Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj );
-
PyObject * BPy_BBox_from_BBox( BBox< Vec3r > &bb );
PyObject * BPy_CurvePoint_from_CurvePoint( CurvePoint& cp );
PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewEdge& dve );
@@ -99,8 +101,19 @@ PyObject * BPy_ChainingIterator_from_ChainingIterator( ChainingIterator& c_it );
PyObject * BPy_ChainPredicateIterator_from_ChainPredicateIterator( ChainPredicateIterator& cp_it );
PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator( ChainSilhouetteIterator& cs_it );
+//==============================
+// Python => C++
+//==============================
+
+bool bool_from_PyBool( PyObject *b );
+IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj );
+Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj );
+Nature::EdgeNature EdgeNature_from_BPy_Nature( PyObject* obj );
+Vec2f * Vec2f_ptr_from_Vector( PyObject* obj );
+Vec3f * Vec3f_ptr_from_Vector( PyObject* obj );
+Vec3r * Vec3r_ptr_from_Vector( PyObject* obj );
+
-
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
index 3db9531da4b..8d2549ebf2c 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
@@ -30,6 +30,10 @@ static PyObject *Interface1D_getId( BPy_Interface1D *self );
static PyObject *Interface1D_getNature( BPy_Interface1D *self );
static PyObject *Interface1D_getTimeStamp( BPy_Interface1D *self );
static PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args);
+static PyObject * Interface1D_verticesBegin( BPy_Interface1D *self );
+static PyObject * Interface1D_verticesEnd( BPy_Interface1D *self );
+static PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args );
+static PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args );
/*----------------------Interface1D instance definitions ----------------------------*/
static PyMethodDef BPy_Interface1D_methods[] = {
@@ -41,6 +45,11 @@ static PyMethodDef BPy_Interface1D_methods[] = {
{"getNature", ( PyCFunction ) Interface1D_getNature, METH_NOARGS, "Returns the nature of the 1D element"},
{"getTimeStamp", ( PyCFunction ) Interface1D_getTimeStamp, METH_NOARGS, "Returns the time stamp of the 1D element. Mainly used for selection"},
{"setTimeStamp", ( PyCFunction ) Interface1D_setTimeStamp, METH_VARARGS, "Sets the time stamp for the 1D element"},
+ {"verticesBegin", ( PyCFunction ) Interface1D_verticesBegin, METH_NOARGS, ""},
+ {"verticesEnd", ( PyCFunction ) Interface1D_verticesEnd, METH_NOARGS, ""},
+ {"pointsBegin", ( PyCFunction ) Interface1D_pointsBegin, METH_VARARGS, ""},
+ {"pointsEnd", ( PyCFunction ) Interface1D_pointsEnd, METH_VARARGS, ""},
+
{NULL, NULL, 0, NULL}
};
@@ -189,6 +198,7 @@ PyMODINIT_FUNC Interface1D_Init( PyObject *module )
int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds)
{
self->if1D = new Interface1D();
+ self->if1D->py_if1D = (PyObject *) self;
return 0;
}
@@ -245,6 +255,41 @@ PyObject *Interface1D_setTimeStamp( BPy_Interface1D *self, PyObject *args) {
Py_RETURN_NONE;
}
+PyObject * Interface1D_verticesBegin( BPy_Interface1D *self ) {
+ Interface0DIterator if0D_it( self->if1D->verticesBegin() );
+ return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
+}
+
+PyObject * Interface1D_verticesEnd( BPy_Interface1D *self ) {
+ Interface0DIterator if0D_it( self->if1D->verticesEnd() );
+ return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
+}
+
+
+PyObject * Interface1D_pointsBegin( BPy_Interface1D *self, PyObject *args ) {
+ float f = 0;
+
+ if(!( PyArg_ParseTuple(args, "|f", &f) )) {
+ cout << "ERROR: Interface1D_pointsBegin" << endl;
+ Py_RETURN_NONE;
+ }
+
+ Interface0DIterator if0D_it( self->if1D->pointsBegin(f) );
+ return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
+}
+
+PyObject * Interface1D_pointsEnd( BPy_Interface1D *self, PyObject *args ) {
+ float f = 0;
+
+ if(!( PyArg_ParseTuple(args, "|f", &f) )) {
+ cout << "ERROR: Interface1D_pointsEnd" << endl;
+ Py_RETURN_NONE;
+ }
+
+ Interface0DIterator if0D_it( self->if1D->pointsEnd(f) );
+ return BPy_Interface0DIterator_from_Interface0DIterator( if0D_it );
+}
+
///////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp
index 42677919ca5..b3188554c09 100644
--- a/source/blender/freestyle/intern/python/Director.cpp
+++ b/source/blender/freestyle/intern/python/Director.cpp
@@ -4,14 +4,29 @@
#include "BPy_BinaryPredicate0D.h"
#include "BPy_BinaryPredicate1D.h"
+#include "BPy_FrsMaterial.h"
+#include "BPy_Id.h"
#include "BPy_UnaryFunction0D.h"
#include "BPy_UnaryFunction1D.h"
#include "BPy_UnaryPredicate0D.h"
#include "BPy_UnaryPredicate1D.h"
#include "BPy_StrokeShader.h"
#include "Iterator/BPy_ChainingIterator.h"
+#include "Iterator/BPy_Interface0DIterator.h"
#include "Interface1D/BPy_Stroke.h"
#include "Interface1D/BPy_ViewEdge.h"
+#include "BPy_ViewShape.h"
+
+#include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DFloat.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DId.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DMaterial.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DVec2f.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DVec3f.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h"
+#include "UnaryFunction0D/BPy_UnaryFunction0DViewShape.h"
// BinaryPredicate0D: __call__
bool Director_BPy_BinaryPredicate0D___call__( PyObject *obj, Interface0D& i1, Interface0D& i2) {
@@ -61,17 +76,58 @@ ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyItera
return ((BPy_ViewEdge *) result)->ve;
}
+
// BPy_UnaryFunction{0D,1D}: __call__
-// BPy_UnaryFunction0DDouble
-// BPy_UnaryFunction0DEdgeNature
-// BPy_UnaryFunction0DFloat
-// BPy_UnaryFunction0DId
-// BPy_UnaryFunction0DMaterial
-// BPy_UnaryFunction0DUnsigned
-// BPy_UnaryFunction0DVec2f
-// BPy_UnaryFunction0DVec3f
-// BPy_UnaryFunction0DVectorViewShape
-// BPy_UnaryFunction0DViewShape
+void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it) {
+
+ PyObject *result = PyObject_CallMethod( obj, "__call__", "O", BPy_Interface0DIterator_from_Interface0DIterator(if0D_it) );
+
+ if( BPy_UnaryFunction0DDouble_Check(obj) ) {
+ ((UnaryFunction0D<double> *) uf0D)->result = PyFloat_AsDouble(result);
+
+ } else if ( BPy_UnaryFunction0DEdgeNature_Check(obj) ) {
+ ((UnaryFunction0D<Nature::EdgeNature> *) uf0D)->result = EdgeNature_from_BPy_Nature(result);
+
+ } else if ( BPy_UnaryFunction0DFloat_Check(obj) ) {
+
+ ((UnaryFunction0D<float> *) uf0D)->result = PyFloat_AsDouble(result);
+
+ } else if ( BPy_UnaryFunction0DId_Check(obj) ) {
+ ((UnaryFunction0D<Id> *) uf0D)->result = *( ((BPy_Id *) result)->id );
+
+ } else if ( BPy_UnaryFunction0DMaterial_Check(obj) ) {
+ ((UnaryFunction0D<Material> *) uf0D)->result = *( ((BPy_FrsMaterial *) result)->m );
+
+ } else if ( BPy_UnaryFunction0DUnsigned_Check(obj) ) {
+ ((UnaryFunction0D<unsigned> *) uf0D)->result = PyInt_AsLong(result);
+
+ } else if ( BPy_UnaryFunction0DVec2f_Check(obj) ) {
+ Vec2f *v = Vec2f_ptr_from_Vector( result );
+ ((UnaryFunction0D<Vec2f> *) uf0D)->result = *v;
+ delete v;
+
+ } else if ( BPy_UnaryFunction0DVec3f_Check(obj) ) {
+ Vec3f *v = Vec3f_ptr_from_Vector( result );
+ ((UnaryFunction0D<Vec3f> *) uf0D)->result = *v;
+ delete v;
+
+ } else if ( BPy_UnaryFunction0DVectorViewShape_Check(obj) ) {
+ vector<ViewShape*> vec;
+ for( int i = 0; i < PyList_Size(result); i++) {
+ ViewShape *b = ( (BPy_ViewShape *) PyList_GetItem(result, i) )->vs;
+ vec.push_back( b );
+ }
+
+ ((UnaryFunction0D< vector<ViewShape*> > *) uf0D)->result = vec;
+
+ } else if ( BPy_UnaryFunction0DViewShape_Check(obj) ) {
+ ((UnaryFunction0D<ViewShape*> *) uf0D)->result = ((BPy_ViewShape *) result)->vs;
+
+ }
+
+}
+
+void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D) {
// BPy_UnaryFunction1DDouble
// BPy_UnaryFunction1DEdgeNature
@@ -82,6 +138,10 @@ ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyItera
// BPy_UnaryFunction1DVectorViewShape
// BPy_UnaryFunction1DVoid
+
+}
+
+
// BPy_Iterator: increment, decrement, isBegin, isEnd
void Director_BPy_Iterator_increment( PyObject *obj ) {
PyObject_CallMethod( obj, "increment", "", 0 );
@@ -103,5 +163,28 @@ bool Director_BPy_Iterator_isEnd( PyObject *obj ) {
return bool_from_PyBool(result);
}
+// BPy_Interface1D: verticesBegin, verticesEnd, pointsBegin, pointsEnd
+Interface0DIterator Director_BPy_Interface1D_verticesBegin( PyObject *obj ){
+ PyObject *result = PyObject_CallMethod( obj, "verticesBegin", "", 0 );
+
+ return *( ((BPy_Interface0DIterator *) result)->if0D_it );
+}
+
+Interface0DIterator Director_BPy_Interface1D_verticesEnd( PyObject *obj ){
+ PyObject *result = PyObject_CallMethod( obj, "verticesEnd", "", 0 );
+
+ return *( ((BPy_Interface0DIterator *) result)->if0D_it );
+}
+
+Interface0DIterator Director_BPy_Interface1D_pointsBegin( PyObject *obj ){
+ PyObject *result = PyObject_CallMethod( obj, "pointsBegin", "", 0 );
+ return *( ((BPy_Interface0DIterator *) result)->if0D_it );
+}
+
+Interface0DIterator Director_BPy_Interface1D_pointsEnd( PyObject *obj ){
+ PyObject *result = PyObject_CallMethod( obj, "pointsEnd", "", 0 );
+
+ return *( ((BPy_Interface0DIterator *) result)->if0D_it );
+}
diff --git a/source/blender/freestyle/intern/python/Director.h b/source/blender/freestyle/intern/python/Director.h
index 2a67be237f5..27afa3bbe3e 100644
--- a/source/blender/freestyle/intern/python/Director.h
+++ b/source/blender/freestyle/intern/python/Director.h
@@ -37,27 +37,9 @@ void Director_BPy_StrokeShader_shade( PyObject *obj, Stroke& s);
void Director_BPy_ChainingIterator_init( PyObject *obj );
ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyIterator& a_it );
-// BPy_UnaryFunction0DDouble
-double Director_BPy_UnaryFunction0DDouble___call__( PyObject *obj, Interface0DIterator& if0D_it);
-// BPy_UnaryFunction0DEdgeNature
-// BPy_UnaryFunction0DFloat
-// BPy_UnaryFunction0DId
-// BPy_UnaryFunction0DMaterial
-// BPy_UnaryFunction0DUnsigned
-// BPy_UnaryFunction0DVec2f
-// BPy_UnaryFunction0DVec3f
-// BPy_UnaryFunction0DVectorViewShape
-// BPy_UnaryFunction0DViewShape
-
-// BPy_UnaryFunction1DDouble
-// BPy_UnaryFunction1DEdgeNature
-// BPy_UnaryFunction1DFloat
-// BPy_UnaryFunction1DUnsigned
-// BPy_UnaryFunction1DVec2f
-// BPy_UnaryFunction1DVec3f
-// BPy_UnaryFunction1DVectorViewShape
-// BPy_UnaryFunction1DVoid
-void Director_BPy_UnaryFunction1DVoid___call__( PyObject *obj, Interface1D& if1D);
+// BPy_UnaryFunction{0D,1D}: __call__
+void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it);
+void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D);
// BPy_Iterator: increment, decrement, isBegin, isEnd
void Director_BPy_Iterator_increment( PyObject *obj );
@@ -65,4 +47,12 @@ void Director_BPy_Iterator_decrement( PyObject *obj );
bool Director_BPy_Iterator_isBegin( PyObject *obj );
bool Director_BPy_Iterator_isEnd( PyObject *obj );
+// BPy_Interface1D: verticesBegin, verticesEnd, pointsBegin, pointsEnd
+Interface0DIterator Director_BPy_Interface1D_verticesBegin( PyObject *obj );
+Interface0DIterator Director_BPy_Interface1D_verticesEnd( PyObject *obj );
+Interface0DIterator Director_BPy_Interface1D_pointsBegin( PyObject *obj );
+Interface0DIterator Director_BPy_Interface1D_pointsEnd( PyObject *obj );
+
+
+
#endif // FREESTYLE_PYTHON_DIRECTOR
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
index e7ac46122b6..45f5c297b8a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
@@ -14,6 +14,8 @@
#include "UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h"
#include "UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h"
+#include "../Director.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -190,6 +192,7 @@ PyMODINIT_FUNC UnaryFunction0DDouble_Init( PyObject *module ) {
int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self)
{
self->uf0D_double = new UnaryFunction0D<double>();
+ self->uf0D_double->py_uf0D = (PyObject *)self;
return 0;
}
@@ -219,7 +222,8 @@ PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyOb
return NULL;
}
- double d = self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it ));
+ double d = self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it));
+
return PyFloat_FromDouble( d );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
index 3dfcb74cddd..79f8ff1f648 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DEdgeNature_Init( PyObject *module ) {
int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self)
{
self->uf0D_edgenature = new UnaryFunction0D<Nature::EdgeNature>();
+ self->uf0D_edgenature->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
index 2c11eb92ed5..bff5fa962c1 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
@@ -164,6 +164,7 @@ PyMODINIT_FUNC UnaryFunction0DFloat_Init( PyObject *module ) {
int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self)
{
self->uf0D_float = new UnaryFunction0D<float>();
+ self->uf0D_float->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
index 2d6cbf09be1..6e21f5f687e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DId_Init( PyObject *module ) {
int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self)
{
self->uf0D_id = new UnaryFunction0D<Id>();
+ self->uf0D_id->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
index 733acce6ab8..2aef794617a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DMaterial_Init( PyObject *module ) {
int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self)
{
self->uf0D_material = new UnaryFunction0D<Material>();
+ self->uf0D_material->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
index a7d8e9f42a7..2d33419032b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DUnsigned_Init( PyObject *module ) {
int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self)
{
self->uf0D_unsigned = new UnaryFunction0D<unsigned int>();
+ self->uf0D_unsigned->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
index fb7fc4f19fe..3eedf16c575 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
@@ -141,6 +141,7 @@ PyMODINIT_FUNC UnaryFunction0DVec2f_Init( PyObject *module ) {
int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self)
{
self->uf0D_vec2f = new UnaryFunction0D<Vec2f>();
+ self->uf0D_vec2f->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
index d0412d7c7d0..aa77d17b18b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DVec3f_Init( PyObject *module ) {
int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self)
{
self->uf0D_vec3f = new UnaryFunction0D<Vec3f>();
+ self->uf0D_vec3f->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
index 02aef4e28cf..93bea5c114e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
@@ -135,6 +135,7 @@ PyMODINIT_FUNC UnaryFunction0DVectorViewShape_Init( PyObject *module ) {
int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* self)
{
self->uf0D_vectorviewshape = new UnaryFunction0D< std::vector<ViewShape*> >();
+ self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
index eb2fceb3f06..a9714e0b2c6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
@@ -141,6 +141,7 @@ PyMODINIT_FUNC UnaryFunction0DViewShape_Init( PyObject *module ) {
int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self)
{
self->uf0D_viewshape = new UnaryFunction0D<ViewShape*>();
+ self->uf0D_viewshape->py_uf0D = (PyObject *)self;
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
index 887d1273e60..c3fc04c8b1e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
@@ -231,6 +231,8 @@ int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *ar
self->uf1D_double = new UnaryFunction1D<double>( IntegrationType_from_BPy_IntegrationType(obj) );
}
+ self->uf1D_double->py_uf1D = (PyObject *)self;
+
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
index d4d7f642494..78d63020062 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
@@ -152,6 +152,8 @@ int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyOb
self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>( IntegrationType_from_BPy_IntegrationType(obj) );
}
+ self->uf1D_edgenature->py_uf1D = (PyObject *)self;
+
return 0;
}
void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* self)
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
index f4c8a9e53ce..a424d7862a6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
@@ -145,6 +145,8 @@ int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args
self->uf1D_float = new UnaryFunction1D<float>( IntegrationType_from_BPy_IntegrationType(obj) );
}
+ self->uf1D_float->py_uf1D = (PyObject *)self;
+
return 0;
}
void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self)
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
index ef75f3bad5b..297116d2112 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
@@ -152,6 +152,8 @@ int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject
self->uf1D_unsigned = new UnaryFunction1D<unsigned int>( IntegrationType_from_BPy_IntegrationType(obj) );
}
+ self->uf1D_unsigned->py_uf1D = (PyObject *)self;
+
return 0;
}
void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* self)
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
index e0fa12c66e6..1d3f1c708b5 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
@@ -158,6 +158,8 @@ int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args
self->uf1D_vec2f = new UnaryFunction1D<Vec2f>( IntegrationType_from_BPy_IntegrationType(obj) );
}
+ self->uf1D_vec2f->py_uf1D = (PyObject *)self;
+
return 0;
}
void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self)
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
index 3a3c7d4e835..1b4c7b281d3 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
@@ -152,6 +152,8 @@ int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f* self, PyObject *args
self->uf1D_vec3f = new UnaryFunction1D<Vec3f>( IntegrationType_from_BPy_IntegrationType(obj) );
}
+ self->uf1D_vec3f->py_uf1D = (PyObject *)self;
+
return 0;
}
void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self)
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
index c0b25403706..36f5fc442bf 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
@@ -165,6 +165,8 @@ int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape*
self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >( IntegrationType_from_BPy_IntegrationType(obj) );
}
+ self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self;
+
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
index 99cc6838997..9d5178a299d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
@@ -161,11 +161,13 @@ int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args)
}
if( !obj )
- self->uf1D_void = new UnaryFunction1D<void>();
+ self->uf1D_void = new UnaryFunction1D_void();
else {
- self->uf1D_void = new UnaryFunction1D<void>( IntegrationType_from_BPy_IntegrationType(obj) );
+ self->uf1D_void = new UnaryFunction1D_void( IntegrationType_from_BPy_IntegrationType(obj) );
}
+ self->uf1D_void->py_uf1D = (PyObject *)self;
+
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h
index 3e8ad431ec4..34615bb4b27 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h
@@ -18,7 +18,7 @@ extern PyTypeObject UnaryFunction1DVoid_Type;
/*---------------------------Python BPy_UnaryFunction1DVoid structure definition----------*/
typedef struct {
BPy_UnaryFunction1D py_uf1D;
- UnaryFunction1D<void> *uf1D_void;
+ UnaryFunction1D_void *uf1D_void;
} BPy_UnaryFunction1DVoid;
/*---------------------------Python BPy_UnaryFunction1DVoid visible prototypes-----------*/
diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp
index fe1ac27b04e..39914cbef1a 100755
--- a/source/blender/freestyle/intern/stroke/Operators.cpp
+++ b/source/blender/freestyle/intern/stroke/Operators.cpp
@@ -65,7 +65,7 @@ void Operators::select(UnaryPredicate1D& pred) {
void Operators::chain(ViewEdgeInternal::ViewEdgeIterator& it,
UnaryPredicate1D& pred,
- UnaryFunction1D<void>& modifier) {
+ UnaryFunction1D_void& modifier) {
if (_current_view_edges_set.empty())
return;
@@ -137,7 +137,7 @@ void Operators::chain(ViewEdgeInternal::ViewEdgeIterator& it,
//void Operators::bidirectionalChain(ViewEdgeIterator& it,
// UnaryPredicate1D& pred,
-// UnaryFunction1D<void>& modifier) {
+// UnaryFunction1D_void& modifier) {
// if (_current_view_edges_set.empty())
// return;
//
diff --git a/source/blender/freestyle/intern/stroke/Operators.h b/source/blender/freestyle/intern/stroke/Operators.h
index 96ecd0aa75b..804ee4d7056 100755
--- a/source/blender/freestyle/intern/stroke/Operators.h
+++ b/source/blender/freestyle/intern/stroke/Operators.h
@@ -85,7 +85,7 @@ public:
*/
static void chain(ViewEdgeInternal::ViewEdgeIterator& it,
UnaryPredicate1D& pred,
- UnaryFunction1D<void>& modifier);
+ UnaryFunction1D_void& modifier);
/*! Builds a set of chains from the current set of ViewEdges.
* Each ViewEdge of the current list starts a new chain. The chaining
diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h
index 8c6f5a9bfa4..014d5a1130e 100755
--- a/source/blender/freestyle/intern/stroke/Predicates1D.h
+++ b/source/blender/freestyle/intern/stroke/Predicates1D.h
@@ -127,7 +127,7 @@ public:
virtual bool operator()(Interface1D& inter1, Interface1D& inter2) {
string name( py_bp1D ? PyString_AsString(PyObject_CallMethod(py_bp1D, "getName", "")) : getName() );
- if( py_bp1D && py_bp1D && PyObject_HasAttrString(py_bp1D, "__call__") ) {
+ if( py_bp1D && PyObject_HasAttrString(py_bp1D, "__call__") ) {
return Director_BPy_BinaryPredicate1D___call__(py_bp1D, inter1, inter2);
} else {
cerr << "Warning: " << name << " operator() not implemented" << endl;
diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp
index b1d6e466215..a1277611a90 100755
--- a/source/blender/freestyle/intern/stroke/Stroke.cpp
+++ b/source/blender/freestyle/intern/stroke/Stroke.cpp
@@ -404,9 +404,11 @@ Stroke::Stroke(const Stroke& iBrother)
_mediumType = iBrother._mediumType;
_textureId = iBrother._textureId;
_tips = iBrother._tips;
-
- if(iBrother._rep)
+
+ if( iBrother._rep )
_rep = new StrokeRep(*(iBrother._rep));
+ else
+ _rep = new StrokeRep(this);
}
Stroke::~Stroke()
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.h b/source/blender/freestyle/intern/view_map/Functions0D.h
index 1ad35da8d91..9543e8c34a6 100755
--- a/source/blender/freestyle/intern/view_map/Functions0D.h
+++ b/source/blender/freestyle/intern/view_map/Functions0D.h
@@ -43,6 +43,8 @@ class SShape;
using namespace Geometry;
+#include "../python/Director.h"
+
//
// UnaryFunction0D (base class for functions in 0D)
//
@@ -70,12 +72,15 @@ class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction0D
{
public:
+ T result;
+ PyObject *py_uf0D;
+
/*! The type of the value
* returned by the functor.
*/
typedef T ReturnedValueType;
/*! Default constructor. */
- UnaryFunction0D() {}
+UnaryFunction0D() { py_uf0D = 0;}
/*! Destructor; */
virtual ~UnaryFunction0D() {}
/*! Returns the string "UnaryFunction0D" */
@@ -90,9 +95,17 @@ public:
* \return the result of the function of type T.
*/
virtual T operator()(Interface0DIterator& iter) {
- cerr << "Warning: UnaryFunction0D operator() not implemented" << endl;
- return T();
+ string name( py_uf0D ? PyString_AsString(PyObject_CallMethod(py_uf0D, "getName", "")) : getName() );
+
+ if( py_uf0D && PyObject_HasAttrString(py_uf0D, "__call__") ) {
+ Director_BPy_UnaryFunction0D___call__( this, py_uf0D, iter);
+ return result;
+ } else {
+ cerr << "Warning: " << name << " operator() not implemented" << endl;
+ return T();
+ }
}
+
};
# ifdef SWIG
diff --git a/source/blender/freestyle/intern/view_map/Functions1D.h b/source/blender/freestyle/intern/view_map/Functions1D.h
index 072733b985d..c4f8b9f7607 100755
--- a/source/blender/freestyle/intern/view_map/Functions1D.h
+++ b/source/blender/freestyle/intern/view_map/Functions1D.h
@@ -36,6 +36,9 @@
# include "Functions0D.h"
# include "Interface1D.h"
# include "../system/FreestyleConfig.h"
+
+#include "../python/Director.h"
+
//
// UnaryFunction1D (base class for functions in 1D)
//
@@ -62,6 +65,10 @@ template <class T>
class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction1D
{
public:
+
+ T result;
+ PyObject *py_uf1D;
+
/*! The type of the value
* returned by the functor.
*/
@@ -92,9 +99,17 @@ public:
* \return the result of the function of type T.
*/
virtual T operator()(Interface1D& inter) {
- cerr << "Warning: UnaryFunction1D operator() not implemented" << endl;
- return T(0);
+ string name( py_uf1D ? PyString_AsString(PyObject_CallMethod(py_uf1D, "getName", "")) : getName() );
+
+ if( py_uf1D && PyObject_HasAttrString(py_uf1D, "__call__") ) {
+ Director_BPy_UnaryFunction1D___call__( this, py_uf1D, inter);
+ return result;
+ } else {
+ cerr << "Warning: " << name << " operator() not implemented" << endl;
+ return T(0);
+ }
}
+
/*! Sets the integration method */
void setIntegrationType(IntegrationType integration) {
_integration = integration;
@@ -109,22 +124,37 @@ protected:
IntegrationType _integration;
};
-# ifdef SWIG
-%feature("director") UnaryFunction1D<void>;
-%feature("director") UnaryFunction1D<unsigned>;
-%feature("director") UnaryFunction1D<float>;
-%feature("director") UnaryFunction1D<double>;
-%feature("director") UnaryFunction1D<Vec2f>;
-%feature("director") UnaryFunction1D<Vec3f>;
-%template(UnaryFunction1DVoid) UnaryFunction1D<void>;
-%template(UnaryFunction1DUnsigned) UnaryFunction1D<unsigned>;
-%template(UnaryFunction1DFloat) UnaryFunction1D<float>;
-%template(UnaryFunction1DDouble) UnaryFunction1D<double>;
-%template(UnaryFunction1DVec2f) UnaryFunction1D<Vec2f>;
-%template(UnaryFunction1DVec3f) UnaryFunction1D<Vec3f>;
-%template(UnaryFunction1DVectorViewShape) UnaryFunction1D<std::vector<ViewShape*> >;
-# endif // SWIG
+class UnaryFunction1D_void
+{
+public:
+
+ PyObject *py_uf1D;
+
+ UnaryFunction1D_void(){_integration = MEAN;}
+ UnaryFunction1D_void(IntegrationType iType){_integration = iType;}
+ virtual ~UnaryFunction1D_void() {}
+
+ virtual string getName() const {
+ return "UnaryFunction1D_void";
+ }
+
+ void operator()(Interface1D& inter) {
+ string name( py_uf1D ? PyString_AsString(PyObject_CallMethod(py_uf1D, "getName", "")) : getName() );
+
+ if( py_uf1D && PyObject_HasAttrString(py_uf1D, "__call__") ) {
+ Director_BPy_UnaryFunction1D___call__( this, py_uf1D, inter);
+ } else {
+ cerr << "Warning: " << name << " operator() not implemented" << endl;
+ }
+ }
+
+ void setIntegrationType(IntegrationType integration) { _integration = integration; }
+ IntegrationType getIntegrationType() const { return _integration; }
+
+ protected:
+ IntegrationType _integration;
+};
//
@@ -385,7 +415,7 @@ namespace Functions1D {
// TimeStampF1D
/*! Returns the time stamp of the Interface1D. */
- class LIB_VIEW_MAP_EXPORT TimeStampF1D : public UnaryFunction1D<void>
+ class LIB_VIEW_MAP_EXPORT TimeStampF1D : public UnaryFunction1D_void
{
public:
/*! Returns the string "TimeStampF1D"*/
@@ -398,7 +428,7 @@ namespace Functions1D {
// IncrementChainingTimeStampF1D
/*! Increments the chaining time stamp of the Interface1D. */
- class LIB_VIEW_MAP_EXPORT IncrementChainingTimeStampF1D : public UnaryFunction1D<void>
+ class LIB_VIEW_MAP_EXPORT IncrementChainingTimeStampF1D : public UnaryFunction1D_void
{
public:
/*! Returns the string "IncrementChainingTimeStampF1D"*/
@@ -411,7 +441,7 @@ namespace Functions1D {
// ChainingTimeStampF1D
/*! Sets the chaining time stamp of the Interface1D. */
- class LIB_VIEW_MAP_EXPORT ChainingTimeStampF1D : public UnaryFunction1D<void>
+ class LIB_VIEW_MAP_EXPORT ChainingTimeStampF1D : public UnaryFunction1D_void
{
public:
/*! Returns the string "ChainingTimeStampF1D"*/
diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h
index 8c75afc73df..55a2aece91c 100755
--- a/source/blender/freestyle/intern/view_map/Interface1D.h
+++ b/source/blender/freestyle/intern/view_map/Interface1D.h
@@ -38,6 +38,8 @@
# include "../winged_edge/Nature.h"
# include "Functions0D.h"
+#include "../python/Director.h"
+
using namespace std;
/*! \file Interface1D.h
* Interface1D and related tools definitions
@@ -125,8 +127,10 @@ class Interface1D
{
public:
+ PyObject *py_if1D;
+
/*! Default constructor */
- Interface1D() {_timeStamp=0;}
+ Interface1D() {_timeStamp=0; py_if1D = 0; }
virtual ~Interface1D() {}; //soc
/*! Returns the string "Interface1D" .*/
@@ -140,16 +144,28 @@ public:
* pointing to the first vertex.
*/
virtual Interface0DIterator verticesBegin() {
- cerr << "Warning: method verticesBegin() not implemented" << endl;
- return Interface0DIterator();
+ string name( py_if1D ? PyString_AsString(PyObject_CallMethod(py_if1D, "getExactTypeName", "")) : getExactTypeName() );
+
+ if( py_if1D && PyObject_HasAttrString(py_if1D, "verticesBegin") ) {
+ return Director_BPy_Interface1D_verticesBegin(py_if1D);
+ } else {
+ cerr << "Warning: " << name << " verticesBegin() not implemented" << endl;
+ return Interface0DIterator();
+ }
}
/*! Returns an iterator over the Interface1D vertices,
* pointing after the last vertex.
*/
virtual Interface0DIterator verticesEnd(){
- cerr << "Warning: method verticesEnd() not implemented" << endl;
- return Interface0DIterator();
+ string name( py_if1D ? PyString_AsString(PyObject_CallMethod(py_if1D, "getExactTypeName", "")) : getExactTypeName() );
+
+ if( py_if1D && PyObject_HasAttrString(py_if1D, "verticesEnd") ) {
+ return Director_BPy_Interface1D_verticesEnd(py_if1D);
+ } else {
+ cerr << "Warning: " << name << " verticesEnd() not implemented" << endl;
+ return Interface0DIterator();
+ }
}
/*! Returns an iterator over the Interface1D points,
@@ -162,8 +178,14 @@ public:
* this 1D element.
*/
virtual Interface0DIterator pointsBegin(float t=0.f) {
- cerr << "Warning: method pointsBegin() not implemented" << endl;
- return Interface0DIterator();
+ string name( py_if1D ? PyString_AsString(PyObject_CallMethod(py_if1D, "getExactTypeName", "")) : getExactTypeName() );
+
+ if( py_if1D && PyObject_HasAttrString(py_if1D, "pointsBegin") ) {
+ return Director_BPy_Interface1D_pointsBegin(py_if1D);
+ } else {
+ cerr << "Warning: " << name << " pointsBegin() not implemented" << endl;
+ return Interface0DIterator();
+ }
}
/*! Returns an iterator over the Interface1D points,
@@ -176,8 +198,14 @@ public:
* this 1D element.
*/
virtual Interface0DIterator pointsEnd(float t=0.f) {
- cerr << "Warning: method pointsEnd() not implemented" << endl;
- return Interface0DIterator();
+ string name( py_if1D ? PyString_AsString(PyObject_CallMethod(py_if1D, "getExactTypeName", "")) : getExactTypeName() );
+
+ if( py_if1D && PyObject_HasAttrString(py_if1D, "pointsEnd") ) {
+ return Director_BPy_Interface1D_pointsEnd(py_if1D);
+ } else {
+ cerr << "Warning: " << name << " pointsEnd() not implemented" << endl;
+ return Interface0DIterator();
+ }
}
// Data access methods