Revision: 15773
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15773
Author:   mxcurioni
Date:     2008-07-26 04:33:21 +0200 (Sat, 26 Jul 2008)

Log Message:
-----------
soc-2008-mxcurioni: implemented (but did not test) the following classes: 
Material, Chain, FEdgeSharp, FEdgeSmooth. All Interface1D classes have now been 
fully implemented.

Modified Paths:
--------------
    
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/Interface1D/Curve/BPy_Chain.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp

Added Paths:
-----------
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.h
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h

Removed Paths:
-------------
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Material.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Material.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-26 00:43:29 UTC (rev 15772)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp
  2008-07-26 02:33:21 UTC (rev 15773)
@@ -1,6 +1,7 @@
 #include "BPy_Convert.h"
 
 #include "BPy_BBox.h"
+#include "BPy_FrsMaterial.h"
 #include "BPy_Id.h"
 #include "BPy_IntegrationType.h"
 #include "BPy_Interface0D.h"
@@ -181,8 +182,14 @@
        return py_sv_it;
 }
 
+PyObject * BPy_FrsMaterial_from_Material( Material& m ){
+       PyObject *py_m = FrsMaterial_Type.tp_new( &FrsMaterial_Type, 0, 0 );
+       ((BPy_FrsMaterial*) py_m)->m = new Material( m );
 
+       return py_m;
+}
 
+
 
///////////////////////////////////////////////////////////////////////////////////////////
 
 #ifdef __cplusplus

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h
    2008-07-26 00:43:29 UTC (rev 15772)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h
    2008-07-26 02:33:21 UTC (rev 15773)
@@ -17,6 +17,9 @@
 // Interface0D, Interface0DIteratorNested, Interface0DIterator
 #include "../view_map/Interface0D.h"
 
+// Material
+#include "../scene_graph/Material.h"
+
 // Stroke, StrokeAttribute, StrokeVertex
 #include "../stroke/Stroke.h"
 
@@ -36,6 +39,8 @@
 // StrokeInternal::StrokeVertexIterator
 #include "../stroke/StrokeIterators.h"
 
+
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -57,6 +62,7 @@
 PyObject * BPy_FEdge_from_FEdge( FEdge& fe );
 PyObject * BPy_Id_from_Id( Id& id );
 PyObject * BPy_Interface0D_from_Interface0D( Interface0D& if0D );
+PyObject * BPy_FrsMaterial_from_Material( Material& m );
 PyObject * BPy_Nature_from_Nature( unsigned short n );
 PyObject * BPy_MediumType_from_MediumType( int n );
 PyObject * BPy_SShape_from_SShape( SShape& ss );

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
        2008-07-26 00:43:29 UTC (rev 15772)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
        2008-07-26 02:33:21 UTC (rev 15773)
@@ -3,6 +3,7 @@
 #include "BPy_BBox.h"
 #include "BPy_BinaryPredicate0D.h"
 #include "BPy_BinaryPredicate1D.h"
+#include "BPy_FrsMaterial.h"
 #include "BPy_Id.h"
 #include "BPy_IntegrationType.h"
 #include "BPy_Interface0D.h"
@@ -144,6 +145,7 @@
        BBox_Init( module );
        BinaryPredicate0D_Init( module );
        BinaryPredicate1D_Init( module );
+       FrsMaterial_Init( module );
        Id_Init( module );
        IntegrationType_Init( module );
        Interface0D_Init( module );

Copied: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
 (from rev 15709, 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Material.cpp)
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
                              (rev 0)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
      2008-07-26 02:33:21 UTC (rev 15773)
@@ -0,0 +1,407 @@
+#include "BPy_FrsMaterial.h"
+
+#include "BPy_Convert.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////////////
+
+/*---------------  Python API function prototypes for FrsMaterial instance  
-----------*/
+static int FrsMaterial___init__(BPy_FrsMaterial *self, PyObject *args, 
PyObject *kwds);
+static void FrsMaterial___dealloc__(BPy_FrsMaterial *self);
+static PyObject * FrsMaterial___repr__(BPy_FrsMaterial *self);
+
+static PyObject * FrsMaterial_diffuse( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_diffuseR( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_diffuseG( BPy_FrsMaterial* self) ;
+static PyObject * FrsMaterial_diffuseB( BPy_FrsMaterial* self) ;
+static PyObject * FrsMaterial_diffuseA( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_specular( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_specularR( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_specularG( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_specularB( BPy_FrsMaterial* self) ;
+static PyObject * FrsMaterial_specularA( BPy_FrsMaterial* self) ;
+static PyObject * FrsMaterial_ambient( BPy_FrsMaterial* self) ;
+static PyObject * FrsMaterial_ambientR( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_ambientG( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_ambientB( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_ambientA( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_emission( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_emissionR( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_emissionG( BPy_FrsMaterial* self) ;
+static PyObject * FrsMaterial_emissionB( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_emissionA( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_shininess( BPy_FrsMaterial* self);
+static PyObject * FrsMaterial_setDiffuse( BPy_FrsMaterial *self, PyObject 
*args );
+static PyObject * FrsMaterial_setSpecular( BPy_FrsMaterial *self, PyObject 
*args );
+static PyObject * FrsMaterial_setAmbient( BPy_FrsMaterial *self, PyObject 
*args );
+static PyObject * FrsMaterial_setEmission( BPy_FrsMaterial *self, PyObject 
*args );
+static PyObject * FrsMaterial_setShininess( BPy_FrsMaterial *self, PyObject 
*args );
+
+/*----------------------FrsMaterial instance definitions 
----------------------------*/
+static PyMethodDef BPy_FrsMaterial_methods[] = {
+       {"diffuse", ( PyCFunction ) FrsMaterial_diffuse, METH_NOARGS, "() 
Returns the diffuse color as a 4 float array"},
+       {"diffuseR", ( PyCFunction ) FrsMaterial_diffuseR, METH_NOARGS, "() 
Returns the red component of the diffuse color "},
+       {"diffuseG", ( PyCFunction ) FrsMaterial_diffuseG, METH_NOARGS, "() 
Returns the green component of the diffuse color "},
+       {"diffuseB", ( PyCFunction ) FrsMaterial_diffuseB, METH_NOARGS, "() 
Returns the blue component of the diffuse color "},
+       {"diffuseA", ( PyCFunction ) FrsMaterial_diffuseA, METH_NOARGS, "() 
Returns the alpha component of the diffuse color "},
+       {"specular", ( PyCFunction ) FrsMaterial_specular, METH_NOARGS, "() 
Returns the specular color as a 4 float array"},
+       {"specularR", ( PyCFunction ) FrsMaterial_specularR, METH_NOARGS, "() 
Returns the red component of the specular color "},
+       {"specularG", ( PyCFunction ) FrsMaterial_specularG, METH_NOARGS, "() 
Returns the green component of the specular color "},
+       {"specularB", ( PyCFunction ) FrsMaterial_specularB, METH_NOARGS, "() 
Returns the blue component of the specular color "},
+       {"specularA", ( PyCFunction ) FrsMaterial_specularA, METH_NOARGS, "() 
Returns the alpha component of the specular color "},
+       {"ambient", ( PyCFunction ) FrsMaterial_ambient, METH_NOARGS, "() 
Returns the ambient color as a 4 float array"},
+       {"ambientR", ( PyCFunction ) FrsMaterial_ambientR, METH_NOARGS, "() 
Returns the red component of the ambient color "},
+       {"ambientG", ( PyCFunction ) FrsMaterial_ambientG, METH_NOARGS, "() 
Returns the green component of the ambient color "},
+       {"ambientB", ( PyCFunction ) FrsMaterial_ambientB, METH_NOARGS, "() 
Returns the blue component of the ambient color "},
+       {"ambientA", ( PyCFunction ) FrsMaterial_ambientA, METH_NOARGS, "() 
Returns the alpha component of the ambient color "},
+       {"emission", ( PyCFunction ) FrsMaterial_emission, METH_NOARGS, "() 
Returns the emission color as a 4 float array"},
+       {"emissionR", ( PyCFunction ) FrsMaterial_emissionR, METH_NOARGS, "() 
Returns the red component of the emission color "},
+       {"emissionG", ( PyCFunction ) FrsMaterial_emissionG, METH_NOARGS, "() 
Returns the green component of the emission color "},
+       {"emissionB", ( PyCFunction ) FrsMaterial_emissionB, METH_NOARGS, "() 
Returns the blue component of the emission color "},
+       {"emissionA", ( PyCFunction ) FrsMaterial_emissionA, METH_NOARGS, "() 
Returns the alpha component of the emission color "},
+       {"shininess", ( PyCFunction ) FrsMaterial_shininess, METH_NOARGS, "() 
Returns the shininess coefficient "},
+       {"setDiffuse", ( PyCFunction ) FrsMaterial_setDiffuse, METH_NOARGS, 
"(float r, float g, float b, float a) Sets the diffuse color"},
+       {"setSpecular", ( PyCFunction ) FrsMaterial_setSpecular, METH_NOARGS, 
"(float r, float g, float b, float a) Sets the specular color"},
+       {"setAmbient", ( PyCFunction ) FrsMaterial_setAmbient, METH_NOARGS, 
"(float r, float g, float b, float a) Sets the ambient color"},
+       {"setEmission", ( PyCFunction ) FrsMaterial_setEmission, METH_NOARGS, 
"(float r, float g, float b, float a) Sets the emission color"},
+       {"setShininess", ( PyCFunction ) FrsMaterial_setShininess, METH_NOARGS, 
"(float r, float g, float b, float a) Sets the shininess color"},
+       {NULL, NULL, 0, NULL}
+};
+
+/*-----------------------BPy_FrsMaterial type definition 
------------------------------*/
+
+PyTypeObject FrsMaterial_Type = {
+       PyObject_HEAD_INIT( NULL ) 
+       0,                                                      /* ob_size */
+       "FrsMaterial",                          /* tp_name */
+       sizeof( BPy_FrsMaterial ),      /* tp_basicsize */
+       0,                                                      /* tp_itemsize 
*/
+       
+       /* methods */
+       (destructor)FrsMaterial___dealloc__,    /* tp_dealloc */
+       NULL,                                                   /* printfunc 
tp_print; */
+       NULL,                                                   /* getattrfunc 
tp_getattr; */
+       NULL,                                                   /* setattrfunc 
tp_setattr; */
+       NULL,                                                                   
        /* tp_compare */
+       (reprfunc)FrsMaterial___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; */

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to