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-11-17 17:21:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-11-17 17:21:53 +0300
commit6ce8374990ef9d98129b02f3b38d6b1454581109 (patch)
tree61dc8d12af53eb009f83a11fc55b25824e1b974d /source/blender/src/drawimage.c
parente0fb0a1783d98454a733561ae524526478372ecc (diff)
Selecting an image in editmode now adds UV's if they are not there (before assigning the image)
Diffstat (limited to 'source/blender/src/drawimage.c')
-rw-r--r--source/blender/src/drawimage.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index e7a43086fa3..342e361d869 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -309,9 +309,25 @@ void image_changed(SpaceImage *sima, Image *image)
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;
- } else if (EM_texFaceCheck()) {
+ } else if ((G.obedit) &&
+ (G.obedit->type == OB_MESH) &&
+ (G.editMesh) &&
+ (G.editMesh->faces.first)
+ ) {
+
+ /* Add a UV layer if there is none, editmode only */
+ if ( !CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE) ) {
+ EM_add_data_layer(&em->fdata, CD_MTFACE);
+ CustomData_set_layer_active(&em->fdata, CD_MTFACE, 0); /* always zero because we have no other UV layers */
+ change = 1; /* so we update the object, incase no faces are selected */
+
+ /* BIF_undo_push("New UV Texture"); - undo should be done by whatever changes the image */
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+ }
+
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) {