user: Show practical ways to work with Common Features in a Blender add-on or script – include code.

assistant: ### Rig UI Panels

[image reference removed]

The generated rig is accompanied by a script that implements a set of panels that appear in the Item
tab of the 3D view sidebar when a bone belonging to the generated rig is active.

#### Rig Bake Settings

This panel is displayed if the armature has an active [Action](../../../animation/actions.xhtml), and
is used by operators that apply an operation to multiple keyframes.

Bake All Keyed Frames
:   When enabled, the operator computes and keyframes its result on every frame that has a key for any of the
    bones, as opposed to just relevant ones.

Limit Frame Range
:   When enabled, the operator is limited to a certain frame range.

    Start, End
    :   Specify the frame range to process.

    Get Frame Range
    :   Sets the baking frame range from the scene frame range.

#### Rig Main Properties

This panel shows properties and operators that are relevant to the selected bones.

#### Rig Layers

This panel contains buttons for toggling visibility of bone collections.

The layout and labels of the buttons are defined in the metarig
[Bone Collection UI](metarigs.xhtml#bpy-types-bonecollection-rigify-ui-row) panel.

### Common Controls

Rigify rigs are built from standardized components called sub-rigs, which are linked together in a parent-child
hierarchy. Although the precise behavior of each sub-rig is determined by its implementation, there are certain
conventions that are followed by many of them.

#### Root Bone

Every Rigify rig has a bone called root, which serves as a parent for all bones of the rig.
It is assigned to a bone collection called Root. Unless the metarig has a custom bone
of that name, it is positioned at the origin of the rig object. Its widget looks like
a circle with four arrow shaped protrusions.

[image reference removed]

#### Limb Master

Many limb-like sub-rigs have a gear-shaped bone at their base.

This bone can in some cases be used to transform the whole sub-rig as a rigid unit, and is also used as a container
for its custom properties that are displayed in the *Rig Main Properties* panel. If you are looking in the Graph
editor for the animated values of the properties, this is most likely the bone to look at.

As an exception, if multiple controls of the sub-rig need their own copy of conceptually the same property,
it may be placed on those controls directly instead.

#### Tweak Controls

These controls look like blue spheres in the default color scheme, and are the final control layer above the
deformation bones themselves.

Tweaks are subordinate to the general IK or FK limb position but can be moved apart, twisted and scaled freely,
even reaching virtually impossible limb shapes.

Rubber Tweak
:   [image reference removed]

    Some sub-rigs provide a slider in their *Rig Main Properties* when tweaks are selected, which controls
    the smoothness of the Bendy Bone joint at that position. When zero, the joint deforms with a sharp bend,
    while setting it to 1 makes the transition smooth for a more rubber hose cartoon like appearance.

#### Custom Pivots

Some bones that can be freely moved in space (like IK controls) can be optionally accompanied by a custom pivot
control. These controls usually look like a plain axes empty with the axis lines capped with squares or crosses,
like the one in the image above. The control can be freely moved to change the location of the pivot, and then
rotated or scaled to transform the target bone around the pivot.

#### IK and FK Switching

[image reference removed]

A number of rig types provides both IK and FK controls (red for IK and green for FK in the image above),
with an ability to switch and snap between them.

Switching is controlled by a slider in *Rig Main Properties*, usually blending between full IK at 0 and full FK at 1.

Snapping one type of controls to the shape of the other is done via buttons, which form a group of three
in their complete set:

- The main button will snap on the current frame, and auto-key the result if enabled.
- The *Action* button will bake the change on multiple keyframes, according to *Rig Bake Settings*.
- The *Clear* button will delete keyframes on the corresponding controls within the bake interval.

#### Parent Switching

[image reference removed]

Some freely movable controls, e.g. usually the IK controls, can have a mechanism to switch their parent bone
between a set of choices, including the root bone, or none at all.

This mechanism is exposed in the *Rig Main Properties* panel through a row with three controls:

- A button that presents a dropdown menu, which allows switching the parent on the current frame while
  preserving the bone position and orientation in the world space.
- A dropdown input field that directly exposes the switch property for keyframing and direct manipulation.
  Changing the value can cause the bone position to jump.
- A button to apply the position preserving parent switch over the bake range of keyframes.