diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-04-17 07:37:08 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-04-17 09:37:08 +0400 |
commit | 77b37fa4615dc1e8d5656259744f0e8a1634e258 (patch) | |
tree | 4c1e9e8580156da0a65ac4fe11dbef82f6281327 /source/blender/freestyle/intern/view_map | |
parent | 5d4a6a94ef40f8ae8c49d8fd8fc65384324cb03c (diff) |
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 <Python.h> and keep non-Python header files independent of it.
Diffstat (limited to 'source/blender/freestyle/intern/view_map')
6 files changed, 229 insertions, 120 deletions
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 <Python.h> +} + +#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 <iostream> -#include <Python.h> #include <string> #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 <Python.h> +} + +#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 <float.h> #include <iostream> -#include <Python.h> #include <string> #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 |