diff options
Diffstat (limited to 'source/blender')
23 files changed, 122 insertions, 633 deletions
diff --git a/source/blender/freestyle/intern/app_blender/AppConfig.cpp b/source/blender/freestyle/intern/app_blender/AppConfig.cpp index de4b71c5241..a2fa8787fa9 100755 --- a/source/blender/freestyle/intern/app_blender/AppConfig.cpp +++ b/source/blender/freestyle/intern/app_blender/AppConfig.cpp @@ -18,6 +18,8 @@ // /////////////////////////////////////////////////////////////////////////////// +#include "test_config.h" + #include "AppConfig.h" #include <iostream> @@ -33,8 +35,7 @@ namespace Config{ // get the root directory //soc //setRootDir(getEnvVar("FREESTYLE_BLENDER_DIR")); - setRootDir("/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle"); - cout << _PythonPath << endl; + setRootDir( TEST_ROOT_DIR ); //setRootDir(QString(".")); _pInstance = this; diff --git a/source/blender/freestyle/intern/app_blender/AppGLWidget.h b/source/blender/freestyle/intern/app_blender/AppGLWidget.h index 492fafc883a..3cf7844876d 100755 --- a/source/blender/freestyle/intern/app_blender/AppGLWidget.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget.h @@ -48,9 +48,9 @@ using namespace std; //# include <QGLViewer/qglviewer.h> //soc -#include "camera.h" -#include "vec.h" -#include "quaternion.h" +#include "AppGLWidget_camera.h" +#include "AppGLWidget_vec.h" +#include "AppGLWidget_quaternion.h" using namespace Geometry; diff --git a/source/blender/freestyle/intern/app_blender/camera.cpp b/source/blender/freestyle/intern/app_blender/AppGLWidget_camera.cpp index 25af0550e6c..23c3b2f09a4 100644 --- a/source/blender/freestyle/intern/app_blender/camera.cpp +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_camera.cpp @@ -23,7 +23,7 @@ *****************************************************************************/ -#include "camera.h" +#include "AppGLWidget_camera.h" //#include "qglviewer.h" using namespace std; diff --git a/source/blender/freestyle/intern/app_blender/camera.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_camera.h index d6dad1dd895..cd349803712 100644 --- a/source/blender/freestyle/intern/app_blender/camera.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_camera.h @@ -26,7 +26,7 @@ #ifndef QGLVIEWER_CAMERA_H #define QGLVIEWER_CAMERA_H -#include "manipulatedCameraFrame.h" +#include "AppGLWidget_manipulatedCameraFrame.h" /*! \brief A perspective or orthographic camera. \class Camera camera.h QGLViewer/camera.h diff --git a/source/blender/freestyle/intern/app_blender/config.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_config.h index c1b65aad560..c2fc1b092e1 100644 --- a/source/blender/freestyle/intern/app_blender/config.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_config.h @@ -18,7 +18,7 @@ using namespace std; -#include "point.h" +#include "AppGLWidget_point.h" # ifdef WIN32 # include <windows.h> diff --git a/source/blender/freestyle/intern/app_blender/constraint.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_constraint.h index 871cb2be098..64e8d333d74 100644 --- a/source/blender/freestyle/intern/app_blender/constraint.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_constraint.h @@ -26,8 +26,8 @@ #ifndef QGLVIEWER_CONSTRAINT_H #define QGLVIEWER_CONSTRAINT_H -#include "vec.h" -#include "quaternion.h" +#include "AppGLWidget_vec.h" +#include "AppGLWidget_quaternion.h" //namespace qglviewer { class Frame; diff --git a/source/blender/freestyle/intern/app_blender/frame.cpp b/source/blender/freestyle/intern/app_blender/AppGLWidget_frame.cpp index 26c2ee5d2b4..8fb17a7c1c6 100644 --- a/source/blender/freestyle/intern/app_blender/frame.cpp +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_frame.cpp @@ -23,7 +23,7 @@ *****************************************************************************/ -#include "frame.h" +#include "AppGLWidget_frame.h" #include <math.h> //using namespace qglviewer; @@ -653,7 +653,7 @@ void Frame::setReferenceFrame(const Frame* const refFrame) cout << "Frame::setReferenceFrame would create a loop in Frame hierarchy" << endl; else { - bool identical = (referenceFrame_ == refFrame); + //bool identical = (referenceFrame_ == refFrame); referenceFrame_ = refFrame; } } diff --git a/source/blender/freestyle/intern/app_blender/frame.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_frame.h index 1ff3d91f75c..30297499285 100644 --- a/source/blender/freestyle/intern/app_blender/frame.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_frame.h @@ -26,7 +26,7 @@ #ifndef QGLVIEWER_FRAME_H #define QGLVIEWER_FRAME_H -#include "constraint.h" +#include "AppGLWidget_constraint.h" // #include "GL/gl.h" is now included in config.h for ease of configuration //namespace qglviewer { diff --git a/source/blender/freestyle/intern/app_blender/manipulatedCameraFrame.cpp b/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedCameraFrame.cpp index c4e2e67b26a..7b52b90eedc 100644 --- a/source/blender/freestyle/intern/app_blender/manipulatedCameraFrame.cpp +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedCameraFrame.cpp @@ -23,8 +23,8 @@ *****************************************************************************/ -#include "manipulatedCameraFrame.h" -#include "camera.h" +#include "AppGLWidget_manipulatedCameraFrame.h" +#include "AppGLWidget_camera.h" //#include "qglviewer.h" // #if QT_VERSION >= 0x040000 diff --git a/source/blender/freestyle/intern/app_blender/manipulatedCameraFrame.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedCameraFrame.h index 3c28edab622..df9d8f8e7e3 100644 --- a/source/blender/freestyle/intern/app_blender/manipulatedCameraFrame.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedCameraFrame.h @@ -26,7 +26,7 @@ #ifndef QGLVIEWER_MANIPULATED_CAMERA_FRAME_H #define QGLVIEWER_MANIPULATED_CAMERA_FRAME_H -#include "manipulatedFrame.h" +#include "AppGLWidget_manipulatedFrame.h" //namespace qglviewer { /*! \brief The ManipulatedCameraFrame class represents a ManipulatedFrame with Camera specific mouse bindings. diff --git a/source/blender/freestyle/intern/app_blender/manipulatedFrame.cpp b/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedFrame.cpp index 6721204383d..31243308472 100644 --- a/source/blender/freestyle/intern/app_blender/manipulatedFrame.cpp +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedFrame.cpp @@ -23,9 +23,9 @@ *****************************************************************************/ -#include "manipulatedFrame.h" +#include "AppGLWidget_manipulatedFrame.h" //#include "qglviewer.h" -#include "camera.h" +#include "AppGLWidget_camera.h" //using namespace qglviewer; using namespace std; diff --git a/source/blender/freestyle/intern/app_blender/manipulatedFrame.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedFrame.h index 8ad815f0a63..4dfc82c672a 100644 --- a/source/blender/freestyle/intern/app_blender/manipulatedFrame.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedFrame.h @@ -26,7 +26,7 @@ #ifndef QGLVIEWER_MANIPULATED_FRAME_H #define QGLVIEWER_MANIPULATED_FRAME_H -#include "frame.h" +#include "AppGLWidget_frame.h" //namespace qglviewer { /*! \brief A ManipulatedFrame is a Frame that can be rotated and translated using the mouse. diff --git a/source/blender/freestyle/intern/app_blender/point.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_point.h index 81903f174a8..81903f174a8 100644 --- a/source/blender/freestyle/intern/app_blender/point.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_point.h diff --git a/source/blender/freestyle/intern/app_blender/quaternion.cpp b/source/blender/freestyle/intern/app_blender/AppGLWidget_quaternion.cpp index 3dd42ed6ed3..77219cdce1a 100644 --- a/source/blender/freestyle/intern/app_blender/quaternion.cpp +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_quaternion.cpp @@ -23,7 +23,7 @@ *****************************************************************************/ -#include "quaternion.h" +#include "AppGLWidget_quaternion.h" #include <stdlib.h> // RAND_MAX // All the methods are declared inline in Quaternion.h diff --git a/source/blender/freestyle/intern/app_blender/quaternion.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_quaternion.h index e3bc876aa4c..e6242e908b1 100644 --- a/source/blender/freestyle/intern/app_blender/quaternion.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_quaternion.h @@ -26,8 +26,8 @@ #ifndef QGLVIEWER_QUATERNION_H #define QGLVIEWER_QUATERNION_H -#include "config.h" -#include "vec.h" +#include "AppGLWidget_config.h" +#include "AppGLWidget_vec.h" /*! \brief The Quaternion class represents 3D rotations and orientations. \class Quaternion quaternion.h QGLViewer/quaternion.h diff --git a/source/blender/freestyle/intern/app_blender/vec.cpp b/source/blender/freestyle/intern/app_blender/AppGLWidget_vec.cpp index a44dd1ed6ed..2fad849238d 100644 --- a/source/blender/freestyle/intern/app_blender/vec.cpp +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_vec.cpp @@ -23,7 +23,7 @@ *****************************************************************************/ -#include "vec.h" +#include "AppGLWidget_vec.h" // Most of the methods are declared inline in vec.h using namespace std; diff --git a/source/blender/freestyle/intern/app_blender/vec.h b/source/blender/freestyle/intern/app_blender/AppGLWidget_vec.h index ff17917fac8..47643a19e8e 100644 --- a/source/blender/freestyle/intern/app_blender/vec.h +++ b/source/blender/freestyle/intern/app_blender/AppGLWidget_vec.h @@ -26,7 +26,7 @@ #ifndef QGLVIEWER_VEC_H #define QGLVIEWER_VEC_H -#include "config.h" +#include "AppGLWidget_config.h" // #include <qapplication.h> diff --git a/source/blender/freestyle/intern/app_blender/Controller.cpp b/source/blender/freestyle/intern/app_blender/Controller.cpp index 9401f1ae281..25d9653b8f4 100755 --- a/source/blender/freestyle/intern/app_blender/Controller.cpp +++ b/source/blender/freestyle/intern/app_blender/Controller.cpp @@ -108,6 +108,8 @@ Controller::Controller() _ComputeSteerableViewMap = false; _ComputeSuggestive = true; _sphereRadius = 1.0; + + init_options(); } Controller::~Controller() @@ -1053,3 +1055,66 @@ void Controller::displayDensityCurves(int x, int y){ // _pDensityCurvesWindow->SetLevelCurve(i, Vec2d(0,0), Vec2d(nbCurves, 1), curvesDirection[i], "orientation", "density"); // _pDensityCurvesWindow->show(); } + +void Controller::init_options(){ +// //from AppOptionsWindow.cpp +// +// // Directories +// ViewMapIO::Options::setModelsPath((const char*)modelsPathLineEdit->text().toAscii().data()); +// PythonInterpreter::Options::setPythonPath((const char*)pythonPathLineEdit->text().toAscii().data()); +// TextureManager::Options::setPatternsPath((const char*)patternsPathLineEdit->text().toAscii().data()); +// TextureManager::Options::setBrushesPath((const char*)brushesPathLineEdit->text().toAscii().data()); +// //g_pController->setBrowserCmd(browserCmdLineEdit->text()); +// //g_pController->setHelpIndex(helpIndexPathLineEdit->text()); +// +// // ViewMap Format +// if (asFloatCheckBox->isChecked()) +// ViewMapIO::Options::addFlags(ViewMapIO::Options::FLOAT_VECTORS); +// else +// ViewMapIO::Options::rmFlags(ViewMapIO::Options::FLOAT_VECTORS); +// if (noOccluderListCheckBox->isChecked()) +// ViewMapIO::Options::addFlags(ViewMapIO::Options::NO_OCCLUDERS); +// else +// ViewMapIO::Options::rmFlags(ViewMapIO::Options::NO_OCCLUDERS); +// g_pController->setComputeSteerableViewMapFlag(steerableViewMapCheckBox->isChecked()); +// +// // Visibility +// if (qiCheckBox->isChecked()) +// g_pController->setQuantitativeInvisibility(true); +// else +// g_pController->setQuantitativeInvisibility(false); +// +// // Papers Textures +// vector<string> sl; +// for (unsigned i = 0; i < paperTexturesList->count(); i++) { +// sl.push_back(paperTexturesList->item(i)->text().toAscii().constData()); +// } +// TextureManager::Options::setPaperTextures(sl); +// +// // Drawing Buffers +// if (frontBufferCheckBox->isChecked()) +// g_pController->setFrontBufferFlag(true); +// else +// g_pController->setFrontBufferFlag(false); +// if (backBufferCheckBox->isChecked()) +// g_pController->setBackBufferFlag(true); +// else +// g_pController->setBackBufferFlag(false); +// +// // Ridges and Valleys +// g_pController->setComputeRidgesAndValleysFlag(ridgeValleyCheckBox->isChecked()); +// // Suggestive Contours +// g_pController->setComputeSuggestiveContoursFlag(suggestiveContoursCheckBox->isChecked()); +// bool ok; +// real r = sphereRadiusLineEdit->text().toFloat(&ok); +// if(ok) +// g_pController->setSphereRadius(r); +// else +// sphereRadiusLineEdit->setText(QString(QString::number(g_pController->getSphereRadius()))); +// r = krEpsilonLineEdit->text().toFloat(&ok); +// if(ok) +// g_pController->setSuggestiveContourKrDerivativeEpsilon(r); +// else +// krEpsilonLineEdit->setText(QString(QString::number(g_pController->getSuggestiveContourKrDerivativeEpsilon()))); +// } +} diff --git a/source/blender/freestyle/intern/app_blender/Controller.h b/source/blender/freestyle/intern/app_blender/Controller.h index 5727db5705a..77f28071791 100755 --- a/source/blender/freestyle/intern/app_blender/Controller.h +++ b/source/blender/freestyle/intern/app_blender/Controller.h @@ -59,6 +59,9 @@ public: void SetView(AppGLWidget *iView); + //soc + void init_options(); + int Load3DSFile(const char *iFileName); void CloseFile(); void LoadViewMapFile(const char *iFileName, bool only_camera = false); diff --git a/source/blender/freestyle/intern/app_blender/api.cpp b/source/blender/freestyle/intern/app_blender/api.cpp index 0601ce191f9..5f3d8224ec5 100644 --- a/source/blender/freestyle/intern/app_blender/api.cpp +++ b/source/blender/freestyle/intern/app_blender/api.cpp @@ -2,6 +2,7 @@ #include "AppGLWidget.h" #include "Controller.h" #include "AppConfig.h" +#include "test_config.h" #include <iostream> @@ -20,13 +21,13 @@ extern "C" { c->SetView(view); - c->Load3DSFile( "/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle/data/models/teapot.3DS" ); + c->Load3DSFile( TEST_3DS_FILE ); - c->InsertStyleModule( 0, "/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules/contour.py" ); + c->InsertStyleModule( 0, TEST_STYLE_MODULE_FILE ); c->toggleLayer(0, true); c->ComputeViewMap(); - //c->DrawStrokes(); + c->DrawStrokes(); cout << "Freestyle end" << endl; diff --git a/source/blender/freestyle/intern/app_blender/old_camera_vec_quaternion.txt b/source/blender/freestyle/intern/app_blender/old_camera_vec_quaternion.txt deleted file mode 100644 index 0d10049ee15..00000000000 --- a/source/blender/freestyle/intern/app_blender/old_camera_vec_quaternion.txt +++ /dev/null @@ -1,593 +0,0 @@ -// -// Filename : AppConfig.h -// Author : Stephane Grabli -// Purpose : Configuration file -// Date of creation : 26/02/2003 -// -/////////////////////////////////////////////////////////////////////////////// - -// -// Copyright (C) : Please refer to the COPYRIGHT file distributed -// with this source distribution. -// -// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef ARTGLWIDGET_H -# define ARTGLWIDGET_H - -# ifndef WIN32 -# include <algorithm> -using namespace std; -# define __min(x,y) (min(x,y)) -# define __max(x,y) (max(x,y)) -# endif // WIN32 - - -//# include <qstringlist.h> -# include "../geometry/Geom.h" -# include "../geometry/BBox.h" -# include "../scene_graph/NodeDrawingStyle.h" -# include "../system/TimeUtils.h" -# include "../system/Precision.h" -# include "AppConfig.h" -# include "../rendering/GLDebugRenderer.h" -//# include <QGLViewer/qglviewer.h> - -using namespace Geometry; - -typedef enum {SURFACIC, LINE, DEPTHBUFFER} RenderStyle; - -class FEdge; -class QMainWindow; -class GLRenderer; -class GLSelectRenderer; -class GLBBoxRenderer; -class GLMonoColorRenderer; -class GLDebugRenderer; - -class Vec{ -public: - Vec() {}; - Vec(float _x, float _y, float _z): x(_x), y(_y), z(_z) {}; - ~Vec() {} - - float operator[] (unsigned i) { - switch(i){ - case 0: return x; break; - case 1: return y; break; - case 2: return z; break; - } - return 0.0; - } - - - float x,y,z; -}; - -class Quaternion{ -public: - Quaternion( float _x, float _y, float _z, float _s): x(_x), y(_y), z(_z), s(_s){}; - ~Quaternion() {} - - float operator[] (unsigned i) { - switch(i){ - case 0: return x; break; - case 1: return y; break; - case 2: return z; break; - case 3: return s; break; - } - return 0.0; - } - - float x,y,z,s; -}; - -class Camera { - private: - float _position[3]; - float _orientation[3]; - - public: - Camera(){}; - ~Camera() {}; - - void setZNearCoefficient(float f) {} - void playPath(int i) {} - - void loadProjectionMatrix() {} - void loadModelViewMatrix() {} - real distanceToSceneCenter() { return 0;} - void showEntireScene() {} - real zFar() {return 0;} - real zNear() {return 0;} - void setPosition(Vec v) {} - void setOrientation(Quaternion q) {} - float* position() { return _position; } - float* orientation() { return _orientation; } - void getWorldCoordinatesOf(float *src, float *vp_tmp) {} - -}; - - -//class AppGLWidget : public QGLViewer -class AppGLWidget -{ - //Q_OBJECT - - -public: - - AppGLWidget(const char *iName = 0); - virtual ~AppGLWidget(); - -public: - - inline void swapBuffers() {} - inline void updateGL() {} - inline void makeCurrent() {} - inline void setSceneBoundingBox(Vec &min_, Vec &max_) {} - inline void saveSnapshot(bool b) {} - inline real width() { return _width; } - inline real height() { return _height; } - void setStateFileName(const string& name) { stateFileName_ = name; }; - - -Camera * _camera; - - // captures a frame animation that was previously registered - void captureMovie(); - - /*! Sets the rendering style. - iStyle - The style used to render. Can be: - SURFACIC : usual rendering - LINES : line rendering - DEPTHBUFFER : grey-levels rendering of the depth buffer - */ - inline void SetRenderStyle(RenderStyle iStyle) - { - _RenderStyle = iStyle; - } - - /*! Sets the model to draw in the viewer - * iModel - * The Root Node of the model - */ - inline void SetModel(NodeGroup *iModel) - { - if(0 != _ModelRootNode->numberOfChildren()) - { - _ModelRootNode->DetachChildren(); - _ModelRootNode->clearBBox(); - } - - AddModel(iModel); - } - - /*! Adds a model for displaying in the viewer */ - inline void AddModel(NodeGroup *iModel) - { - _ModelRootNode->AddChild(iModel); - - _ModelRootNode->UpdateBBox(); - - _minBBox = __min(__min(_ModelRootNode->bbox().getMin()[0], - _ModelRootNode->bbox().getMin()[1]), - _ModelRootNode->bbox().getMin()[2]); - _maxBBox = __max(__max(_ModelRootNode->bbox().getMax()[0], - _ModelRootNode->bbox().getMax()[1]), - _ModelRootNode->bbox().getMax()[2]); - - _maxAbs = __max(rabs(_minBBox), rabs(_maxBBox)); - - _minAbs = __min(rabs(_minBBox), rabs(_maxBBox)); - - // DEBUG: - ReInitRenderers(); - - } - - inline void AddSilhouette(NodeGroup* iSilhouette) - { - _SilhouetteRootNode->AddChild(iSilhouette); - //ToggleSilhouette(true); - updateGL(); - } - - inline void Add2DSilhouette(NodeGroup *iSilhouette) - { - //_pFENode->AddChild(iSilhouette); - //ToggleSilhouette(true); - updateGL(); - } - - inline void Add2DVisibleSilhouette(NodeGroup *iVSilhouette) - { - //_pVisibleSilhouetteNode->AddChild(iVSilhouette); - updateGL(); - } - - inline void SetDebug(NodeGroup* iDebug) - { - if(0 != _DebugRootNode->numberOfChildren()) - { - _DebugRootNode->DetachChildren(); - _DebugRootNode->clearBBox(); - } - - AddDebug(iDebug); - } - - inline void AddDebug(NodeGroup* iDebug) - { - _DebugRootNode->AddChild(iDebug); - updateGL(); - } - - inline void DetachModel(Node *iModel) - { - _ModelRootNode->DetachChild(iModel); - _ModelRootNode->UpdateBBox(); - - _minBBox = __min(__min(_ModelRootNode->bbox().getMin()[0], - _ModelRootNode->bbox().getMin()[1]), - _ModelRootNode->bbox().getMin()[2]); - _maxBBox = __max(__max(_ModelRootNode->bbox().getMax()[0], - _ModelRootNode->bbox().getMax()[1]), - _ModelRootNode->bbox().getMax()[2]); - - _maxAbs = __max(rabs(_minBBox), rabs(_maxBBox)); - _minAbs = __min(rabs(_minBBox), rabs(_maxBBox)); - } - - inline void DetachModel() - { - _ModelRootNode->DetachChildren(); - _ModelRootNode->clearBBox(); - - // 2D Scene - //_p2DNode.DetachChildren(); - //_pFENode->DetachChildren(); - //_pVisibleSilhouetteNode->DetachChildren(); - updateGL(); - } - - inline void DetachSilhouette() - { - _SilhouetteRootNode->DetachChildren(); - //_pFENode->DetachChildren(); - //_pVisibleSilhouetteNode->DetachChildren(); - _p2DSelectionNode->destroy(); - //updateGL(); //FIXME - } - - inline void DetachVisibleSilhouette() - { - //_pVisibleSilhouetteNode->DetachChildren(); - _p2DSelectionNode->destroy(); - updateGL(); - } - - inline void DetachDebug() - { - _DebugRootNode->DetachChildren(); - updateGL(); - } - - void SetMainWindow(QMainWindow *iMainWindow) ; - - inline void Set3DContext() - { - // GL_PROJECTION matrix - _camera->loadProjectionMatrix(); - // GL_MODELVIEW matrix - _camera->loadModelViewMatrix(); - } - - inline void RetriveModelViewMatrix(float *p) - { - makeCurrent(); - glGetFloatv(GL_MODELVIEW_MATRIX, p); - } - inline void RetriveModelViewMatrix(real *p) - { - makeCurrent(); - glGetDoublev(GL_MODELVIEW_MATRIX, p); - } - - inline void RetrieveProjectionMatrix(float *p) - { - makeCurrent(); - glGetFloatv(GL_PROJECTION_MATRIX, p); - - } - inline void RetrieveProjectionMatrix(real *p) - { - makeCurrent(); - glGetDoublev(GL_PROJECTION_MATRIX, p); - - } - - inline void RetrieveViewport(int *p) - { - makeCurrent(); - glGetIntegerv(GL_VIEWPORT,(GLint *)p); - } - - inline real GetFocalLength() const - { - real Near = __max(0.1,(real)(-2.f*_maxAbs+_camera->distanceToSceneCenter())); - return Near; - } - - inline real GetAspect() const - { - return ((real) _width/(real) _height); - } - - inline real GetFovyRadian() const - { - return _Fovy/180.0 * M_PI; - } - - inline real GetFovyDegrees() const - { - return _Fovy; - } - - inline void FitBBox() - { - Vec min_(_ModelRootNode->bbox().getMin()[0], - _ModelRootNode->bbox().getMin()[1], - _ModelRootNode->bbox().getMin()[2]); - Vec max_(_ModelRootNode->bbox().getMax()[0], - _ModelRootNode->bbox().getMax()[1], - _ModelRootNode->bbox().getMax()[2]); - setSceneBoundingBox(min_, max_); - _camera->showEntireScene(); - } - - inline void ToggleSilhouette(bool enabled) - { - _fedges = enabled; - updateGL(); - } - - // Reinit the renderers which need to be informed - // when a model is added to the scene. - void ReInitRenderers(); - - inline void SetSelectedFEdge(FEdge* iFEdge) { _pDebugRenderer->SetSelectedFEdge(iFEdge); } - - inline GLDebugRenderer* debugRenderer() { return _pDebugRenderer; } - inline void toggle3D() { _Draw3DScene == true ? _Draw3DScene = false : _Draw3DScene = true; updateGL();} - - /*! glReadPixels */ - typedef enum{ - RGB, - DEPTH - } PixelFormat; - void readPixels(int x, - int y, - int width, - int height, - PixelFormat format, - float *pixels) - { - makeCurrent(); - //glReadBuffer(GL_FRONT); //in reality: glReadBuffer and glDrawBuffer are both set to GL_BACK - glReadBuffer(GL_BACK); - GLenum glformat; - switch(format) - { - case RGB: - glformat = GL_RGB; - break; - case DEPTH: - glformat = GL_DEPTH_COMPONENT; - break; - default: - break; - } - glReadPixels(x,y,width, height, glformat, GL_FLOAT, (GLfloat*)pixels); - } - - void clear() { makeCurrent(); glClear(GL_COLOR_BUFFER_BIT ); } - - void prepareCanvas(); - void releaseCanvas(); - - typedef enum { - FRONT, - BACK - } GLBuffer; - - void setReadPixelsBuffer(int iBuffer) - { - makeCurrent(); - switch(iBuffer) - { - case FRONT: - glReadBuffer(GL_FRONT); - break; - case BACK: - glReadBuffer(GL_BACK); - break; - default: - break; - } - } - - BBox<Vec3r> scene3DBBox() const { return _ModelRootNode->bbox(); } - - inline real znear() const { - return _camera->zNear(); - } - - inline real zfar() const { - return _camera->zFar(); - } - - inline bool draw3DsceneEnabled() const { return _Draw3DScene; } - - inline bool getRecordFlag() const {return _record;} - - void setCameraState(const float* position, const float* orientation) { - _camera->setPosition(Vec(position[0], position[1], position[2])); - _camera->setOrientation(Quaternion(orientation[0], orientation[1], orientation[2], orientation[3])); - } - - void getCameraState(float* position, float* orientation) const { - float* pos = _camera->position(); - float* orient = _camera->orientation(); - int i; - for(i=0;i<3;++i){ - position[i] = pos[i]; - } - for(i=0;i<4;++i){ - orientation[i] = orient[i]; - } - } - - void saveCameraState() { - getCameraState(_cameraPosition, _cameraOrientation); - _cameraStateSaved = true; - } - - void setUpdateMode(bool b) { - _enableUpdateSilhouettes = b; - } - - bool getUpdateMode() const { - return _enableUpdateSilhouettes; - } - static void setFrontBufferFlag(bool iBool); - static bool getFrontBufferFlag(); - static void setBackBufferFlag(bool iBool); - static bool getBackBufferFlag(); - -protected: - virtual void init(); - virtual void draw(); - - /*! Loads an envmap */ - void LoadEnvMap(const char *filename); - -public: - /*! Core scene drawing */ - void DrawScene(SceneVisitor *iRenderer); - - /*! 2D Scene Drawing */ - void Draw2DScene(SceneVisitor *iRenderer); - - /*! Draws scene silhouettes in real time */ - void DrawSilhouette(); - - /*! Draws the Scene in lines style */ - // void DrawLines(); - // /*! Draws the scene in surfacic style */ - // void DrawSurfacic(); - // /*! Draws the scene as a depth buffer image */ - // void DrawDepthBuffer(); - - GLRenderer* glRenderer() {return _pGLRenderer;} - -protected: - - - //QString shortcutBindingsString() const; - - /*! fabs or abs */ - inline int rabs(int x) {return abs(x);} - inline real rabs(real x) {return fabs(x);} - - -protected: - float _Fovy; - //float _SceneDepth; - //BBox<Vec3f> _BBox; - - RenderStyle _RenderStyle; - - //The root node container - NodeGroup _RootNode; - NodeDrawingStyle *_ModelRootNode; - NodeDrawingStyle *_SilhouetteRootNode; - NodeDrawingStyle *_DebugRootNode; - - bool _silhouette; - bool _fedges; - bool _debug; - bool _selection_mode; - - //a Universal light: - NodeGroup _Light; - - real _minBBox; - real _maxBBox; - real _maxAbs; - - real _minAbs; - bool _drawBBox; - - // OpenGL Renderer - GLRenderer *_pGLRenderer; - GLSelectRenderer *_pSelectRenderer; - GLBBoxRenderer *_pBBoxRenderer; - GLMonoColorRenderer *_pMonoColorRenderer; - GLDebugRenderer *_pDebugRenderer; - - QMainWindow *_pMainWindow; - - Chronometer _Chrono; - - // 2D Scene - bool _Draw2DScene; - bool _Draw3DScene; NodeGroup _p2DNode; - //NodeDrawingStyle *_pFENode; // Feature edges node - //NodeDrawingStyle *_pVisibleSilhouetteNode; - NodeDrawingStyle *_p2DSelectionNode; - - // EnvMap - bool _drawEnvMap; - int _currentEnvMap; - int _maxId; - int _blendFunc; - - // Each time we compute the view map, the camera state is - // saved in order to be able to restore it later - bool _cameraStateSaved; - float _cameraPosition[3]; - float _cameraOrientation[4]; - - // interactive silhouette update - bool _enableUpdateSilhouettes; - //capture movie - bool _captureMovie; - // 2D drawing buffers - static bool _frontBufferFlag; - static bool _backBufferFlag; - - bool _record; - - -real _width, _height; -Vec _min,_max; -string stateFileName_; -}; - -#endif // ARTGLWIDGET_H diff --git a/source/blender/freestyle/intern/app_blender/test_config.h b/source/blender/freestyle/intern/app_blender/test_config.h new file mode 100644 index 00000000000..773ca2f75f5 --- /dev/null +++ b/source/blender/freestyle/intern/app_blender/test_config.h @@ -0,0 +1,6 @@ + +#define TEST_3DS_FILE "/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle/data/models/teapot.3DS" + +#define TEST_STYLE_MODULE_FILE "/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules/contour.py" + +#define TEST_ROOT_DIR "/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle"
\ No newline at end of file diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h index f9a573ffb86..b8eaa4a8a3c 100755 --- a/source/blender/freestyle/intern/system/PythonInterpreter.h +++ b/source/blender/freestyle/intern/system/PythonInterpreter.h @@ -41,11 +41,17 @@ class LIB_SYSTEM_EXPORT PythonInterpreter : public Interpreter PythonInterpreter() { _language = "Python"; - Py_Initialize(); + //Py_Initialize(); + + cout << "Freestyle Python Init: " << endl; + cout << "- is init : " << Py_IsInitialized() << endl; + cout << "- prog path : " << Py_GetProgramFullPath() << endl; + cout << "- mod path : " << Py_GetPath() << endl; + cout << "- version : " << Py_GetVersion() << endl; } virtual ~PythonInterpreter() { - Py_Finalize(); + //Py_Finalize(); } int interpretCmd(const string& cmd) { @@ -88,19 +94,19 @@ private: if (_initialized) return; PyRun_SimpleString("import sys"); - vector<string> pathnames; - StringUtils::getPathName(_path, "", pathnames); - string cmd; - char* c_cmd; - for (vector<string>::const_iterator it = pathnames.begin(); + vector<string> pathnames; + StringUtils::getPathName(_path, "", pathnames); + string cmd; + char* c_cmd; + for (vector<string>::const_iterator it = pathnames.begin(); it != pathnames.end(); ++it) { - cmd = "sys.path.append(\"" + *it + "\")"; - c_cmd = strdup(cmd.c_str()); - PyRun_SimpleString(c_cmd); - free(c_cmd); - } - // PyRun_SimpleString("from Freestyle import *"); + cmd = "sys.path.append(\"" + *it + "\")"; + c_cmd = strdup(cmd.c_str()); + PyRun_SimpleString(c_cmd); + free(c_cmd); + } + PyRun_SimpleString("from Freestyle import *"); _initialized = true; } |