Operations

April 12, 2026 · View on GitHub

Source: src/mpfb/ui/operations/exportops/

Parent panel: MPFB_PT_Operations_Panel ("Operations")

Overview

The "Export copy" panel creates a deep copy of a fully assembled MPFB character for use in other applications. An "export copy" is an independent duplicate of the entire character hierarchy — including the basemesh, any rig, and all attached clothing and body parts — with a configurable set of cleanup operations applied to it. The original character is left untouched.

Typical reasons to create an export copy include:

  • Baking shape keys so the mesh is at its final morph positions without any shape key data blocks.
  • Loading facial animation shape keys (visemes, ARKit face units) that are not part of the standard MPFB character but are needed for real-time or game-engine use.
  • Cleaning up modifiers — baking or removing mask and subdivision modifiers that are not meaningful outside of Blender.
  • Removing helper geometry that is only needed for MPFB's internal clothing workflow.

The panel is shown whenever a basemesh can be found among the active object's relatives (poll strategy: BASEMESH_AMONGST_RELATIVES). This means you can trigger it from the rig, from a clothing piece, or from the basemesh itself.

Panel

MPFB_PT_ExportOpsPanel ("Export copy")

AttributeValue
bl_label"Export copy"
bl_categoryOPERATIONSCATEGORY
bl_parent_idMPFB_PT_Operations_Panel
bl_options{'DEFAULT_CLOSED'}
Base classAbstract_Panel
Properties prefix"EXPO_"

The panel draws three collapsible boxes:

  • Basemeshmask_modifiers, subdiv_modifiers, bake_shapekeys, delete_helpers, remove_basemesh settings.
  • Visemes and faceunitsvisemes_meta, visemes_microsoft, faceunits_arkit, interpolate toggles.
  • Create copysuffix and collection settings, plus the Create export copy button.

Operators

MPFB_OT_Create_Export_Copy_Operator

AttributeValue
bl_idnamempfb.export_copy
bl_label"Create export copy"
bl_options{'REGISTER'}
PollBASEMESH_AMONGST_RELATIVES

Creates a deep copy of the character using ExportService.create_character_copy(). The copy is placed into an "export copy" collection if collection is enabled, or into the same collection as the original basemesh if not. The copy's objects are named with the suffix string appended.

After creating the copy, the operator applies the configured cleanup operations in the following order:

  1. Bake shape keys (if bake_shapekeys) — calls TargetService.bake_targets() on the new basemesh, collapsing all morph targets into the final geometry.
  2. Load facial shape keys (if any of visemes_meta, visemes_microsoft, or faceunits_arkit) — calls FaceService.load_targets() to add the requested shape key packs. This loads them with zero weight so they can be driven by game-engine blend shapes or facial animation controllers.
  3. Interpolate targets (if interpolate) — calls FaceService.interpolate_targets() to generate intermediate shape keys between the loaded facial shapes.
  4. Handle modifiers — calls ExportService.bake_modifiers_remove_helpers() which:
    • Bakes mask modifiers if mask_modifiers == "BAKE".
    • Bakes subdivision modifiers if subdiv_modifiers == "BAKE".
    • Deletes helper geometry if delete_helpers is enabled.
  5. Remove mask modifiers (if mask_modifiers == "REMOVE") — removes all MASK-type modifiers from the new basemesh.
  6. Remove subdivision modifiers (if subdiv_modifiers == "REMOVE") — removes all SUBSURF-type modifiers.
  7. Remove basemesh (if remove_basemesh) — deletes the basemesh from the copy, leaving only the rig and clothing. Useful when the workflow only needs the clothing meshes.

Scene Properties

Properties are stored with the EXPO_ prefix on the scene object.

PropertyTypeDefaultDescription
mask_modifiersenum"KEEP"How to handle mask modifiers on the copy: KEEP (leave them), REMOVE (delete them), BAKE (apply them to the mesh)
subdiv_modifiersenum"KEEP"How to handle subdivision modifiers: KEEP, REMOVE, or BAKE
bake_shapekeysbooleanBake all morph targets into the final geometry of the copy
delete_helpersbooleanRemove helper geometry (HelperGeometry and JointCubes vertex groups) from the copy
remove_basemeshbooleanDelete the basemesh from the copy after all other operations are complete
visemes_metabooleanLoad Meta (visemes02) facial shape keys onto the copy's basemesh
visemes_microsoftbooleanLoad Microsoft/SSML (visemes01) facial shape keys onto the copy's basemesh
faceunits_arkitbooleanLoad ARKit (faceunits01) facial shape keys onto the copy's basemesh
interpolatebooleanGenerate interpolated intermediate shapes between the loaded facial shape keys
suffixstringText appended to object names in the copy (e.g. "_export")
collectionbooleanPlace the copy in a dedicated "export copy" collection rather than the original's collection