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>2007-10-24 22:58:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-10-24 22:58:26 +0400
commit6c54cd87ce628e3de0630a46d8b313c544472c29 (patch)
tree3766fd3f4979a90b3ce2d0285e9e4bbee40f18b3 /source/blender/src/drawimage.c
parent30be716fc8e0ada286a94a53bf64dc5d16402c24 (diff)
* 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.
Diffstat (limited to 'source/blender/src/drawimage.c')
-rw-r--r--source/blender/src/drawimage.c94
1 files changed, 56 insertions, 38 deletions
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index c9d6b8a649b..859b8fd0bde 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -96,6 +96,7 @@
#include "BIF_screen.h"
#include "BIF_toolbox.h"
#include "BIF_transform.h"
+#include "BIF_editmesh.h"
#include "BSE_drawipo.h"
#include "BSE_drawview.h"
@@ -243,31 +244,33 @@ void calc_image_view(SpaceImage *sima, char mode)
void what_image(SpaceImage *sima)
{
MTFace *activetf;
-
+
if( (sima->mode!=SI_TEXTURE) ||
(sima->image && sima->image->source==IMA_SRC_VIEWER) ||
- (G.obedit != OBACT)
+ (G.obedit != OBACT) ||
+ (sima->pin)
) {
return;
}
- /* viewer overrides faceselect */
- if (!sima->pin)
+ /* viewer overrides uv editmode */
+ if (EM_texFaceCheck()) {
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);
- else sima->curtile= activetf->tile;
+ activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
- if(sima->image) {
- if(activetf->mode & TF_TILES)
- sima->image->tpageflag |= IMA_TILES;
- else sima->image->tpageflag &= ~IMA_TILES;
+ if(activetf && activetf->mode & TF_TEX) {
+ if (!sima->pin)
+ sima->image= activetf->tpage;
+
+ 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;
EditMesh *em = G.editMesh;
EditFace *efa;
-
- if(image==NULL)
+ ImBuf *ibuf = NULL;
+ short change = 0;
+
+ if(image==NULL) {
sima->flag &= ~SI_DRAWTOOL;
+ } else {
+ ibuf = BKE_image_get_ibuf(image, NULL);
+ }
- if(sima->mode!=SI_TEXTURE || !EM_texFaceCheck())
+ if(sima->mode!=SI_TEXTURE)
return;
-
+
/* 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;
-
- for (efa= em->faces.first; efa; efa= efa->next) {
- tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (efa->h==0 && efa->f & SELECT) {
- if (image) {
- tface->tpage= image;
- tface->mode |= TF_TEX;
-
- if(image->tpageflag & IMA_TILES) tface->mode |= TF_TILES;
- else tface->mode &= ~TF_TILES;
-
- if(image->id.us==0) id_us_plus(&image->id);
- else id_lib_extern(&image->id);
- } else {
- tface->tpage= NULL;
- tface->mode &= ~TF_TEX;
+ } else if (EM_texFaceCheck()) {
+ for (efa= em->faces.first; efa; efa= efa->next) {
+ tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ if (efa->h==0 && efa->f & SELECT) {
+ if (image) {
+ tface->tpage= image;
+ tface->mode |= TF_TEX;
+
+ if(image->tpageflag & IMA_TILES) tface->mode |= TF_TILES;
+ else tface->mode &= ~TF_TILES;
+
+ if(image->id.us==0) id_us_plus(&image->id);
+ else id_lib_extern(&image->id);
+
+ if (tface->transp==TF_ADD) {} /* they obviously know what they are doing! - leave as is */
+ 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 */
sima->image = image;
- object_uvs_changed(OBACT);
+ if (change)
+ object_uvs_changed(OBACT);
+
allqueue(REDRAWBUTSEDIT, 0);
}
/*