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
diff options
context:
space:
mode:
authorMaxime Curioni <maxime.curioni@gmail.com>2008-08-02 01:55:58 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-08-02 01:55:58 +0400
commit7565990db264dbb7771744cea0a1c87b3e11fc3f (patch)
treedb4795f8c46b8cde474112e775708f57a13ccf9e /source/blender/freestyle/intern/python/Director.cpp
parentc324f0cbc72b47182ba3d7fd1bbd280fcebe3283 (diff)
soc-2008-mxcurioni: made considerable changes to support cross-language polymorphism for UnaryFunction0D, Interface0D, Interface1D. Add to change UnaryFunction1D<void> to static UnaryFunction1D_void. Resolved namespace collision on the Image class (changed to FrsImage). There is greater support for style modules but somehow, some do not show anything yet (japanese_bigbrush being an example).
Diffstat (limited to 'source/blender/freestyle/intern/python/Director.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp103
1 files changed, 93 insertions, 10 deletions
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 );
+}