[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15163] branches/soc-2008-mxcurioni: soc-2008-mxcurioni: now supports current scene drawing ( instead of fixed scene object), still with fixed style and fixed camera.

Maxime Curioni maxime.curioni at gmail.com
Sun Jun 8 21:35:24 CEST 2008


Revision: 15163
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15163
Author:   mxcurioni
Date:     2008-06-08 21:35:20 +0200 (Sun, 08 Jun 2008)

Log Message:
-----------
soc-2008-mxcurioni: now supports current scene drawing (instead of fixed scene object), still with fixed style and fixed camera. Initialization is properly handled, which limits memory problems and speed-ups subsequent rendering. The viewing ratio should be correct now too. I also removed linking references to former lib3ds library path (caused some linking problems).

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/config/darwin-config.py
    branches/soc-2008-mxcurioni/config/linux2-config.py
    branches/soc-2008-mxcurioni/config/linuxcross-config.py
    branches/soc-2008-mxcurioni/config/openbsd3-config.py
    branches/soc-2008-mxcurioni/config/sunos5-config.py
    branches/soc-2008-mxcurioni/config/win32-mingw-config.py
    branches/soc-2008-mxcurioni/config/win32-vc-config.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/test_config.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/swig/ModuleWrapper.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/swig/ModuleWrapper.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/python/Freestyle.py
    branches/soc-2008-mxcurioni/tools/Blender.py
    branches/soc-2008-mxcurioni/tools/btools.py

Added Paths:
-----------
    branches/soc-2008-mxcurioni/source/blender/freestyle/python/3ds_export.py

Modified: branches/soc-2008-mxcurioni/config/darwin-config.py
===================================================================
--- branches/soc-2008-mxcurioni/config/darwin-config.py	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/config/darwin-config.py	2008-06-08 19:35:20 UTC (rev 15163)
@@ -167,7 +167,6 @@
 BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
-BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
 BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 # WITH_BF_OPENEXR = 'true'

Modified: branches/soc-2008-mxcurioni/config/linux2-config.py
===================================================================
--- branches/soc-2008-mxcurioni/config/linux2-config.py	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/config/linux2-config.py	2008-06-08 19:35:20 UTC (rev 15163)
@@ -93,7 +93,6 @@
 BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
-BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
 BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'

Modified: branches/soc-2008-mxcurioni/config/linuxcross-config.py
===================================================================
--- branches/soc-2008-mxcurioni/config/linuxcross-config.py	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/config/linuxcross-config.py	2008-06-08 19:35:20 UTC (rev 15163)
@@ -13,7 +13,6 @@
 BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
-BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
 BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 ###########################

Modified: branches/soc-2008-mxcurioni/config/openbsd3-config.py
===================================================================
--- branches/soc-2008-mxcurioni/config/openbsd3-config.py	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/config/openbsd3-config.py	2008-06-08 19:35:20 UTC (rev 15163)
@@ -87,7 +87,6 @@
 BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
-BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
 BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'

Modified: branches/soc-2008-mxcurioni/config/sunos5-config.py
===================================================================
--- branches/soc-2008-mxcurioni/config/sunos5-config.py	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/config/sunos5-config.py	2008-06-08 19:35:20 UTC (rev 15163)
@@ -89,7 +89,6 @@
 BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
-BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
 BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'

Modified: branches/soc-2008-mxcurioni/config/win32-mingw-config.py
===================================================================
--- branches/soc-2008-mxcurioni/config/win32-mingw-config.py	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/config/win32-mingw-config.py	2008-06-08 19:35:20 UTC (rev 15163)
@@ -104,7 +104,6 @@
 BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
-BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
 BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'

Modified: branches/soc-2008-mxcurioni/config/win32-vc-config.py
===================================================================
--- branches/soc-2008-mxcurioni/config/win32-vc-config.py	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/config/win32-vc-config.py	2008-06-08 19:35:20 UTC (rev 15163)
@@ -115,7 +115,6 @@
 BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
-BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
 BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript	2008-06-08 19:35:20 UTC (rev 15163)
@@ -74,13 +74,21 @@
 ########################################################
 #	swig
 #
-# 	1] Run the following two commands in the source/blender/freestyle/intern/swig directory.
+# 	1] Run the following three commands in the source/blender/freestyle/intern/swig directory.
 #
 #	2] Replace /Users/mx/Documents/work/GSoC_2008/bf-blender/branches/build/darwin/lib to the path
 #	of your library directory (used to locate libbf_freestyle.a)
 #
 #   3] Replace the python directories to suit your config
 
+# export SWIG_LIB=/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/extern/freestyle/swig/Lib
+
+# cd /Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle/intern/swig
+
+# /Users/mx/Documents/work/GSoC_2008/bf-blender/branches/build/darwin/bin/swig -c++ -python -o ModuleWrapper.cpp Freestyle.i
+
+# mv ./Freestyle.py ../../python/
+
 # g++ -w  -I../geometry -I../image -I../scene_graph -I../stroke -I../system -I../view_map -I../winged_edge -I/usr/include/python2.5 -I../../../blenlib -I../../../blenkernel -I../../../imbuf -I../../../makesdna -c ModuleWrapper.cpp -o ModuleWrapper.o
 
 ###########  Mac OS X ###########

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-06-08 19:35:20 UTC (rev 15163)
@@ -11,10 +11,11 @@
 #endif
 
 #include "render_types.h"
-//#include "renderdatabase.h"
-/* display_draw() needs render layer info */
 #include "renderpipeline.h"
 
+#include "BLI_blenlib.h"
+#include "BPY_extern.h"
+
 #ifdef __cplusplus
 }
 #endif
@@ -25,26 +26,50 @@
 extern "C" {
 #endif
 
-	void FRS_execute(Render* re) {
-		cout << "Freestyle start" << endl;
-	
+	static Controller *controller = NULL;
+	static AppGLWidget *view = NULL;
+
+	void FRS_initialize(){
 		Config::Path pathconfig;
-		Controller *c = new Controller;
-		AppGLWidget *view = new AppGLWidget;
 		
-		c->SetView(view);
+		if( controller == NULL )
+			controller = new Controller;
+		
+		if( view == NULL )
+			view = new AppGLWidget;
+	}
+
+	void FRS_execute(Render* re) {
+			
+		FRS_initialize();
+		
+		controller->SetView(view);
 		unsigned int width = re->winx;
 		unsigned int height = re->winy;
 		view->setWidth(width);
 		view->setHeight(height);
+		view->_camera->setScreenWidthAndHeight(width, height);
+		//view->setCameraState(const float* position, const float* orientation) 
 		
-		c->Load3DSFile( TEST_3DS_FILE );
+		BPY_run_python_script( TEST_3DS_EXPORT );
 		
-		c->InsertStyleModule( 0, TEST_STYLE_MODULE_FILE );
-		c->toggleLayer(0, true);
-		c->ComputeViewMap();
+		char btempdir[255];
+		BLI_where_is_temp(btempdir,1);
+		string exported_3ds_file =  btempdir;
+		exported_3ds_file += "/tmp_scene_freestyle.3ds";
+		if( BLI_exists( const_cast<char *>(exported_3ds_file.c_str()) ) ) {
+			controller->Load3DSFile( exported_3ds_file.c_str() );
+		}
+		else {
+			cout << "Cannot find" << exported_3ds_file << endl;
+			return;
+		}
 		
-		c->DrawStrokes(); // build strokes
+		controller->InsertStyleModule( 0, TEST_STYLE_MODULE_FILE );
+		controller->toggleLayer(0, true);
+		controller->ComputeViewMap();
+		
+		controller->DrawStrokes(); // build strokes
 		view->draw(); // render final result
 		
 		RenderResult rres;
@@ -52,8 +77,6 @@
 		view->readPixels(0,0,width,height,AppGLWidget::RGBA, rres.rectf );		
 		re->result->renlay = render_get_active_layer(re, re->result);
 		re->display_draw(re->result, NULL);
-		
-		cout << "Freestyle end" << endl;
 
 	}
 	

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/test_config.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/test_config.h	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/test_config.h	2008-06-08 19:35:20 UTC (rev 15163)
@@ -1,8 +1,10 @@
-
-#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"
 
 #define TEST_TEXTURE_FILE "/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle/data/textures/papers/whitepaper.jpg"
+
+
+
+
+#define TEST_3DS_EXPORT "/Users/mx/Documents/work/GSoC_2008/bf-blender/branches/soc-2008-mxcurioni/source/blender/freestyle/python/3ds_export.py"

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/swig/ModuleWrapper.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/swig/ModuleWrapper.cpp	2008-06-08 19:29:19 UTC (rev 15162)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/swig/ModuleWrapper.cpp	2008-06-08 19:35:20 UTC (rev 15163)
@@ -1,111845 +1,110778 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.31
- * 
- * This file is not intended to be easily readable and contains a number of 
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
- * ----------------------------------------------------------------------------- */
-
-#define SWIGPYTHON
-#define SWIG_DIRECTORS
-#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
-
-#ifdef __cplusplus
-template<class T> class SwigValueWrapper {
-    T *tt;
-public:
-    SwigValueWrapper() : tt(0) { }
-    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
-    SwigValueWrapper(const T& t) : tt(new T(t)) { }
-    ~SwigValueWrapper() { delete tt; } 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list