[Bf-blender-cvs] [8c3aedc] soc-2014-fluid: Big commit. Manta included in Blender Python. NOT ALL modules imported
Roman Pogribnyi
noreply at git.blender.org
Tue Jul 8 21:33:49 CEST 2014
Commit: 8c3aedcec5df97d7b46270dd89cc9d77c17ac77e
Author: Roman Pogribnyi
Date: Tue Jul 8 21:31:15 2014 +0200
https://developer.blender.org/rB8c3aedcec5df97d7b46270dd89cc9d77c17ac77e
Big commit. Manta included in Blender Python. NOT ALL modules imported
===================================================================
M extern/CMakeLists.txt
M extern/SConscript
D extern/manta_pp/CMakeLists.txt
D extern/manta_pp/SConscript
D extern/manta_pp/commonkernels.h
D extern/manta_pp/commonkernels.h.reg
D extern/manta_pp/commonkernels.h.reg.cpp
D extern/manta_pp/conjugategrad.cpp
D extern/manta_pp/conjugategrad.h
D extern/manta_pp/conjugategrad.h.reg
D extern/manta_pp/conjugategrad.h.reg.cpp
D extern/manta_pp/cuda/buoyancy.cu
D extern/manta_pp/cuda/cudatools.h
D extern/manta_pp/cuda/curlnoise.cu
D extern/manta_pp/cuda/curlnoise.h
D extern/manta_pp/cuda/meshtools.cu
D extern/manta_pp/cuda/particle.cu
D extern/manta_pp/cuda/turbulence.cu
D extern/manta_pp/edgecollapse.cpp
D extern/manta_pp/edgecollapse.h
D extern/manta_pp/edgecollapse.h.reg
D extern/manta_pp/edgecollapse.h.reg.cpp
D extern/manta_pp/fastmarch.cpp
D extern/manta_pp/fastmarch.h
D extern/manta_pp/fastmarch.h.reg
D extern/manta_pp/fastmarch.h.reg.cpp
D extern/manta_pp/fileio.cpp
D extern/manta_pp/fileio.h
D extern/manta_pp/fileio.h.reg
D extern/manta_pp/fileio.h.reg.cpp
D extern/manta_pp/flip.cpp
D extern/manta_pp/flip.h
D extern/manta_pp/flip.h.reg
D extern/manta_pp/flip.h.reg.cpp
D extern/manta_pp/fluidsolver.cpp
D extern/manta_pp/fluidsolver.h
D extern/manta_pp/fluidsolver.h.reg
D extern/manta_pp/fluidsolver.h.reg.cpp
D extern/manta_pp/general.cpp
D extern/manta_pp/general.h
D extern/manta_pp/general.h.reg
D extern/manta_pp/general.h.reg.cpp
D extern/manta_pp/grid.cpp
D extern/manta_pp/grid.h
D extern/manta_pp/grid.h.reg
D extern/manta_pp/grid.h.reg.cpp
D extern/manta_pp/gui/customctrl.cpp
D extern/manta_pp/gui/customctrl.h
D extern/manta_pp/gui/customctrl.h.reg
D extern/manta_pp/gui/customctrl.h.reg.cpp
D extern/manta_pp/gui/glwidget.cpp
D extern/manta_pp/gui/glwidget.h
D extern/manta_pp/gui/glwidget.h.reg
D extern/manta_pp/gui/glwidget.h.reg.cpp
D extern/manta_pp/gui/mainwindow.cpp
D extern/manta_pp/gui/mainwindow.h
D extern/manta_pp/gui/mainwindow.h.reg
D extern/manta_pp/gui/mainwindow.h.reg.cpp
D extern/manta_pp/gui/meshpainter.cpp
D extern/manta_pp/gui/meshpainter.h
D extern/manta_pp/gui/meshpainter.h.reg
D extern/manta_pp/gui/meshpainter.h.reg.cpp
D extern/manta_pp/gui/moc_customctrl.cxx
D extern/manta_pp/gui/moc_customctrl.cxx_parameters
D extern/manta_pp/gui/moc_glwidget.cxx
D extern/manta_pp/gui/moc_glwidget.cxx_parameters
D extern/manta_pp/gui/moc_mainwindow.cxx
D extern/manta_pp/gui/moc_mainwindow.cxx_parameters
D extern/manta_pp/gui/moc_meshpainter.cxx
D extern/manta_pp/gui/moc_meshpainter.cxx_parameters
D extern/manta_pp/gui/moc_painter.cxx
D extern/manta_pp/gui/moc_painter.cxx_parameters
D extern/manta_pp/gui/moc_particlepainter.cxx
D extern/manta_pp/gui/moc_particlepainter.cxx_parameters
D extern/manta_pp/gui/moc_qtmain.cxx
D extern/manta_pp/gui/moc_qtmain.cxx_parameters
D extern/manta_pp/gui/painter.cpp
D extern/manta_pp/gui/painter.h
D extern/manta_pp/gui/painter.h.reg
D extern/manta_pp/gui/painter.h.reg.cpp
D extern/manta_pp/gui/particlepainter.cpp
D extern/manta_pp/gui/particlepainter.h
D extern/manta_pp/gui/particlepainter.h.reg
D extern/manta_pp/gui/particlepainter.h.reg.cpp
D extern/manta_pp/gui/qtmain.cpp
D extern/manta_pp/gui/qtmain.h
D extern/manta_pp/gui/qtmain.h.reg
D extern/manta_pp/gui/qtmain.h.reg.cpp
D extern/manta_pp/hginfo.h
D extern/manta_pp/kernel.cpp
D extern/manta_pp/kernel.h
D extern/manta_pp/kernel.h.reg
D extern/manta_pp/kernel.h.reg.cpp
D extern/manta_pp/levelset.cpp
D extern/manta_pp/levelset.h
D extern/manta_pp/levelset.h.reg
D extern/manta_pp/levelset.h.reg.cpp
D extern/manta_pp/manta.h
D extern/manta_pp/mesh.cpp
D extern/manta_pp/mesh.h
D extern/manta_pp/mesh.h.reg
D extern/manta_pp/mesh.h.reg.cpp
D extern/manta_pp/movingobs.cpp
D extern/manta_pp/movingobs.h
D extern/manta_pp/movingobs.h.reg
D extern/manta_pp/movingobs.h.reg.cpp
D extern/manta_pp/noisefield.cpp
D extern/manta_pp/noisefield.h
D extern/manta_pp/noisefield.h.reg
D extern/manta_pp/noisefield.h.reg.cpp
D extern/manta_pp/particle.cpp
D extern/manta_pp/particle.h
D extern/manta_pp/particle.h.reg
D extern/manta_pp/particle.h.reg.cpp
D extern/manta_pp/plugin/advection.cpp
D extern/manta_pp/plugin/extforces.cpp
D extern/manta_pp/plugin/initplugins.cpp
D extern/manta_pp/plugin/kepsilon.cpp
D extern/manta_pp/plugin/meshplugins.cpp
D extern/manta_pp/plugin/pressure.cpp
D extern/manta_pp/plugin/vortexplugins.cpp
D extern/manta_pp/plugin/waveletturbulence.cpp
D extern/manta_pp/preprocessor/code.cpp
D extern/manta_pp/preprocessor/code.h
D extern/manta_pp/preprocessor/codegen_kernel.cpp
D extern/manta_pp/preprocessor/codegen_python.cpp
D extern/manta_pp/preprocessor/main.cpp
D extern/manta_pp/preprocessor/main.h
D extern/manta_pp/preprocessor/merge.cpp
D extern/manta_pp/preprocessor/parse.cpp
D extern/manta_pp/preprocessor/prep.h
D extern/manta_pp/preprocessor/tokenize.cpp
D extern/manta_pp/preprocessor/tokenize.h
D extern/manta_pp/preprocessor/util.cpp
D extern/manta_pp/preprocessor/util.h
D extern/manta_pp/pwrapper/manta.h
D extern/manta_pp/pwrapper/pclass.cpp
D extern/manta_pp/pwrapper/pclass.h
D extern/manta_pp/pwrapper/pconvert.cpp
D extern/manta_pp/pwrapper/pconvert.h
D extern/manta_pp/pwrapper/pvec3.cpp
D extern/manta_pp/pwrapper/pymain.cpp
D extern/manta_pp/pwrapper/pymain.h
D extern/manta_pp/pwrapper/pythonInclude.h
D extern/manta_pp/pwrapper/registry.cpp
D extern/manta_pp/pwrapper/registry.h
D extern/manta_pp/python/defines.py
D extern/manta_pp/python/defines.py.reg
D extern/manta_pp/python/defines.py.reg.cpp
D extern/manta_pp/shapes.cpp
D extern/manta_pp/shapes.h
D extern/manta_pp/shapes.h.reg
D extern/manta_pp/shapes.h.reg.cpp
D extern/manta_pp/test.cpp
D extern/manta_pp/turbulencepart.cpp
D extern/manta_pp/turbulencepart.h
D extern/manta_pp/turbulencepart.h.reg
D extern/manta_pp/turbulencepart.h.reg.cpp
D extern/manta_pp/util/integrator.h
D extern/manta_pp/util/interpol.h
D extern/manta_pp/util/interpolHigh.h
D extern/manta_pp/util/mcubes.h
D extern/manta_pp/util/quaternion.h
D extern/manta_pp/util/randomstream.h
D extern/manta_pp/util/solvana.h
D extern/manta_pp/util/vectorbase.cpp
D extern/manta_pp/util/vectorbase.h
D extern/manta_pp/vortexfilament.cpp
D extern/manta_pp/vortexfilament.h
D extern/manta_pp/vortexpart.cpp
D extern/manta_pp/vortexpart.h
D extern/manta_pp/vortexpart.h.reg
D extern/manta_pp/vortexpart.h.reg.cpp
D extern/manta_pp/vortexsheet.cpp
D extern/manta_pp/vortexsheet.h
D extern/manta_pp/vortexsheet.h.reg
D extern/manta_pp/vortexsheet.h.reg.cpp
M intern/cycles/CMakeLists.txt
M intern/smoke/intern/MANTA.h
M intern/smoke/intern/smoke_API.cpp
M source/blender/python/CMakeLists.txt
M source/blender/python/SConscript
M source/blender/python/intern/bpy_interface.c
A source/blender/python/manta_pp/CMakeLists.txt
A source/blender/python/manta_pp/SConscript
A source/blender/python/manta_pp/commonkernels.h
A source/blender/python/manta_pp/commonkernels.h.reg
A source/blender/python/manta_pp/commonkernels.h.reg.cpp
A source/blender/python/manta_pp/conjugategrad.cpp
A source/blender/python/manta_pp/conjugategrad.h
A source/blender/python/manta_pp/conjugategrad.h.reg
A source/blender/python/manta_pp/conjugategrad.h.reg.cpp
A source/blender/python/manta_pp/cuda/buoyancy.cu
A source/blender/python/manta_pp/cuda/cudatools.h
A source/blender/python/manta_pp/cuda/curlnoise.cu
A source/blender/python/manta_pp/cuda/curlnoise.h
A source/blender/python/manta_pp/cuda/meshtools.cu
A source/blender/python/manta_pp/cuda/particle.cu
A source/blender/python/manta_pp/cuda/turbulence.cu
A source/blender/python/manta_pp/edgecollapse.cpp
A source/blender/python/manta_pp/edgecollapse.h
A source/blender/python/manta_pp/edgecollapse.h.reg
A source/blender/python/manta_pp/edgecollapse.h.reg.cpp
A source/blender/python/manta_pp/fastmarch.cpp
A source/blender/python/manta_pp/fastmarch.h
A source/blender/python/manta_pp/fastmarch.h.reg
A source/blender/python/manta_pp/fastmarch.h.reg.cpp
A source/blender/python/manta_pp/fileio.cpp
A source/blender/python/manta_pp/fileio.h
A source/blender/python/manta_pp/fileio.h.reg
A source/blender/python/manta_pp/fileio.h.reg.cpp
A source/blender/python/manta_pp/flip.cpp
A source/blender/python/manta_pp/flip.h
A source/blender/python/manta_pp/flip.h.reg
A source/blender/python/manta_pp/flip.h.reg.cpp
A source/blender/python/manta_pp/fluidsolver.cpp
A source/blender/python/manta_pp/fluidsolver.h
A source/blender/python/manta_pp/fluidsolver.h.reg
A source/blender/python/manta_pp/fluidsolver.h.reg.cpp
A source/blender/python/manta_pp/general.cpp
A source/blender/python/manta_pp/general.h
A source/blender/python/manta_pp/general.h.reg
A source/blender/python/manta_pp/general.h.reg.cpp
A source/blender/python/manta_pp/grid.cpp
A source/blender/python/manta_pp/grid.h
A source/blender/python/manta_pp/grid.h.reg
A source/blender/python/manta_pp/grid.h.reg.cpp
A source/blender/python/manta_pp/gui/customctrl.cpp
A source/blender/python/manta_pp/gui/customctrl.h
A source/blender/python/manta_pp/gui/customctrl.h.reg
A source/blender/python/manta_pp/gui/customctrl.h.reg.cpp
A source/blender/python/manta_pp/gui/glwidget.cpp
A source/blender/python/manta_pp/gui/glwidget.h
A source/blender/python/manta_pp/gui/glwidget.h.reg
A source/blender/python/manta_pp/gui/glwidget.h.reg.cpp
A source/blender/python/manta_pp/gui/mainwindow.cpp
A source/blender/python/manta_pp/gui/mainwindow.h
A source/blender/python/manta_pp/gui/mainwindow.h.reg
A source/blender/python/manta_pp/gui/mainwindow.h.reg.cpp
A source/blender/python/manta_pp/gui/meshpainter.cpp
A source/blender/python/manta_pp/gui/meshpainter.h
A source/blender/python/manta_pp/gui/meshpainter.h.reg
A source/blender/python/manta_pp/gui/meshpainter.h.reg.cpp
A source/blender/python/manta_pp/gui/moc_customctrl.cxx
A source/blender/python/manta_pp/gui/moc_customctrl.cxx_parameters
A source/blender/python/manta_pp/gui/moc_glwidget.cxx
A source/blender/python/manta_pp/gui/moc_glwidget.cxx_parameters
A source/blender/python/manta_pp/gui/moc_mainwindow.cxx
A source/blender/python/manta_pp/gui/moc_mainwindow.cxx_parameters
A source/blender/python/manta_pp/gui/moc_meshpainter.cxx
A source/blender/python/manta_pp/gui/moc_meshpainter.cxx_parameters
A source/blender/python/manta_pp/gui/moc_painter.cxx
A source/blender/python/manta_pp/gui/moc_painter.cxx_parameters
A source/blender/python/manta_pp/gui/moc_particlepainter.cxx
A source/blender/python/manta_pp/gui/moc_particlepainter.cxx_parameters
A source/blender/python/manta_pp/gui/moc_qtmain.cxx
A source/blender/python/manta_pp/gui/moc_qtmain.cxx_parameters
A source/blender/python/manta_pp/gui/painter.cpp
A source/blender/python/manta_pp/gui/painter.h
A source/blender/python/manta_pp/gui/painter.h.reg
A source/blender/python/manta_pp/gui/painter.h.reg.cpp
A source/blender/python/manta_pp/gui/particlepainter.cpp
A source/blender/python/manta_pp/gui/particlepainter.h
A source/blender/python/manta_pp/gui/particlepainter.h.reg
A source/blender/python/manta_pp/gui/particlepainter.h.reg.cpp
A source/blender/python/manta_pp/gui/qtmain.cpp
A source/blender/python/manta_pp/gui/qtmain.h
A source/blender/python/manta_pp/gui/qtmain.h.reg
A source/blender/python/manta_pp/gui/qtmain.h.reg.cpp
A source/blender/python/manta_pp/hginfo.h
A source/blender/python/manta_pp/kernel.cpp
A source/blender/python/manta_pp/kernel.h
A source/blender/python/manta_pp/kernel.h.reg
A source/blender/python/manta_pp/kernel.h.reg.cpp
A source/blender/python/manta_pp/levelset.cpp
A source/blender/python/manta_pp/levelset.h
A source/blender/python/manta_pp/levelset.h.reg
A source/blender/python/manta_pp/levelset.h.reg.cpp
A source/blender/python/manta_pp/manta.h
A source/blender/python/manta_pp/mesh.cpp
A source/blender/python/manta_pp/mesh.h
A source/blender/python/manta_pp/mesh.h.reg
A source/blender/python/manta_pp/mesh.h.reg.cpp
A source/blender/python/manta_pp/movingobs.cpp
A source/blender/python/manta_pp/movingobs.h
A source/blender/python/manta_pp/movingobs.h.reg
A source/blender/python/manta_pp/movingobs.h.reg.cpp
A source/blender/python/manta_pp/noisefield.cpp
A source/blender/python/manta_pp/noisefield.h
A source/blender/python/manta_pp/noisefield.h.reg
A source/blender/python/manta_pp/noisefield.h.reg.cpp
A source/blender/python/manta_pp/particle.cpp
A source/blender/python/manta_pp/particle.h
A source/blender/python/manta_pp/particle.h.reg
A source/blender/python/manta_pp/particle.h.reg.cpp
A source/blender/python/manta_pp/plugin/advection.cpp
A source/blender/python/manta_pp/plugin/extforces.cpp
A source/blender/python/manta_pp/plugin/initplugins.cpp
A source/blender/python/manta_pp/plugin/kepsilon.cpp
A source/blender/python/manta_pp/plugin/meshplugins.cpp
A source/blender/python/manta_pp/plugin/pressure.cpp
A source/blender/python/manta_pp/plugin/vortexplugins.cpp
A source/blender/python/manta_pp/plugin/waveletturbulence.cpp
A source/blender/python/manta_pp/preprocessor/code.cpp
A source/blender/python/manta_pp/preprocessor/code.h
A source/blender/python/manta_pp/preprocessor/codegen_kernel.cpp
A source/blender/python/manta_pp/preprocessor/codegen_python.cpp
A source/blender/python/manta_pp/preprocessor/main.cpp
A source/blender/python/manta_pp/preprocessor/main.h
A source/blender/python/manta_pp/preprocessor/merge.cpp
A source/blender/python/manta_pp/preprocessor/parse.cpp
A source/blender/python/manta_pp/preprocessor/prep.h
A source/blender/python/manta_pp/preprocessor/tokenize.cpp
A source/blender/python/manta_pp/preprocessor/tokenize.h
A source/blender/python/manta_pp/preprocessor/util.cpp
A source/blender/python/manta_pp/preprocessor/util.h
A source/blender/python/manta_pp/pwrapper/manta.h
A source/blender/python/manta_pp/pwrapper/manta_api.h
A source/blender/python/manta_pp/pwrapper/pclass.cpp
A source/blender/python/manta_pp/pwrapper/pclass.h
A source/blender/python/manta_pp/pwrapper/pconvert.cpp
A source/blender/python/manta_pp/pwrapper/pconvert.h
A source/blender/python/manta_pp/pwrapper/pvec3.cpp
A source/blender/python/manta_pp/pwrapper/pymain.cpp
A source/blender/python/manta_pp/pwrapper/pymain.h
A source/blender/python/manta_pp/pwrapper/pythonInclude.h
A source/blender/python/manta_pp/pwrapper/registry.cpp
A source/blender/python/manta_pp/pwrapper/registry.h
A source/blender/python/manta_pp/python/defines.py
A source/blender/python/manta_pp/python/defines.py.reg
A source/blender/python/manta_pp/python/defines.py.reg.cpp
A source/blender/python/manta_pp/shapes.cpp
A source/blender/python/manta_pp/shapes.h
A source/blender/python/manta_pp/shapes.h.reg
A source/blender/python/manta_pp/shapes.h.reg.cpp
A source/blender/python/manta_pp/test.cpp
A source/blender/python/manta_pp/turbulencepart.cpp
A source/blender/python/manta_pp/turbulencepart.h
A source/blender/python/manta_pp/turbulencepart.h.reg
A source/blender/python/manta_pp/turbulencepart.h.reg.cpp
A source/blender/python/manta_pp/util/integrator.h
A source/blender/python/manta_pp/util/interpol.h
A source/blender/python/manta_pp/util/interpolHigh.h
A source/blender/python/manta_pp/util/mcubes.h
A source/blender/python/manta_pp/util/quaternion.h
A source/blender/python/manta_pp/util/randomstream.h
A source/blender/python/manta_pp/util/solvana.h
A source/blender/python/manta_pp/util/vectorbase.cpp
A source/blender/python/manta_pp/util/vectorbase.h
A source/blender/python/manta_pp/vortexfilament.cpp
A source/blender/python/manta_pp/vortexfilament.h
A source/blender/python/manta_pp/vortexpart.cpp
A source/blender/python/manta_pp/vortexpart.h
A source/blender/python/manta_pp/vortexpart.h.reg
A source/blender/python/manta_pp/vortexpart.h.reg.cpp
A source/blender/python/manta_pp/vortexsheet.cpp
A source/blender/python/manta_pp/vortexsheet.h
A source/blender/python/manta_pp/vortexsheet.h.reg
A source/blender/python/manta_pp/vortexsheet.h.reg.cpp
M source/blenderplayer/CMakeLists.txt
M source/creator/CMakeLists.txt
===================================================================
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index d0e072f..9878072 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -30,7 +30,7 @@ add_subdirectory(colamd)
add_subdirectory(rangetree)
add_subdirectory(wcwidth)
add_subdirectory(libmv)
-add_subdirectory(manta_pp)
+#add_subdirectory(manta_pp)
if(WITH_BULLET)
if(NOT WITH_SYSTEM_BULLET)
diff --git a/extern/SConscript b/extern/SConscript
index 74acd35..164b773 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -7,7 +7,7 @@ SConscript(['colamd/SConscript'])
SConscript(['rangetree/SConscript'])
SConscript(['wcwidth/SConscript'])
SConscript(['libmv/SConscript'])
-SConscript(['manta_pp/SConscript'])
+#SConscript(['manta_pp/SConscript'])
if env['WITH_BF_GAMEENGINE']:
SConscript(['recastnavigation/SConscript'])
diff --git a/extern/manta_pp/pwrapper/registry.cpp b/extern/manta_pp/pwrapper/registry.cpp
deleted file mode 100644
index 0880b88..0000000
--- a/extern/manta_pp/pwrapper/registry.cpp
+++ /dev/null
@@ -1,683 +0,0 @@
-/******************************************************************************
- *
- * MantaFlow fluid solver framework
- * Copyright 2011-2014 Tobias Pfaff, Nils Thuerey
- *
- * This program is free software, distributed under the terms of the
- * GNU General Public License (GPL)
- * http://www.gnu.org/licenses
- *
- * Auto python registry
- *
- ******************************************************************************/
-
-#include "pythonInclude.h"
-#include "structmember.h"
-#include "manta.h"
-#include "registry.h"
-using namespace std;
-
-const string gDefaultModuleName = "manta";
-
-namespace Pb {
-
-//******************************************************************************
-// Custom object definition
-
-struct Method {
- Method(const string& n, const string& d, GenericFunction f) : name(n), doc(d), func(f) {}
- string name, doc;
- GenericFunction func;
-
- PyMethodDef def() {
- PyMethodDef def = {&name[0], (PyCFunction)func, METH_VARARGS | METH_KEYWORDS, &doc[0]};
- return def;
- }
-};
-struct GetSet {
- GetSet() : getter(0),setter(0) {}
- GetSet(const string& n, const string& d, Getter g, Setter s) : name(n), doc(d), getter(g), setter(s) {}
- string name, doc;
- Getter getter;
- Setter setter;
-
- PyGetSetDef def() {
- PyGetSetDef def = {&name[0], getter, setter, &doc[0], NULL};
- return def;
- }
-};
-
-struct ClassData {
- string cName, pyName;
- string cPureName, cTemplate;
- InitFunc init;
- PyTypeObject typeInfo;
- PyNumberMethods numInfo;
- //PySequenceMethods seqInfo;
- vector<Method> methods;
- map<string,GetSet> getset;
- map<string,OperatorFunction> ops;
- ClassData* baseclass;
- string baseclassName;
- Constructor constructor;
-
- vector<PyMethodDef> genMethods;
- vector<PyGetSetDef> genGetSet;
-};
-
-struct PbObject {
- PyObject_HEAD
- Manta::PbClass *instance;
- ClassData *classdef;
-};
-
-//******************************************************
-// Internal wrapper class
-
-//! Registers all classes and methods exposed to Python.
-/*! This class is only used internally by Pb:: framwork.
- * Please use the functionality of PbClass to lookup and translate pointers. */
-class WrapperRegistry {
-public:
- static WrapperRegistry& instance();
- void addClass(const std::string& name, const std::string& internalName, const std::string& baseclass);
- void addExternalInitializer(InitFunc func);
- void addMethod(const std::string& classname, const std::string& methodname, GenericFunction method);
- void addOperator(const std::string& classname, const std::string& methodname, OperatorFunction method);
- void addConstructor(const std::string& classname, Constructor method);
- void addGetSet(const std::string& classname, const std::string& property, Getter getfunc, Setter setfunc);
- void addPythonPath(const std::string& path);
- void addPythonCode(const std::string& file, const std::string& code);
- PyObject* createPyObject(const std::string& classname, const std::string& name, Manta::PbArgs& args, Manta::PbClass *parent);
- void construct(const std::string& scriptname, const vector<string>& args);
- void cleanup();
- void renameObjects();
- void runPreInit();
- PyObject* initModule();
- ClassData* lookup(const std::string& name);
- bool canConvert(ClassData* from, ClassData* to);
- PyThreadState *state;
- /*blender integration*/
- PyGILState_STATE mMainGilState;
- PyThreadState* mOldThreadState;
- PyThreadState* mNewThreadState;
- PyThreadState* mSubThreadState;
- PyGILState_STATE mSubGilState;
-
-private:
- ClassData* getOrConstructClass(const string& name);
- void registerBaseclasses();
- void registerDummyTypes();
- void registerMeta();
- void addConstants(PyObject* module);
- void registerOperators(ClassData* cls);
- void addParentMethods(ClassData* cls, ClassData* base);
- WrapperRegistry();
- std::map<std::string, ClassData*> mClasses;
- std::vector<ClassData*> mClassList;
- std::vector<InitFunc> mExtInitializers;
- std::vector<std::string> mPaths;
- std::string mCode, mScriptName;
- std::vector<std::string> args;
-};
-
-//******************************************************************************
-// Callback functions
-
-PyObject* cbGetClass(PbObject* self, void* cl) {
- return Manta::toPy(self->classdef->cPureName);
-}
-
-PyObject* cbGetTemplate(PbObject* self, void* cl) {
- return Manta::toPy(self->classdef->cTemplate);
-}
-
-PyObject* cbGetCName(PbObject* self, void* cl) {
- return Manta::toPy(self->classdef->cName);
-}
-
-void cbDealloc(PbObject* self) {
- //cout << "dealloc " << self->instance->getName() << " " << self->classdef->cName << endl;
- if (self->instance) {
- // don't delete top-level objects
- if (self->instance->getParent() != self->instance)
- delete self->instance;
- }
- Py_TYPE(self)->tp_free((PyObject*)self);
-}
-
-PyObject* cbNew(PyTypeObject *type, PyObject *args, PyObject *kwds) {
- PbObject *self = (PbObject*) type->tp_alloc(type, 0);
- if (self != NULL) {
- // lookup and link classdef
- self->classdef = WrapperRegistry::instance().lookup(type->tp_name);
- self->instance = NULL;
- //cout << "creating " << self->classdef->cName << endl;
- } else
- errMsg("can't allocate new python class object");
- return (PyObject*) self;
-}
-
-int cbDisableConstructor(PyObject* self, PyObject* args, PyObject* kwds) {
- errMsg("Can't instantiate a class template without template arguments");
- return -1;
-}
-
-PyMODINIT_FUNC PyInit_Main(void) {
-#if PY_MAJOR_VERSION >= 3
- return WrapperRegistry::instance().initModule();
-#else
- WrapperRegistry::instance().initModule();
-#endif
-}
-
-//******************************************************
-// WrapperRegistry
-
-WrapperRegistry::WrapperRegistry() {
- addClass("__modclass__", "__modclass__" , "");
- addClass("PbClass", "PbClass", "");
-}
-
-ClassData* WrapperRegistry::getOrConstructClass(const string& classname) {
- map<string,ClassData*>::iterator it = mClasses.find(classname);
-
- if (it != mClasses.end())
- return it->second;
- ClassData* data = new ClassData;
- data->cName = classname;
- data->cPureName = classname;
- data->cTemplate = "";
- size_t tplIdx = classname.find('<');
- if (tplIdx != string::npos) {
- data->cPureName = classname.substr(0,tplIdx);
- data->cTemplate = classname.substr(tplIdx+1, classname.find('>')-tplIdx-1);
- }
- data->baseclass = NULL;
- data->constructor = cbDisableConstructor;
- mClasses[classname] = data;
- mClassList.push_back(data);
- return data;
-}
-
-void replaceAll(string& source, string const& find, string const& replace) {
- for(string::size_type i = 0; (i = source.find(find, i)) != std::string::npos;)
- {
- source.replace(i, find.length(), replace);
- i += replace.length() - find.length() + 1;
- }
-}
-
-void WrapperRegistry::addClass(const string& pyName, const string& internalName, const string& baseclass) {
- ClassData* data = getOrConstructClass(internalName);
-
- // regularize python name
- string pythonName = pyName;
- replaceAll(pythonName, "<", "_");
- replaceAll(pythonName, ">", "");
- replaceAll(pythonName, ",", "_");
-
- if (data->pyName.empty())
- data->pyName = pythonName;
- mClasses[pythonName] = data;
- if (!baseclass.empty())
- data->baseclassName = baseclass;
-}
-
-void WrapperRegistry::addExternalInitializer(InitFunc func) {
- mExtInitializers.push_back(func);
-}
-
-void WrapperRegistry::addPythonPath(const string& path) {
- mPaths.push_back(path);
-}
-
-void WrapperRegistry::addPythonCode(const string& file, const string& code) {
- mCode += code + "\n";
-}
-
-void WrapperRegistry::addGetSet(const string& classname, const string& property, Getter getfunc, Setter setfunc) {
- ClassData* classdef = getOrConstructClass(classname);
- GetSet& def = classdef->getset[property];
- if (def.name.empty()) {
- def.name = property;
- def.doc = property;
- }
- if (getfunc) def.getter = getfunc;
- if (setfunc) def.setter = setfunc;
-}
-
-void WrapperRegistry::addMethod(const string& classname, const string& methodname, GenericFunction func) {
- string aclass = classname;
- if (aclass.empty())
- aclass = "__modclass__";
-
- ClassData* classdef = getOrConstructClass(aclass);
- for(int i=0; i<(int)classdef->methods.size(); i++)
- if (classdef->methods[i].name == methodname) return; // avoid duplicates
- classdef->methods.push_back(Method(methodname,methodname,func));
-}
-
-void WrapperRegistry::addOperator(const string& classname, const string& methodname, OperatorFunction func) {
- if (classname.empty())
- errMsg("PYTHON operators have to be defined within classes.");
-
- string op = methodname.substr(8);
- ClassData* classdef = getOrConstructClass(classname);
- classdef->ops[op] = func;
-}
-
-void WrapperRegistry::addConstructor(const string& classname, Constructor func) {
- ClassData* classdef = getOrConstructClass(classname);
- classdef->constructor = func;
-}
-
-void WrapperRegistry::addParentMethods(ClassData* cur, ClassData* base) {
- if (base == 0) return;
-
- for (vector<Method>::iterator it = base->methods.begin(); it != base->methods.end(); ++it)
- addMethod(cur->cName, it->name, it->func);
-
- for (map<string,GetSet>::iterator it = base->getset.begin(); it != base->getset.end(); ++it)
- addGetSet(cur->c
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list