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>2008-04-13 19:14:32 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-04-13 19:14:32 +0400
commit6b81045bc39f24290782fcc7a45687267ca9e8f1 (patch)
tree014a1ce0210e7eb035d5ba1b12758fa073ea4fdc /source/blender/blenkernel
parent209ff9e66301986af513ca93a1f34fe065798414 (diff)
* 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
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/armature.c59
1 files changed, 44 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 24819f44ac1..aa131b85e17 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -384,59 +384,88 @@ void bone_autoside_name (char *name, int strip_number, short axis, float head, f
/* 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 ******************* */