Blender V5.0
armature_naming.cc File Reference
#include <cstring>
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
#include "DNA_object_types.h"
#include "BLI_ghash.h"
#include "BLI_listbase_wrapper.hh"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_string_utils.hh"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "BKE_action.hh"
#include "BKE_animsys.h"
#include "BKE_armature.hh"
#include "BKE_constraint.h"
#include "BKE_context.hh"
#include "BKE_deform.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_layer.hh"
#include "BKE_main.hh"
#include "BKE_modifier.hh"
#include "DEG_depsgraph.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_armature.hh"
#include "ED_screen.hh"
#include "ANIM_armature.hh"
#include "armature_intern.hh"

Go to the source code of this file.

Classes

struct  BoneFlipNameData

Functions

Unique Bone Name Utility (Edit Mode)
static bool editbone_unique_check (ListBase *ebones, const StringRefNull name, EditBone *bone)
void ED_armature_ebone_unique_name (ListBase *ebones, char *name, EditBone *bone)
Unique Bone Name Utility (Object Mode)
static void ed_armature_bone_unique_name (bArmature *arm, char *name)
Bone Renaming (Object & Edit Mode API)
static void constraint_bone_name_fix (Object *rename_ob, Object *constraint_ob, ListBase *conlist, const char *oldname, const char *newname)
void ED_armature_bone_rename (Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep)
Bone Flipping (Object & Edit Mode API)
void ED_armature_bones_flip_names (Main *bmain, bArmature *arm, ListBase *bones_names, const bool do_strip_numbers)
Flip Bone Names (Edit Mode Operator)
static wmOperatorStatus armature_flip_names_exec (bContext *C, wmOperator *op)
void ARMATURE_OT_flip_names (wmOperatorType *ot)
Bone Auto Side Names (Edit Mode Operator)
static wmOperatorStatus armature_autoside_names_exec (bContext *C, wmOperator *op)
void ARMATURE_OT_autoside_names (wmOperatorType *ot)

Detailed Description

Operators and API's for renaming bones both in and out of Edit Mode.

This file contains functions/API's for renaming bones and/or working with them.

Definition in file armature_naming.cc.

Function Documentation

◆ armature_autoside_names_exec()

◆ armature_flip_names_exec()

◆ ARMATURE_OT_autoside_names()

◆ ARMATURE_OT_flip_names()

void ARMATURE_OT_flip_names ( wmOperatorType * ot)

◆ constraint_bone_name_fix()

void constraint_bone_name_fix ( Object * rename_ob,
Object * constraint_ob,
ListBase * conlist,
const char * oldname,
const char * newname )
static

Helper call for armature_bone_rename().

Parameters
rename_obThe object whose bone was renamed.
constraint_obThe object that owns the constraints in conlist.

Definition at line 120 of file armature_naming.cc.

References bActionConstraint::act, bActionConstraint::action_slot_handle, BKE_action_fix_paths_rename(), BKE_constraint_targets_flush(), BKE_constraint_targets_get(), CONSTRAINT_TYPE_ACTION, Object::id, LISTBASE_FOREACH, STREQ, and STRNCPY_UTF8.

Referenced by ED_armature_bone_rename().

◆ ED_armature_bone_rename()

void ED_armature_bone_rename ( Main * bmain,
bArmature * arm,
const char * oldnamep,
const char * newnamep )

Bone Rename (called by UI for renaming a bone). Seems messy, but that's what you get with not using pointers but channel names :).

Warning
make sure the original bone was not renamed yet!

Definition at line 163 of file armature_naming.cc.

References bScreen::areabase, BKE_animdata_fix_paths_rename_all(), BKE_armature_find_bone_name(), BKE_grease_pencil_vgroup_name_update(), BKE_modifiers_uses_armature(), BKE_object_defgroup_find_name(), BKE_object_supports_vertex_groups(), BKE_pose_channel_find_name(), BKE_pose_channels_is_valid(), BLI_assert, BLI_ghash_haskey(), BLI_ghash_insert(), BLI_ghash_remove(), UVWarpModifierData::bone_dst, UVWarpModifierData::bone_src, bArmature::bonehash, bPose::chanbase, bPose::chanhash, constraint_bone_name_fix(), Object::constraints, Object::data, DEG_id_tag_update(), Camera::dof, ed_armature_bone_unique_name(), ED_armature_ebone_find_name(), ED_armature_ebone_unique_name(), bArmature::edbo, eModifierType_Hook, eModifierType_UVWarp, ListBase::first, CameraDOFSettings::focus_object, CameraDOFSettings::focus_subtarget, bArmature::id, bScreen::id, Camera::id, Object::id, ID_RECALC_GEOMETRY, ID_RECALC_SYNC_TO_EVAL, blender::StringRefBase::is_empty(), LISTBASE_FOREACH, MAXBONENAME, Object::modifiers, Bone::name, bPoseChannel::name, EditBone::name, ID::name, Node::name, ID::next, OB_CAMERA, View3D::ob_center, View3D::ob_center_bone, OB_GREASE_PENCIL, HookModifierData::object, UVWarpModifierData::object_dst, UVWarpModifierData::object_src, Main::objects, PARBONE, Object::parent, Object::parsubstr, Object::partype, Object::pose, RPT_WARNING, Main::screens, SPACE_VIEW3D, STREQ, STREQLEN, STRNCPY(), STRNCPY_UTF8, HookModifierData::subtarget, Object::type, and WM_global_reportf().

Referenced by armature_autoside_names_exec(), ED_armature_bones_flip_names(), blender::ed::outliner::namebutton_fn(), and pose_autoside_names_exec().

◆ ed_armature_bone_unique_name()

void ed_armature_bone_unique_name ( bArmature * arm,
char * name )
static

◆ ED_armature_bones_flip_names()

void ED_armature_bones_flip_names ( Main * bmain,
bArmature * arm,
ListBase * bones_names,
bool do_strip_numbers )

Renames (by flipping) all selected bones at once.

This way if we are flipping related bones (e.g., Bone.L, Bone.R) at the same time all the bones are safely renamed, without conflicting with each other.

Parameters
armArmature the bones belong to
bones_namesList of bone conflict elements (LinkData pointing to names).
do_strip_numbersif set, try to get rid of dot-numbers at end of bone names.

Definition at line 406 of file armature_naming.cc.

References BLI_addtail(), BLI_string_flip_side_name(), ED_armature_bone_rename(), LISTBASE_FOREACH, MAXBONENAME, BoneFlipNameData::name, name, BoneFlipNameData::name_flip, STREQ, and STRNCPY_UTF8.

Referenced by armature_flip_names_exec(), and pose_flip_names_exec().

◆ ED_armature_ebone_unique_name()

void ED_armature_ebone_unique_name ( ListBase * ebones,
char * name,
EditBone * bone )

Ensure the bone name is unique. If bone is already in list, pass it as argument to ignore it.

Definition at line 78 of file armature_naming.cc.

References BLI_uniquename_cb(), DATA_, editbone_unique_check(), EditBone::name, and name.

Referenced by armature_extrude_exec(), armature_subdivide_exec(), duplicateEditBoneObjects(), ED_armature_bone_rename(), ED_armature_ebone_add(), and ED_armature_join_objects_exec().

◆ editbone_unique_check()

bool editbone_unique_check ( ListBase * ebones,
const StringRefNull name,
EditBone * bone )
static

Definition at line 61 of file armature_naming.cc.

References ED_armature_ebone_find_name(), and name.

Referenced by ED_armature_ebone_unique_name().