From 09b36970bb584c1c72dd6166f2dde068b09e22bf Mon Sep 17 00:00:00 2001 From: Maxime Curioni Date: Mon, 19 May 2008 05:34:31 +0000 Subject: soc-2008-mxcurioni: uploaded missing files. Still NOT linking so do not use this version yet :( --- .../freestyle/intern/app_blender/AppConfig.cpp | 124 +++++++++++++++++++++ .../freestyle/intern/app_blender/AppConfig.h | 111 ++++++++++++++++++ .../blender/freestyle/intern/app_blender/api.cpp | 21 ++++ 3 files changed, 256 insertions(+) create mode 100755 source/blender/freestyle/intern/app_blender/AppConfig.cpp create mode 100755 source/blender/freestyle/intern/app_blender/AppConfig.h create mode 100644 source/blender/freestyle/intern/app_blender/api.cpp (limited to 'source/blender/freestyle/intern/app_blender') diff --git a/source/blender/freestyle/intern/app_blender/AppConfig.cpp b/source/blender/freestyle/intern/app_blender/AppConfig.cpp new file mode 100755 index 00000000000..baa847322d6 --- /dev/null +++ b/source/blender/freestyle/intern/app_blender/AppConfig.cpp @@ -0,0 +1,124 @@ +// +// 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. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "AppConfig.h" +#include + +#include "../system/StringUtils.h" + +using namespace std; + +namespace Config{ + Path* Path::_pInstance = 0; + Path::Path(){ + // get the home directory + _HomeDir = getEnvVar("HOME"); + // get the root directory + setRootDir(getEnvVar("FREESTYLE_DIR")); + //setRootDir(QString(".")); + _pInstance = this; + } + void Path::setRootDir(const string& iRootDir){ + _ProjectDir = iRootDir; + _ModelsPath = ""; + _PatternsPath = _ProjectDir + + string(DIR_SEP.c_str()) + + "data" + + string(DIR_SEP.c_str()) + + "textures" + + string(DIR_SEP.c_str()) + + "variation_patterns" + + string(DIR_SEP.c_str()); + _BrushesPath = _ProjectDir + + string(DIR_SEP.c_str()) + + "data" + + string(DIR_SEP.c_str()) + + "textures" + + string(DIR_SEP.c_str()) + + "brushes" + + string(DIR_SEP.c_str()); + _PythonPath = _ProjectDir + + string(DIR_SEP.c_str()) + + "python" + + string(PATH_SEP.c_str()) + + _ProjectDir + + string(DIR_SEP.c_str()) + + "style_modules" + + string(DIR_SEP.c_str()) ; + if (getenv("PYTHONPATH")) { + _PythonPath += string(PATH_SEP.c_str()) + string(getenv("PYTHONPATH")); + } +#ifdef WIN32 + _BrowserCmd = "C:\\Program Files\\Internet Explorer\\iexplore.exe %s"; +#else + _BrowserCmd = "mozilla %s"; +#endif + _HelpIndexPath = _ProjectDir + + string(DIR_SEP.c_str()) + + "doc" + + string(DIR_SEP.c_str()) + + "html" + + string(DIR_SEP.c_str()) + + "index.html"; + _PapersDir = _ProjectDir + + string(DIR_SEP.c_str()) + + "data" + + string(DIR_SEP.c_str()) + + "textures" + + string(DIR_SEP.c_str()) + + "papers" + + string(DIR_SEP.c_str()); + _EnvMapDir = _ProjectDir + + string(DIR_SEP.c_str()) + + "data" + + string(DIR_SEP.c_str()) + + "env_map" + + string(DIR_SEP.c_str()); + _MapsDir = _ProjectDir + + string(DIR_SEP.c_str()) + + "data" + + string(DIR_SEP.c_str()) + + "maps" + + string(DIR_SEP.c_str()); + } + void Path::setHomeDir(const string& iHomeDir){ + _HomeDir = iHomeDir; + } + Path::~Path(){ + _pInstance = 0; + } + Path* Path::getInstance() { + return _pInstance; + } + string Path::getEnvVar(const string& iEnvVarName){ + string value; + if (!getenv( StringUtils::toAscii(iEnvVarName).c_str() ) ) { + cerr << "Warning: You may want to set the $"<< StringUtils::toAscii(iEnvVarName) + << " environment variable to use " << string(Config::APPLICATION_NAME) << "." << endl + << " Otherwise, the current directory will be used instead." << endl; + value = "."; + }else{ + value = getenv( StringUtils::toAscii(iEnvVarName).c_str() ); + } + return value; + } + +} // End of namepace Config + diff --git a/source/blender/freestyle/intern/app_blender/AppConfig.h b/source/blender/freestyle/intern/app_blender/AppConfig.h new file mode 100755 index 00000000000..8a6fef746dc --- /dev/null +++ b/source/blender/freestyle/intern/app_blender/AppConfig.h @@ -0,0 +1,111 @@ +// +// Filename : AppConfig.h +// Author : Emmanuel Turquin +// 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 APP_CONFIG_H +# define APP_CONFIG_H + +# include +# include "../system/FreestyleConfig.h" +# include "../system/Precision.h" + +using namespace std; + +namespace Config { + + class Path{ + protected: + static Path * _pInstance; + string _ProjectDir; + string _ModelsPath; + string _PatternsPath; + string _BrushesPath; + string _PythonPath; + string _BrowserCmd; + string _HelpIndexPath; + string _PapersDir; + string _EnvMapDir; + string _MapsDir; + string _HomeDir; + public: + Path(); + virtual ~Path(); + static Path* getInstance(); + + void setRootDir(const string& iRootDir) ; + void setHomeDir(const string& iHomeDir) ; + + const string& getProjectDir() const {return _ProjectDir;} + const string& getModelsPath() const {return _ModelsPath;} + const string& getPatternsPath() const {return _PatternsPath;} + const string& getBrushesPath() const {return _BrushesPath;} + const string& getPythonPath() const {return _PythonPath;} + const string& getBrowserCmd() const {return _BrowserCmd;} + const string& getHelpIndexpath() const {return _HelpIndexPath;} + const string& getPapersDir() const {return _PapersDir;} + const string& getEnvMapDir() const {return _EnvMapDir;} + const string& getMapsDir() const {return _MapsDir;} + const string& getHomeDir() const {return _HomeDir;} + + static string getEnvVar(const string& iEnvVarName); + + }; + + // + // Configuration, default values + // + ////////////////////////////////////////////////////////////// + + // Application + static const string APPLICATION_NAME("APPNAME"); + static const string APPLICATION_VERSION("APPVERSION"); + + // ViewMap + static const string VIEWMAP_EXTENSION("vm"); + static const string VIEWMAP_MAGIC("ViewMap File"); + static const string VIEWMAP_VERSION("1.9"); + + // Style modules + static const string STYLE_MODULE_EXTENSION("py"); + static const string STYLE_MODULES_LIST_EXTENSION("sml"); + + // Options + static const string OPTIONS_DIR("." + APPLICATION_NAME); + static const string OPTIONS_FILE("options.xml"); + static const string OPTIONS_CURRENT_DIRS_FILE("current_dirs.xml"); + static const string OPTIONS_QGLVIEWER_FILE("qglviewer.xml"); + + // Default options + static const real DEFAULT_SPHERE_RADIUS = 1.0; + static const real DEFAULT_DKR_EPSILON = 0.0; + + // Papers + static const string DEFAULT_PAPER_TEXTURE("whitepaper.jpg"); + + +} // End of namepace Config + +#endif // APP_CONFIG_H diff --git a/source/blender/freestyle/intern/app_blender/api.cpp b/source/blender/freestyle/intern/app_blender/api.cpp new file mode 100644 index 00000000000..78ab50a7c4d --- /dev/null +++ b/source/blender/freestyle/intern/app_blender/api.cpp @@ -0,0 +1,21 @@ +#include "Controller.h" +#include + +using namespace std; + +#ifdef __cplusplus +extern "C" { +#endif + + void FRS_execute() { + cout << "Freestyle" << endl; + + Controller *c = new Controller; + + //c->Load3DSFile( "/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle/data/models/teapot.3DS" ); + + } + +#ifdef __cplusplus +} +#endif -- cgit v1.2.3