[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14407] trunk/blender/source/blender: * Made Armature auto name L/R, Top/Bot, Fr/Bk remove existing, known extensions.

Campbell Barton ideasman42 at gmail.com
Sun Apr 13 17:15:26 CEST 2008


Revision: 14407
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14407
Author:   campbellbarton
Date:     2008-04-13 17:14:32 +0200 (Sun, 13 Apr 2008)

Log Message:
-----------
* Made Armature auto name L/R, Top/Bot, Fr/Bk remove existing, known extensions.
* Added fromDupli MTex setting to python api
* Shift+RMB was setting the active face in the UV view.
* Armature scripts menu was broken

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/armature.c
    trunk/blender/source/blender/python/api2_2x/MTex.c
    trunk/blender/source/blender/python/api2_2x/doc/Texture.py
    trunk/blender/source/blender/src/drawimage.c
    trunk/blender/source/blender/src/editsima.c
    trunk/blender/source/blender/src/header_view3d.c

Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c	2008-04-13 05:51:13 UTC (rev 14406)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c	2008-04-13 15:14:32 UTC (rev 14407)
@@ -384,59 +384,88 @@
 		/* z-axis - vertical (top/bottom) */
 		if (IS_EQ(head, 0)) {
 			if (tail < 0)
-				strcpy(extension, ".Bot");
+				strcpy(extension, "Bot");
 			else if (tail > 0)
-				strcpy(extension, ".Top");
+				strcpy(extension, "Top");
 		}
 		else {
 			if (head < 0)
-				strcpy(extension, ".Bot");
+				strcpy(extension, "Bot");
 			else
-				strcpy(extension, ".Top");
+				strcpy(extension, "Top");
 		}
 	}
 	else if (axis == 1) {
 		/* y-axis - depth (front/back) */
 		if (IS_EQ(head, 0)) {
 			if (tail < 0)
-				strcpy(extension, ".Fr");
+				strcpy(extension, "Fr");
 			else if (tail > 0)
-				strcpy(extension, ".Bk");
+				strcpy(extension, "Bk");
 		}
 		else {
 			if (head < 0)
-				strcpy(extension, ".Fr");
+				strcpy(extension, "Fr");
 			else
-				strcpy(extension, ".Bk");
+				strcpy(extension, "Bk");
 		}
 	}
 	else {
 		/* x-axis - horizontal (left/right) */
 		if (IS_EQ(head, 0)) {
 			if (tail < 0)
-				strcpy(extension, ".R");
+				strcpy(extension, "R");
 			else if (tail > 0)
-				strcpy(extension, ".L");
+				strcpy(extension, "L");
 		}
 		else {
 			if (head < 0)
-				strcpy(extension, ".R");
+				strcpy(extension, "R");
 			else if (head > 0)
-				strcpy(extension, ".L");
+				strcpy(extension, "L");
 		}
 	}
 
 	/* Simple name truncation 
 	 *	- truncate if there is an extension and it wouldn't be able to fit
-	 *	- otherwise, just append to end (TODO: this should really check if there was already a tag there, and remove it)
+	 *	- otherwise, just append to end
 	 */
 	if (extension[0]) {
-		if ((32 - len) < strlen(extension)) {
+		int change = 1;
+		
+		while (change) { /* remove extensions */
+			change = 0;
+			if (len > 2 && basename[len-2]=='.') {
+				if (basename[len-1]=='L' || basename[len-1] == 'R' ) { /* L R */
+					basename[len-2] = '\0';
+					len-=2;
+					change= 1;
+				}
+			} else if (len > 3 && basename[len-3]=='.') {
+				if (	(basename[len-2]=='F' && basename[len-1] == 'r') ||	/* Fr */
+						(basename[len-2]=='B' && basename[len-1] == 'k')	/* Bk */
+				) {
+					basename[len-3] = '\0';
+					len-=3;
+					change= 1;
+				}
+			} else if (len > 4 && basename[len-4]=='.') {
+				if (	(basename[len-3]=='T' && basename[len-2]=='o' && basename[len-1] == 'p') ||	/* Top */
+						(basename[len-3]=='B' && basename[len-2]=='o' && basename[len-1] == 't')	/* Bot */
+				) {
+					basename[len-4] = '\0';
+					len-=4;
+					change= 1;
+				}
+			}
+		}
+		
+		if ((32 - len) < strlen(extension) + 1) { /* add 1 for the '.' */
 			strncpy(name, basename, len-strlen(extension));
 		}
 	}
 
-	sprintf(name, "%s%s", basename, extension);
+	sprintf(name, "%s.%s", basename, extension);
 }
 
 /* ************* B-Bone support ******************* */

Modified: trunk/blender/source/blender/python/api2_2x/MTex.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/MTex.c	2008-04-13 05:51:13 UTC (rev 14406)
+++ trunk/blender/source/blender/python/api2_2x/MTex.c	2008-04-13 15:14:32 UTC (rev 14407)
@@ -1,5 +1,5 @@
 /* 
- * $Id: MTex.c 10279 2007-03-16 11:38:02Z campbellbarton $
+ * $Id$
  *
  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
  *
@@ -145,6 +145,9 @@
 	{ "correctNor", (getter) MTex_getFlag, (setter) MTex_setFlag,
 		"Correct normal mapping for Texture space and Object space",
 		(void*) MTEX_VIEWSPACE },
+	{ "fromDupli", (getter) MTex_getFlag, (setter) MTex_setFlag,
+		"If object is duplicated by vertices, faces or particles, inherit texture coordinate from parent object",
+		(void*) MTEX_DUPLI_MAPTO },
 	{ "xproj", (getter) MTex_getProjX, (setter) MTex_setProjX,
 		"Projection of X axis to Texture space", NULL },
 	{ "yproj", (getter) MTex_getProjY, (setter) MTex_setProjY,

Modified: trunk/blender/source/blender/python/api2_2x/doc/Texture.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Texture.py	2008-04-13 05:51:13 UTC (rev 14406)
+++ trunk/blender/source/blender/python/api2_2x/doc/Texture.py	2008-04-13 15:14:32 UTC (rev 14407)
@@ -515,6 +515,7 @@
 	@ivar neg: Negate texture values mode
 	@ivar noRGB: Convert texture RGB values to intensity values
 	@ivar correctNor: Correct normal mapping for Texture space and Object space
+	@ivar fromDupli: If object is duplicated by vertices, faces or particles, inherit texture coordinate from parent object
 	@ivar xproj: Projection of X axis to Texture space. L{Proj}
 	@ivar yproj: Projection of Y axis to Texture space. L{Proj}
 	@ivar zproj: Projection of Z axis to Texture space. L{Proj}

Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c	2008-04-13 05:51:13 UTC (rev 14406)
+++ trunk/blender/source/blender/src/drawimage.c	2008-04-13 15:14:32 UTC (rev 14407)
@@ -887,7 +887,7 @@
 		}
 		
 		glLineWidth(1);
-		cpack(0xFFFFFF);
+		cpack(0xA8A8A8);
 		for (efa= em->faces.first; efa; efa= efa->next) {
 //			tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
 //			if (simaFaceDraw_Check(efa, tface)) {

Modified: trunk/blender/source/blender/src/editsima.c
===================================================================
--- trunk/blender/source/blender/src/editsima.c	2008-04-13 05:51:13 UTC (rev 14406)
+++ trunk/blender/source/blender/src/editsima.c	2008-04-13 15:14:32 UTC (rev 14407)
@@ -848,7 +848,10 @@
 								simaUVSel_Set(efa, tf, 3);
 					}
 				}
-				EM_set_actFace(nearestefa);
+				
+				if (actface)
+					EM_set_actFace(nearestefa);
+				
 				flush = 1;
 			}			
 		}

Modified: trunk/blender/source/blender/src/header_view3d.c
===================================================================
--- trunk/blender/source/blender/src/header_view3d.c	2008-04-13 05:51:13 UTC (rev 14406)
+++ trunk/blender/source/blender/src/header_view3d.c	2008-04-13 15:14:32 UTC (rev 14407)
@@ -3884,9 +3884,9 @@
 
 static void do_view3d_scripts_armaturemenu(void *arg, int event)
 {
-	BPY_menu_do_python(PYMENU_SCRIPTTEMPLATE, event);
+	BPY_menu_do_python(PYMENU_ARMATURE, event);
 	
-	allqueue(REDRAWIMAGE, 0);
+	allqueue(REDRAWVIEW3D, 0);
 }
 
 static uiBlock *view3d_scripts_armaturemenu(void *args_unused)





More information about the Bf-blender-cvs mailing list