1
$\begingroup$

I'm trying to create an animation rig with quite a few armature bones. I'm modeling a bug, which has a total of 14 legs, and each one of those legs has 5 armature bones. The legs are identical, except they are in different positions with different rotations, so to set up the armatures I simply created an armature for one leg and duplicated it to the other legs, rotating and repositioning it as needed. However, I named the front legs FrontLeg.L and FrontLeg.R. The other legs, since they're just duplicated, are, for example, FrontLeg.R.007, etc etc. I can easily rename the parent bone for each leg, but this becomes tedious very quickly to do this for all of the children as well.

Is there any easy way for me to rename the parent bone to, for example, 2ndFrontLeg.L and have all of the children automatically be assigned names 2ndFrontLeg.L.001, 2ndFrontLeg.L.002, etc, after they've already been created? I'm completely ok with using addons as well

$\endgroup$
1
  • $\begingroup$ I would simplify your model a bit (animating 4 legs is difficult enough, maybe 6 or 8 is reasonable if you have a bug or a spider but 14?) leaving less bones to name and then you could use the flip names option which flips names of half of your bones. But that does not answer your question. $\endgroup$
    – aky-her
    Commented Oct 20, 2015 at 5:49

2 Answers 2

3
$\begingroup$

there's a new answer! This feature is now built in Blender, just pick Edit → Batch Rename... from the menu.

Official docs: https://docs.blender.org/manual/en/latest/files/blend/rename.html

$\endgroup$
4
$\begingroup$
  1. Open a text editor in Blender and paste the code below there.
  2. Replace the text in "original" and "replacement" as needed.
  3. Go to pose mode and select the parent of the new chain.
  4. Press "Run Script" in the text editor.

Here's the code:

import bpy
original    = "FrontLeg"    # Original name that was duplicated to generate all legs
replacement = "2ndFrontLeg" # The new name you want for this particular leg's bone chain

parent = bpy.context.active_pose_bone
for b in [ parent ] + parent.children_recursive:
    b.name = replacement
$\endgroup$
4
  • $\begingroup$ Looks great! However, there's one small change to it that I would like: could you make it automatically change the number (e.g: .007) at the end of the name of each bone? So that it's like: 2ndFrontLeg.L.001, 2ndFrontLeg.L.002, etc instead of just keeping the digits, which often ends up with things like: 2ndFrontLeg.L.004, 2ndFrontLeg.002`, etc etc, not in order $\endgroup$ Commented Oct 20, 2015 at 23:06
  • 1
    $\begingroup$ @Markasoftware, updated the script to work as requested. $\endgroup$
    – TLousky
    Commented Oct 21, 2015 at 5:50
  • $\begingroup$ I think your original answer would have been more useful in my test case. How would you simply do a find and replace in all bones? @TLousky $\endgroup$
    – Tyler
    Commented Mar 20, 2019 at 5:47
  • $\begingroup$ You could always try to: for b in [ parent ] + parent.children_recursive: b.name = b.name.replace('something','somethingelse') $\endgroup$
    – TLousky
    Commented Mar 20, 2019 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .