Repository navigation
Editor Automation
Extensible command registry, script execution engine, and multi-step wizard framework for automating editor operations.
Source: SparkEditor/Source/Panels/EditorAutomation.h
Editor Automation provides a central registry for named commands that can be invoked programmatically, from text scripts, or through wizard UIs. Any editor operation that modifies the scene -- selecting objects, changing properties, importing assets -- can be registered as a command and then composed into automated workflows.
Commands are registered with a name, description, category, and handler callback. They accept string arguments and return a structured result with success/failure, a human-readable message, and an optional return value. The system records all executed commands in a history with timestamps, enabling undo-style replay and audit logging.
The scripting engine parses multi-line text scripts where each line is a command invocation. Lines beginning with # or / are treated as comments. For more structured workflows, the wizard system organizes commands into named, ordered steps with optional skip support. Wizards can be registered and triggered from UI buttons or other automation scripts. The system is designed as the integration point for AngelScript, Lua, or Python -- each scripting language binds a thin wrapper that calls ExecuteCommand under the hood.
| Class / Struct | Description |
|---|---|
EditorAutomation |
Singleton command registry, script runner, and wizard manager |
EditorCommandInfo |
Metadata for a registered command: name, description, usage, category |
EditorCommandResult |
Execution result: success flag, message, and optional return value |
EditorWizard |
Multi-step wizard with ordered steps and execution state |
WizardStep |
A single wizard step: name, description, command string, optional flag |
CommandHistoryEntry |
Record of an executed command with result and timestamp |
ScriptResult |
Summary of a script run: commands executed, failures, error messages |
auto& automation = SparkEditor::EditorAutomation::GetInstance();
automation.Initialize(); // registers built-in commands (echo, help, wait, noop)
// Register a custom command
automation.RegisterCommand("select_all_lights", "Select all light entities",
[](const std::vector<std::string>& args) -> SparkEditor::EditorCommandResult {
// ... select lights via SelectionManager ...
return {true, "Selected 12 lights", "12"};
},
"select_all_lights", "Selection");
// Execute a single command
auto result = automation.ExecuteCommand("select_all_lights", {});
// Run a multi-line script
auto scriptResult = automation.RunScript(R"(
# Lighting setup script
select_all_lights
set_property intensity 2.5
save_scene
)");
// Create and run a wizard
SparkEditor::EditorWizard wizard("Setup Lighting");
wizard.AddStep("Select lights", "select_all_lights", "Find all lights in scene");
wizard.AddStep("Set intensity", "set_property intensity 1.0", "Normalize intensity");
wizard.AddStep("Bake lightmaps", "bake_lighting", "Optional bake step", /*optional=*/true);
automation.RegisterWizard(wizard);
auto wizResult = automation.RunWizard("Setup Lighting");
// Query available commands
auto names = automation.GetCommandNames();
auto sceneCommands = automation.GetCommandsByCategory("Scene");// AngelScript binding
engine->RegisterGlobalFunction("bool EditorExec(const string &in cmd)",
asFUNCTION(+[](const std::string& cmd) -> bool {
return SparkEditor::EditorAutomation::GetInstance().ExecuteCommand(cmd, {}).success;
}), asCALL_CDECL);
// Lua binding
lua["editor_exec"] = [](const std::string& cmd) -> bool {
return SparkEditor::EditorAutomation::GetInstance().ExecuteCommand(cmd, {}).success;
};| Method | Return | Description |
|---|---|---|
RegisterCommand(name, desc, handler, usage, category) |
bool |
Register a named command with handler callback |
UnregisterCommand(name) |
void |
Remove a registered command |
HasCommand(name) |
bool |
Check if a command is registered |
GetCommandCount() |
size_t |
Number of registered commands |
GetCommandInfo(name) |
const EditorCommandInfo* |
Get metadata for a command |
GetCommandNames() |
vector<string> |
All registered command names (sorted) |
GetCommandsByCategory(category) |
vector<string> |
Commands in a specific category |
| Method | Return | Description |
|---|---|---|
ExecuteCommand(name, args) |
EditorCommandResult |
Execute a command by name with arguments |
ExecuteCommandLine(commandLine) |
EditorCommandResult |
Parse and execute a single command string |
RunScript(script) |
ScriptResult |
Execute a multi-line script |
GetHistory() |
const vector<CommandHistoryEntry>& |
Full command execution history |
| Method | Return | Description |
|---|---|---|
RegisterWizard(wizard) |
void |
Register a multi-step wizard |
GetWizard(name) |
const EditorWizard* |
Get a wizard by name |
RunWizard(name) |
ScriptResult |
Execute all steps of a wizard |
GetWizardNames() |
vector<string> |
All registered wizard names |
- Selection Manager -- automation commands frequently manipulate selection
- Asset Dependency Graph -- asset audit commands use the dependency graph
- AngelScript Scripting -- primary scripting language integration point
- Editor Panels -- panels can expose operations as automation commands
Published from 2b03dc797148. Edit the canonical source in wiki/.
- Documentation
- Docs route
- Wiki index
- Guides
- Tutorials
- Samples
- Examples
- API Reference
- API route
- Reference
- Build Guide
- Dependencies
- FAQ
- Changelog
- Roadmap
- Contributing
- Code of Conduct
- Home
- FAQ
- Getting Started
- Quick-Start Tutorial
- Making Your First Game
- Making Your First Multiplayer Game
- Artist Workflow Guide
- Editor Walkthrough
- Migration Guide
- How SparkEngine Works
- Architecture Overview
- Engine Architecture Flowchart
- Creating a Game Module
- Game Modules (catalog)
- Entity Component System
- Rendering and Graphics
- Physics
- Cloth Simulation
- Audio
- Input System
- Camera System
- Scripting with AngelScript
- Visual Scripting
- AI and Navigation
- Animation
- 2D Systems
- Networking
- Dedicated Server
- Multiplayer Quick Start
- Area Server Architecture
- Scene Management
- Large World Support
- Collaborative Editing
- Coroutine System
- Event System
- Event Response System
- Job System
- UI System
- UI Layout Extensions
- Localization
- Dialogue System
- Destruction System
- Replay System
- Achievement System
- Loading System
- Mod System
- Content Delivery
- Tween System
- Memory Integrity
- Gameplay Systems
- Terrain and Procedural Generation
- Save System
- Persistence System
- Day Night Cycle and Weather
- Cinematic Sequencer
- Runtime Prefabs
- SparkEditor
- Editor Tutorials
- SparkConsole
- SparkDaemon
- Shader Pipeline
- Asset Pipeline
- Asset Validation
- Asset Migration
- Game Packaging
- Online Services
- DataTable System
- Loot and Crafting System
- CSG System
- Font System
- Timer Manager
- Movie Render Pipeline
- HLOD and World Partition
- Remote Debug System
- Selection Manager
- Asset Dependency Graph
- Editor Automation
- File Watcher
- Project Templates
- System Requirements
- VR Support
- Mobile Platform
- Accessibility
- Platform Input
- Platform Certification
- Cross-Compilation: Wine Testing
- RHI Abstraction Layer
- D3D11 Backend
- D3D12 Backend
- Vulkan Backend
- OpenGL Backend
- Metal Backend
- DXR Raytracing
- Hybrid Ray Tracing
- Upscaling (DLSS/FSR)
- Render Graph
- Shader Graph
- GPU Particles
- GPU-Driven Rendering
- Volumetric Fog
- Volumetric Clouds
- Global Illumination
- Virtual Texturing
- Water Rendering
- Clustered Lighting
- Material System
- Post-Processing
- Shadow System
- Particle System
- Decal System
- Sky and Atmosphere
- Foliage System
- Mesh Shaders
- Neural Rendering
- Configuration Reference
- Performance Tips
- Benchmark Framework
- Threading Model
- Fuzz Policy and Parser Security
- Memory Safety
- Memory Management Patterns
- Build System and CMake Modules
- Profiler and Debugging
- Performance Profiling Guide
- Telemetry System
- Crash Reporting
- Golden Image Testing
- Utilities
- Testing
- Fuzz Policy and Parser Security
- Codebase Statistics
- Codebase Health
- Error Handling Patterns
- Hot Reload Overview
- Troubleshooting
- Contributing
- Workflow Patterns
- Build Optimizations
- CI Reproducible Builds
- GitHub API and PR Checks
- Git Rebase Conflicts
- Clang-Format
- Code Quality Violations
- AI Bloat Pattern
- MinGW + Wine Cross-Compilation
- Live Editor Testing
- Engine & Renderer Landscape
- DuetOS Portability Catalog
- Five-Engine Analysis
- Eleven-Engine Analysis
- ThorVG / Unity Graphics Analysis
- Advanced Techniques Catalog
- Third-Party Library Evaluation
- Engine Viability Evaluation
- Engine Feature Recommendations
- Project Recommendations
- Mac Compatibility Analysis
- Codebase Observations
- Codebase Bloat Audit
- Test Suite Audit
- Documentation Coverage Audit
- ThirdParty Dependencies Audit
- Load Test Baseline
- Gameplay Systems Status
- SparkGame Module Status
- Stub and Abandoned Features
- Memory Integrity System
- Memory Safety Evaluation
- Hardware Acceleration Systems
- Jolt Physics Integration
- GPU/CPU Separation Plan
- Daemon Services Architecture
- Reflection & Polymorphism Refactoring Plan
- SparkBuild In-Tree
- Wine No-JobSystem Breakthrough
- Wine Role and Fallback Tiers