From 77b37fa4615dc1e8d5656259744f0e8a1634e258 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Thu, 17 Apr 2014 12:37:08 +0900 Subject: Freestyle: Fix for VC++ warnings about 'hypot' macro redefinitions (Part 3). (See commit e1771e72fbbf828dbf5bed871b814288389f3611 for more detail of the problem). Made changes to intern/view_map/Interface0D.h and intern/python/Director.h to avoid #include and keep non-Python header files independent of it. --- .../freestyle/intern/application/Controller.cpp | 4 + .../blender/freestyle/intern/python/Director.cpp | 24 ++-- source/blender/freestyle/intern/python/Director.h | 14 +-- .../freestyle/intern/stroke/ChainingIterators.cpp | 12 ++ .../freestyle/intern/stroke/ChainingIterators.h | 13 +-- .../freestyle/intern/stroke/Predicates0D.cpp | 41 +++++++ .../blender/freestyle/intern/stroke/Predicates0D.h | 16 +-- .../freestyle/intern/stroke/Predicates1D.cpp | 41 +++++++ .../blender/freestyle/intern/stroke/Predicates1D.h | 16 +-- .../freestyle/intern/stroke/StrokeShader.cpp | 36 ++++++ .../blender/freestyle/intern/stroke/StrokeShader.h | 13 +-- .../freestyle/intern/view_map/Functions0D.h | 3 +- .../freestyle/intern/view_map/Functions1D.h | 6 +- .../freestyle/intern/view_map/Interface0D.cpp | 123 +++++++++++++++++++++ .../freestyle/intern/view_map/Interface0D.h | 98 +++------------- .../freestyle/intern/view_map/Interface1D.cpp | 75 +++++++++++++ .../freestyle/intern/view_map/Interface1D.h | 44 ++------ 17 files changed, 394 insertions(+), 185 deletions(-) create mode 100644 source/blender/freestyle/intern/stroke/Predicates0D.cpp create mode 100644 source/blender/freestyle/intern/stroke/Predicates1D.cpp create mode 100644 source/blender/freestyle/intern/stroke/StrokeShader.cpp create mode 100644 source/blender/freestyle/intern/view_map/Interface0D.cpp create mode 100644 source/blender/freestyle/intern/view_map/Interface1D.cpp diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 81ce1622517..91a7547895f 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -22,6 +22,10 @@ * \ingroup freestyle */ +extern "C" { +#include +} + #include #include #include diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp index ed98bfee63f..f03aa0bcc97 100644 --- a/source/blender/freestyle/intern/python/Director.cpp +++ b/source/blender/freestyle/intern/python/Director.cpp @@ -74,7 +74,7 @@ int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, Interface0D Py_XDECREF(arg2); return -1; } - PyObject *result = PyObject_CallMethod(bp0D->py_bp0D, (char *)"__call__", (char *)"OO", arg1, arg2); + PyObject *result = PyObject_CallMethod((PyObject *)bp0D->py_bp0D, (char *)"__call__", (char *)"OO", arg1, arg2); Py_DECREF(arg1); Py_DECREF(arg2); if (!result) @@ -101,7 +101,7 @@ int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D, Interface1D Py_XDECREF(arg2); return -1; } - PyObject *result = PyObject_CallMethod(bp1D->py_bp1D, (char *)"__call__", (char *)"OO", arg1, arg2); + PyObject *result = PyObject_CallMethod((PyObject *)bp1D->py_bp1D, (char *)"__call__", (char *)"OO", arg1, arg2); Py_DECREF(arg1); Py_DECREF(arg2); if (!result) @@ -124,7 +124,7 @@ int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIt PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 0); if (!arg) return -1; - PyObject *result = PyObject_CallMethod(up0D->py_up0D, (char *)"__call__", (char *)"O", arg); + PyObject *result = PyObject_CallMethod((PyObject *)up0D->py_up0D, (char *)"__call__", (char *)"O", arg); Py_DECREF(arg); if (!result) return -1; @@ -146,7 +146,7 @@ int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D& PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D); if (!arg) return -1; - PyObject *result = PyObject_CallMethod(up1D->py_up1D, (char *)"__call__", (char *)"O", arg); + PyObject *result = PyObject_CallMethod((PyObject *)up1D->py_up1D, (char *)"__call__", (char *)"O", arg); Py_DECREF(arg); if (!result) return -1; @@ -168,7 +168,7 @@ int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke& s) PyObject *arg = BPy_Stroke_from_Stroke(s); if (!arg) return -1; - PyObject *result = PyObject_CallMethod(ss->py_ss, (char *)"shade", (char *)"O", arg); + PyObject *result = PyObject_CallMethod((PyObject *)ss->py_ss, (char *)"shade", (char *)"O", arg); Py_DECREF(arg); if (!result) return -1; @@ -183,7 +183,7 @@ int Director_BPy_ChainingIterator_init(ChainingIterator *c_it) PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_c_it) not initialized"); return -1; } - PyObject *result = PyObject_CallMethod(c_it->py_c_it, (char *)"init", NULL); + PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, (char *)"init", NULL); if (!result) return -1; Py_DECREF(result); @@ -199,7 +199,7 @@ int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIter PyObject *arg = BPy_AdjacencyIterator_from_AdjacencyIterator(a_it); if (!arg) return -1; - PyObject *result = PyObject_CallMethod(c_it->py_c_it, (char *)"traverse", (char *)"O", arg); + PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, (char *)"traverse", (char *)"O", arg); Py_DECREF(arg); if (!result) return -1; @@ -219,12 +219,13 @@ int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIter } // BPy_UnaryFunction{0D,1D}: __call__ -int Director_BPy_UnaryFunction0D___call__(void *uf0D, PyObject *obj, Interface0DIterator& if0D_it) +int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator& if0D_it) { - if (!obj) { // internal error + if (!py_uf0D) { // internal error PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_uf0D) not initialized"); return -1; } + PyObject *obj = (PyObject *)py_uf0D; PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 0); if (!arg) return -1; @@ -277,12 +278,13 @@ int Director_BPy_UnaryFunction0D___call__(void *uf0D, PyObject *obj, Interface0D return 0; } -int Director_BPy_UnaryFunction1D___call__(void *uf1D, PyObject *obj, Interface1D& if1D) +int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D& if1D) { - if (!obj) { // internal error + if (!py_uf1D) { // internal error PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_uf1D) not initialized"); return -1; } + PyObject *obj = (PyObject *)py_uf1D; PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D); if (!arg) return -1; diff --git a/source/blender/freestyle/intern/python/Director.h b/source/blender/freestyle/intern/python/Director.h index d58a51b65b2..40576c0ec2c 100644 --- a/source/blender/freestyle/intern/python/Director.h +++ b/source/blender/freestyle/intern/python/Director.h @@ -41,16 +41,6 @@ class StrokeShader; using namespace Freestyle; -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifdef __cplusplus -} -#endif - // BinaryPredicate0D: __call__ int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, Interface0D& i1, Interface0D& i2); @@ -58,8 +48,8 @@ int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, Interface0D int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D, Interface1D& i1, Interface1D& i2); // UnaryFunction{0D,1D}: __call__ -int Director_BPy_UnaryFunction0D___call__(void *uf0D, PyObject *obj, Interface0DIterator& if0D_it); -int Director_BPy_UnaryFunction1D___call__(void *uf1D, PyObject *obj, Interface1D& if1D); +int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator& if0D_it); +int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D& if1D); // UnaryPredicate0D: __call__ int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIterator& if0D_it); diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp index 66575fd8fc2..25fdc0475d9 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp @@ -25,6 +25,8 @@ * \date 01/07/2003 */ +#include "../python/Director.h" + #include "ChainingIterators.h" #include "../system/TimeStamp.h" @@ -62,6 +64,16 @@ bool AdjacencyIterator::isValid(ViewEdge *edge) return true; } +int ChainingIterator::init() +{ + return Director_BPy_ChainingIterator_init(this); +} + +int ChainingIterator::traverse(const AdjacencyIterator &it) +{ + return Director_BPy_ChainingIterator_traverse(this, const_cast(it)); +} + int ChainingIterator::increment() { _increment = true; diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h index 8d01cea84e7..5a8d4b678b8 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.h +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h @@ -32,7 +32,6 @@ #include "Predicates1D.h" -#include "../python/Director.h" #include "../system/Iterator.h" //soc @@ -161,7 +160,7 @@ protected: public: ViewEdge *result; - PyObject *py_c_it; + void *py_c_it; /*! Builds a Chaining Iterator from the first ViewEdge used for iteration and its orientation. * \param iRestrictToSelection @@ -203,10 +202,7 @@ public: * This method is called each time a new chain is started. * It can be used to reset some history information that you might want to keep. */ - virtual int init() - { - return Director_BPy_ChainingIterator_init(this); - } + virtual int init(); /*! This method iterates over the potential next ViewEdges and returns the one that will be followed next. * returns the next ViewEdge to follow or 0 when the end of the chain is reached. @@ -214,10 +210,7 @@ public: * The iterator over the ViewEdges adjacent to the end vertex of the current ViewEdge. * The Adjacency iterator reflects the restriction rules by only iterating over the valid ViewEdges. */ - virtual int traverse(const AdjacencyIterator &it) - { - return Director_BPy_ChainingIterator_traverse(this, const_cast(it)); - } + virtual int traverse(const AdjacencyIterator &it); /* accessors */ /*! Returns true if the orientation of the current ViewEdge corresponds to its natural orientation */ diff --git a/source/blender/freestyle/intern/stroke/Predicates0D.cpp b/source/blender/freestyle/intern/stroke/Predicates0D.cpp new file mode 100644 index 00000000000..f189b2e38ea --- /dev/null +++ b/source/blender/freestyle/intern/stroke/Predicates0D.cpp @@ -0,0 +1,41 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/freestyle/intern/stroke/Predicates0D.cpp + * \ingroup freestyle + */ + +#include "Predicates0D.h" + +#include "../python/Director.h" + +namespace Freestyle { + +int UnaryPredicate0D::operator()(Interface0DIterator& it) +{ + return Director_BPy_UnaryPredicate0D___call__(this, it); +} + +int BinaryPredicate0D::operator()(Interface0D& inter1, Interface0D& inter2) +{ + return Director_BPy_BinaryPredicate0D___call__(this, inter1, inter2); +} + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/Predicates0D.h b/source/blender/freestyle/intern/stroke/Predicates0D.h index a6e7cbee042..6ce77649c31 100644 --- a/source/blender/freestyle/intern/stroke/Predicates0D.h +++ b/source/blender/freestyle/intern/stroke/Predicates0D.h @@ -29,8 +29,6 @@ * \date 01/07/2003 */ -#include "../python/Director.h" - #include "../view_map/Functions0D.h" #ifdef WITH_CXX_GUARDEDALLOC @@ -54,7 +52,7 @@ class UnaryPredicate0D { public: bool result; - PyObject *py_up0D; + void *py_up0D; /*! Default constructor. */ UnaryPredicate0D() @@ -76,10 +74,7 @@ public: * The Interface0DIterator pointing onto the Interface0D at which we wish to evaluate the predicate. * \return true if the condition is satisfied, false otherwise. */ - virtual int operator()(Interface0DIterator& it) - { - return Director_BPy_UnaryPredicate0D___call__(this, it); - } + virtual int operator()(Interface0DIterator& it); #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryPredicate0D") @@ -101,7 +96,7 @@ class BinaryPredicate0D { public: bool result; - PyObject *py_bp0D; + void *py_bp0D; /*! Default constructor. */ BinaryPredicate0D() @@ -126,10 +121,7 @@ public: * The second Interface0D. * \return true or false. */ - virtual int operator()(Interface0D& inter1, Interface0D& inter2) - { - return Director_BPy_BinaryPredicate0D___call__(this, inter1, inter2); - } + virtual int operator()(Interface0D& inter1, Interface0D& inter2); #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BinaryPredicate0D") diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.cpp b/source/blender/freestyle/intern/stroke/Predicates1D.cpp new file mode 100644 index 00000000000..7c5d777e57c --- /dev/null +++ b/source/blender/freestyle/intern/stroke/Predicates1D.cpp @@ -0,0 +1,41 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/freestyle/intern/stroke/Predicates1D.cpp + * \ingroup freestyle + */ + +#include "Predicates1D.h" + +#include "../python/Director.h" + +namespace Freestyle { + +int UnaryPredicate1D::operator()(Interface1D& inter) +{ + return Director_BPy_UnaryPredicate1D___call__(this, inter); +} + +int BinaryPredicate1D::operator()(Interface1D& inter1, Interface1D& inter2) +{ + return Director_BPy_BinaryPredicate1D___call__(this, inter1, inter2); +} + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h index 257f938bf30..46efeae9f12 100644 --- a/source/blender/freestyle/intern/stroke/Predicates1D.h +++ b/source/blender/freestyle/intern/stroke/Predicates1D.h @@ -33,8 +33,6 @@ #include "AdvancedFunctions1D.h" -#include "../python/Director.h" - #include "../system/TimeStamp.h" #include "../view_map/Interface1D.h" @@ -61,7 +59,7 @@ class UnaryPredicate1D { public: bool result; - PyObject *py_up1D; + void *py_up1D; /*! Default constructor. */ UnaryPredicate1D() @@ -83,10 +81,7 @@ public: * The Interface1D on which we wish to evaluate the predicate. * \return true if the condition is satisfied, false otherwise. */ - virtual int operator()(Interface1D& inter) - { - return Director_BPy_UnaryPredicate1D___call__(this, inter); - } + virtual int operator()(Interface1D& inter); #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryPredicate1D") @@ -108,7 +103,7 @@ class BinaryPredicate1D { public: bool result; - PyObject *py_bp1D; + void *py_bp1D; /*! Default constructor. */ BinaryPredicate1D() @@ -133,10 +128,7 @@ public: * The second Interface1D. * \return true or false. */ - virtual int operator()(Interface1D& inter1, Interface1D& inter2) - { - return Director_BPy_BinaryPredicate1D___call__(this, inter1, inter2); - } + virtual int operator()(Interface1D& inter1, Interface1D& inter2); #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BinaryPredicate1D") diff --git a/source/blender/freestyle/intern/stroke/StrokeShader.cpp b/source/blender/freestyle/intern/stroke/StrokeShader.cpp new file mode 100644 index 00000000000..4b21910a894 --- /dev/null +++ b/source/blender/freestyle/intern/stroke/StrokeShader.cpp @@ -0,0 +1,36 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/freestyle/intern/stroke/StrokeShader.cpp + * \ingroup freestyle + */ + +#include "StrokeShader.h" + +#include "../python/Director.h" + +namespace Freestyle { + +int StrokeShader::shade(Stroke& ioStroke) const +{ + return Director_BPy_StrokeShader_shade( const_cast(this), ioStroke); +} + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/StrokeShader.h b/source/blender/freestyle/intern/stroke/StrokeShader.h index 4657e98be61..e655b80d397 100644 --- a/source/blender/freestyle/intern/stroke/StrokeShader.h +++ b/source/blender/freestyle/intern/stroke/StrokeShader.h @@ -32,12 +32,12 @@ #include #include -#include "../python/Director.h" - #ifdef WITH_CXX_GUARDEDALLOC #include "MEM_guardedalloc.h" #endif +using namespace std; + namespace Freestyle { // @@ -72,10 +72,10 @@ class Stroke; * } * \endcode */ -class LIB_STROKE_EXPORT StrokeShader +class StrokeShader { public: - PyObject *py_ss; + void *py_ss; /*! Default constructor. */ StrokeShader() @@ -97,10 +97,7 @@ public: * The stroke we wish to shade. this Stroke is modified by the Shader (which typically * modifies the Stroke's attribute's values such as Color, Thickness, Geometry...) */ - virtual int shade(Stroke& ioStroke) const - { - return Director_BPy_StrokeShader_shade( const_cast(this), ioStroke); - } + virtual int shade(Stroke& ioStroke) const; #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:StrokeShader") diff --git a/source/blender/freestyle/intern/view_map/Functions0D.h b/source/blender/freestyle/intern/view_map/Functions0D.h index 7b90eacc218..b9b28f77636 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.h +++ b/source/blender/freestyle/intern/view_map/Functions0D.h @@ -78,7 +78,7 @@ class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction0D { public: T result; - PyObject *py_uf0D; + void *py_uf0D; /*! The type of the value returned by the functor. */ typedef T ReturnedValueType; @@ -103,6 +103,7 @@ public: * An Interface0DIterator pointing onto the point at which we wish to evaluate the function. * \return the result of the function of type T. */ + /* FIXME move the implementation to Functions0D.cpp */ virtual int operator()(Interface0DIterator& iter) { return Director_BPy_UnaryFunction0D___call__(this, py_uf0D, iter); diff --git a/source/blender/freestyle/intern/view_map/Functions1D.h b/source/blender/freestyle/intern/view_map/Functions1D.h index ff109903e9b..9edb705ef29 100644 --- a/source/blender/freestyle/intern/view_map/Functions1D.h +++ b/source/blender/freestyle/intern/view_map/Functions1D.h @@ -68,7 +68,7 @@ class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction1D { public: T result; - PyObject *py_uf1D; + void *py_uf1D; /*! The type of the value returned by the functor. */ typedef T ReturnedValueType; @@ -104,6 +104,7 @@ public: * The Interface1D on which we wish to evaluate the function. * \return the result of the function of type T. */ + /* FIXME move the implementation to Functions1D.cpp */ virtual int operator()(Interface1D& inter) { return Director_BPy_UnaryFunction1D___call__(this, py_uf1D, inter); @@ -133,7 +134,7 @@ protected: class UnaryFunction1D_void { public: - PyObject *py_uf1D; + void *py_uf1D; UnaryFunction1D_void() { @@ -152,6 +153,7 @@ public: return "UnaryFunction1D_void"; } + /* FIXME move the implementation to Functions1D.cpp */ int operator()(Interface1D& inter) { return Director_BPy_UnaryFunction1D___call__(this, py_uf1D, inter); diff --git a/source/blender/freestyle/intern/view_map/Interface0D.cpp b/source/blender/freestyle/intern/view_map/Interface0D.cpp new file mode 100644 index 00000000000..135a935d2fe --- /dev/null +++ b/source/blender/freestyle/intern/view_map/Interface0D.cpp @@ -0,0 +1,123 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/freestyle/intern/view_map/Interface0D.cpp + * \ingroup freestyle + */ + +extern "C" { +#include +} + +#include "Interface0D.h" + +namespace Freestyle { + +real Interface0D::getX() const +{ + PyErr_SetString(PyExc_TypeError, "method getX() not properly overridden"); + return 0; +} + +real Interface0D::getY() const +{ + PyErr_SetString(PyExc_TypeError, "method getY() not properly overridden"); + return 0; +} + +real Interface0D::getZ() const +{ + PyErr_SetString(PyExc_TypeError, "method getZ() not properly overridden"); + return 0; +} + +Geometry::Vec3f Interface0D::getPoint3D() const +{ + PyErr_SetString(PyExc_TypeError, "method getPoint3D() not properly overridden"); + return 0; +} + +real Interface0D::getProjectedX() const +{ + PyErr_SetString(PyExc_TypeError, "method getProjectedX() not properly overridden"); + return 0; +} + +real Interface0D::getProjectedY() const +{ + PyErr_SetString(PyExc_TypeError, "method getProjectedY() not properly overridden"); + return 0; +} + +real Interface0D::getProjectedZ() const +{ + PyErr_SetString(PyExc_TypeError, "method getProjectedZ() not properly overridden"); + return 0; +} + +Geometry::Vec2f Interface0D::getPoint2D() const +{ + PyErr_SetString(PyExc_TypeError, "method getPoint2D() not properly overridden"); + return 0; +} + +FEdge * Interface0D::getFEdge(Interface0D&) +{ + PyErr_SetString(PyExc_TypeError, "method getFEdge() not properly overridden"); + return 0; +} + +Id Interface0D::getId() const +{ + PyErr_SetString(PyExc_TypeError, "method getId() not properly overridden"); + return 0; +} + +Nature::VertexNature Interface0D::getNature() const +{ + PyErr_SetString(PyExc_TypeError, "method getNature() not properly overridden"); + return Nature::POINT; +} + +SVertex * Interface0D::castToSVertex() +{ + PyErr_SetString(PyExc_TypeError, "method castToSVertex() not properly overridden"); + return 0; +} + +ViewVertex * Interface0D::castToViewVertex() +{ + PyErr_SetString(PyExc_TypeError, "method castToViewVertex() not properly overridden"); + return 0; +} + +NonTVertex * Interface0D::castToNonTVertex() +{ + PyErr_SetString(PyExc_TypeError, "method castToNonTVertex() not properly overridden"); + return 0; +} + +TVertex * Interface0D::castToTVertex() +{ + PyErr_SetString(PyExc_TypeError, "method castToTVertex() not properly overridden"); + return 0; +} + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h index c9776bb77fa..8f7137f412a 100644 --- a/source/blender/freestyle/intern/view_map/Interface0D.h +++ b/source/blender/freestyle/intern/view_map/Interface0D.h @@ -29,7 +29,6 @@ */ #include -#include #include #include "../geometry/Geom.h" @@ -76,110 +75,49 @@ public: // Data access methods /*! Returns the 3D x coordinate of the point. */ - virtual real getX() const - { - PyErr_SetString(PyExc_TypeError, "method getX() not properly overridden"); - return 0; - } + virtual real getX() const; /*! Returns the 3D y coordinate of the point. */ - virtual real getY() const - { - PyErr_SetString(PyExc_TypeError, "method getY() not properly overridden"); - return 0; - } + virtual real getY() const; - /*! Returns the 3D z coordinate of the point. */ - virtual real getZ() const - { - PyErr_SetString(PyExc_TypeError, "method getZ() not properly overridden"); - return 0; - } + /*! Returns the 3D z coordinate of the point. */ + virtual real getZ() const; - /*! Returns the 3D point. */ - virtual Geometry::Vec3f getPoint3D() const - { - PyErr_SetString(PyExc_TypeError, "method getPoint3D() not properly overridden"); - return 0; - } + /*! Returns the 3D point. */ + virtual Geometry::Vec3f getPoint3D() const; /*! Returns the 2D x coordinate of the point. */ - virtual real getProjectedX() const - { - PyErr_SetString(PyExc_TypeError, "method getProjectedX() not properly overridden"); - return 0; - } + virtual real getProjectedX() const; /*! Returns the 2D y coordinate of the point. */ - virtual real getProjectedY() const - { - PyErr_SetString(PyExc_TypeError, "method getProjectedY() not properly overridden"); - return 0; - } + virtual real getProjectedY() const; /*! Returns the 2D z coordinate of the point. */ - virtual real getProjectedZ() const - { - PyErr_SetString(PyExc_TypeError, "method getProjectedZ() not properly overridden"); - return 0; - } + virtual real getProjectedZ() const; - /*! Returns the 2D point. */ - virtual Geometry::Vec2f getPoint2D() const - { - PyErr_SetString(PyExc_TypeError, "method getPoint2D() not properly overridden"); - return 0; - } + /*! Returns the 2D point. */ + virtual Geometry::Vec2f getPoint2D() const; /*! Returns the FEdge that lies between this Interface0D and the Interface0D given as argument. */ - virtual FEdge *getFEdge(Interface0D&) - { - PyErr_SetString(PyExc_TypeError, "method getFEdge() not properly overridden"); - return 0; - } + virtual FEdge *getFEdge(Interface0D&); /*! Returns the Id of the point. */ - virtual Id getId() const - { - PyErr_SetString(PyExc_TypeError, "method getId() not properly overridden"); - return 0; - } + virtual Id getId() const; /*! Returns the nature of the point. */ - virtual Nature::VertexNature getNature() const - { - PyErr_SetString(PyExc_TypeError, "method getNature() not properly overridden"); - return Nature::POINT; - } - + virtual Nature::VertexNature getNature() const; /*! Cast the Interface0D in SVertex if it can be. */ - virtual SVertex *castToSVertex() - { - PyErr_SetString(PyExc_TypeError, "method castToSVertex() not properly overridden"); - return 0; - } + virtual SVertex *castToSVertex(); /*! Cast the Interface0D in ViewVertex if it can be. */ - virtual ViewVertex *castToViewVertex() - { - PyErr_SetString(PyExc_TypeError, "method castToViewVertex() not properly overridden"); - return 0; - } + virtual ViewVertex *castToViewVertex(); /*! Cast the Interface0D in NonTVertex if it can be. */ - virtual NonTVertex *castToNonTVertex() - { - PyErr_SetString(PyExc_TypeError, "method castToNonTVertex() not properly overridden"); - return 0; - } + virtual NonTVertex *castToNonTVertex(); /*! Cast the Interface0D in TVertex if it can be. */ - virtual TVertex *castToTVertex() - { - PyErr_SetString(PyExc_TypeError, "method castToTVertex() not properly overridden"); - return 0; - } + virtual TVertex *castToTVertex(); #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Interface0D") diff --git a/source/blender/freestyle/intern/view_map/Interface1D.cpp b/source/blender/freestyle/intern/view_map/Interface1D.cpp new file mode 100644 index 00000000000..985310e52b5 --- /dev/null +++ b/source/blender/freestyle/intern/view_map/Interface1D.cpp @@ -0,0 +1,75 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/freestyle/intern/view_map/Interface1D.cpp + * \ingroup freestyle + */ + +extern "C" { +#include +} + +#include "Interface1D.h" + +namespace Freestyle { + +Interface0DIterator Interface1D::verticesBegin() +{ + PyErr_SetString(PyExc_TypeError, "method verticesBegin() not properly overridden"); + return Interface0DIterator(); +} + +Interface0DIterator Interface1D::verticesEnd() +{ + PyErr_SetString(PyExc_TypeError, "method verticesEnd() not properly overridden"); + return Interface0DIterator(); +} + +Interface0DIterator Interface1D::pointsBegin(float t) +{ + PyErr_SetString(PyExc_TypeError, "method pointsBegin() not properly overridden"); + return Interface0DIterator(); +} + +Interface0DIterator Interface1D::pointsEnd(float t) +{ + PyErr_SetString(PyExc_TypeError, "method pointsEnd() not properly overridden"); + return Interface0DIterator(); +} + +real Interface1D::getLength2D() const +{ + PyErr_SetString(PyExc_TypeError, "method getLength2D() not properly overridden"); + return 0; +} + +Id Interface1D::getId() const +{ + PyErr_SetString(PyExc_TypeError, "method getId() not properly overridden"); + return Id(0, 0); +} + +Nature::EdgeNature Interface1D::getNature() const +{ + PyErr_SetString(PyExc_TypeError, "method getNature() not properly overridden"); + return Nature::NO_FEATURE; +} + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h index c7beafaf14d..95ace73af14 100644 --- a/source/blender/freestyle/intern/view_map/Interface1D.h +++ b/source/blender/freestyle/intern/view_map/Interface1D.h @@ -30,7 +30,6 @@ #include #include -#include #include #include "Functions0D.h" @@ -148,18 +147,10 @@ public: // Iterator access /*! Returns an iterator over the Interface1D vertices, pointing to the first vertex. */ - virtual Interface0DIterator verticesBegin() - { - PyErr_SetString(PyExc_TypeError, "method verticesBegin() not properly overridden"); - return Interface0DIterator(); - } + virtual Interface0DIterator verticesBegin(); /*! Returns an iterator over the Interface1D vertices, pointing after the last vertex. */ - virtual Interface0DIterator verticesEnd() - { - PyErr_SetString(PyExc_TypeError, "method verticesEnd() not properly overridden"); - return Interface0DIterator(); - } + virtual Interface0DIterator verticesEnd(); /*! Returns an iterator over the Interface1D points, pointing to the first point. The difference with * verticesBegin() is that here we can iterate over points of the 1D element at a any given sampling. @@ -167,11 +158,7 @@ public: * \param t * The sampling with which we want to iterate over points of this 1D element. */ - virtual Interface0DIterator pointsBegin(float t = 0.0f) - { - PyErr_SetString(PyExc_TypeError, "method pointsBegin() not properly overridden"); - return Interface0DIterator(); - } + virtual Interface0DIterator pointsBegin(float t = 0.0f); /*! Returns an iterator over the Interface1D points, pointing after the last point. The difference with * verticesEnd() is that here we can iterate over points of the 1D element at a any given sampling. @@ -179,36 +166,19 @@ public: * \param t * The sampling with which we want to iterate over points of this 1D element. */ - virtual Interface0DIterator pointsEnd(float t = 0.0f) - { - PyErr_SetString(PyExc_TypeError, "method pointsEnd() not properly overridden"); - return Interface0DIterator(); - } + virtual Interface0DIterator pointsEnd(float t = 0.0f); // Data access methods /*! Returns the 2D length of the 1D element. */ - virtual real getLength2D() const - { - PyErr_SetString(PyExc_TypeError, "method getLength2D() not properly overridden"); - return 0; - } + virtual real getLength2D() const; /*! Returns the Id of the 1D element. */ - virtual Id getId() const - { - PyErr_SetString(PyExc_TypeError, "method getId() not properly overridden"); - return Id(0, 0); - } - + virtual Id getId() const; // FIXME: ce truc n'a rien a faire la...(c une requete complexe qui doit etre ds les Function1D) /*! Returns the nature of the 1D element. */ - virtual Nature::EdgeNature getNature() const - { - PyErr_SetString(PyExc_TypeError, "method getNature() not properly overridden"); - return Nature::NO_FEATURE; - } + virtual Nature::EdgeNature getNature() const; /*! Returns the time stamp of the 1D element. Mainly used for selection. */ virtual unsigned getTimeStamp() const -- cgit v1.2.3