[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31125] branches/soc-2010-nicolasbishop: = = Ptex ==

Nicholas Bishop nicholasbishop at gmail.com
Fri Aug 6 23:21:01 CEST 2010


Revision: 31125
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31125
Author:   nicholasbishop
Date:     2010-08-06 23:21:01 +0200 (Fri, 06 Aug 2010)

Log Message:
-----------
== Ptex ==

* Removing some old vpaint/multires stuff that is obseleted by ptex

Modified Paths:
--------------
    branches/soc-2010-nicolasbishop/release/scripts/ui/space_image.py
    branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_multires.h
    branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/multires.c
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2010-nicolasbishop/source/blender/modifiers/intern/MOD_multires.c

Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/space_image.py
===================================================================
--- branches/soc-2010-nicolasbishop/release/scripts/ui/space_image.py	2010-08-06 20:04:37 UTC (rev 31124)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/space_image.py	2010-08-06 21:21:01 UTC (rev 31125)
@@ -137,10 +137,7 @@
 
             layout.prop(sima, "image_painting")
 
-            layout.separator()
-            layout.operator("paint.vertex_colors_to_texture")
 
-
 class IMAGE_MT_uvs_showhide(bpy.types.Menu):
     bl_label = "Show/Hide Faces"
 

Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_multires.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_multires.h	2010-08-06 20:04:37 UTC (rev 31124)
+++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/BKE_multires.h	2010-08-06 21:21:01 UTC (rev 31125)
@@ -49,9 +49,6 @@
 struct DerivedMesh *multires_dm_create_from_derived(struct MultiresModifierData*,
 	int local_mmd, struct DerivedMesh*, struct Object *, struct GridKey *, int, int);
 
-/* convert multires color layers to standard mcol layers */
-void multires_apply_colors(struct DerivedMesh *cddm, struct DerivedMesh *ccgdm);
-
 struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene,
 	struct ModifierData *lastmd);
 struct DerivedMesh *get_multires_dm(struct Scene *scene, struct MultiresModifierData *mmd,

Modified: branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/multires.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/multires.c	2010-08-06 20:04:37 UTC (rev 31124)
+++ branches/soc-2010-nicolasbishop/source/blender/blenkernel/intern/multires.c	2010-08-06 21:21:01 UTC (rev 31125)
@@ -99,7 +99,7 @@
 {
 	if(render)
 		return (mmd->modifier.scene)? get_render_subsurf_level(&mmd->modifier.scene->r, mmd->renderlvl): mmd->renderlvl;
-	else if(ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT))
+	else if(ob->mode & OB_MODE_SCULPT)
 		return mmd->sculptlvl;
 	else
 		return (mmd->modifier.scene)? get_render_subsurf_level(&mmd->modifier.scene->r, mmd->lvl): mmd->lvl;
@@ -155,7 +155,7 @@
 
 void multires_force_render_update(Object *ob)
 {
-	if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT)) && modifiers_findByType(ob, eModifierType_Multires))
+	if(ob && (ob->mode & OB_MODE_SCULPT) && modifiers_findByType(ob, eModifierType_Multires))
 		multires_force_update(ob);
 }
 
@@ -320,12 +320,6 @@
 
 		cd_grids[i].totelem = totelem;
 
-		for(j = 0; j < gridkey->color; ++j) {
-			CustomData_multires_sync_layer(cd_grids+i,
-						       CD_MCOL,
-						       gridkey->color_names[j]);
-		}
-
 		for(j = 0; j < gridkey->mask; ++j) {
 			CustomData_multires_sync_layer(cd_grids+i,
 						       CD_PAINTMASK,
@@ -476,14 +470,10 @@
 					 CustomData *vdata,
 					 CustomData *fdata)
 {
- 	GRIDELEM_KEY_INIT(gridkey, 1,
-			  CustomData_get_multires_count(fdata, CD_MCOL),
+ 	GRIDELEM_KEY_INIT(gridkey, 1, 0,
 			  CustomData_get_multires_count(vdata, CD_PAINTMASK),
 			  1);
 
-	gridkey->color_names = CustomData_get_multires_names(fdata,
-							     CD_MCOL);
-
 	gridkey->mask_names = CustomData_get_multires_names(vdata,
 							    CD_PAINTMASK);
 			  
@@ -939,31 +929,6 @@
 							break;
 						}
 					}
-
-					/* Colors */
-					for(j = 0; j < gridkey->color; ++j) {
-						float *color = GRIDELEM_COLOR_AT(grid, ccgdm_offset, gridkey)[j];
-						float *scolor = GRIDELEM_COLOR_AT(subgrid, ccgdm_offset, gridkey)[j];
-						float *stored_color_layer =
-							CustomData_multires_get_data(&stored_grids[i],
-										     CD_MCOL,
-										     gridkey->color_names[j]);
-						float *stored_color = &stored_color_layer[(stored_index+
-											   stored_offset)*4];
-
-						switch(op) {
-						case APPLY_DISPS:
-							add_v4_v4v4(color, scolor, stored_color);
-							clamp_v4_fl(color, 0, 1);
-							break;
-						case CALC_DISPS:
-							sub_v4_v4v4(stored_color, color, scolor);
-							break;
-						case ADD_DISPS:
-							add_v4_v4(stored_color, color);
-							break;
-						}
-					}
 				}
 			}
 		}
@@ -1155,60 +1120,7 @@
 	return result;
 }
 
-/* convert multires color layers to standard mcol layers */
-void multires_apply_colors(DerivedMesh *cddm, DerivedMesh *ccgdm)
-{
-	DMGridData **grids;
-	GridKey *gridkey;
-	MCol **mcol;
-	int i, j, k, x, y, gridsize, boundary, totgrid;
 
-	grids = ccgdm->getGridData(ccgdm);
-	gridkey = ccgdm->getGridKey(ccgdm);
-	gridsize = ccgdm->getGridSize(ccgdm);
-	totgrid = ccgdm->getNumGrids(ccgdm);
-	boundary = gridsize - 1;
-
-	/* get multires mcol layers */
-	mcol = MEM_callocN(sizeof(MCol*)*gridkey->color,
-			   "multires_apply_colors.mcol");
-	for(i = 0; i < gridkey->color; ++i) {
-		char *name = gridkey->color_names[i];
-
-		/* TODO: note that this works because plain subdivided mcols
-		   already generated, that's inefficient and should be fixed */
-		mcol[i] = CustomData_get_layer_named(&cddm->faceData, CD_MCOL, name);
-	}
-
-	for(i = 0; i < totgrid; ++i) {
-		DMGridData *grid = grids[i];
-
-		for(y = 0; y < boundary; ++y) {
-			for(x = 0; x < boundary; ++x) {
-				for(j = 0; j < gridkey->color; ++j) {
-					float *col[4];
-
-					col[0] = GRIDELEM_COLOR_AT(grid, y*gridsize+x, gridkey)[j];
-					col[1] = GRIDELEM_COLOR_AT(grid, (y+1)*gridsize+x, gridkey)[j];
-					col[2] = GRIDELEM_COLOR_AT(grid, (y+1)*gridsize+(x+1), gridkey)[j];
-					col[3] = GRIDELEM_COLOR_AT(grid, y*gridsize+(x+1), gridkey)[j];
-
-					for(k = 0; k < 4; ++k) {
-						mcol[j][k].b = col[k][0] * 255;
-						mcol[j][k].g = col[k][1] * 255;
-						mcol[j][k].r = col[k][2] * 255;
-						mcol[j][k].a = col[k][3] * 255;
-					}
-
-					mcol[j] += 4;
-				}
-			}
-		}
-	}
-
-	MEM_freeN(mcol);
-}
-
 /**** Old Multires code ****
 ***************************/
 

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h	2010-08-06 20:04:37 UTC (rev 31124)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h	2010-08-06 21:21:01 UTC (rev 31125)
@@ -146,7 +146,6 @@
 void PAINT_OT_vertex_paint_radial_control(struct wmOperatorType *ot);
 void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot);
 void PAINT_OT_vertex_paint(struct wmOperatorType *ot);
-void PAINT_OT_vertex_colors_to_texture(struct wmOperatorType *ot);
 unsigned int vpaint_get_current_col(struct VPaint *vp);
 
 /* paint_image.c */

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c	2010-08-06 20:04:37 UTC (rev 31124)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c	2010-08-06 21:21:01 UTC (rev 31125)
@@ -216,7 +216,6 @@
 	WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
 	WM_operatortype_append(PAINT_OT_vertex_paint);
 	WM_operatortype_append(PAINT_OT_vertex_color_set);
-	WM_operatortype_append(PAINT_OT_vertex_colors_to_texture);
 	WM_operatortype_append(PAINT_OT_overlay_manipulate);
 
 	/* ptex */

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c	2010-08-06 20:04:37 UTC (rev 31124)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c	2010-08-06 21:21:01 UTC (rev 31125)
@@ -576,8 +576,6 @@
 // two modules should be more clearly defined.
 static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
 {
-	Object *ob = CTX_data_active_object(C);
-	VPaint *vp = CTX_data_tool_settings(C)->vpaint;
 	ViewContext vc;
 
 	(void)unused;

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c	2010-08-06 20:04:37 UTC (rev 31124)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c	2010-08-06 21:21:01 UTC (rev 31125)
@@ -2299,209 +2299,6 @@
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
 }
 
-/**** convert vertex colors to texture ****/
-static void vcol_to_tex_tri(ImBuf *ibuf,
-			    float uv1[2], float uv2[2], float uv3[3],
-			    float col1[3], float col2[3], float col3[3])
-{
-	/* ibuf coords */
-	float t[3][2] = {{uv1[0] * ibuf->x, uv1[1] * ibuf->y},
-			 {uv2[0] * ibuf->x, uv2[1] * ibuf->y},
-			 {uv3[0] * ibuf->x, uv3[1] * ibuf->y}};
-	float co[2];
-	rctf r;
-	int i;
-	
-	r.xmin = MIN3(t[0][0], t[1][0], t[2][0]);
-	r.xmax = MAX3(t[0][0], t[1][0], t[2][0]);
-	r.ymin = MIN3(t[0][1], t[1][1], t[2][1]);
-	r.ymax = MAX3(t[0][1], t[1][1], t[2][1]);
-
-	/* expand by a pixel */
-	for(i = 0; i < 3; ++i) {
-		if(r.xmin == t[i][0])
-			--t[i][0];
-		if(r.xmax == t[i][0])
-			++t[i][0];
-		if(r.ymin == t[i][1])
-			--t[i][1];
-		if(r.ymax == t[i][1])
-			++t[i][1];
-	}
-	r.xmin = (int)(r.xmin+0.5f) - 2;
-	r.xmax = (int)(r.xmax+0.5f) + 2;
-	r.ymin = (int)(r.ymin+0.5f) - 2;
-	r.ymax = (int)(r.ymax+0.5f) + 2;
-
-	for(co[1] = r.ymin; co[1] <= r.ymax; ++co[1]) {
-		for(co[0] = r.xmin; co[0] <= r.xmax; ++co[0]) {
-			if(isect_point_tri_v2(co, t[0], t[1], t[2])) {
-				float w[3], col[3];
-				int offset = ibuf->x * co[1] + co[0];
-
-				barycentric_weights_v2(t[0], t[1], t[2], co, w);
-				interp_v3_v3v3v3(col, col1, col2, col3, w);
-
-				if(ibuf->rect_float) {
-					copy_v3_v3(ibuf->rect_float + offset*4,
-						   col);
-				}
-				else {
-					char *ccol = ((char*)ibuf->rect) +
-						offset*4;
-
-					ccol[0] = col[0] * 255.0;
-					ccol[1] = col[1] * 255.0;
-					ccol[2] = col[2] * 255.0;
-					
-				}
-			}
-		}
-	}
-}
-
-static void multires_vcol_to_tex(ImBuf *ibuf, DerivedMesh *dm, Mesh *me,
-				 MTFace *mtface)
-{
-	DMGridData **grids;
-	GridKey *gridkey;
-	int i, x, y, totgrid, gridsize, boundary, offset;
-
-	totgrid = dm->getNumGrids(dm);
-	gridsize = dm->getGridSize(dm);
-	grids = dm->getGridData(dm);
-	gridkey = dm->getGridKey(dm);
-

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list