Editing the Rigify UI Panel

Hi,

I’m trying to add more functionality to an already generated rigify rig, I’ve been setting up the necessary bones and constraints and in this case I want to add more dynamic parenting controllable in the existing UI, by default it can switch between the Torso and Root, I would like it to switch between the torso root and head.

This is what the panel looks like now, when I try to edit source blender can’t open the script
1

So then I open the python file an look for it but I can’t tell where its getting the properties from

    controls = ['upper_arm_ik.L', 'upper_arm_fk.L', 'forearm_fk.L', 'hand_fk.L', 'hand_ik.L', 'MCH-hand_fk.L', 'upper_arm_parent.L']
    tweaks   = ['upper_arm_tweak.L.001', 'forearm_tweak.L', 'forearm_tweak.L.001']
    ik_ctrl  = ['hand_ik.L', 'MCH-upper_arm_ik.L', 'MCH-upper_arm_ik_target.L']
    fk_ctrl  = 'upper_arm_fk.L'
    parent   = 'upper_arm_parent.L'
    hand_fk   = 'hand_fk.L'
    pole = 'upper_arm_ik_target.L'
    
    # IK/FK Switch on all Control Bones
    if is_selected( controls ):
        layout.prop( pose_bones[parent], '["IK_FK"]', slider = True )
        props = layout.operator("pose.rigify_arm_fk2ik_" + rig_id, text="Snap FK->IK (" + fk_ctrl + ")")
        props.uarm_fk = controls[1]
        props.farm_fk = controls[2]
        props.hand_fk = controls[3]
        props.uarm_ik = controls[0]
        props.farm_ik = ik_ctrl[1]
        props.hand_ik = controls[4]
        props = layout.operator("pose.rigify_arm_ik2fk_" + rig_id, text="Snap IK->FK (" + fk_ctrl + ")")
        props.uarm_fk = controls[1]
        props.farm_fk = controls[2]
        props.hand_fk = controls[3]
        props.uarm_ik = controls[0]
        props.farm_ik = ik_ctrl[1]
        props.hand_ik = controls[4]
        props.pole = pole
        props.main_parent = parent
        props = layout.operator("pose.rigify_rot2pole_" + rig_id, text="Switch Rotation-Pole")
        props.bone_name = controls[1]
        props.limb_type = "arm"
        props.controls = str(controls)
        props.ik_ctrl = str(ik_ctrl)
        props.fk_ctrl = str(fk_ctrl)
        props.parent = str(parent)
        props.pole = str(pole)
    
    
    # BBone rubber hose on each Respective Tweak
    for t in tweaks:
        if is_selected( t ):
            layout.prop( pose_bones[ t ], '["rubber_tweak"]', slider = True )
    
    # IK Stretch and pole_vector on IK Control bone
    if is_selected( ik_ctrl ) or is_selected(parent):
        layout.prop( pose_bones[ parent ], '["IK_Stretch"]', slider = True )
        layout.prop( pose_bones[ parent ], '["pole_vector"]')
    
    # FK limb follow
    if is_selected( fk_ctrl ) or is_selected(parent):
        layout.prop( pose_bones[ parent ], '["FK_limb_follow"]', slider = True )
    
    controls = ['upper_arm_ik.L', 'hand_ik.L', 'upper_arm_parent.L']
    ctrl    = 'upper_arm_parent.L'
    
    if is_selected( controls ):
        layout.prop( pose_bones[ ctrl ], '["IK_follow"]')
        if 'pole_follow' in pose_bones[ctrl].keys():
            layout.prop( pose_bones[ ctrl ], '["pole_follow"]', slider = True )
        if 'root/parent' in pose_bones[ctrl].keys():
            layout.prop( pose_bones[ ctrl ], '["root/parent"]', slider = True )

PS: I’m trying to learn scripting, so far I can make or edit a basic UI using bone properties but i can’t seem to do much with the rigify panel.

1 Like