Historical example · current workflow unverified The source author reported this working with Blender 4.4 or later. The underlying temp_override() and Custom layout mechanisms still exist, but this exact panel-and-mode combination was not rerun for this guide.

Outcome

Show Blender’s Pose-mode display-options panel inside a PME Popup Dialog while working in Weight Paint. The pattern temporarily supplies the context the native panel’s poll() expects, then gives its draw() method a layout owned by PME.

Pose panel drawn in a Weight Paint PME Popup Dialog

Historical Custom-item pattern

Place the code in a Custom item where L is the PME layout:

with C.temp_override(
        object=C.pose_object,
        active_object=C.pose_object,
        selected_objects=[C.pose_object],
        mode="POSE"):
    dummy = type("DummyPanel", (), {})()
    dummy.layout = L.box()
    bpy.types.VIEW3D_PT_tools_posemode_options.draw(dummy, C)

The linked JSON example captures the original setup.

What the code assumes

  1. The active object has an associated pose object; C.pose_object must not be None.
  2. The target Blender panel still has the same class name and accepts the context supplied by the override.
  3. The current PME item is a Custom layout item, so L exists.
  4. The panel’s own controls are meaningful in the original Weight Paint workflow.

temp_override() changes the context only within the with block. It does not make an arbitrary Blender panel generally safe in another editor or mode.

Test before adopting it

  • Start with a throwaway Popup Dialog containing only this one Custom item.
  • Test with an armature and mesh in the exact Weight Paint setup you use.
  • Open Blender’s System Console and stop if the panel’s poll() or draw() raises an error.
  • Check the panel after a Blender upgrade; native panel identifiers and context requirements can change.

Do not use this pattern to bypass a panel’s safety requirements. If a native panel performs an action that still requires Pose mode at execution time, the override may draw it but not make that action valid.

Sources