diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-04-18 18:47:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-04-18 18:47:45 +0400 |
commit | 4fde9823fdfe323de4c8d3b76aa75d98ef9362a6 (patch) | |
tree | 047f14eeb0a0c71f41a0a70cf0c53bb9e6e8b687 /source/blender/blenkernel | |
parent | 153081accdc6c8d5779b1d13e1d25555682b9e44 (diff) |
possible fix for [#22057] Autoname L/R in bones names center bones as .R
Bone would get a '.' added even when there was no extension.
(center limit would still be useful)
- name flipping function used sizeof() incorrectly.
- ED_lorem should be extern.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_armature.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/deform.c | 8 |
3 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 7e3d7f2a2ce..2c661a74573 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -81,7 +81,7 @@ void make_local_armature(struct bArmature *arm); struct bArmature *copy_armature(struct bArmature *arm); void bone_flip_name (char *name, int strip_number); -void bone_autoside_name (char *name, int strip_number, short axis, float head, float tail); +int bone_autoside_name (char *name, int strip_number, short axis, float head, float tail); struct Bone *get_named_bone (struct bArmature *arm, const char *name); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index aec6ab6a139..04d5acb11cc 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -361,7 +361,7 @@ void bone_flip_name (char *name, int strip_number) * axis: the axis to name on * head/tail: the head/tail co-ordinate of the bone on the specified axis */ -void bone_autoside_name (char *name, int strip_number, short axis, float head, float tail) +int bone_autoside_name (char *name, int strip_number, short axis, float head, float tail) { unsigned int len; char basename[32]={""}; @@ -462,9 +462,15 @@ void bone_autoside_name (char *name, int strip_number, short axis, float head, f if ((32 - len) < strlen(extension) + 1) { /* add 1 for the '.' */ strncpy(name, basename, len-strlen(extension)); } + + sprintf(name, "%s.%s", basename, extension); + + return 1; } - sprintf(name, "%s.%s", basename, extension); + else { + return 0; + } } /* ************* B-Bone support ******************* */ diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index d9ba6cd6a9d..fecafc701a6 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -364,10 +364,10 @@ void defgroup_unique_name (bDeformGroup *dg, Object *ob) void flip_side_name (char *name, const char *from_name, int strip_number) { int len; - char prefix[sizeof((bDeformGroup *)NULL)->name]={""}; /* The part before the facing */ - char suffix[sizeof((bDeformGroup *)NULL)->name]={""}; /* The part after the facing */ - char replace[sizeof((bDeformGroup *)NULL)->name]={""}; /* The replacement string */ - char number[sizeof((bDeformGroup *)NULL)->name]={""}; /* The number extension string */ + char prefix[sizeof(((bDeformGroup *)NULL)->name)]= {""}; /* The part before the facing */ + char suffix[sizeof(((bDeformGroup *)NULL)->name)]= {""}; /* The part after the facing */ + char replace[sizeof(((bDeformGroup *)NULL)->name)]= {""}; /* The replacement string */ + char number[sizeof(((bDeformGroup *)NULL)->name)]= {""}; /* The number extension string */ char *index=NULL; len= strlen(from_name); |