[break] feat: Port terrain editor from cocos-creator with authoring API and fixes - #900
Open
doommm wants to merge 9 commits into
Open
[break] feat: Port terrain editor from cocos-creator with authoring API and fixes#900doommm wants to merge 9 commits into
doommm wants to merge 9 commits into
Conversation
doommm
force-pushed
the
codex/terrain-editor
branch
from
September 1, 2026 07:23
94349f6 to
f7adb93
Compare
- Publish explicit Terrain snapshots, session controls, and block reads.\n- Invalidate stale Terrain state across Scene lifecycle changes.
- expose target-safe Manage and layer mutations with atomic Undo - publish the Terrain authoring API with regression coverage
Keep extension importer names compatible while preserving built-in completions.
- Replace `layers: Array<string | null>` with `ITerrainBlockLayerSlot | null` carrying the layer index and current detail map UUID. - Change `weight.data` from `number[]` to a defensive `Uint8Array` snapshot of the row-major RGBA8 texels. - Read block layer detail maps from the live Terrain state via `getCurrentBlockLayerSlots` instead of the stale selection cache. - Update the DTS snapshot, terrain service comment, and gizmo/service tests for the new binary interface.
doommm
force-pushed
the
codex/terrain-editor
branch
from
September 5, 2026 07:09
f7adb93 to
18a6d9a
Compare
doommm
marked this pull request as ready for review
September 5, 2026 07:38
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.
This pull request adds comprehensive support for the Terrain asset type in the asset handling and service layers, and improves type safety for asset handler types throughout the codebase. It also ensures binary content is properly handled when creating assets, and includes additional tests to verify these behaviors.
Terrain asset support:
ITerrain*interfaces and types (such asITerrainService,ITerrainBlockData,TerrainReadResult, etc.) to the type declarations, enabling proper typing and API support for terrain editing and management features. ([[1]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dR6915-R7029),[[2]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dR7423-R7427))Terrainservice in theIServiceManagerinterface, and imported theTerraintype for use in service APIs. ([[1]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dR5419),[[2]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dR6878))Asset handler type safety improvements:
ASSET_HANDLER_TYPESto areadonlytuple type and updated its usage in all type declarations to improve literal type inference and ensure all asset handler types (including"terrain"and"database") are correctly represented. ([[1]](https://github.com/cocos/cocos-cli/pull/900/files#diff-ee2f852140e8d3b6b50539ee6123466853fcbd1bf577400dc451100cf7660621L61-R61),[[2]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dL63-R63),[[3]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dL1061-R1063),[[4]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dL5447-R5455),[[5]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dL7749-R7878))AssetHandlerTypeto be a union of the literal types fromASSET_HANDLER_TYPESand any string, increasing flexibility and future-proofing the type. ([[1]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dL91-R93),[[2]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dL1152-R1156),[[3]](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dL7791-R7922))Asset creation and binary content handling:
Buffercontent, preventing corruption of binary assets. ([src/core/assets/manager/asset-handler.tsL428-R429](https://github.com/cocos/cocos-cli/pull/900/files#diff-93b7be637fc879610bb5e2b8d3a728cb3cf80ea82f805463b7baf2647cfade02L428-R429))[src/core/assets/test/asset-handler-filesystem-bridge.test.tsR127-R136](https://github.com/cocos/cocos-cli/pull/900/files#diff-8200d94463ba684ba5a8c3e14967da7422c2d095ed28dbb8fd9d298a07f48c52R127-R136))Testing and validation:
ASSET_HANDLER_TYPESandAssetHandlerTypeare correctly declared and preserve literal types in the generated.d.tsfiles. ([packages/cocos-cli-types/__tests__/dts-snapshot.test.tsR41-R60](https://github.com/cocos/cocos-cli/pull/900/files#diff-6f24011f84c590485167b2df90a246ebf6c355eba2fed80973300cfb48613b0cR41-R60))Minor API improvements:
getComponentGizmomethod to theIGizmoServiceinterface. ([packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snapR6377](https://github.com/cocos/cocos-cli/pull/900/files#diff-a8348e31674835a05155d991b06289ab32594d5ea8f97984df20bd3ddb354d1dR6377))