Scripting

aether-creator-studio

Creator tools, terrain editing, and visual scripting editor

The aether-creator-studio crate provides the world-building toolset for Aether. It includes terrain sculpting and painting, prop placement, lighting editing, a visual scripting editor with a node graph and IR compiler, undo/redo history, and scene serialization.

Overview

Creator Studio is the primary authoring interface for world builders. It covers:

  • Terrain editing with sculpt brushes, paint layers, and vegetation placement.
  • Prop editing with place, move, rotate, scale, and delete operations.
  • Lighting editor for ambient settings, light probes, and environment configuration.
  • Visual scripting with a node graph, type-safe connections, validation, and compilation to IR instructions.
  • Undo/redo via a command stack that records every editor operation.
  • Scene serialization for 2D and 3D scenes in a portable format.
  • World manifest management for spawn points, physics settings, and metadata.

Key Types

EditorScene

The in-memory scene representation containing all placed objects, terrain, and lighting.

use aether_creator_studio::{EditorScene, SceneObject, ObjectKind, Position};

let mut scene = EditorScene::new();
let obj = SceneObject {
    kind: ObjectKind::Prop,
    position: Position { x: 5.0, y: 0.0, z: 10.0 },
    ..Default::default()
};

UndoStack

Records editor commands and supports undo/redo traversal.

use aether_creator_studio::{UndoStack, EditorCommand, CommandResult};

let mut undo = UndoStack::new();
undo.execute(PlacePropCommand { prop_id, position })?;
undo.undo()?; // Reverts the prop placement
undo.redo()?; // Re-applies it

NodeGraph

The visual scripting graph. Contains nodes connected by typed ports. Supports validation, cycle detection, and compilation.

use aether_creator_studio::{
    NodeGraph, Node, NodeKind, Connection, DataType, Port, PortDirection,
};

let mut graph = NodeGraph::new();
let on_start = graph.add_node(Node::new(NodeKind::OnStart));
let log_node = graph.add_node(Node::new(NodeKind::LogMessage));
graph.connect(on_start, 0, log_node, 0)?;

compile

Compiles a visual script graph into IR instructions that can be executed by the ScriptVm.

use aether_creator_studio::{compile, NodeGraph, CompiledScript};

let graph = build_graph();
let compiled: CompiledScript = compile(&graph)?;
// compiled.instructions contains the IR

ScriptVm

Executes compiled visual scripts. Runs IR instructions against the engine API.

use aether_creator_studio::{ScriptVm, VmConfig, CompiledScript, NoOpApi};

let vm = ScriptVm::new(VmConfig::default());
let api = NoOpApi; // Use RecordingApi for testing
vm.execute(&compiled, &api)?;

Terrain Tools

use aether_creator_studio::{
    SculptBrush, TerrainBrush, SculptCommand, PaintCommand, PaintLayer,
};

let brush = TerrainBrush {
    sculpt: SculptBrush::Raise,
    radius: 5.0,
    strength: 0.8,
};

WorldManifest

The authoritative world configuration including spawn points, physics, and metadata.

use aether_creator_studio::{
    WorldManifest, create_default_manifest, validate_manifest,
};

let manifest = create_default_manifest();
let errors = validate_manifest(&manifest);

Usage Examples

Building and Compiling a Visual Script

use aether_creator_studio::{
    NodeGraph, Node, NodeKind, compile, validate_graph,
    ValidationResult,
};

let mut graph = NodeGraph::new();
let trigger = graph.add_node(Node::new(NodeKind::OnStart));
let action = graph.add_node(Node::new(NodeKind::SpawnEntity));
graph.connect(trigger, 0, action, 0)?;

let validation: ValidationResult = validate_graph(&graph);
assert!(validation.is_valid());

let compiled = compile(&graph)?;

Scene Serialization

use aether_creator_studio::{
    serialize_scene_3d, deserialize_scene_3d, Scene3D,
};

let json = serialize_scene_3d(&scene)?;
let loaded: Scene3D = deserialize_scene_3d(&json)?;