Conversation
…spector panel changes
…e inspector functionality
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3aeafe8d2f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| foreach ($tokens as $index => $token) { | ||
| if (is_array($token) && $token[0] === T_RETURN) { | ||
| return $index; |
There was a problem hiding this comment.
Parse the top-level scene return instead of the first return
findReturnIndex() returns the first T_RETURN token in the file, so scenes that define helpers/closures before the final return [...] are parsed against the wrong array expression. When SceneWriter::serialize() then merges data, it rewrites that earlier return block and can leave the actual scene payload untouched, producing a corrupted scene file on save for any scene source that contains a prior return statement.
Useful? React with 👍 / 👎.
| && array_key_exists($index, $originalValue) | ||
| ) { | ||
| $lines[] = $childIndent | ||
| . $this->renderMergedValue( | ||
| $currentValue[$index], |
There was a problem hiding this comment.
Avoid index-based merge when list entries shift
The list merge path reuses source/original nodes by numeric index, which breaks when a loaded scene uses partial metadata (fallback load) and items are deleted or reordered. After an index shift, a remaining object is merged with the deleted object's source node ($originalValue[$index]), so preserved fields can be copied from the wrong object (or hidden fields can be dropped), leading to silent scene data corruption on save.
Useful? React with 👍 / 👎.
This pull request introduces several enhancements and refactors to the editor and scene loading components, focusing on improved scene metadata handling, more robust serialization/deserialization, and better terminal input management. The most significant changes are grouped below.
Scene loading and metadata improvements
SceneLoader, allowing scenes to be loaded safely and reliably even if they contain problematic code. This includes a new method for loading scene data in a separate PHP process and improved error handling. (src/Editor/SceneLoader.php, [1] [2]SceneSourceParserfor parsing PHP scene files to extract metadata, providing a fallback mechanism when direct loading fails. (src/Editor/SceneSourceParser.php, src/Editor/SceneSourceParser.phpR1-R276)SceneDTOto track additional metadata:sourcePath,rawData, andsourceData, ensuring the editor has access to both original and processed scene information. (src/Editor/DTOs/SceneDTO.php, [1] [2] [3]SceneLoaderto populate newSceneDTOfields when loading a scene. (src/Editor/SceneLoader.php, src/Editor/SceneLoader.phpR35-R37)Hierarchy object serialization and deserialization
HierarchyObjectDTOto support more flexible and robust serialization, including new fields (type,size,sprite,text,components,children), improved handling of UI elements, and normalization of vector/numeric data. (src/Editor/DTOs/HierarchyObjectDTO.php, src/Editor/DTOs/HierarchyObjectDTO.phpL5-R157)Terminal input and key handling
InputManagerby saving/restoring terminal mode snapshots, ensuring proper echo and non-blocking mode management. (src/Editor/IO/InputManager.php, [1] [2] [3]CTRL_CandCTRL_Skey codes in both theKeyCodeenum and key detection logic, enabling new keyboard shortcuts. (src/Editor/IO/Enumerations/KeyCode.php, [1];src/Editor/IO/InputManager.php, [2]Documentation
README.mdto help users find the editor guide. (README.md, README.mdR14-R17)