[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23515] branches/soc-2008-mxcurioni/source : Migration of Freestyle to Blender 2.5 codebase (continued):

Maxime Curioni maxime.curioni at gmail.com
Mon Sep 28 05:56:33 CEST 2009


Revision: 23515
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23515
Author:   mxcurioni
Date:     2009-09-28 05:56:31 +0200 (Mon, 28 Sep 2009)

Log Message:
-----------
Migration of Freestyle to Blender 2.5 codebase (continued):
- proper Freestyle initialization, with support for undo/redo
- re-added FreestyleStyleConfig data structure
- Freestyle Python interpreter updated

This commit should compile without errors. More work is necessary to complete the migration:
- add Freestyle in the UI
- set up RNA support

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/SConscript
    branches/soc-2008-mxcurioni/source/blender/blenkernel/CMakeLists.txt
    branches/soc-2008-mxcurioni/source/blender/blenkernel/SConscript
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/blender.c
    branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppConfig.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/FRS_freestyle.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/BlenderFileLoader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/BlenderFileLoader.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/BlenderStrokeRenderer.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/BlenderStrokeRenderer.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/StyleModule.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/system/Interpreter.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/system/PythonInterpreter.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/intern/makesdna.c
    branches/soc-2008-mxcurioni/source/blender/windowmanager/intern/wm_files.c
    branches/soc-2008-mxcurioni/source/creator/creator.c

Added Paths:
-----------
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h

Modified: branches/soc-2008-mxcurioni/source/blender/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/SConscript	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/SConscript	2009-09-28 03:56:31 UTC (rev 23515)
@@ -9,6 +9,7 @@
             'blenpluginapi/SConscript',
             'gpu/SConscript',
             'editors/SConscript',
+			'freestyle/SConscript',
             'imbuf/SConscript',
             'imbuf/intern/cineon/SConscript',
             'makesdna/SConscript',
@@ -31,7 +32,4 @@
     SConscript (['imbuf/intern/openexr/SConscript'])
 
 if env['WITH_BF_QUICKTIME']:
-    SConscript (['quicktime/SConscript'])
-
-if env['WITH_BF_FREESTYLE']:
-    SConscript (['freestyle/SConscript'])
+    SConscript (['quicktime/SConscript'])
\ No newline at end of file

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/CMakeLists.txt
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/CMakeLists.txt	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/CMakeLists.txt	2009-09-28 03:56:31 UTC (rev 23515)
@@ -30,7 +30,7 @@
 	. ../../../intern/guardedalloc ../../../intern/memutil ../editors/include ../blenlib ../makesdna
 	../render/extern/include ../../../intern/decimation/extern
 	../imbuf ../avi ../../../intern/elbeem/extern ../../../intern/opennl/extern
-	../../../intern/iksolver/extern ../blenloader
+	../../../intern/iksolver/extern ../blenloader ../freestyle
 	../nodes ../../../extern/glew/include ../gpu ../makesrna ../../../intern/smoke/extern
 	../../../intern/bsp/extern ../blenfont
 	../../../intern/audaspace/intern

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/SConscript	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/SConscript	2009-09-28 03:56:31 UTC (rev 23515)
@@ -6,7 +6,7 @@
 incs = '. #/intern/guardedalloc #/intern/memutil ../editors/include ../blenlib ../blenfont ../makesdna'
 incs += ' ../render/extern/include #/intern/decimation/extern ../makesrna'
 incs += ' ../imbuf ../avi #/intern/elbeem/extern ../nodes'
-incs += ' #/intern/iksolver/extern ../blenloader'
+incs += ' #/intern/iksolver/extern ../blenloader ../freestyle'
 incs += ' #/extern/bullet2/src'
 incs += ' #/intern/opennl/extern #/intern/bsp/extern'
 incs += ' ../gpu #/extern/glew/include'

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/blender.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/blender.c	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/blender.c	2009-09-28 03:56:31 UTC (rev 23515)
@@ -93,6 +93,8 @@
 
 #include "BKE_utildefines.h" // O_BINARY FALSE
 
+#include "FRS_freestyle.h"
+
 Global G;
 UserDef U;
 ListBase WMlist= {NULL, NULL};
@@ -630,6 +632,8 @@
 void BKE_undo_step(bContext *C, int step)
 {
 	
+	FRS_initialize(C);
+	
 	if(step==0) {
 		read_undosave(C, curundo);
 	}

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h	2009-09-28 03:56:31 UTC (rev 23515)
@@ -11,6 +11,8 @@
 	#include "DNA_listBase.h"
 	#include "DNA_scene_types.h"
 	
+	#include "BKE_context.h"
+	
 	extern short freestyle_is_initialized;
 	
 	extern float freestyle_viewpoint[3];
@@ -26,8 +28,8 @@
 	extern float* freestyle_dkr_epsilon;
 	
 	// Rendering
-	void FRS_initialize();
-	void FRS_add_Freestyle(struct Render* re);
+	void FRS_initialize(bContext* C);
+	void FRS_add_Freestyle( struct Render* re);
 	void FRS_exit();
 	
 	// Panel configuration

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript	2009-09-28 03:56:31 UTC (rev 23515)
@@ -6,7 +6,7 @@
 defs = []
 incs = ''
 
-incs += '../blenkernel ../blenloader ../blenlib ../imbuf ../makesdna ../python '
+incs += '../blenkernel ../blenloader ../blenlib ../imbuf ../makesdna ../makesrna ../python '
 incs += '../render/extern/include ../render/intern/include ../include ../src'
 incs += ' #/extern/glew/include #/intern/guardedalloc'
 incs += ' ' + env['BF_PYTHON_INC']	
@@ -67,7 +67,7 @@
 				sources=sources,
                 includes=Split(incs),
                 defines=defs,
-				libtype=['blender'],
+				libtype=['core'],
                 priority = [25]
  )
 

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppConfig.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppConfig.cpp	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppConfig.cpp	2009-09-28 03:56:31 UTC (rev 23515)
@@ -25,7 +25,7 @@
 using namespace std;
 
 extern "C" {
-	#include "api2_2x/EXPP_interface.h"
+	#include "BLI_util.h"
 }
 
 namespace Config {
@@ -33,7 +33,7 @@
 Path::Path() {
 	// get the root directory
 	//soc
-	setRootDir( bpy_gethome(1) );
+	setRootDir( BLI_gethome_folder("scripts") );
 
 	_pInstance = this;
 }

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	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp	2009-09-28 03:56:31 UTC (rev 23515)
@@ -656,7 +656,7 @@
 }
 
 Render* Controller::RenderStrokes(Render *re) {
-	BlenderStrokeRenderer* blenderRenderer = new BlenderStrokeRenderer;
+	BlenderStrokeRenderer* blenderRenderer = new BlenderStrokeRenderer(re);
   	_Canvas->Render( blenderRenderer );
 	Render* freestyle_render = blenderRenderer->RenderScene(re);
 	delete blenderRenderer;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/FRS_freestyle.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/FRS_freestyle.cpp	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/FRS_freestyle.cpp	2009-09-28 03:56:31 UTC (rev 23515)
@@ -17,9 +17,8 @@
 #include "DNA_camera_types.h"
 #include "DNA_freestyle_types.h"
 
-#include "BKE_global.h"
+#include "BKE_main.h"
 #include "BLI_blenlib.h"
-#include "BIF_renderwin.h"
 #include "BPY_extern.h"
 
 #include "renderpipeline.h"
@@ -33,6 +32,7 @@
 	static Config::Path *pathconfig = NULL;
 	static Controller *controller = NULL;
 	static AppView *view = NULL;
+	static Scene *current_scene = NULL;
 
 	// camera information
 	float freestyle_viewpoint[3];
@@ -55,7 +55,7 @@
 	//   Initialization 
 	//=======================================================
 
-	void FRS_initialize(){
+	void FRS_initialize(bContext* C){
 		
 		if( !freestyle_is_initialized ) {
 
@@ -69,8 +69,12 @@
 			freestyle_is_initialized = 1;
 		}
 		
-		FRS_select_layer( (SceneRenderLayer*) BLI_findlink(&G.scene->r.layers, G.scene->r.actlay) );
+		current_scene = CTX_data_scene(C);
+		if( !current_scene )
+			current_scene = (Scene*) CTX_data_main(C)->scene.first;
 		
+		FRS_select_layer( (SceneRenderLayer*) BLI_findlink(&current_scene->r.layers, current_scene->r.actlay) );
+		
 	}
 	
 	void FRS_exit() {
@@ -212,7 +216,7 @@
 		init_view(re);
 		init_camera(re);
 		
-		for(srl= (SceneRenderLayer *)G.scene->r.layers.first; srl; srl= srl->next) {
+		for(srl= (SceneRenderLayer *)current_scene->r.layers.first; srl; srl= srl->next) {
 			if( !(srl->layflag & SCE_LAY_DISABLE) &&
 			 	srl->layflag & SCE_LAY_FRS &&
 				displayed_layer_count(srl) > 0       )
@@ -277,7 +281,7 @@
 		freestyle_dkr_epsilon = &config->dkr_epsilon;
 		
 		freestyle_current_layer = srl;
-		G.scene->freestyle_current_layer_number = BLI_findindex(&G.scene->r.layers, freestyle_current_layer);
+		current_scene->freestyle_current_layer_number = BLI_findindex(&current_scene->r.layers, freestyle_current_layer);
 	}
 	
 	void FRS_add_module()

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	2009-09-28 03:28:28 UTC (rev 23514)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/BlenderFileLoader.cpp	2009-09-28 03:56:31 UTC (rev 23515)
@@ -66,7 +66,7 @@
 	// M allows to recover world coordinates from camera coordinates
 	// M => obr->ob->imat * obr->obmat  (multiplication from left to right)
 	float M[4][4];
-	MTC_Mat4MulMat4(M, obr->ob->imat, obr->ob->obmat); 
+	Mat4MulMat4(M, obr->ob->imat, obr->ob->obmat); 
 	
 	// We compute a normal per vertex and manages the smoothing of the shape:
 	// Lib3dsVector *normalL=(Lib3dsVector*)malloc(3*sizeof(Lib3dsVector)*mesh->faces);
@@ -128,7 +128,7 @@
 	pvtmp[1] = obr->vertnodes[0].vert->co[1];
 	pvtmp[2] = obr->vertnodes[0].vert->co[2];
 	
-	MTC_Mat4MulVecfl( M, pvtmp);
+	Mat4MulVecfl( M, pvtmp);
 	
 	minBBox[0] = pvtmp[0];
 	maxBBox[0] = pvtmp[0];
@@ -197,7 +197,7 @@
 				//lib3ds_vector_transform(pv, M, mesh->pointL[f->points[i]].pos); //fills the cells of the pv array
 				for(j=0; j<3; j++)
 					pv[j] = fv[i]->co[j];
-				MTC_Mat4MulVecfl( M, pv);
+				Mat4MulVecfl( M, pv);
 	
 				for(j=0; j<3; j++) // we parse the xyz coordinates of the vertex i
 				{
@@ -234,8 +234,8 @@
 			vec02[2] = pv_ptr[2][2] - pv_ptr[0][2];
 			
 			float n[3];
-			MTC_cross3Float(n, vec01, vec02);
-			MTC_normalize3DF(n);
+			Crossf(n, vec01, vec02);
+			Normalize(n);
 			
 			for(i=0; i<3; ++i) {
 				for(j=0; j<3; ++j) {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list