1
$\begingroup$

Good day, I'm new to Blender, and actually to the whole 3D world. I have come with a non regular issue and I hope you guys can give me hand.

I have list of rigged models, each one with their very own set of bones. I'm looking, to put it in some way, all the bones of each model to find which bones they have in common to then build an specific project with that list.

However, the list is pretty much of something around 25~ models and they are fully rigged (regular bones, face bones, hair bones and so on), and doing this by hand seems like a extreme hassle.

This comes with yet another terrible issue: I don't know Python, so I'm pretty much against the wall right now and about to pull my hair. So I wanted to ask, is it possible to get the bone list from Blender? Or is there a script already made for that task? I hopeyou can help me guys, it would mean a lot for me. Thank you in advance for reading and for your time!

$\endgroup$
  • $\begingroup$ Welcome to Blender.SE! Do you mean just a list of all bones? By "in common" do you mean have the same name, or same defining parameters? $\endgroup$ – PGmath Dec 2 '15 at 3:52
  • $\begingroup$ Hello, thanks for the answer. Yeah, by common I mean, for example, I know all of them have a pelvis bone, but some of them have a different number of spines, or don't have face bones or don't have hair bones and so on. I want the file so I can more or less do comparisons of common bones, number of bones and so on. $\endgroup$ – TotalNoob Dec 2 '15 at 6:20
  • $\begingroup$ Do you just need the names? What if there is no naming convention between the rigs? $\endgroup$ – Jaroslav Jerryno Novotny Dec 2 '15 at 8:01
  • $\begingroup$ Yeah, just the names is perfect.it doesn't really matter if there isn't a convetion $\endgroup$ – TotalNoob Dec 2 '15 at 8:04
1
$\begingroup$

So here's the plan:

  • to import all the armatures into 1 file
  • to run a script to compare them between each other and export the names of bones they have in common.

Importing (several options):

  • Just CtrlC, CtrlV from a file to another.
  • Or ShiftF1 to append an object. Navigate to a .blend file, select Object, and pick the armature object.

After all the armatures are in the same scene, switch to Scripting screen layout.

  • you can select it from the top menu bar (you should be in the Default screen now)
  • or you can use CtrlLeft Arrow and CtrlRight Arrow to switch between the screens.

In the Text editor, make a new text file and paste the code in:

import bpy

bone_names = []
for armature in [ob for ob in bpy.data.objects if ob.type == 'ARMATURE']:
    for bone in armature.data.bones:
        bone_names.append(bone.name)

common_names = set([name for name in bone_names if bone_names.count(name) > 1])

print(common_names)

Run the script, it will print the output into the Console window (Window > Toggle System Console).

If you want to print it into a text-file or json-file that's easy too just give me a file-path and I'll edit the script.

$\endgroup$
  • $\begingroup$ Hello, first I want to apologize for the super late answer, my PC got messed up and I had to fix it, it took some time. Anyway, I tried what you told me, but the console doesn't return anything. At the top screen I get this: bpy.ops.text.run_script() but I don't get anything at the console $\endgroup$ – TotalNoob Dec 3 '15 at 5:44
  • $\begingroup$ @TotalNoob Are we talking about the same console? There is a Python console and a Console Window. See: i.stack.imgur.com/BbPSG.png $\endgroup$ – Jaroslav Jerryno Novotny Dec 3 '15 at 8:51
  • $\begingroup$ Ok, I didn't notice that one, so I checked the other console, but it doesn't return anything, it only says set(). I gave it a try with 2 models on the same file puu.sh/lIa5H/8a6302a021.png $\endgroup$ – TotalNoob Dec 3 '15 at 19:44
  • $\begingroup$ @TotalNoob That means the list of common names is empty. Try to test it on some test armatures, where there is at least one bone with the same name in both of the armatures. $\endgroup$ – Jaroslav Jerryno Novotny Dec 4 '15 at 7:49
  • $\begingroup$ Thank you very much, I tried it and it worked! By the way, is there a script to just fetch like, all the bones of a single armature? That would be asking too much, but yeah, still thank you very much, this helped me tons! $\endgroup$ – TotalNoob Dec 4 '15 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.