Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-02-23 15:35:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-02-23 15:35:16 +0300
commit334da0fa57195af65c2877ee2882714efe5431f9 (patch)
tree57251aaff7be3f9e05d6c8811864c4ece1677bce
parent373d4fe6d3c49dae35c05d7c06df4d1d0b56f62d (diff)
[#18291] Viewing muliple object UV's in the UV/Image editor
patch from Chris and Guillermo S. Romero.
-rw-r--r--source/blender/include/blendef.h4
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/src/drawimage.c52
3 files changed, 52 insertions, 5 deletions
diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h
index 60d3a589c51..dc05acc1735 100644
--- a/source/blender/include/blendef.h
+++ b/source/blender/include/blendef.h
@@ -95,6 +95,10 @@
/* This is a TESTBASELIB that can work without a 3D view */
#define TESTBASELIB_BGMODE(base) ( ((base)->flag & SELECT) && ((base)->lay & (G.vd ? G.vd->lay : G.scene->lay)) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
+/* Test base for 2D Windows */
+/* This is added so that DNA_view3d_types.h doesn't have to be included */
+#define TESTBASE_2D(base) ( ((base)->flag & SELECT) && ((base)->lay & G.scene->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
+
#define BASE_SELECTABLE(base) ((base->lay & G.vd->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0)
#define FIRSTBASE G.scene->base.first
#define LASTBASE G.scene->base.last
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 226a3ecd834..735e1c4f195 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -539,6 +539,7 @@ typedef struct SpaceImaSel {
#define SI_SMOOTH_UV 1<<20
#define SI_DRAW_STRETCH 1<<21
#define SI_DISPGP 1<<22
+#define SI_DRAW_OTHER 1<<23
/* SpaceIpo->flag */
#define SIPO_LOCK_VIEW 1<<0
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index d400af3c2bf..b8409aff3bd 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -474,12 +474,13 @@ void draw_uvs_sima(void)
MTFace *tface,*activetface = NULL;
EditMesh *em = G.editMesh;
EditFace *efa, *efa_act;
-
+ Base *base;
+
char col1[4], col2[4];
float pointsize;
int drawface;
int lastsel, sel;
-
+
if (!G.obedit || !CustomData_has_layer(&em->fdata, CD_MTFACE))
return;
@@ -489,7 +490,47 @@ void draw_uvs_sima(void)
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
glLoadIdentity();
-
+ if(G.sima->flag & SI_DRAW_OTHER) {
+ base= FIRSTBASE;
+ if(base) {
+ MTFace *activetf;
+ Image *curimage;
+
+ activetf = get_active_mtface(NULL, NULL, 1);
+ if (activetf) {
+ curimage = activetf->tpage;
+ glColor3ub(96, 96, 96);
+ while(base) {
+ if (TESTBASE_2D(base)) {
+ Object *ob;
+ ob = base->object;
+ if ((ob->type==OB_MESH) && (ob!=G.obedit)) {
+ Mesh *me;
+ me = ob->data;
+ if (me->mtface) {
+ MFace *mface;
+ int a;
+ mface= me->mface;
+ tface= me->mtface;
+ 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();
+ }
+ }
+ }
+ }
+ }
+ base= base->next;
+ }
+ }
+ }
+ }
+
if(G.sima->flag & SI_DRAWTOOL) {
/* draws the grey mesh when painting */
glColor3ub(112, 112, 112);
@@ -902,7 +943,7 @@ void draw_uvs_sima(void)
}
glLineWidth(1);
- col2[0] = col2[1] = col2[2] = 128; col2[3] = 255;
+ col2[0] = col2[1] = col2[2] = 192; col2[3] = 255;
glColor4ubv((unsigned char *)col2);
if (G.f & G_DRAWEDGES) {
@@ -1467,7 +1508,8 @@ static void image_panel_view_properties(short cntrl) // IMAGE_HANDLER_VIEW_PROPE
uiDefButBitI(block, TOG, G_DRAWFACES, B_REDR, "Faces", 10,30,60,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades in the 3d view and UV editor");
uiDefButBitI(block, TOG, G_DRAWEDGES, B_REDR, "Edges", 70, 30,60,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights in the 3d view and UV editor");
- uiDefButBitI(block, TOG, SI_DRAWSHADOW, B_REDR, "Final Shadow", 130, 30,110,19, &G.sima->flag, 0, 0, 0, 0, "Draw the final result from the objects modifiers");
+ uiDefButBitI(block, TOG, SI_DRAWSHADOW, B_REDR, "Final Shadow", 130, 30,100,19, &G.sima->flag, 0, 0, 0, 0, "Draw the final result from the objects modifiers");
+ uiDefButBitI(block, TOG, SI_DRAW_OTHER, B_REDR, "Other Objs", 230, 30, 80, 19, &G.sima->flag, 0, 0, 0, 0, "Also draw all 3d view selected mesh objects that use this image");
uiDefButBitI(block, TOG, SI_DRAW_STRETCH, B_REDR, "UV Stretch", 10,0,100,19, &G.sima->flag, 0, 0, 0, 0, "Difference between UV's and the 3D coords (blue for low distortion, red is high)");
if (G.sima->flag & SI_DRAW_STRETCH) {