[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30895] branches/soc-2010-aligorith-2/ source/blender/blenloader: Bullet SoC - I/O Code for Manipulators

Joshua Leung aligorith at gmail.com
Fri Jul 30 13:15:40 CEST 2010


Revision: 30895
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30895
Author:   aligorith
Date:     2010-07-30 13:15:39 +0200 (Fri, 30 Jul 2010)

Log Message:
-----------
Bullet SoC - I/O Code for Manipulators

Note: this adds a dependency in blenloader on the WindowManager module. I've only done this for scons now, so other buildsystems will need tweaking later. However, I'm not sure if it's fine to reference windowmanager stuff in blenloader...

Modified Paths:
--------------
    branches/soc-2010-aligorith-2/source/blender/blenloader/SConscript
    branches/soc-2010-aligorith-2/source/blender/blenloader/intern/readfile.c
    branches/soc-2010-aligorith-2/source/blender/blenloader/intern/writefile.c

Modified: branches/soc-2010-aligorith-2/source/blender/blenloader/SConscript
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/blenloader/SConscript	2010-07-30 10:44:00 UTC (rev 30894)
+++ branches/soc-2010-aligorith-2/source/blender/blenloader/SConscript	2010-07-30 11:15:39 UTC (rev 30895)
@@ -6,6 +6,7 @@
 incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
 incs += ' ../makesdna ../readblenfile ../editors/include'
 incs += ' ../render/extern/include ../makesrna'
+incs += ' ../windowmanager/'
 
 incs += ' ' + env['BF_ZLIB_INC']
 

Modified: branches/soc-2010-aligorith-2/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/blenloader/intern/readfile.c	2010-07-30 10:44:00 UTC (rev 30894)
+++ branches/soc-2010-aligorith-2/source/blender/blenloader/intern/readfile.c	2010-07-30 11:15:39 UTC (rev 30895)
@@ -149,6 +149,9 @@
 #include "BLO_undofile.h"
 #include "BLO_readblenfile.h" // streaming read pipe, for BLO_readblenfile BLO_readblenfilememory
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 #include "readfile.h"
 
 #include "PIL_time.h"
@@ -5041,6 +5044,22 @@
 		v3d->twtype= V3D_MANIP_TRANSLATE;
 }
 
+static void direct_link_manipulator(FileData *fd, wmManipulator *man)
+{
+	/* relink properties */
+	man->properties = newdataadr(fd, man->properties);
+	if (man->properties)
+		IDP_DirectLinkProperty(man->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+		
+	/* relink type-info */
+	man->type = WM_manipulatortype_find(man->idname, 1);
+	
+	/* clear runtime state storage */
+	// XXX: actually relink some of this instead?
+	man->draw_callbacks.first= man->draw_callbacks.last= NULL;
+	man->active_handle = 0;
+}
+
 static void direct_link_screen(FileData *fd, bScreen *sc)
 {
 	ScrArea *sa;
@@ -5086,15 +5105,20 @@
 	for(sa= sc->areabase.first; sa; sa= sa->next) {
 		SpaceLink *sl;
 		ARegion *ar;
+		wmManipulator *man;
 
 		link_list(fd, &(sa->spacedata));
 		link_list(fd, &(sa->regionbase));
+		link_list(fd, &(sa->manipulators));
 
 		sa->handlers.first= sa->handlers.last= NULL;
 		sa->type= NULL;	/* spacetype callbacks */
 		
 		for(ar= sa->regionbase.first; ar; ar= ar->next)
 			direct_link_region(fd, ar, sa->spacetype);
+			
+		for(man= sa->manipulators.first; man; man= man->next)
+			direct_link_manipulator(fd, man);
 		
 		/* accident can happen when read/save new file with older version */
 		/* 2.50: we now always add spacedata for info */
@@ -5109,9 +5133,13 @@
 		
 		for (sl= sa->spacedata.first; sl; sl= sl->next) {
 			link_list(fd, &(sl->regionbase));
+			link_list(fd, &(sl->manipulators));
 
 			for(ar= sl->regionbase.first; ar; ar= ar->next)
 				direct_link_region(fd, ar, sl->spacetype);
+			
+			for(man= sa->manipulators.first; man; man= man->next)
+			direct_link_manipulator(fd, man);
 
 			if (sl->spacetype==SPACE_VIEW3D) {
 				View3D *v3d= (View3D*) sl;

Modified: branches/soc-2010-aligorith-2/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/blenloader/intern/writefile.c	2010-07-30 10:44:00 UTC (rev 30894)
+++ branches/soc-2010-aligorith-2/source/blender/blenloader/intern/writefile.c	2010-07-30 11:15:39 UTC (rev 30895)
@@ -2003,6 +2003,15 @@
 	}
 }
 
+static void write_manipulator(WriteData *wd, wmManipulator *man)
+{
+	/* don't bother trying to save data from the 'runtime' section... */
+	writestruct(wd, DATA, "wmManipulator", 1, man);
+	
+	if (man->properties)
+		IDP_WriteProperty(man->properties, wd);
+}
+
 static void write_screens(WriteData *wd, ListBase *scrbase)
 {
 	bScreen *sc;
@@ -2030,6 +2039,7 @@
 			SpaceLink *sl;
 			Panel *pa;
 			ARegion *ar;
+			wmManipulator *man;
 			
 			writestruct(wd, DATA, "ScrArea", 1, sa);
 			
@@ -2040,8 +2050,14 @@
 					writestruct(wd, DATA, "Panel", 1, pa);
 			}
 			
+			for(man= sa->manipulators.first; man; man= man->next) 
+				write_manipulator(wd, man);
+			
 			sl= sa->spacedata.first;
 			while(sl) {
+				for(man= sl->manipulators.first; man; man= man->next) 
+					write_manipulator(wd, man);
+				
 				for(ar= sl->regionbase.first; ar; ar= ar->next)
 					write_region(wd, ar, sl->spacetype);
 				





More information about the Bf-blender-cvs mailing list