Repository navigation
Add entity cloning and prefabs, an inspector edit mode, and asset hot reload - #7
Merged
Merged
Conversation
… reload Batch 5 of ROADMAP.md, the last one. - Entity::clone() and Entity::instantiate(json) copy an entity's saved state with new entity and component ids. Entity::load(json) still keeps the ids, as scene loading needs. - Prefab::save, load and spawn, and Pancake::spawn(file, position). Prefab files are cached and read again when they change on disk. Missing or malformed files print an error and return nullptr. - The inspector can edit: dragging moves the selected entity (stopping its body), Duplicate and Delete buttons with Ctrl+D and Delete shortcuts, and a toolbar to pause, step, save and load. The actions are public as Inspector::duplicateSelected, deleteSelected and moveSelected. - Hot reload: TexturePool and AudioPool record each file's modified time. AssetPool::reloadChanged reloads changed files in place, and with Pancake::hotReload(true) the main loop checks twice a second of real time. Texture::reload keeps the GL texture id, so sprites and spritesheets pick up the new image without being touched, and handles 3 channel rows that aren't 4 byte aligned. - Console commands clone, prefab, saveprefab, hotreload and reload. - The demo's D key no longer toggles physics debug drawing when Ctrl is held, since Ctrl+D duplicates in the inspector. Tests: new unit test test_prefab for clones, instantiate, prefab save, load, refresh on change, and bad files. New engine test test_editor_engine for the inspector actions, prefabs from code and the console, and hot reload of a PNG and a WAV the test writes and changes, checking the texture keeps its GL id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015cNAkNqoDWA5gFReD1AsqV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch 5 of
ROADMAP.md, the last one. Batches 1–4 are already onmaster, so this targetsmasterdirectly and contains one commit.Changes
Entity::clone()andEntity::instantiate(json)copy an entity's saved state with new entity and component ids. Components that aren't serialisable are left out.Entity::load(json)still keeps the ids in the json, as scene loading needs.core/prefab.hpp):Prefab::save,loadandspawn, andPancake::spawn(file, position).ERROR::PREFAB::...and returnnullptr.loadcommand.Inspector::duplicateSelected,deleteSelectedandmoveSelected.TexturePoolandAudioPoolrecord each file's modified time, andAssetPool::reloadChanged()reloads changed files in place.Pancake::hotReload(true), the main loop checks twice a second of real time, so it also works while paused.Texture::reloadkeeps the GL texture id, so sprites and spritesheets pick up the new image untouched. It also sets the unpack alignment for 3-channel rows that aren't 4-byte aligned.clone <id|name> [x y],prefab <file> <x> <y>,saveprefab <id|name> <file>,hotreload [on|off]andreload.Testing
tests/test_prefab.cppcovers:loadversusinstantiateids;tests/test_editor_engine.cppcovers:clone;reloadwith hot reload off.🤖 Generated with Claude Code
https://claude.ai/code/session_015cNAkNqoDWA5gFReD1AsqV
Generated by Claude Code