forked from bartvdbraak/blender
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.
This commit is contained in:
parent
153081accd
commit
4fde9823fd
@ -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);
|
||||
|
||||
|
@ -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 ******************* */
|
||||
|
@ -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);
|
||||
|
@ -5601,8 +5601,8 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
|
||||
CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
|
||||
{
|
||||
BLI_strncpy(newname, ebone->name, sizeof(newname));
|
||||
bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]);
|
||||
ED_armature_bone_rename(arm, ebone->name, newname);
|
||||
if(bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
|
||||
ED_armature_bone_rename(arm, ebone->name, newname);
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
|
@ -1410,8 +1410,8 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
|
||||
CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
|
||||
{
|
||||
BLI_strncpy(newname, pchan->name, sizeof(newname));
|
||||
bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]);
|
||||
ED_armature_bone_rename(arm, pchan->name, newname);
|
||||
if(bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
|
||||
ED_armature_bone_rename(arm, pchan->name, newname);
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
struct wmOperatorType;
|
||||
|
||||
/* lorem.c */
|
||||
char *ED_lorem;
|
||||
extern char *ED_lorem;
|
||||
|
||||
/* editfont.c */
|
||||
enum { DEL_ALL, DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL };
|
||||
|
@ -96,12 +96,15 @@ void BPy_init_modules( void )
|
||||
/* Needs to be first since this dir is needed for future modules */
|
||||
char *modpath= BLI_gethome_folder("scripts/modules", BLI_GETHOME_ALL);
|
||||
if(modpath) {
|
||||
// printf("bpy: found module path '%s'.\n", modpath);
|
||||
PyObject *sys_path= PySys_GetObject("path"); /* borrow */
|
||||
PyObject *py_modpath= PyUnicode_FromString(modpath);
|
||||
PyList_Insert(sys_path, 0, py_modpath); /* add first */
|
||||
Py_DECREF(py_modpath);
|
||||
}
|
||||
|
||||
else {
|
||||
printf("bpy: couldnt find 'scripts/modules', blender probably wont start.\n");
|
||||
}
|
||||
/* stand alone utility modules not related to blender directly */
|
||||
Geometry_Init();
|
||||
Mathutils_Init();
|
||||
|
Loading…
Reference in New Issue
Block a user