[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15919] branches/soc-2008-mxcurioni/source /blender/freestyle: soc-2008-mxcurioni: Made crucial corrections to stabilize the system.

Maxime Curioni maxime.curioni at gmail.com
Sat Aug 2 09:39:50 CEST 2008


Revision: 15919
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15919
Author:   mxcurioni
Date:     2008-08-02 09:39:49 +0200 (Sat, 02 Aug 2008)

Log Message:
-----------
soc-2008-mxcurioni: Made crucial corrections to stabilize the system. Most of the original styles are supported:  stroke attributes are correctly taken into account, Python shaders are supported. Added SamplingShader.

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_Interface0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Operators.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_SShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Director.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Director.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.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/StrokeShader/BPy_SpatialNoiseShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Operators.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Stroke.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Stroke.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/StrokeShader.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/Interface0D.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/Interface1D.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/ChainingIterators.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/freestyle_init.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/japanese_bigbrush.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/qi0_not_external_contour.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/sequentialsplit_sketchy.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/split_at_highest_2d_curvatures.py

Added Paths:
-----------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.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-08-02 06:31:56 UTC (rev 15918)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp	2008-08-02 07:39:49 UTC (rev 15919)
@@ -92,9 +92,9 @@
 }
 
 
-PyObject * BPy_SVertex_from_SVertex( SVertex& sv ) {
+PyObject * BPy_SVertex_from_SVertex_ptr( SVertex *sv ) {
 	PyObject *py_sv = SVertex_Type.tp_new( &SVertex_Type, 0, 0 );
-	((BPy_SVertex *) py_sv)->sv = new SVertex( sv );
+	((BPy_SVertex *) py_sv)->sv = sv;
 	((BPy_SVertex *) py_sv)->py_if0D.if0D = ((BPy_SVertex *) py_sv)->sv;
 
 	return py_sv;
@@ -119,18 +119,17 @@
 	return py_n;
 }
 
-PyObject * BPy_Stroke_from_Stroke( Stroke& s ) {
+PyObject * BPy_Stroke_from_Stroke_ptr( Stroke* s ) {
 	PyObject *py_s = Stroke_Type.tp_new( &Stroke_Type, 0, 0 );
-	((BPy_Stroke *) py_s)->s = new Stroke( s );
+	((BPy_Stroke *) py_s)->s = s;
 	((BPy_Stroke *) py_s)->py_if1D.if1D = ((BPy_Stroke *) py_s)->s;
 
 	return py_s;
 }
 
-PyObject * BPy_StrokeAttribute_from_StrokeAttribute( StrokeAttribute& sa ) {
+PyObject * BPy_StrokeAttribute_from_StrokeAttribute_ptr( StrokeAttribute *sa ) {
 	PyObject *py_sa = StrokeAttribute_Type.tp_new( &StrokeAttribute_Type, 0, 0 );
-	((BPy_StrokeAttribute *) py_sa)->sa = new StrokeAttribute( sa );
-
+	((BPy_StrokeAttribute *) py_sa)->sa = sa;
 	return py_sa;	
 }
 
@@ -145,9 +144,9 @@
 	return py_mt;
 }
 
-PyObject * BPy_StrokeVertex_from_StrokeVertex( StrokeVertex& sv ) {
+PyObject * BPy_StrokeVertex_from_StrokeVertex_ptr( StrokeVertex *sv ) {
 	PyObject *py_sv = StrokeVertex_Type.tp_new( &StrokeVertex_Type, 0, 0 );
-	((BPy_StrokeVertex *) py_sv)->sv = new StrokeVertex( sv );
+	((BPy_StrokeVertex *) py_sv)->sv = sv;
 	((BPy_StrokeVertex *) py_sv)->py_cp.cp = ((BPy_StrokeVertex *) py_sv)->sv;
 	((BPy_StrokeVertex *) py_sv)->py_cp.py_if0D.if0D = ((BPy_StrokeVertex *) py_sv)->sv;
 
@@ -169,9 +168,9 @@
 	return py_bb;
 }
 
-PyObject * BPy_ViewEdge_from_ViewEdge( ViewEdge& ve ) {
+PyObject * BPy_ViewEdge_from_ViewEdge_ptr( 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)->ve = ve;
 	((BPy_ViewEdge *) py_ve)->py_if1D.if1D = ((BPy_ViewEdge *) py_ve)->ve;
 
 	return py_ve;
@@ -219,7 +218,7 @@
 PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewEdge& dve ) {
 	PyObject *py_dve = PyList_New(2);
 	
-	PyList_SetItem(	py_dve, 0, BPy_ViewEdge_from_ViewEdge(*(dve.first)) );
+	PyList_SetItem(	py_dve, 0, BPy_ViewEdge_from_ViewEdge_ptr(dve.first) );
 	PyList_SetItem(	py_dve, 1, PyBool_from_bool(dve.second) );
 	
 	return py_dve;
@@ -316,7 +315,7 @@
 //==============================
 
 bool bool_from_PyBool( PyObject *b ) {
-	return b == Py_True;
+	return (b == Py_True || PyInt_AsLong(b) != 0);
 }
 
 IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) {

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-08-02 06:31:56 UTC (rev 15918)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.h	2008-08-02 07:39:49 UTC (rev 15919)
@@ -82,12 +82,12 @@
 PyObject * BPy_Nature_from_Nature( unsigned short n );
 PyObject * BPy_MediumType_from_MediumType( int n );
 PyObject * BPy_SShape_from_SShape( SShape& ss );
-PyObject * BPy_Stroke_from_Stroke( Stroke& s );
-PyObject * BPy_StrokeAttribute_from_StrokeAttribute( StrokeAttribute& sa );
-PyObject * BPy_StrokeVertex_from_StrokeVertex( StrokeVertex& sv );
-PyObject * BPy_SVertex_from_SVertex( SVertex& sv );
+PyObject * BPy_Stroke_from_Stroke_ptr( Stroke* s );
+PyObject * BPy_StrokeAttribute_from_StrokeAttribute_ptr( StrokeAttribute *sa );
+PyObject * BPy_StrokeVertex_from_StrokeVertex_ptr( StrokeVertex *sv );
+PyObject * BPy_SVertex_from_SVertex_ptr( SVertex *sv );
 PyObject * BPy_ViewVertex_from_ViewVertex_ptr( ViewVertex *vv );
-PyObject * BPy_ViewEdge_from_ViewEdge( ViewEdge& ve );
+PyObject * BPy_ViewEdge_from_ViewEdge_ptr( ViewEdge *ve );
 PyObject * BPy_ViewShape_from_ViewShape( ViewShape& vs );
 
 PyObject * BPy_AdjacencyIterator_from_AdjacencyIterator( AdjacencyIterator& a_it );

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface0D.cpp	2008-08-02 06:31:56 UTC (rev 15918)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface0D.cpp	2008-08-02 07:39:49 UTC (rev 15919)
@@ -183,12 +183,14 @@
 int Interface0D___init__(BPy_Interface0D *self, PyObject *args, PyObject *kwds)
 {
 	self->if0D = new Interface0D();
+	self->if0D->py_if0D = (PyObject *)self;
 	return 0;
 }
 
 void Interface0D___dealloc__(BPy_Interface0D* self)
 {
-	delete self->if0D;
+	if( self->if0D->py_if0D )
+		delete self->if0D;
     self->ob_type->tp_free((PyObject*)self);
 }
 

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp	2008-08-02 06:31:56 UTC (rev 15918)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp	2008-08-02 07:39:49 UTC (rev 15919)
@@ -204,7 +204,8 @@
 
 void Interface1D___dealloc__(BPy_Interface1D* self)
 {
-	delete self->if1D;
+	if( self->if1D->py_if1D )
+		delete self->if1D;
     self->ob_type->tp_free((PyObject*)self);
 }
 

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp	2008-08-02 06:31:56 UTC (rev 15918)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp	2008-08-02 07:39:49 UTC (rev 15919)
@@ -227,11 +227,7 @@
 	return PyBool_from_bool( self->it->isEnd() );
 }
 
-PyObject * Iterator_getObject(BPy_Iterator* self) {
-	return PyBool_from_bool( self->it->isEnd() );
-}
 
-
 ///////////////////////////////////////////////////////////////////////////////////////////
 
 #ifdef __cplusplus

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Operators.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Operators.cpp	2008-08-02 06:31:56 UTC (rev 15918)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Operators.cpp	2008-08-02 07:39:49 UTC (rev 15919)
@@ -24,28 +24,27 @@
 static PyObject * Operators_recursiveSplit(BPy_Operators* self, PyObject *args);
 static PyObject * Operators_sort(BPy_Operators* self, PyObject *args);
 static PyObject * Operators_create(BPy_Operators* self, PyObject *args);
+static PyObject * Operators_getViewEdgesSize( BPy_Operators* self);
+static PyObject * Operators_getChainsSize( BPy_Operators* self);
+static PyObject * Operators_getStrokesSize( BPy_Operators* self);
 
 /*----------------------Operators instance definitions ----------------------------*/
 static PyMethodDef BPy_Operators_methods[] = {
 	{"select", ( PyCFunction ) Operators_select, METH_VARARGS | METH_STATIC, 
 	"select operator"},
-	
 	{"bidirectionalChain", ( PyCFunction ) Operators_bidirectionalChain, METH_VARARGS | METH_STATIC,
-	 "select operator"},
-	
+	 "bidirectionalChain operator"},
 	{"sequentialSplit", ( PyCFunction ) Operators_sequentialSplit, METH_VARARGS | METH_STATIC,
-	 "select operator"},
-	
+	 "sequentialSplit operator"},
 	{"recursiveSplit", ( PyCFunction ) Operators_recursiveSplit, METH_VARARGS | METH_STATIC, 
-	"select operator"},
-	
+	"recursiveSplit operator"},
 	{"sort", ( PyCFunction ) Operators_sort, METH_VARARGS | METH_STATIC, 
-	"select operator"},
-	
+	"sort operator"},
 	{"create", ( PyCFunction ) Operators_create, METH_VARARGS | METH_STATIC, 
-	"select operator"},
-	
-		
+	"create operator"},
+	{"getViewEdgesSize", ( PyCFunction ) Operators_getViewEdgesSize, METH_NOARGS | METH_STATIC, ""},
+	{"getChainsSize", ( PyCFunction ) Operators_getChainsSize, METH_NOARGS | METH_STATIC, ""},
+	{"getStrokesSize", ( PyCFunction ) Operators_getStrokesSize, METH_NOARGS | METH_STATIC, ""},
 	{NULL, NULL, 0, NULL}
 };
 
@@ -322,6 +321,19 @@
 	Py_RETURN_NONE;
 }
 
+PyObject * Operators_getViewEdgesSize( BPy_Operators* self) {
+	return PyInt_FromLong( Operators::getViewEdgesSize() );
+}
+
+PyObject * Operators_getChainsSize( BPy_Operators* self ) {
+	return PyInt_FromLong( Operators::getChainsSize() );
+}
+
+PyObject * Operators_getStrokesSize( BPy_Operators* self) {
+	return PyInt_FromLong( Operators::getStrokesSize() );
+}
+
+
 ///////////////////////////////////////////////////////////////////////////////////////////
 
 #ifdef __cplusplus

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_SShape.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_SShape.cpp	2008-08-02 06:31:56 UTC (rev 15918)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_SShape.cpp	2008-08-02 07:39:49 UTC (rev 15919)
@@ -228,7 +228,7 @@
 	vector< SVertex * >::iterator it;
 	
 	for( it = vertices.begin(); it != vertices.end(); it++ ) {
-		PyList_Append( py_vertices, BPy_SVertex_from_SVertex(*( *it )) );
+		PyList_Append( py_vertices, BPy_SVertex_from_SVertex_ptr(*it) );
 	}
 	
 	return py_vertices;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp	2008-08-02 06:31:56 UTC (rev 15918)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp	2008-08-02 07:39:49 UTC (rev 15919)
@@ -199,6 +199,7 @@
 		return -1;
 	}
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list