[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12613] trunk/blender/source/blender/src/ drawimage.c: Selecting an image in editmode now adds UV' s if they are not there (before assigning the image)

Campbell Barton ideasman42 at gmail.com
Sat Nov 17 15:21:54 CET 2007


Revision: 12613
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12613
Author:   campbellbarton
Date:     2007-11-17 15:21:53 +0100 (Sat, 17 Nov 2007)

Log Message:
-----------
Selecting an image in editmode now adds UV's if they are not there (before assigning the image)

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawimage.c

Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c	2007-11-17 01:17:23 UTC (rev 12612)
+++ trunk/blender/source/blender/src/drawimage.c	2007-11-17 14:21:53 UTC (rev 12613)
@@ -309,9 +309,25 @@
 		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) {





More information about the Bf-blender-cvs mailing list