Rig Control Scripts


I have just done a load of work at the studio I work at rigging some characters in Lightwave :(. All in all a bit of a nightmare job. But there were a few things that I liked about them.

Proxy Picker: Was a tool that lets you make an object that can be used as a selector for another object. for example it can be hard to select the bones on a hand without zooming right in. But with proxy picker you could make a large hand shaped control that’s stuck to the rig that lets you select the different parts of the hand while still being zoomed out. selecting a part of that hand would jump you to selecting the corresponding part of the rig!

Hidden controls: Although not actually a Lightwave feature, on my rigs I set it up so that the controls for certain parts of the body are only displayed when you select a certain bone. This made the rigs much more tidy and streamlined as you only had the screen filled with controls when you select the right bone, for example if you selected the L_Foot the controls for the IKFK_Blend, Ball_Role, Heel_Pivot, Toe_Pivot, Toe_Twist, Toe, Bank_In and Bank_out would be displayed and the rest would be hidden.

Here is my latest Blender Rig LINK the controls are on the right.

I was wondering if this was possible in Blender? can you get a Python script to start when you select an object, or would it have to running all the time?

I was thinking of a setup like this:

Hidden Controls:
Script starts when bone X is selected.
Move all control Bones and Meshes to hidden layer.
Move Bone Y and Mesh Y to visible layer.
End script.

Proxy Picker:
Script starts when bone X is selected.
Deselect everything “a”.
Select Bone Y.
End Script.

Is this possible?

About the proxy picker, what about selecting bones in the outliner?

Hidden controls possibly could be made by making each system on layer 1 then moving them to different scenes…

I dont think you would need a script to do any of this, but if you wanted something different then tell me.


You could try a method similar to the script from the bomba rig where clicking on the mesh would select the underlying bone.
Here’s the script;


###     Pegotes 0.1     ###
###                     ###
###  Un capricho para   ###
### contentar a Caronte ###

import Blender,BPyWindow,BPyMesh
from Blender import *
from Blender.Scene import *
from Blender.NMesh import *
from Blender.Window import *
from Blender.Mathutils import *

def Select():
    evt = Blender.event
    if evt == Draw.RIGHTMOUSE and PoseMode() and not EditMode():
        sce = Blender.Scene.GetCurrent()
        arm = sce.objects.active
        for obj in sce.objects:
            for mod in obj.modifiers:
                if mod.type == Modifier.Types.ARMATURE:
                    if (mod[Modifier.Settings.OBJECT] == arm):
                        os = obj
        m    =    NMesh.GetRawFromObject(os.name)
        mc    =    GetMouseCoords()
        ray    =    BPyWindow.mouseViewRay(mc[0],mc[1],os.matrix)
        ori,dir= ray[1],ray[2]
        f    =    BPyMesh.pickMeshRayFace(m,ori,dir)
        if (f[0]):
            arm = sce.objects.active
            inf = []
            grupos = os.getData().getVertGroupNames()

#            for v in f[0].v:
#                inf.append(os.getData().getVertexInfluences(v.index))
#            for grp in grupos:
#                for i in inf:
#                    if (grp == i[0][0]): 
#                        if    not (grp in sumas): 
#                            sumas.append(grp)
# Need better algoritm for selecting Vertex Groups
            for grp in grupos:
                vert_groups = os.getData().getVertsFromGroup(grp, 0)
                for ver in vert_groups:
                    if (ver == f[0].v[0].index):
                        if (grp[-1] != "*"): break
                        pose = arm.getPose()

                        if (GetKeyQualifiers() == Qual.SHIFT):
                            pose.bones[grp].sel = 1    
                            for bonename in pose.bones.keys():
                                pose.bones[bonename].sel = 0
                            pose.bones[grp].sel = 1

I’d imagine just substitute the bone name for the vertex group lookup and then do_stuff().

Or maybe a pyconstraint on the proxy bone that selects the bone you wish to target – if that’s even possible.

@ MC Hammond - regarding the LINK you posted - these controls are awesome but they dont have any limitations and the girl becomes quite elastic… This does not have anything in common with normal human rigging, i.e. the one that will ALWAYS result in acceptable simulation of human moves.


mandoragon: Yes I know you can select bones in Outliner but its far more intuitive and visually clean to have a control on the rig! thanks for the help though :slight_smile:

Uncle Entity: Hum looks complicated :frowning: I will have a look to see if I can understand it. Could you give me a link to the Bomba Rig I cant seem to find it :frowning:

Abidos: Thanks for the C&C on the rig. yes it does deform in an elastic way but thats by design if I was doing a realistic rig I would have constraints but as its a stylized character I felt that the flezible elastic was a good thing, I evently want to try and get some rubber hose type rigging going on, on her arms and legs :smiley:

Any way back to the code:

I found this but cant seem to implement it :frowning: I have only ever coded BGE is there anything I should know about getting python to run inside blender? do I need to put it somewhere or just run it from the txt editor?

will editing the state flags update in the viewport?

Armature.bones["Bone"].selected = True
Armature.bones["Bone.Select"].active = False

Woot Woot I got the Proxy picker working :smiley:


import Blender,BPyWindow,BPyMesh
from Blender import *
from Blender.Scene import *
from Blender.NMesh import *
from Blender.Window import *
from Blender.Mathutils import *

armatura_obj = Blender.Object.Get(‘Armature’)
poz = armatura_obj.getPose()

def Select():

if poz.bones["Bone.001"].sel == 1 and PoseMode() and not EditMode():


I then used the Script Link thing set to redraw and it works :smiley:

Whoops, I forgot…here’s the link.

Thanks Uncle Entity :smiley: sweet setup

I thought I might give it a go using my Proxy Picker and Hidden Controls Script :slight_smile:
Here is a link if you want to see where I’m up to so far Link “middle download button”

It dosent update properly and its just using stick bones now, eventuly I will put custom shapes slightly smaller hiden under the real mesh so there are so there eaisyer to select.

Can you think of a better way of doing this other than doing it for each bone, maybe a way to just list all the “.select" bones you want to be active then as long as the deform bones are the same name "” and the proxy objects are “*_Proxy” then it will work. Thats my aim anyway.

thanks for sharing your code. and blend. very useful implementation. I thought you might possibly get some use out of the following python code for your rig updating(if you are still using a framechange scriptlink):

ob = Blender.Object.Get('YourArmatureNameHere)