[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42980] branches/soc-2011-onion-uv-tools/ source/blender/editors: -Remove all weight paint related tools since they were cut on review.

Antony Riakiotakis kalast at gmail.com
Thu Dec 29 22:30:52 CET 2011


Revision: 42980
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42980
Author:   psy-fi
Date:     2011-12-29 21:30:43 +0000 (Thu, 29 Dec 2011)
Log Message:
-----------
-Remove all weight paint related tools since they were cut on review. Export to uv space may return as bake weight layers in the bake menu using the renderer if possible.

Modified Paths:
--------------
    branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-onion-uv-tools/source/blender/editors/space_view3d/view3d_draw.c

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c	2011-12-29 16:05:09 UTC (rev 42979)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c	2011-12-29 21:30:43 UTC (rev 42980)
@@ -5796,206 +5796,3 @@
 
 	RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
 }
-
-/* This function is actually a selection of the code path implemented by texture_paint_image_from_view_exec.
- * We really don't need all checks + we need to draw only the selected object */
-static int weight_layers_images_from_view_exec(bContext *C, wmOperator *op)
-{
-	char directory[FILE_MAXDIR];
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d = CTX_wm_view3d(C);
-	ARegion *ar =  CTX_wm_region(C);
-	Object *ob = CTX_data_active_object(C);
-
-	ToolSettings *settings= scene->toolsettings;
-	int w= settings->imapaint.screen_grab_size[0];
-	int h= settings->imapaint.screen_grab_size[1];
-
-	RNA_string_get(op->ptr, "directory", directory);
-	BLI_cleanup_dir(NULL, directory);
-
-	if(view3d_weight_offscreen_draw(scene, v3d, ar, ob, w, h, directory))
-		return OPERATOR_FINISHED;
-	else return OPERATOR_CANCELLED;
-}
-
-static int weight_layers_images_from_view_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)){
-	if(RNA_property_is_set(op->ptr, "directory"))
-		return weight_layers_images_from_view_exec(C, op);
-	WM_event_add_fileselect(C, op);
-	return OPERATOR_RUNNING_MODAL;
-}
-
-void PAINT_OT_weight_layers_images_from_view(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Export Directory";
-	ot->idname= "PAINT_OT_weight_layers_images_from_view";
-	ot->description= "Make multiple png images from vertex group of the active object as seen from the current view";
-
-	/* api callbacks */
-	ot->invoke = weight_layers_images_from_view_invoke;
-	ot->exec= weight_layers_images_from_view_exec;
-	ot->poll= ED_operator_region_view3d_active;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER;
-
-	/* Copied from above, may come in handy */
-	WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH);
-}
-
-
-/* Similar to above but easier, since we work in uv space */
-static int weight_layers_to_uv_images_exec(bContext *C, wmOperator *op)
-{
-	char directory[FILE_MAXDIR];
-	Scene *scene= CTX_data_scene(C);
-	Object *ob = CTX_data_active_object(C);
-	Mesh *me= ob->data;
-	GPUOffScreen *ofs;
-	int maxsize;
-	char err_out[256] = "unknown";
-	MDeformVert *dw;
-	ImBuf *ibuf;
-	bDeformGroup *defgrp;
-	int defnum = 0;
-	int i;
-
-	ToolSettings *settings= scene->toolsettings;
-	int w= settings->imapaint.screen_grab_size[0];
-	int h= settings->imapaint.screen_grab_size[1];
-	RNA_string_get(op->ptr, "directory", directory);
-	BLI_cleanup_dir(NULL, directory);
-
-	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
-
-	if(w > maxsize) w= maxsize;
-	if(h > maxsize) h= maxsize;
-
-	glPushAttrib(GL_LIGHTING_BIT);
-
-	ofs= GPU_offscreen_create(w, h, err_out);
-	if(ofs == NULL)
-		return OPERATOR_CANCELLED;
-
-	ibuf= IMB_allocImBuf(w, h, 32, IB_rect);
-	if(!ibuf){
-		GPU_offscreen_free(ofs);
-		return OPERATOR_CANCELLED;
-	}
-	ibuf->ftype = PNG;
-
-	GPU_offscreen_bind(ofs);
-
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-	glPushMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-	glLoadIdentity();
-
-	/* set flags */
-	G.f |= G_RENDER_OGL;
-
-	glClearColor(0.0, 0.0, 0.0, 0.0);
-
-	/* get our vert groups */
-	dw = CustomData_get_layer(&me->vdata, CD_MDEFORMVERT);
-
-	glShadeModel(GL_SMOOTH);
-
-	/* Do this for each vertex group */
-	for(defgrp = ob->defbase.first; defgrp; defgrp = defgrp->next, defnum++){
-		char imagefile[FILE_MAX];
-
-		MFace *mface= me->mface;
-		MTFace *tface= CustomData_get_layer(&me->fdata, CD_MTFACE);
-		int a;
-
-		glClear(GL_COLOR_BUFFER_BIT);
-
-		for(a=me->totface; a>0; a--, tface++, mface++) {
-			float col1 = defvert_find_weight(dw+mface->v1, defnum);
-			float col2 = defvert_find_weight(dw+mface->v2, defnum);
-			float col3 = defvert_find_weight(dw+mface->v3, defnum);
-			if(mface->v4){
-				glBegin(GL_QUADS);
-			}
-			else{
-				glBegin(GL_TRIANGLES);
-			}
-			glColor4f(col1,col1,col1, col1);
-			glVertex2f(2.0*tface->uv[0][0] - 1.0, 2.0*tface->uv[0][1] - 1.0);
-			glColor4f(col2,col2,col2,col2);
-			glVertex2f(2.0*tface->uv[1][0] - 1.0, 2.0*tface->uv[1][1] - 1.0);
-			glColor4f(col3,col3,col3,col3);
-			glVertex2f(2.0*tface->uv[2][0] - 1.0, 2.0*tface->uv[2][1] - 1.0);
-			if(mface->v4){
-				float col4 = defvert_find_weight(dw+mface->v4, defnum);
-				glColor4f(col4,col4,col4,col4);
-				glVertex2f(2.0*tface->uv[3][0] - 1.0, 2.0*tface->uv[3][1] - 1.0);
-			}
-			glEnd();
-		}
-
-		glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
-
-		i = 0;
-		do{
-			if(i)
-				BLI_snprintf(imagefile, FILE_MAX, "%s%s_%s.%d.png", directory, ob->id.name, defgrp->name, i-1);
-			else
-				BLI_snprintf(imagefile, FILE_MAX, "%s%s_%s.png", directory, ob->id.name, defgrp->name);
-			i++;
-		}while(BLI_exists(imagefile));
-		/* cleanup the name so that it contains no illegal characters*/
-		BLI_clean(imagefile);
-		IMB_saveiff(ibuf, imagefile, 0);
-	}
-
-
-	IMB_freeImBuf(ibuf);
-
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
-
-	glColor4ub(255, 255, 255, 255); // XXX, without this the sequencer flickers with opengl draw enabled, need to find out why - campbell
-
-	G.f &= ~G_RENDER_OGL;
-
-	/* unbind */
-	GPU_offscreen_unbind(ofs);
-	GPU_offscreen_free(ofs);
-
-	glPopAttrib();
-
-	return OPERATOR_FINISHED;
-}
-
-static int weight_layers_to_uv_images_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)){
-	if(RNA_property_is_set(op->ptr, "directory"))
-		return weight_layers_to_uv_images_exec(C, op);
-	WM_event_add_fileselect(C, op);
-	return OPERATOR_RUNNING_MODAL;
-}
-
-void PAINT_OT_weight_layers_to_uv_images(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Weight layers uv images";
-	ot->idname= "PAINT_OT_weight_layers_to_uv_images";
-	ot->description= "Make multiple png images from vertex group of the active object in uv space";
-
-	/* api callbacks */
-	ot->invoke= weight_layers_to_uv_images_invoke;
-	ot->exec= weight_layers_to_uv_images_exec;
-	ot->poll= ED_operator_uvmap_mesh;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER;
-
-	WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH);
-}

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_intern.h	2011-12-29 16:05:09 UTC (rev 42979)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_intern.h	2011-12-29 21:30:43 UTC (rev 42980)
@@ -102,8 +102,6 @@
 void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot);
 void PAINT_OT_project_image(struct wmOperatorType *ot);
 void PAINT_OT_image_from_view(struct wmOperatorType *ot);
-void PAINT_OT_weight_layers_images_from_view(struct wmOperatorType *ot);
-void PAINT_OT_weight_layers_to_uv_images(struct wmOperatorType *ot);
 
 /* uv sculpting */
 int uv_sculpt_poll(struct bContext *C);

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c	2011-12-29 16:05:09 UTC (rev 42979)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c	2011-12-29 21:30:43 UTC (rev 42980)
@@ -405,8 +405,6 @@
 	WM_operatortype_append(PAINT_OT_weight_from_bones);
 	WM_operatortype_append(PAINT_OT_weight_sample);
 	WM_operatortype_append(PAINT_OT_weight_sample_group);
-	WM_operatortype_append(PAINT_OT_weight_layers_images_from_view);
-	WM_operatortype_append(PAINT_OT_weight_layers_to_uv_images);
 
 	/* uv */
 	WM_operatortype_append(SCULPT_OT_uv_sculpt_stroke);

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/space_view3d/view3d_draw.c	2011-12-29 16:05:09 UTC (rev 42979)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/space_view3d/view3d_draw.c	2011-12-29 21:30:43 UTC (rev 42980)
@@ -2909,206 +2909,3 @@
 
 	v3d->flag |= V3D_INVALID_BACKBUF;
 }
-
-
-int view3d_weight_offscreen_draw(Scene *scene, View3D *v3d, ARegion *ar, Object *ob, int w, int h, const char *directory)
-{
-	GPUOffScreen *ofs;
-	int maxsize;
-	int winmatexists = 0;
-	float winmat[4][4];
-	RegionView3D *rv3d=
-	ar->regiondata;	char err_out[256] = "unknown";
-	int bwinx, bwiny;
-	rcti brect;
-	int zbufbackup = v3d->zbuf;
-	DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_MVERT | CD_MASK_MDEFORMVERT | CD_MASK_MFACE);
-	int numOfQuads = 0;
-	MDeformVert *dw;
-	ImBuf *ibuf;
-	bDeformGroup *defgrp;
-	int defnum = 0;
-	int numOfFaces;
-	int numOfVerts;
-	MVert *verts;
-	MFace *faces;
-	unsigned char *weightColors;
-	int i;
-	int *quadIndices, *triIndices;
-	unsigned int tri_buf_index = 0, quad_buf_index = 0;
-
-	/* change camera matrix if object camera */
-	if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
-		CameraParams params;
-
-		camera_params_init(&params);
-		camera_params_from_object(&params, v3d->camera);
-		camera_params_compute_viewplane(&params, w, h, scene->r.xasp, scene->r.yasp);
-		camera_params_compute_matrix(&params);
-
-		view3d_main_area_setup_view(scene, v3d, ar, NULL, winmat);
-	} else {
-		view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
-	}
-
-
-	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
-	if(w > maxsize) w= maxsize;
-	if(h > maxsize) h= maxsize;
-
-	glPushAttrib(GL_LIGHTING_BIT);
-
-	ofs= GPU_offscreen_create(w, h, err_out);
-	if(ofs == NULL)
-		return 0;
-
-	ibuf= IMB_allocImBuf(w, h, 32, IB_rect);
-	if(!ibuf){
-		GPU_offscreen_free(ofs);
-		return 0;
-	}
-
-	ibuf->ftype = PNG;
-
-	GPU_offscreen_bind(ofs);
-	glPushMatrix();
-
-	/* set temporary new size */
-	bwinx= ar->winx;
-	bwiny= ar->winy;
-	brect= ar->winrct;
-	ar->winx= w;
-	ar->winy= h;
-	ar->winrct.xmin= 0;
-	ar->winrct.ymin= 0;
-	ar->winrct.xmax= w;
-	ar->winrct.ymax= h;
-
-	/* set flags */
-	G.f |= G_RENDER_OGL;
-

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list