Пример #1
0
static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
{
	bArmature *arm = (bArmature *)ptr->id.data;
	Bone *bone = (Bone *)ptr->data;
	char oldname[sizeof(bone->name)], newname[sizeof(bone->name)];
	
	/* need to be on the stack */
	BLI_strncpy_utf8(newname, value, sizeof(bone->name));
	BLI_strncpy(oldname, bone->name, sizeof(bone->name));

	ED_armature_bone_rename(arm, oldname, newname);
}
Пример #2
0
static void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev)
{
	EditBone *eBone= bonev;
	char oldname[sizeof(eBone->name)], newname[sizeof(eBone->name)];

	/* need to be on the stack */
	BLI_strncpy(newname, eBone->name, sizeof(eBone->name));
	BLI_strncpy(oldname, (char *)namev, sizeof(eBone->name));
	/* restore */
	BLI_strncpy(eBone->name, oldname, sizeof(eBone->name));

	ED_armature_bone_rename(CTX_data_edit_object(C)->data, oldname, newname); // editarmature.c
	WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, CTX_data_edit_object(C)); // XXX fix
}
Пример #3
0
static int armature_flip_names_exec(bContext *C, wmOperator *UNUSED(op))
{
	Object *ob = CTX_data_edit_object(C);
	bArmature *arm;
	
	/* paranoia checks */
	if (ELEM(NULL, ob, ob->pose)) 
		return OPERATOR_CANCELLED;
	arm = ob->data;
	
	/* loop through selected bones, auto-naming them */
	CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
	{
		char name_flip[MAXBONENAME];
		BKE_deform_flip_side_name(name_flip, ebone->name, true);
		ED_armature_bone_rename(arm, ebone->name, name_flip);
	}
Пример #4
0
static int armature_flip_names_exec(bContext *C, wmOperator *UNUSED(op))
{
    Object *ob = CTX_data_edit_object(C);
    bArmature *arm;
    char newname[MAXBONENAME];

    /* paranoia checks */
    if (ELEM(NULL, ob, ob->pose))
        return OPERATOR_CANCELLED;
    arm = ob->data;

    /* loop through selected bones, auto-naming them */
    CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
    {
        flip_side_name(newname, ebone->name, TRUE); // 1 = do strip off number extensions
        ED_armature_bone_rename(arm, ebone->name, newname);
    }