[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38336] branches/soc-2011-onion/source/ blender/editors: Wish from blenderartists thread
Antony Riakiotakis
kalast at gmail.com
Tue Jul 12 17:08:02 CEST 2011
Revision: 38336
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38336
Author: psy-fi
Date: 2011-07-12 15:08:02 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Wish from blenderartists thread
(http://blenderartists.org/forum/showthread.php?216643-Summer-of-Code-Sculpt-and-Paint-Feedback-team/page8)
- show UV's while in texpaint mode
Thanks to Alekzsander for the suggestion :)
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/editors/include/ED_uvedit.h
branches/soc-2011-onion/source/blender/editors/space_image/space_image.c
branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c
branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c
Modified: branches/soc-2011-onion/source/blender/editors/include/ED_uvedit.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/ED_uvedit.h 2011-07-12 14:17:06 UTC (rev 38335)
+++ branches/soc-2011-onion/source/blender/editors/include/ED_uvedit.h 2011-07-12 15:08:02 UTC (rev 38336)
@@ -77,7 +77,7 @@
void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel);
/* uvedit_draw.c */
-void draw_uvedit_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct Object *obedit);
+void draw_uvedit_main(const struct bContext *C, struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct Object *obedit);
/* uvedit_buttons.c */
void ED_uvedit_buttons_register(struct ARegionType *art);
Modified: branches/soc-2011-onion/source/blender/editors/space_image/space_image.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/space_image/space_image.c 2011-07-12 14:17:06 UTC (rev 38335)
+++ branches/soc-2011-onion/source/blender/editors/space_image/space_image.c 2011-07-12 15:08:02 UTC (rev 38336)
@@ -796,7 +796,7 @@
/* and uvs in 0.0-1.0 space */
UI_view2d_view_ortho(v2d);
- draw_uvedit_main(sima, ar, scene, obedit);
+ draw_uvedit_main(C, sima, ar, scene, obedit);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
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-12 14:17:06 UTC (rev 38335)
+++ branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c 2011-07-12 15:08:02 UTC (rev 38336)
@@ -2856,9 +2856,9 @@
i = 0;
do{
if(i)
- snprintf(imagefile, 1024, "%s%s_%s.%d.png",filename, ob->id.name, defgrp->name, i-1);
+ BLI_snprintf(imagefile, 1024, "%s%s_%s.%d.png",filename, ob->id.name, defgrp->name, i-1);
else
- snprintf(imagefile, 1024, "%s%s_%s.png",filename, ob->id.name, defgrp->name);
+ BLI_snprintf(imagefile, 1024, "%s%s_%s.png",filename, ob->id.name, defgrp->name);
i++;
}while(BLI_exists(imagefile));
/* cleanup the name so that it contains no illegal characters*/
Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c 2011-07-12 14:17:06 UTC (rev 38335)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c 2011-07-12 15:08:02 UTC (rev 38336)
@@ -44,6 +44,7 @@
#include "BLI_editVert.h"
#include "BLI_utildefines.h"
+#include "BKE_context.h"
#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
@@ -421,6 +422,30 @@
}
}
+static void draw_uvs_texpaint(Object *ob, Image *curimage)
+{
+ Mesh *me= ob->data;
+
+ glColor3ub(96, 96, 96);
+
+ if(me->mtface) {
+ MFace *mface= me->mface;
+ MTFace *tface= me->mtface;
+ int a;
+
+ for(a=me->totface; a>0; a--, tface++, mface++) {
+ if(tface->tpage == curimage) {
+ glBegin(GL_LINE_LOOP);
+ glVertex2fv(tface->uv[0]);
+ glVertex2fv(tface->uv[1]);
+ glVertex2fv(tface->uv[2]);
+ if(mface->v4) glVertex2fv(tface->uv[3]);
+ glEnd();
+ }
+ }
+ }
+}
+
/* draws uv's in the image space */
static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
{
@@ -887,18 +912,24 @@
BKE_mesh_end_editmesh(obedit->data, em);
}
-void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedit)
+void draw_uvedit_main(const bContext *C, SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedit)
{
- int show_uvedit, show_uvshadow;
+ int show_uvedit, show_uvshadow, show_texpaint_uvshadow;
+ Object *paint_ob = CTX_data_active_object(C);
+ show_texpaint_uvshadow = (paint_ob && paint_ob->type == OB_MESH && paint_ob->mode == OB_MODE_TEXTURE_PAINT);
show_uvedit= ED_space_image_show_uvedit(sima, obedit);
show_uvshadow= ED_space_image_show_uvshadow(sima, obedit);
- if(show_uvedit || show_uvshadow) {
+ if(show_uvedit || show_uvshadow || show_texpaint_uvshadow) {
if(show_uvshadow)
draw_uvs_shadow(obedit);
- else
+ else if(show_uvedit)
draw_uvs(sima, scene, obedit);
+ else {
+ Image *ima = ED_space_image(sima);
+ draw_uvs_texpaint(paint_ob, ima);
+ }
if(show_uvedit)
drawcursor_sima(sima, ar);
More information about the Bf-blender-cvs
mailing list