Skip to content

PME2: Action.context implementation for operator context override #82

@Pluglug

Description

@Pluglug

Summary

Design and implement the Action.context field for operator context override.

Background

JSON Schema v2 includes a context field for type: "command":

{
  "type": "command",
  "value": "bpy.ops.mesh.primitive_cube_add()",
  "context": "{'area': next(a for a in C.screen.areas if a.type == 'VIEW_3D')}"
}

Purpose

In Blender 4.x+, operator context override requires with syntax:

# Blender 4.x style
with context.temp_override(**override_dict):
    bpy.ops.some_operator()

The context field allows users to specify this override as a Python expression.

Implementation Plan

TBD - Detailed implementation plan to be added.

Considerations

  • How to safely evaluate the context expression
  • Error handling for invalid expressions
  • UI for editing context override
  • Documentation and examples
  • Backward compatibility with existing command strings

Metadata

Metadata

Assignees

Labels

apiAPI changes or additionsschemaJSON Schema v2 design and implementation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions