[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17778] branches/soc-2008-mxcurioni/source /blender: replaced "Shape loading" message with " Importing triangular meshes into Blender"

Maxime Curioni maxime.curioni at gmail.com
Wed Dec 10 16:30:44 CET 2008


Revision: 17778
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17778
Author:   mxcurioni
Date:     2008-12-10 16:30:43 +0100 (Wed, 10 Dec 2008)

Log Message:
-----------
replaced "Shape loading" message with "Importing triangular meshes into Blender"
handled case when scene is empty
made controller's view map as public variable

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/BlenderFileLoader.cpp
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/rendercore.c

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp	2008-12-10 15:12:46 UTC (rev 17777)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp	2008-12-10 15:30:43 UTC (rev 17778)
@@ -180,8 +180,12 @@
     return 1;
   }
 
-  cout << "Scene loaded\n" << endl;
+	if( blenderScene->numberOfChildren() < 1) {
+		cout << "Empty scene" << endl;
+		return 1;
+	}
 
+	  cout << "Scene loaded" << endl;
   printf("Mesh cleaning    : %lf\n", _Chrono.stop());
   _SceneNumFaces += loader.numFacesRead();
 

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.h	2008-12-10 15:12:46 UTC (rev 17777)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.h	2008-12-10 15:30:43 UTC (rev 17778)
@@ -140,6 +140,10 @@
 
   void resetInterpreter();
 
+public:
+	// Viewmap data structure
+	ViewMap * _ViewMap;
+
 private:
 
   // Main Window:
@@ -168,8 +172,6 @@
 
   // Winged-Edge structure
   WingedEdge* _winged_edge;
-  
-  ViewMap * _ViewMap;
 
   // Silhouette structure:
   //std::vector<SShape*> _SShapes;

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-12-10 15:12:46 UTC (rev 17777)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-12-10 15:30:43 UTC (rev 17778)
@@ -140,7 +140,8 @@
 		controller->Clear();
 
 		// load mesh
-		controller->LoadMesh(re);
+		if( controller->LoadMesh(re) ) // returns if scene cannot be loaded or if empty
+			return;
 		
 		// add style module
 		cout << "Module: " << style_module << endl;
@@ -161,37 +162,19 @@
 		// compute view map
 		controller->ComputeViewMap();
 	}
-
-	// void FRS_render_GL(Render* re) {
-	// 	
-	// 
-	// // build strokes
-	// controller->DrawStrokes();
-	//
-	// 	cout << "Rendering Freestyle with OpenGL" << endl;
-	// 	
-	// 	// render strokes
-	// 	view->workingBuffer = GL_BACK;
-	// 	view->draw();
-	// 	
-	// 	// display result
-	// 	RenderResult rres;
-	// 	RE_GetResultImage(re, &rres);
-	// 	view->readPixels(0, 0, re->winx, re->winy, AppGLWidget::RGBA, rres.rectf );		
-	// 	re->result->renlay = render_get_active_layer(re, re->result);
-	// 	re->display_draw(re->result, NULL);
-	// 	
-	// 	controller->CloseFile();
-	// }
 	
 	void FRS_render_Blender(Render* re) {
 		
-		// build strokes
-		controller->DrawStrokes();
+		if( controller->_ViewMap ) {
+			// build strokes
+			controller->DrawStrokes();
 		
-		cout << "Rendering Freestyle with Blender's internal renderer" << endl;
-		controller->RenderBlender(re);
-		controller->CloseFile();
+			cout << "Rendering Freestyle with Blender's internal renderer" << endl;
+			controller->RenderBlender(re);
+			controller->CloseFile();
+		} else {
+			cout << "Freestyle cannot be used because the view map is not available" << endl;
+		}
 	}	
 	
 #ifdef __cplusplus

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/BlenderFileLoader.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/BlenderFileLoader.cpp	2008-12-10 15:12:46 UTC (rev 17777)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/BlenderFileLoader.cpp	2008-12-10 15:30:43 UTC (rev 17778)
@@ -18,7 +18,7 @@
 	ObjectInstanceRen *obi;
 	ObjectRen *obr;
 
-	cout << "Shape loading" << endl;
+	cout << "\nImporting triangular meshes into Blender" << endl;
 
   // creation of the scene root node
   _Scene = new NodeGroup;

Modified: branches/soc-2008-mxcurioni/source/blender/render/intern/source/rendercore.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/render/intern/source/rendercore.c	2008-12-10 15:12:46 UTC (rev 17777)
+++ branches/soc-2008-mxcurioni/source/blender/render/intern/source/rendercore.c	2008-12-10 15:30:43 UTC (rev 17778)
@@ -908,7 +908,10 @@
     int totsample;
     int x, y, od;
     float* freestyle;
-   
+
+	if( R.freestyle_render == NULL || R.freestyle_render->result == NULL )
+		return;
+		
     freestyle_rl = render_get_active_layer( R.freestyle_render, R.freestyle_render->result );
     if( freestyle_rl->rectf == NULL)
         return;





More information about the Bf-blender-cvs mailing list