[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20785] branches/soc-2009-yukishiro/source /blender: fix several things after merge

Jingyuan Huang jingyuan.huang at gmail.com
Wed Jun 10 17:13:06 CEST 2009


Revision: 20785
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20785
Author:   yukishiro
Date:     2009-06-10 17:13:05 +0200 (Wed, 10 Jun 2009)

Log Message:
-----------
fix several things after merge

Modified Paths:
--------------
    branches/soc-2009-yukishiro/source/blender/blenloader/intern/readfile.c
    branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c
    branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c
    branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_header.c
    branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h

Modified: branches/soc-2009-yukishiro/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenloader/intern/readfile.c	2009-06-10 15:09:44 UTC (rev 20784)
+++ branches/soc-2009-yukishiro/source/blender/blenloader/intern/readfile.c	2009-06-10 15:13:05 UTC (rev 20785)
@@ -3933,6 +3933,7 @@
 	if(sce->toolsettings) {
 		sce->toolsettings->vpaint= newdataadr(fd, sce->toolsettings->vpaint);
 		sce->toolsettings->wpaint= newdataadr(fd, sce->toolsettings->wpaint);
+		sce->toolsettings->lpaint= newdataadr(fd, sce->toolsettings->lpaint);
 		sce->toolsettings->sculpt= newdataadr(fd, sce->toolsettings->sculpt);
 		sce->toolsettings->imapaint.paintcursor= NULL;
 		sce->toolsettings->particle.paintcursor= NULL;
@@ -4163,6 +4164,13 @@
 	}
 }
 
+/* ****************** READ LIGHTPAINT ***************** */
+static void direct_link_lightenv(FileData *fd, LightEnv *env)
+{
+        direct_link_scriptlink(fd, &env->scriptlink);
+        env->preview = direct_link_preview_image(fd, env->preview);
+}
+
 /* ****************** READ SCREEN ***************** */
 
 static void butspace_version_132(SpaceButs *buts)
@@ -4912,6 +4920,7 @@
 		case ID_BR: return "Data from BR";
 		case ID_PA: return "Data from PA";
 		case ID_GD: return "Data from GD";
+		case ID_LE: return "Data from LE";
 	}
 	return "Data from Lib Block";
 	
@@ -5071,6 +5080,9 @@
 		case ID_GD:
 			direct_link_gpencil(fd, (bGPdata *)id);
 			break;
+                case ID_LE:
+                        direct_link_lightenv(fd, (LightEnv *)id);
+                        break;
 	}
 	
 	/*link direct data of ID properties*/
@@ -10106,6 +10118,7 @@
 						break;
 					case ID_PA:
 						expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
+                                                break;
 					}
 
 					doit= 1;

Modified: branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c	2009-06-10 15:09:44 UTC (rev 20784)
+++ branches/soc-2009-yukishiro/source/blender/blenloader/intern/writefile.c	2009-06-10 15:13:05 UTC (rev 20785)
@@ -1591,7 +1591,7 @@
 		if(sce->toolsettings->wpaint)
 			writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->wpaint);
 		if(sce->toolsettings->lpaint)
-			writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->wpaint);
+			writestruct(wd, DATA, "VPaint", 1, sce->toolsettings->lpaint);
 		if(sce->toolsettings->sculpt)
 			writestruct(wd, DATA, "Sculpt", 1, sce->toolsettings->sculpt);
 
@@ -1729,6 +1729,21 @@
 	}
 }
 
+static void write_lightenvs(WriteData *wd, ListBase *idbase)
+{
+        LightEnv *env;
+        
+        env = idbase->first;
+        while (env) {
+                if (env->id.us > 0 || wd->current) {
+                        writestruct(wd, ID_LE, "LightEnv", 1, env);
+			if (env->id.properties) IDP_WriteProperty(env->id.properties, wd);
+			write_scriptlink(wd, &env->scriptlink);
+			write_previews(wd, env->preview);
+                }
+        }
+}
+
 static void write_windowmanagers(WriteData *wd, ListBase *lb)
 {
 	wmWindowManager *wm;
@@ -2212,6 +2227,7 @@
 	write_brushes  (wd, &mainvar->brush);
 	write_scripts  (wd, &mainvar->script);
 	write_gpencils (wd, &mainvar->gpencil);
+        write_lightenvs(wd, &mainvar->lightenv);
 	if(current==NULL)	
 		write_libraries(wd,  mainvar->next); /* no library save in undo */
 

Modified: branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c	2009-06-10 15:09:44 UTC (rev 20784)
+++ branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c	2009-06-10 15:13:05 UTC (rev 20785)
@@ -149,20 +149,19 @@
 }
 
 /************************ light paint poll ************************/
-
 static int light_paint_poll(bContext *C)
 {
-	if(CTX_wm_region_view3d(C)) return 1;
-
-	return 0;
-}
-
-static int lp_poll(bContext *C)
-{
 	if(G.f & G_LIGHTPAINT) {
 		ScrArea *sa= CTX_wm_area(C);
 		if(sa->spacetype==SPACE_VIEW3D) {
 			ARegion *ar= CTX_wm_region(C);
+                        Object *ob = CTX_data_active_object(C);
+                        View3D *v3d= CTX_wm_view3d(C);
+                        short dt;
+
+                        dt = v3d->drawtype < ob->dt ? v3d->drawtype : ob->dt;
+                        if (dt != OB_SHADED) return 0;
+
 			if(ar->regiontype==RGN_TYPE_WINDOW)
 				return 1;
 		}
@@ -170,6 +169,14 @@
 	return 0;
 }
 
+static int light_paint_toggle_poll(bContext *C)
+{
+	if(CTX_data_active_object(C)==NULL)
+		return 0;
+
+	return 1;
+}
+
 /* Cursor */
 static void lp_drawcursor(bContext *C, int x, int y, void *customdata)
 {
@@ -197,7 +204,7 @@
 		lp->paintcursor = NULL;
 	}
 	else {
-	        lp->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), lp_poll, lp_drawcursor, NULL);
+	        lp->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), light_paint_poll, lp_drawcursor, NULL);
         }
 }
 
@@ -541,7 +548,7 @@
 	
 	/* api callbacks */
 	ot->exec= light_paint_toggle_exec;
-	ot->poll= light_paint_poll;
+	ot->poll= light_paint_toggle_poll;
 
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -577,7 +584,7 @@
 	ot->invoke= lpaint_radial_control_invoke;
 	ot->modal= lpaint_radial_control_modal;
 	ot->exec= lpaint_radial_control_exec;
-	ot->poll= lp_poll;
+	ot->poll= light_paint_poll;
 	
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;

Modified: branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_header.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_header.c	2009-06-10 15:09:44 UTC (rev 20784)
+++ branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_header.c	2009-06-10 15:13:05 UTC (rev 20785)
@@ -154,7 +154,7 @@
 	if(G.f & G_PARTICLEEDIT)
 		WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL);
 	
-	G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE+G_PARTICLEEDIT);
+	G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_LIGHTPAINT+G_SCULPTMODE+G_PARTICLEEDIT);
 }
 
 

Modified: branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h	2009-06-10 15:09:44 UTC (rev 20784)
+++ branches/soc-2009-yukishiro/source/blender/makesdna/DNA_lightenv_types.h	2009-06-10 15:13:05 UTC (rev 20785)
@@ -43,9 +43,10 @@
 
         short flag, type;
         float shcoeffs[25][3];
+
         light_func func;
         struct Image *probe_image; // image has preview
-
+        struct PreviewImage *preview;
 	ScriptLink scriptlink;
 
 } LightEnv;





More information about the Bf-blender-cvs mailing list