[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38181] branches/soc-2011-onion/source/ blender/editors/space_view3d/view3d_draw.c: Vertex Weights Export Tool
Antony Riakiotakis
kalast at gmail.com
Thu Jul 7 09:13:47 CEST 2011
Revision: 38181
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38181
Author: psy-fi
Date: 2011-07-07 07:13:46 +0000 (Thu, 07 Jul 2011)
Log Message:
-----------
Vertex Weights Export Tool
=====================
*Remove some unneeded code
*Now saving to blend file's directory, I think that's a more acceptable behavior since I can't find a clean way to select a directory through GUI and this seems the best default place.
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c
Modified: branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c 2011-07-07 06:02:22 UTC (rev 38180)
+++ branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c 2011-07-07 07:13:46 UTC (rev 38181)
@@ -60,6 +60,7 @@
#include "BKE_key.h"
#include "BKE_object.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
@@ -2694,7 +2695,7 @@
{
GPUOffScreen *ofs;
int maxsize;
- float *winmatarg = NULL;
+ int winmatexists = 0;
float winmat[4][4];
RegionView3D *rv3d= ar->regiondata;
char err_out[256] = "unknown";
@@ -2723,7 +2724,7 @@
rctf _viewplane;
object_camera_matrix(&scene->r, v3d->camera, w, h, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens, &_yco, &_dx, &_dy);
- winmatarg = &winmat[0][0];
+ winmatexists = 0;
}
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
@@ -2773,7 +2774,10 @@
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
/* setup view matrices */
- view3d_main_area_setup_view(scene, v3d, ar, NULL, winmatarg);
+ if(winmatexists)
+ view3d_main_area_setup_view(scene, v3d, ar, NULL, winmat);
+ else
+ view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
ED_view3d_init_mats_rv3d_gl(ob, rv3d);
/* get our vert groups */
@@ -2822,7 +2826,6 @@
}
}
- glColor3f(1.0 ,1.0, 1.0);
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
@@ -2834,7 +2837,7 @@
/* Do this for each vertex group */
for(defgrp = ob->defbase.first; defgrp; defgrp = defgrp->next, defnum++){
- char filename[1024];
+ char filename[FILE_MAX], imagefile[1024] ;
/* Fill the Weight buffer */
for(i = 0; i < numOfVerts; i++){
@@ -2847,9 +2850,13 @@
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
- sprintf(filename, "%s_%s.png", ob->id.name, defgrp->name);
-
- IMB_saveiff(ibuf, filename, 0);
+ BLI_strncpy(filename, G.main->name, 1024);
+ BLI_parent_dir(filename);
+ BLI_cleanup_dir(NULL, filename);
+ sprintf(imagefile, "%s%s_%s.png",filename, ob->id.name, defgrp->name);
+ /* cleanup the name so that it contains no illegal characters*/
+ BLI_clean(imagefile);
+ IMB_saveiff(ibuf, imagefile, 0);
}
glPopClientAttrib();
More information about the Bf-blender-cvs
mailing list