sparkengine-editor-scenes-and-reflection

Diagnose and fix SparkEditor scene loading, reflection-driven Inspector editing, and undo/redo issues.

31|3|Updated Jul 26, 2025
One-click install
npx skills add https://github.com/Krilliac/SparkEngine --skill sparkengine-editor-scenes-and-reflection-krilliac
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sparkengine-editor-scenes-and-reflection
Source: https://github.com/Krilliac/SparkEngine/tree/main/.claude/skills/sparkengine-editor-scenes-and-reflection
Command: npx skills add https://github.com/Krilliac/SparkEngine --skill sparkengine-editor-scenes-and-reflection-krilliac

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? SparkEngine's editor has two incompatible JSON scene dialects, a fail-closed versioned loader, and two Inspector paths with different undo behavior, which makes scene load failures, missing Inspector fields, and broken undo hard to diagnose without deep codebase knowledge. ## Core Features & Use Cases - Scene dialect identification and troubleshooting: Distinguish reflected-World JSON (version 1, entities array) from SceneFile JSON v2 (objects/components/environment) and map loader errors like "Scene file version is unsupported" to their exact cause. - Reflection registration guidance: Register components with SPARK_REFLECT macros, TypeRegistry, and ComponentFactory so fields appear in the Inspector instead of "(no reflection data registered)". - Undo/redo and lifecycle rules: Apply the SwapWorld funnel ordering (clear CommandHistory before freeing the World) to prevent use-after-free crashes, and understand which edits are undoable. - Use Case: A user reports "Ctrl+Z crashes after opening a scene" — the Skill pinpoints that a code path replaced the World without SwapWorld, leaving CommandHistory holding dangling pointers. ## Quick Start Ask the assistant to diagnose why your .sparkscene file fails to load in the SparkEditor or why a component field is missing from the Inspector.

Frequently Asked Questions about sparkengine-editor-scenes-and-reflection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my .sparkscene file fail to load with "Scene file version is unsupported"?▼

The SceneFile v2 loader requires the version field to appear exactly once and equal SCENE_FILE_VERSION (2); any mismatch, duplication, or missing field rejects the whole file. There is no migration path, so old files must be resaved by a build that wrote them.

How do I register a component for reflection in SparkEngine?▼

Register the type in SparkEngine/Source/Core/ComponentReflection.cpp using the SPARK_REFLECT macros and TypeInfo model defined in Core/Reflection.h. Once registered with TypeRegistry and ComponentFactory, the component's fields appear in the Inspector instead of "(no reflection data registered)".

Why is my Inspector property edit not undoable in SparkEditor?▼

The World-backed Inspector path calls RenderReflectedFields without a snapshot or CommandHistory command, so those edits are not undoable — this is a known open gap. The legacy SceneFile-backed Inspector path wraps edits in LambdaCommand and is fully undoable.

Why does Ctrl+Z crash after opening a scene in the editor?▼

A code path replaced the World without going through EditorUI::SwapWorld, which clears CommandHistory before freeing the old World. Undo commands capture raw pointers into the old World, so skipping the clear causes use-after-free crashes.

Does SparkEditor support binary scene files?▼

No. Binary scene serialization is deliberately fail-closed: SaveBinary and LoadBinary return errors because the legacy raw-memory format was retired. Use the JSON .sparkscene format; restoring binary scenes is a schema-design task, not a bug fix.

What are the two SparkEngine scene file formats?▼

Dialect A is reflected-World JSON with a top-level entities array and version 1 (written but not checked on load). Dialect B is SceneFile JSON v2 with objects, components, and environment, enforced by a fail-closed version and per-component schema gate.