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/BPy_Convert.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/BPy_Convert.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.cpp61
1 files changed, 45 insertions, 16 deletions
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);
+}
///////////////////////////////////////////////////////////////////////////////////////////