[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15786] branches/soc-2008-mxcurioni/source /blender/freestyle: soc-2008-mxcurioni: added (but did not test) ViewMap and Noise classes.
Maxime Curioni
maxime.curioni at gmail.com
Sat Jul 26 23:47:39 CEST 2008
Revision: 15786
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15786
Author: mxcurioni
Date: 2008-07-26 23:47:39 +0200 (Sat, 26 Jul 2008)
Log Message:
-----------
soc-2008-mxcurioni: added (but did not test) ViewMap and Noise classes. Updated ViewShape class accordingly
Modified Paths:
--------------
branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Noise.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/view_map/ViewMap.cpp
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMap.h
Added Paths:
-----------
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Noise.h
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_ViewMap.h
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript 2008-07-26 20:05:55 UTC (rev 15785)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript 2008-07-26 21:47:39 UTC (rev 15786)
@@ -96,6 +96,7 @@
prefix + '/Iterator/BPy_ChainSilhouetteIterator.cpp',
prefix + '/BPy_MediumType.cpp',
prefix + '/BPy_Nature.cpp',
+ prefix + '/BPy_Noise.cpp',
prefix + '/BPy_SShape.cpp',
prefix + '/BPy_StrokeAttribute.cpp',
prefix + '/BPy_StrokeShader.cpp',
@@ -103,6 +104,7 @@
prefix + '/BPy_UnaryFunction1D.cpp',
prefix + '/BPy_UnaryPredicate0D.cpp',
prefix + '/BPy_UnaryPredicate1D.cpp',
+ prefix + '/BPy_ViewMap.cpp',
prefix + '/BPy_ViewShape.cpp'
]
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp 2008-07-26 20:05:55 UTC (rev 15785)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp 2008-07-26 21:47:39 UTC (rev 15786)
@@ -930,7 +930,7 @@
if (!_ViewMap)
return NULL;
- FEdge *fedge = (FEdge*)_ViewMap->GetClosestFEdge(x,y);
+ FEdge *fedge = (FEdge*)_ViewMap->getClosestFEdge(x,y);
//ViewEdge *selection = fedge->viewedge();
_pView->setSelectedFEdge(fedge);
_Canvas->setSelectedFEdge(fedge);
@@ -942,7 +942,7 @@
if (!_ViewMap)
return NULL;
- FEdge *fedge = (FEdge*)_ViewMap->GetClosestFEdge(x,y);
+ FEdge *fedge = (FEdge*)_ViewMap->getClosestFEdge(x,y);
ViewEdge *selection = fedge->viewedge();
_pView->setSelectedFEdge(fedge);
_Canvas->setSelectedFEdge(fedge);
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 20:05:55 UTC (rev 15785)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Freestyle.cpp 2008-07-26 21:47:39 UTC (rev 15786)
@@ -7,11 +7,11 @@
#include "BPy_Id.h"
#include "BPy_IntegrationType.h"
#include "BPy_Interface0D.h"
+#include "BPy_Interface1D.h"
#include "BPy_Iterator.h"
-#include "Interface0D/BPy_CurvePoint.h"
-#include "BPy_Interface1D.h"
#include "BPy_MediumType.h"
#include "BPy_Nature.h"
+#include "BPy_Noise.h"
#include "BPy_SShape.h"
#include "BPy_StrokeAttribute.h"
#include "BPy_StrokeShader.h"
@@ -19,6 +19,7 @@
#include "BPy_UnaryFunction1D.h"
#include "BPy_UnaryPredicate0D.h"
#include "BPy_UnaryPredicate1D.h"
+#include "BPy_ViewMap.h"
#include "BPy_ViewShape.h"
@@ -151,6 +152,7 @@
Interface0D_Init( module );
Interface1D_Init( module );
Iterator_Init( module );
+ Noise_Init( module );
SShape_Init( module );
StrokeAttribute_Init( module );
StrokeShader_Init( module );
@@ -158,8 +160,9 @@
UnaryFunction1D_Init( module );
UnaryPredicate0D_Init( module );
UnaryPredicate1D_Init( module );
+ ViewMap_Init( module );
ViewShape_Init( module );
-
+
return module;
}
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Noise.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Noise.cpp 2008-07-26 20:05:55 UTC (rev 15785)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Noise.cpp 2008-07-26 21:47:39 UTC (rev 15786)
@@ -1,48 +1,239 @@
- PyObject *_wrap_Noise_turbulence1__SWIG_0(PyObject *self , PyObject *args) {
-}
+#include "BPy_Noise.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
- PyObject *_wrap_Noise_turbulence1__SWIG_1(PyObject *self , PyObject *args) {
-}
+///////////////////////////////////////////////////////////////////////////////////////////
+/*--------------- Python API function prototypes for Noise instance -----------*/
+static int Noise___init__(BPy_Noise *self, PyObject *args, PyObject *kwds);
+static void Noise___dealloc__(BPy_Noise *self);
+static PyObject * Noise___repr__(BPy_Noise *self);
- PyObject *_wrap_Noise_turbulence1(PyObject *self, PyObject *args) {
-}
+static PyObject * Noise_turbulence1( BPy_Noise *self, PyObject *args);
+static PyObject * Noise_turbulence2( BPy_Noise *self, PyObject *args);
+static PyObject * Noise_turbulence3( BPy_Noise *self, PyObject *args);
+static PyObject * Noise_smoothNoise1( BPy_Noise *self, PyObject *args);
+static PyObject * Noise_smoothNoise2( BPy_Noise *self, PyObject *args);
+static PyObject * Noise_smoothNoise3( BPy_Noise *self, PyObject *args);
+/*----------------------Noise instance definitions ----------------------------*/
+static PyMethodDef BPy_Noise_methods[] = {
+ {"turbulence1", ( PyCFunction ) Noise_turbulence1, METH_VARARGS, "(float arg, float freq, float amp, unsigned oct=4))Returns a noise value for a 1D element"},
+ {"turbulence2", ( PyCFunction ) Noise_turbulence2, METH_VARARGS, "([x, y], float freq, float amp, unsigned oct=4)))Returns a noise value for a 2D element"},
+ {"turbulence3", ( PyCFunction ) Noise_turbulence3, METH_VARARGS, "([x, y, z], float freq, float amp, unsigned oct=4)))Returns a noise value for a 3D element"},
+ {"smoothNoise1", ( PyCFunction ) Noise_smoothNoise1, METH_VARARGS, "(float arg))Returns a smooth noise value for a 1D element "},
+ {"smoothNoise2", ( PyCFunction ) Noise_smoothNoise2, METH_VARARGS, "([x, y]))Returns a smooth noise value for a 2D element "},
+ {"smoothNoise3", ( PyCFunction ) Noise_smoothNoise3, METH_VARARGS, "([x, y, z))Returns a smooth noise value for a 3D element "},
+ {NULL, NULL, 0, NULL}
+};
- PyObject *_wrap_Noise_turbulence2__SWIG_0(PyObject *self , PyObject *args) {
+/*-----------------------BPy_Noise type definition ------------------------------*/
+
+PyTypeObject Noise_Type = {
+ PyObject_HEAD_INIT( NULL )
+ 0, /* ob_size */
+ "Noise", /* tp_name */
+ sizeof( BPy_Noise ), /* tp_basicsize */
+ 0, /* tp_itemsize */
+
+ /* methods */
+ (destructor)Noise___dealloc__, /* tp_dealloc */
+ NULL, /* printfunc tp_print; */
+ NULL, /* getattrfunc tp_getattr; */
+ NULL, /* setattrfunc tp_setattr; */
+ NULL, /* tp_compare */
+ (reprfunc)Noise___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; */
+ NULL, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
+
+ /* Functions to access object as input/output buffer */
+ NULL, /* PyBufferProcs *tp_as_buffer; */
+
+ /*** Flags to define presence of optional/expanded features ***/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
+
+ NULL, /* char *tp_doc; Documentation string */
+ /*** Assigned meaning in release 2.0 ***/
+ /* call function for all accessible objects */
+ NULL, /* traverseproc tp_traverse; */
+
+ /* delete references to contained objects */
+ NULL, /* inquiry tp_clear; */
+
+ /*** Assigned meaning in release 2.1 ***/
+ /*** rich comparisons ***/
+ NULL, /* richcmpfunc tp_richcompare; */
+
+ /*** weak reference enabler ***/
+ 0, /* long tp_weaklistoffset; */
+
+ /*** Added in release 2.2 ***/
+ /* Iterators */
+ NULL, /* getiterfunc tp_iter; */
+ NULL, /* iternextfunc tp_iternext; */
+
+ /*** Attribute descriptor and subclassing stuff ***/
+ BPy_Noise_methods, /* struct PyMethodDef *tp_methods; */
+ NULL, /* struct PyMemberDef *tp_members; */
+ NULL, /* struct PyGetSetDef *tp_getset; */
+ NULL, /* struct _typeobject *tp_base; */
+ NULL, /* PyObject *tp_dict; */
+ NULL, /* descrgetfunc tp_descr_get; */
+ NULL, /* descrsetfunc tp_descr_set; */
+ 0, /* long tp_dictoffset; */
+ (initproc)Noise___init__, /* initproc tp_init; */
+ NULL, /* allocfunc tp_alloc; */
+ PyType_GenericNew, /* newfunc tp_new; */
+
+ /* Low-level free-memory routine */
+ NULL, /* freefunc tp_free; */
+
+ /* For PyObject_IS_GC */
+ NULL, /* inquiry tp_is_gc; */
+ NULL, /* PyObject *tp_bases; */
+
+ /* method resolution order */
+ NULL, /* PyObject *tp_mro; */
+ NULL, /* PyObject *tp_cache; */
+ NULL, /* PyObject *tp_subclasses; */
+ NULL, /* PyObject *tp_weaklist; */
+ NULL
+};
+
+//-------------------MODULE INITIALIZATION--------------------------------
+PyMODINIT_FUNC Noise_Init( PyObject *module )
+{
+ if( module == NULL )
+ return;
+
+ if( PyType_Ready( &Noise_Type ) < 0 )
+ return;
+
+ Py_INCREF( &Noise_Type );
+ PyModule_AddObject(module, "Noise", (PyObject *)&Noise_Type);
}
+//------------------------INSTANCE METHODS ----------------------------------
- PyObject *_wrap_Noise_turbulence2__SWIG_1(PyObject *self , PyObject *args) {
+int Noise___init__(BPy_Noise *self, PyObject *args, PyObject *kwds)
+{
+ self->n = new Noise();
+ return 0;
}
+void Noise___dealloc__(BPy_Noise* self)
+{
+ delete self->n;
+ self->ob_type->tp_free((PyObject*)self);
+}
- PyObject *_wrap_Noise_turbulence2(PyObject *self, PyObject *args) {
+
+PyObject * Noise___repr__(BPy_Noise* self)
+{
+ return PyString_FromFormat("Noise - address: %p", self->n );
}
- PyObject *_wrap_Noise_turbulence3__SWIG_0(PyObject *self , PyObject *args) {
+PyObject * Noise_turbulence1( BPy_Noise *self , PyObject *args) {
+ float f1, f2, f3;
+ unsigned int i;
+
+ if(!( PyArg_ParseTuple(args, "fff|I", &f1, &f2, &f3, &i) )) {
+ cout << "ERROR: Noise_turbulence1" << endl;
+ Py_RETURN_NONE;
+ }
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list