1
$\begingroup$

I try create script for my self to rigging. I create adn snap bones using this code for all bones(copy and paste)

RIG.data.edit_bones.new("RemRoll_bone1.L")
RIG.data.edit_bones['RemRoll_bone1.L'].head = RIG.data.edit_bones['bone1.L'].head
RIG.data.edit_bones['RemRoll_bone1.L'].tail = RIG.data.edit_bones['bone1.L'].tail
RIG.data.edit_bones['RemRoll_bone1.L'].roll = RIG.data.edit_bones['bone1.L'].roll

RIG.data.edit_bones.new("RemRoll_bone2.L")
RIG.data.edit_bones['RemRoll_bone2.L'].head = RIG.data.edit_bones['bone2.L'].head
RIG.data.edit_bones['RemRoll_bone2.L'].tail = RIG.data.edit_bones['bone2.L'].tail
RIG.data.edit_bones['RemRoll_bone2.L'].roll = RIG.data.edit_bones['bone1.L'].roll

I want do someting like this now, but im to new at the Scripting(

remroll_list = [

("bone1.L"),
("bone2.L")

]

for n1 in remroll_list:

    RIG.data.edit_bones.new.['RemRoll_'] + (n1)
    RIG.data.edit_bones['RemRoll_'] + (n1).head = RIG.data.edit_bones(n1).head
    RIG.data.edit_bones['RemRoll_'] + (n1).tail = RIG.data.edit_bones(n1).tail
    RIG.data.edit_bones['RemRoll_'] + (n1).roll = RIG.data.edit_bones(n1).roll

And I don't even know if it is possible to create and move with bones through the list. hlp pls

$\endgroup$
1
$\begingroup$

Ok. This was easy!

import bpy

namelist = [

("Bone"),
("Bone.001"),
("Bone.002"),
("Bone.003")

]

for name123 in namelist:

    RIG = bpy.data.objects['Armature']

    RIG.data.edit_bones.new(('RemRoll_') + name123)
    RIG.data.edit_bones[('RemRoll_') + name123].head = RIG.data.edit_bones.get(name123).head
    RIG.data.edit_bones[('RemRoll_') + name123].tail = RIG.data.edit_bones.get(name123).tail
    RIG.data.edit_bones[('RemRoll_') + name123].roll = RIG.data.edit_bones.get(name123).roll
$\endgroup$
1

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.