Pattern

Capture state in the first Macro Command, make the temporary change, then restore it in the final Command. PME keeps one execution-global mapping for the lifetime of a Macro run.

For a temporary pivot change:

# First Macro Command
saved_pivot = C.space_data.pivot_point
# A middle Command can set the temporary value
C.space_data.pivot_point = "CURSOR"
# Final Macro Command
C.space_data.pivot_point = saved_pivot

Good uses

  • save a transform setting before a short operation;
  • remember a selection mode before an operator requires another one;
  • retain a derived value that later Macro steps need.

Use specific names such as saved_pivot or original_mode. The values belong to that Macro run; they are gone when it ends and cannot carry information to a later hotkey press.

Pitfalls

  • Put restoration after the operation that needs the temporary state, not immediately after setting it.
  • A failing or cancelled Blender operator can stop a sequence before its cleanup step. Test cancellation, and make restoration safe to run more than once.
  • C.space_data is editor-specific. The pivot recipe belongs in a 3D View context.

Sources