soc-2008-mxcurioni: uploaded missing files. Still NOT linking so do not use this...
authorMaxime Curioni <maxime.curioni@gmail.com>
Mon, 19 May 2008 05:34:31 +0000 (05:34 +0000)
committerMaxime Curioni <maxime.curioni@gmail.com>
Mon, 19 May 2008 05:34:31 +0000 (05:34 +0000)
source/blender/freestyle/FST_freestyle.h [new file with mode: 0644]
source/blender/freestyle/SConscript
source/blender/freestyle/intern/app_blender/AppConfig.cpp [new file with mode: 0755]
source/blender/freestyle/intern/app_blender/AppConfig.h [new file with mode: 0755]
source/blender/freestyle/intern/app_blender/api.cpp [new file with mode: 0644]

diff --git a/source/blender/freestyle/FST_freestyle.h b/source/blender/freestyle/FST_freestyle.h
new file mode 100644 (file)
index 0000000..5294081
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef FRS_FREESTYLE_H
+#define FRS_FREESTYLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+       
+       void FRS_execute();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 3d9c1d2fd7ce4174594f3156f49095d349129a1a..31a43bac58c0ec776b3ea5ef81f320543e54e814 100644 (file)
@@ -63,8 +63,9 @@ env.BlenderLib (libname="bf_freestyle",
                                sources=sources,
                 includes=Split(incs),
                 defines=defs,
-                               libtype=['player'],
-                priority = [280] )
+                               libtype=['blender'],
+                priority = [25]
+ )
 
 ########################################################
 # SWIG
diff --git a/source/blender/freestyle/intern/app_blender/AppConfig.cpp b/source/blender/freestyle/intern/app_blender/AppConfig.cpp
new file mode 100755 (executable)
index 0000000..baa8473
--- /dev/null
@@ -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 <iostream>
+
+#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 (executable)
index 0000000..8a6fef7
--- /dev/null
@@ -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 <string>
+# 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 (file)
index 0000000..78ab50a
--- /dev/null
@@ -0,0 +1,21 @@
+#include "Controller.h"
+#include <iostream>
+
+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