I was wondering if it's possible to create a function to lock all bones of a character? The only way I could think of is this:
Code:
bones = ['Bip01', 'Bip01 Footsteps', 'Bip01 Head', 'Bip01 HeadNub',
'Bip01 L Calf', 'Bip01 L Clavicle', 'Bip01 L Finger0', 'Bip01 L Finger01',
'Bip01 L Finger0Nub', 'Bip01 L Finger1', 'Bip01 L Finger11',
'Bip01 L Finger1Nub', 'Bip01 L Finger2', 'Bip01 L Finger21',
'Bip01 L Finger2Nub', 'Bip01 L Finger3', 'Bip01 L Finger31',
'Bip01 L Finger3Nub', 'Bip01 L Finger4', 'Bip01 L Finger41',
'Bip01 L Finger4Nub', 'Bip01 L Foot', 'Bip01 L Forearm', 'Bip01 L Hand',
'Bip01 L Thigh', 'Bip01 L Toe0', 'Bip01 L Toe0Nub', 'Bip01 L UpperArm',
'Bip01 Neck', 'Bip01 Pelvis', 'Bip01 R Calf', 'Bip01 R Clavicle',
'Bip01 R Finger0', 'Bip01 R Finger01', 'Bip01 R Finger0Nub',
'Bip01 R Finger1', 'Bip01 R Finger11', 'Bip01 R Finger1Nub',
'Bip01 R Finger2', 'Bip01 R Finger21', 'Bip01 R Finger2Nub',
'Bip01 R Finger3', 'Bip01 R Finger31', 'Bip01 R Finger3Nub',
'Bip01 R Finger4', 'Bip01 R Finger41', 'Bip01 R Finger4Nub',
'Bip01 R Foot', 'Bip01 R Forearm', 'Bip01 R Hand', 'Bip01 R Thigh',
'Bip01 R Toe0', 'Bip01 R Toe0Nub', 'Bip01 R UpperArm', 'Bip01 Spine',
'Bip01 Spine1', 'Bip01 Spine2']
def lock_all_bones():
for i in range(0, len(bones)):
bone = avatar.getBone(bones[i])
bone.lock()
The only problem is that I had to manually fill bones[] with the right names, so it only works with characters that have these bones. Is it possible to fill this array with a function that goes through all the bones a character has? If so, how can it be accomplished? For example, if I would want to lock all the bones of the standard duck-character, I would have to manually change all the names in bones[] because I don't know a way to get the names of the bones otherwise.