* Changing images in the UV view didnt work properly - reported as bug 7467 (own error, broke on UV in editmode conversion)
* when setting the face, images with alpha's will set the texface's alpha option. * added a draw even to redraw view3d and uv/image view - so the Draw Faces button redraws properly. * made a macro for checking if the object will draw with textures * textured meshes in editmode only draw a selected face overlay (otherwise the entire mesh would get a plue tint wich isnt nice for viewing textures), the selected highlight is still there, this is how Face/UV mode looked. * Alpha clipping STILL had a case where it wasnt disabled and the interface had its alpha clipped, this should be fixed now.
This commit is contained in:
@@ -254,7 +254,7 @@
|
|||||||
#define REDRAWNODE 0x4038
|
#define REDRAWNODE 0x4038
|
||||||
#define RECALC_COMPOSITE 0x4039
|
#define RECALC_COMPOSITE 0x4039
|
||||||
#define REDRAWMARKER 0x4040 /* all views that display markers */
|
#define REDRAWMARKER 0x4040 /* all views that display markers */
|
||||||
|
#define REDRAWVIEW3D_IMAGE 0x4041
|
||||||
|
|
||||||
#endif /* !__MYDEVICE_H__ */
|
#endif /* !__MYDEVICE_H__ */
|
||||||
|
|
||||||
|
|||||||
@@ -308,6 +308,9 @@ extern Object workob;
|
|||||||
#define OB_SHADED 4
|
#define OB_SHADED 4
|
||||||
#define OB_TEXTURE 5
|
#define OB_TEXTURE 5
|
||||||
|
|
||||||
|
/* this condition has been made more complex since editmode can draw textures */
|
||||||
|
#define CHECK_OB_DRAWTEXTURE(vd, dt) ((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX))
|
||||||
|
|
||||||
/* dtx: flags, char! */
|
/* dtx: flags, char! */
|
||||||
#define OB_AXIS 2
|
#define OB_AXIS 2
|
||||||
#define OB_TEXSPACE 4
|
#define OB_TEXSPACE 4
|
||||||
|
|||||||
@@ -4381,7 +4381,7 @@ static void editing_panel_mesh_tools1(Object *ob, Mesh *me)
|
|||||||
uiBlockEndAlign(block);
|
uiBlockEndAlign(block);
|
||||||
|
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
uiDefButBitI(block, TOG, G_DRAWFACES, REDRAWVIEW3D|REDRAWIMAGE, "Draw Faces", 955,88,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
|
uiDefButBitI(block, TOG, G_DRAWFACES, REDRAWVIEW3D_IMAGE, "Draw Faces", 955,88,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades in the 3d view and UV editor");
|
||||||
uiDefButBitI(block, TOG, G_DRAWEDGES, REDRAWVIEW3D, "Draw Edges", 955,66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
|
uiDefButBitI(block, TOG, G_DRAWEDGES, REDRAWVIEW3D, "Draw Edges", 955,66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
|
||||||
uiDefButBitI(block, TOG, G_DRAWCREASES, REDRAWVIEW3D, "Draw Creases", 955,44,150,19, &G.f, 0, 0, 0, 0, "Displays creases created for subsurf weighting");
|
uiDefButBitI(block, TOG, G_DRAWCREASES, REDRAWVIEW3D, "Draw Creases", 955,44,150,19, &G.f, 0, 0, 0, 0, "Displays creases created for subsurf weighting");
|
||||||
uiDefButBitI(block, TOG, G_DRAWSEAMS, REDRAWVIEW3D, "Draw Seams", 955,22,150,19, &G.f, 0, 0, 0, 0, "Displays UV unwrapping seams");
|
uiDefButBitI(block, TOG, G_DRAWSEAMS, REDRAWVIEW3D, "Draw Seams", 955,22,150,19, &G.f, 0, 0, 0, 0, "Displays UV unwrapping seams");
|
||||||
@@ -5321,9 +5321,9 @@ static void editing_panel_mesh_texface(void)
|
|||||||
|
|
||||||
uiBlockBeginAlign(block);
|
uiBlockBeginAlign(block);
|
||||||
uiBlockSetCol(block, TH_BUT_SETTING1);
|
uiBlockSetCol(block, TH_BUT_SETTING1);
|
||||||
uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,80,60,19, &tf->transp, 2.0, 0.0, 0, 0, "Render color of textured face as color");
|
uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,80,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
|
||||||
uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,80,60,19, &tf->transp, 2.0, 1.0, 0, 0, "Render face transparent and add color of face");
|
uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,80,60,19, &tf->transp, 2.0, (float)TF_ADD, 0, 0, "Render face transparent and add color of face");
|
||||||
uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,80,60,19, &tf->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture");
|
uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,80,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,7 @@
|
|||||||
#include "BIF_screen.h"
|
#include "BIF_screen.h"
|
||||||
#include "BIF_toolbox.h"
|
#include "BIF_toolbox.h"
|
||||||
#include "BIF_transform.h"
|
#include "BIF_transform.h"
|
||||||
|
#include "BIF_editmesh.h"
|
||||||
|
|
||||||
#include "BSE_drawipo.h"
|
#include "BSE_drawipo.h"
|
||||||
#include "BSE_drawview.h"
|
#include "BSE_drawview.h"
|
||||||
@@ -243,31 +244,33 @@ void calc_image_view(SpaceImage *sima, char mode)
|
|||||||
void what_image(SpaceImage *sima)
|
void what_image(SpaceImage *sima)
|
||||||
{
|
{
|
||||||
MTFace *activetf;
|
MTFace *activetf;
|
||||||
|
|
||||||
if( (sima->mode!=SI_TEXTURE) ||
|
if( (sima->mode!=SI_TEXTURE) ||
|
||||||
(sima->image && sima->image->source==IMA_SRC_VIEWER) ||
|
(sima->image && sima->image->source==IMA_SRC_VIEWER) ||
|
||||||
(G.obedit != OBACT)
|
(G.obedit != OBACT) ||
|
||||||
|
(sima->pin)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* viewer overrides faceselect */
|
/* viewer overrides uv editmode */
|
||||||
if (!sima->pin)
|
if (EM_texFaceCheck()) {
|
||||||
sima->image= NULL;
|
sima->image= NULL;
|
||||||
|
|
||||||
activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
|
|
||||||
|
|
||||||
if(activetf && activetf->mode & TF_TEX) {
|
|
||||||
if (!sima->pin)
|
|
||||||
sima->image= activetf->tpage;
|
|
||||||
|
|
||||||
if(sima->flag & SI_EDITTILE);
|
activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
|
||||||
else sima->curtile= activetf->tile;
|
|
||||||
|
|
||||||
if(sima->image) {
|
if(activetf && activetf->mode & TF_TEX) {
|
||||||
if(activetf->mode & TF_TILES)
|
if (!sima->pin)
|
||||||
sima->image->tpageflag |= IMA_TILES;
|
sima->image= activetf->tpage;
|
||||||
else sima->image->tpageflag &= ~IMA_TILES;
|
|
||||||
|
if(sima->flag & SI_EDITTILE);
|
||||||
|
else sima->curtile= activetf->tile;
|
||||||
|
|
||||||
|
if(sima->image) {
|
||||||
|
if(activetf->mode & TF_TILES)
|
||||||
|
sima->image->tpageflag |= IMA_TILES;
|
||||||
|
else sima->image->tpageflag &= ~IMA_TILES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,32 +296,45 @@ void image_changed(SpaceImage *sima, Image *image)
|
|||||||
MTFace *tface;
|
MTFace *tface;
|
||||||
EditMesh *em = G.editMesh;
|
EditMesh *em = G.editMesh;
|
||||||
EditFace *efa;
|
EditFace *efa;
|
||||||
|
ImBuf *ibuf = NULL;
|
||||||
if(image==NULL)
|
short change = 0;
|
||||||
sima->flag &= ~SI_DRAWTOOL;
|
|
||||||
|
|
||||||
if(sima->mode!=SI_TEXTURE || !EM_texFaceCheck())
|
if(image==NULL) {
|
||||||
|
sima->flag &= ~SI_DRAWTOOL;
|
||||||
|
} else {
|
||||||
|
ibuf = BKE_image_get_ibuf(image, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sima->mode!=SI_TEXTURE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* skip assigning these procedural images... */
|
/* skip assigning these procedural images... */
|
||||||
if(image && (image->type==IMA_TYPE_R_RESULT || image->type==IMA_TYPE_COMPOSITE))
|
if(image && (image->type==IMA_TYPE_R_RESULT || image->type==IMA_TYPE_COMPOSITE)) {;
|
||||||
return;
|
return;
|
||||||
|
} else if (EM_texFaceCheck()) {
|
||||||
for (efa= em->faces.first; efa; efa= efa->next) {
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
||||||
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
||||||
if (efa->h==0 && efa->f & SELECT) {
|
if (efa->h==0 && efa->f & SELECT) {
|
||||||
if (image) {
|
if (image) {
|
||||||
tface->tpage= image;
|
tface->tpage= image;
|
||||||
tface->mode |= TF_TEX;
|
tface->mode |= TF_TEX;
|
||||||
|
|
||||||
if(image->tpageflag & IMA_TILES) tface->mode |= TF_TILES;
|
if(image->tpageflag & IMA_TILES) tface->mode |= TF_TILES;
|
||||||
else tface->mode &= ~TF_TILES;
|
else tface->mode &= ~TF_TILES;
|
||||||
|
|
||||||
if(image->id.us==0) id_us_plus(&image->id);
|
if(image->id.us==0) id_us_plus(&image->id);
|
||||||
else id_lib_extern(&image->id);
|
else id_lib_extern(&image->id);
|
||||||
} else {
|
|
||||||
tface->tpage= NULL;
|
if (tface->transp==TF_ADD) {} /* they obviously know what they are doing! - leave as is */
|
||||||
tface->mode &= ~TF_TEX;
|
else if (ibuf && ibuf->depth == 32) tface->transp = TF_ALPHA;
|
||||||
|
else tface->transp = TF_SOLID;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
tface->tpage= NULL;
|
||||||
|
tface->mode &= ~TF_TEX;
|
||||||
|
tface->transp = TF_SOLID;
|
||||||
|
}
|
||||||
|
change = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,7 +342,9 @@ void image_changed(SpaceImage *sima, Image *image)
|
|||||||
* to check if the face is displayed in UV-localview */
|
* to check if the face is displayed in UV-localview */
|
||||||
sima->image = image;
|
sima->image = image;
|
||||||
|
|
||||||
object_uvs_changed(OBACT);
|
if (change)
|
||||||
|
object_uvs_changed(OBACT);
|
||||||
|
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ int set_tpage(MTFace *tface)
|
|||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glDisable(GL_TEXTURE_GEN_S);
|
glDisable(GL_TEXTURE_GEN_S);
|
||||||
glDisable(GL_TEXTURE_GEN_T);
|
glDisable(GL_TEXTURE_GEN_T);
|
||||||
|
glDisable ( GL_ALPHA_TEST );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
lasttface= tface;
|
lasttface= tface;
|
||||||
@@ -744,7 +744,7 @@ static void draw_tfaces3D(Object *ob, Mesh *me, DerivedMesh *dm)
|
|||||||
glLineWidth(1);
|
glLineWidth(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw Selected Faces */
|
/* Draw Selected Faces */
|
||||||
if(G.f & G_DRAWFACES) {
|
if(G.f & G_DRAWFACES) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
@@ -960,7 +960,6 @@ static void draw_textured_begin(Object *ob)
|
|||||||
Gtexdraw.istex = istex;
|
Gtexdraw.istex = istex;
|
||||||
memcpy(Gtexdraw.obcol, obcol, sizeof(obcol));
|
memcpy(Gtexdraw.obcol, obcol, sizeof(obcol));
|
||||||
set_draw_settings_cached(1, 0, 0, Gtexdraw.islit, 0, 0, 0);
|
set_draw_settings_cached(1, 0, 0, Gtexdraw.islit, 0, 0, 0);
|
||||||
glDisable ( GL_ALPHA_TEST );
|
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2026,9 +2026,7 @@ static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, Derived
|
|||||||
EM_init_index_arrays(1, 1, 1);
|
EM_init_index_arrays(1, 1, 1);
|
||||||
|
|
||||||
if(dt>OB_WIRE) {
|
if(dt>OB_WIRE) {
|
||||||
if( (G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) ||
|
if( CHECK_OB_DRAWTEXTURE(G.vd, dt) ) {
|
||||||
(G.vd->drawtype==OB_SOLID && G.vd->flag2 & V3D_SOLID_TEX)
|
|
||||||
) {
|
|
||||||
draw_mesh_textured(ob, finalDM, 0);
|
draw_mesh_textured(ob, finalDM, 0);
|
||||||
} else {
|
} else {
|
||||||
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
|
||||||
@@ -2066,6 +2064,10 @@ static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, Derived
|
|||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glDepthMask(0); // disable write in zbuffer, needed for nice transp
|
glDepthMask(0); // disable write in zbuffer, needed for nice transp
|
||||||
|
|
||||||
|
/* dont draw unselected faces, only selected, this is MUCH nicer when texturing */
|
||||||
|
if CHECK_OB_DRAWTEXTURE(G.vd, dt)
|
||||||
|
col1[3] = 0;
|
||||||
|
|
||||||
draw_dm_faces_sel(cageDM, col1, col2, col3, efa_act);
|
draw_dm_faces_sel(cageDM, col1, col2, col3, efa_act);
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
@@ -2089,10 +2091,7 @@ static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, Derived
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* here starts all fancy draw-extra over */
|
/* here starts all fancy draw-extra over */
|
||||||
if( (G.f & G_DRAWEDGES)==0 &&
|
if((G.f & G_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(G.vd, dt)) {
|
||||||
((G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) ||
|
|
||||||
(G.vd->drawtype==OB_SOLID && G.vd->flag2 & V3D_SOLID_TEX))
|
|
||||||
) {
|
|
||||||
/* we are drawing textures and 'G_DRAWEDGES' is disabled, dont draw any edges */
|
/* we are drawing textures and 'G_DRAWEDGES' is disabled, dont draw any edges */
|
||||||
|
|
||||||
/* only draw selected edges otherwise there is no way of telling if a face is selected */
|
/* only draw selected edges otherwise there is no way of telling if a face is selected */
|
||||||
@@ -2242,8 +2241,7 @@ static void draw_mesh_fancy(Base *base, int dt, int flag)
|
|||||||
draw_wire = 1;
|
draw_wire = 1;
|
||||||
}
|
}
|
||||||
else if( (ob==OBACT && (G.f & G_TEXTUREPAINT || FACESEL_PAINT_TEST)) ||
|
else if( (ob==OBACT && (G.f & G_TEXTUREPAINT || FACESEL_PAINT_TEST)) ||
|
||||||
(G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) ||
|
CHECK_OB_DRAWTEXTURE(G.vd, dt))
|
||||||
(G.vd->drawtype==OB_SOLID && G.vd->flag2 & V3D_SOLID_TEX))
|
|
||||||
{
|
{
|
||||||
int faceselect= (ob==OBACT && FACESEL_PAINT_TEST);
|
int faceselect= (ob==OBACT && FACESEL_PAINT_TEST);
|
||||||
|
|
||||||
|
|||||||
@@ -3440,6 +3440,7 @@ void Face_Menu() {
|
|||||||
flip_editnormals();
|
flip_editnormals();
|
||||||
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
|
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
|
||||||
BIF_undo_push("Flip Normals");
|
BIF_undo_push("Flip Normals");
|
||||||
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
bevel_menu();
|
bevel_menu();
|
||||||
|
|||||||
@@ -6036,6 +6036,12 @@ void allqueue(unsigned short event, short val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case REDRAWVIEW3D_IMAGE:
|
||||||
|
if(sa->spacetype==SPACE_VIEW3D || sa->spacetype==SPACE_IMAGE) {
|
||||||
|
scrarea_queue_winredraw(sa);
|
||||||
|
if(val) scrarea_queue_headredraw(sa);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case REDRAWVIEWCAM:
|
case REDRAWVIEWCAM:
|
||||||
if(sa->spacetype==SPACE_VIEW3D) {
|
if(sa->spacetype==SPACE_VIEW3D) {
|
||||||
v3d= sa->spacedata.first;
|
v3d= sa->spacedata.first;
|
||||||
|
|||||||
Reference in New Issue
Block a user