[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20948] branches/soc-2009-yukishiro: add a recompute button

Jingyuan Huang jingyuan.huang at gmail.com
Wed Jun 17 05:41:16 CEST 2009


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

Log Message:
-----------
add a recompute button

Modified Paths:
--------------
    branches/soc-2009-yukishiro/release/ui/buttons_lightenv.py
    branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c
    branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_draw.c
    branches/soc-2009-yukishiro/source/blender/sh/SH_api.h
    branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c

Modified: branches/soc-2009-yukishiro/release/ui/buttons_lightenv.py
===================================================================
--- branches/soc-2009-yukishiro/release/ui/buttons_lightenv.py	2009-06-17 03:13:48 UTC (rev 20947)
+++ branches/soc-2009-yukishiro/release/ui/buttons_lightenv.py	2009-06-17 03:41:16 UTC (rev 20948)
@@ -6,14 +6,29 @@
 	__region_type__ = "WINDOW"
 	__context__ = "lightenv"
 
+	def poll(self, context):
+		return context.lightenv
 
+class LIGHT_PT_compute(LightButtonsPanel):
+	__idname__= "LIGHT_PT_compute"
+	__label__ = "Compute"
+
+	def draw(self, context):
+		layout = self.layout
+		lightenv = context.lightenv
+
+		row = layout.row()
+		row.itemR(lightenv, "degree", text="Degree")
+		row.itemR(lightenv, "num_samples", text="# Samples")
+
+		row = layout.row()
+		row.itemO("PAINT_OT_light_paint_recompute", text="Recompute LightEnv", icon='ICON_LIGHTENV')
+
+
 class LIGHT_PT_preview(LightButtonsPanel):
 	__idname__= "LIGHT_PT_preview"
 	__label__ = "Preview"
 
-	def poll(self, context):
-		return context.lightenv
-
 	def draw(self, context):
 		layout = self.layout
 
@@ -48,6 +63,7 @@
                 scene = context.scene
                 split.template_ID(context, lightenv, "probe_image", new="IMAGE_OT_open")
 
+bpy.types.register(LIGHT_PT_compute)
 bpy.types.register(LIGHT_PT_preview)
 bpy.types.register(LIGHT_PT_type)
 bpy.types.register(LIGHT_PT_probe_image)

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-17 03:13:48 UTC (rev 20947)
+++ branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_light.c	2009-06-17 03:41:16 UTC (rev 20948)
@@ -79,10 +79,12 @@
 
 #include "paint_intern.h"
 
+extern CustomDataMask get_viewedit_datamask(bScreen *screen); //defined in view3d_draw.c
+
 /******************* computation job ****************/
 typedef struct ShJob {
 	Scene *scene;
-        View3D *v3d;
+	unsigned int mask;
 	short recompute;
 	short *stop;
 	short *do_update;
@@ -106,7 +108,7 @@
         if (sj->scene->lightenv == NULL) 
 		add_lightenv(sj->scene, "LightEnv");
 
-        SH_ComputeSceneCoefficients(sj->scene, sj->v3d, sj->recompute);
+        SH_ComputeSceneCoefficients(sj->scene, sj->mask, sj->recompute);
 }
 
 
@@ -128,7 +130,7 @@
 	/* job custom data */
 	sj= MEM_callocN(sizeof(ShJob), "SH job");
 	sj->scene= scene;
-	sj->v3d= CTX_wm_view3d(C);
+	sj->mask= get_viewedit_datamask(CTX_wm_screen(C));
 	sj->recompute= recompute;
 
 	/* setup job */

Modified: branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_draw.c	2009-06-17 03:13:48 UTC (rev 20947)
+++ branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_draw.c	2009-06-17 03:41:16 UTC (rev 20948)
@@ -1804,7 +1804,7 @@
 /* *********************** customdata **************** */
 
 /* goes over all modes and view3d settings */
-static CustomDataMask get_viewedit_datamask(bScreen *screen)
+CustomDataMask get_viewedit_datamask(bScreen *screen)
 {
 	CustomDataMask mask = CD_MASK_BAREMESH;
 	ScrArea *sa;

Modified: branches/soc-2009-yukishiro/source/blender/sh/SH_api.h
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/SH_api.h	2009-06-17 03:13:48 UTC (rev 20947)
+++ branches/soc-2009-yukishiro/source/blender/sh/SH_api.h	2009-06-17 03:41:16 UTC (rev 20948)
@@ -37,7 +37,7 @@
 void SH_init();
 void SH_exit();
 
-void SH_ComputeSceneCoefficients(struct Scene *scene, struct View3D *v3d, short recompute);
+void SH_ComputeSceneCoefficients(struct Scene *scene, unsigned int customdata_mask, short recompute);
 void SH_ComputeLightCoefficients(struct LightEnv *env);
 void SH_ReconstructLightProbe(struct LightEnv *env, struct ImBuf *ibuf);
 void SH_LightProbePreview(struct LightEnv *env, int width, int height,

Modified: branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c	2009-06-17 03:13:48 UTC (rev 20947)
+++ branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c	2009-06-17 03:41:16 UTC (rev 20948)
@@ -247,7 +247,7 @@
 }
 
 
-void SH_ComputeSceneCoefficients(Scene *scene, View3D *v3d, short recompute)
+void SH_ComputeSceneCoefficients(Scene *scene, unsigned int customdata_mask, short recompute)
 {
         Base *base = NULL;
         Object *ob;
@@ -267,7 +267,7 @@
                 me = get_mesh(ob);
                 if (me == NULL) continue;
 
-                dm = mesh_get_derived_final(scene, ob, v3d->customdata_mask);
+                dm = mesh_get_derived_final(scene, ob, customdata_mask);
                 num_verts = dm->getNumVerts(dm);
 	        verts = dm->getVertArray(dm);
 





More information about the Bf-blender-cvs mailing list