diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-06-08 23:35:20 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-06-08 23:35:20 +0400 |
commit | 062fb01614be23623fc9ebedc1ca1307ceb9a1bf (patch) | |
tree | d340298d56872279d438418654f75c943f24acd9 /source/blender/freestyle/intern/app_blender | |
parent | be2b832db7652afe9a6ce9a05da7420d12ac8916 (diff) |
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).
Diffstat (limited to 'source/blender/freestyle/intern/app_blender')
-rw-r--r-- | source/blender/freestyle/intern/app_blender/api.cpp | 53 | ||||
-rw-r--r-- | source/blender/freestyle/intern/app_blender/test_config.h | 8 |
2 files changed, 43 insertions, 18 deletions
diff --git a/source/blender/freestyle/intern/app_blender/api.cpp b/source/blender/freestyle/intern/app_blender/api.cpp index a021e30a6e5..c097b64ef53 100644 --- a/source/blender/freestyle/intern/app_blender/api.cpp +++ b/source/blender/freestyle/intern/app_blender/api.cpp @@ -11,10 +11,11 @@ extern "C" { #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 @@ using namespace std; 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 @@ extern "C" { 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; } diff --git a/source/blender/freestyle/intern/app_blender/test_config.h b/source/blender/freestyle/intern/app_blender/test_config.h index 6507050a4e4..c2337c0ba4c 100644 --- a/source/blender/freestyle/intern/app_blender/test_config.h +++ b/source/blender/freestyle/intern/app_blender/test_config.h @@ -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" |