From 6b81045bc39f24290782fcc7a45687267ca9e8f1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Apr 2008 15:14:32 +0000 Subject: * 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 --- source/blender/blenkernel/intern/armature.c | 59 +++++++++++++++++++++------- source/blender/python/api2_2x/MTex.c | 5 ++- source/blender/python/api2_2x/doc/Texture.py | 1 + source/blender/src/drawimage.c | 2 +- source/blender/src/editsima.c | 5 ++- source/blender/src/header_view3d.c | 4 +- 6 files changed, 56 insertions(+), 20 deletions(-) (limited to 'source/blender') 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 ******************* */ diff --git a/source/blender/python/api2_2x/MTex.c b/source/blender/python/api2_2x/MTex.c index 61d809411a1..df422bd54e0 100644 --- a/source/blender/python/api2_2x/MTex.c +++ b/source/blender/python/api2_2x/MTex.c @@ -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 @@ static PyGetSetDef MTex_getseters[] = { { "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, diff --git a/source/blender/python/api2_2x/doc/Texture.py b/source/blender/python/api2_2x/doc/Texture.py index 184d769171f..8b29d91ca19 100644 --- a/source/blender/python/api2_2x/doc/Texture.py +++ b/source/blender/python/api2_2x/doc/Texture.py @@ -515,6 +515,7 @@ class MTex: @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} diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 9f5d538768d..a3862346c93 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -887,7 +887,7 @@ void draw_uvs_sima(void) } 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)) { diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c index e1772e1edc1..a3dbfa52ef8 100644 --- a/source/blender/src/editsima.c +++ b/source/blender/src/editsima.c @@ -848,7 +848,10 @@ void mouse_select_sima(void) simaUVSel_Set(efa, tf, 3); } } - EM_set_actFace(nearestefa); + + if (actface) + EM_set_actFace(nearestefa); + flush = 1; } } diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index d62f69d8492..c59f953da90 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -3884,9 +3884,9 @@ static void do_view3d_edit_armaturemenu(void *arg, int event) 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) -- cgit v1.2.3