Skip to content

WIP: Port terrain editor from cocos-creator with authoring API and fixes - #900

Draft
doommm wants to merge 7 commits into
cocos:mainfrom
doommm:codex/terrain-editor
Draft

WIP: Port terrain editor from cocos-creator with authoring API and fixes#900
doommm wants to merge 7 commits into
cocos:mainfrom
doommm:codex/terrain-editor

Conversation

@doommm

@doommm doommm commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This pull request primarily updates type definitions and interfaces to improve type safety, extensibility, and support for terrain editing features in the Cocos CLI types package. The most significant changes are the enhancement of asset handler type definitions, introduction of comprehensive terrain-related interfaces, and improvements to the gizmo and service manager interfaces.

Asset Handler Types:

  • Changed ASSET_HANDLER_TYPES from a mutable string array to a readonly tuple of string literals, ensuring better type inference and safety for asset handler types. (src/core/assets/@types/interface.ts [1] packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap [2] [3] [4] [5]
  • Updated AssetHandlerType to allow both the defined literals and any string, improving extensibility for custom asset handler types. (packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap [1] [2] [3]

Terrain Editing Support:

  • Added a comprehensive set of interfaces and types for terrain editing, including block data, brush state, editor state, terrain service API, and related enums. This enables robust type support for terrain features in the editor. (packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap [1] [2]
  • Added Terrain to the IServiceManager interface to expose terrain editing services. (packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap packages/cocos-cli-types/tests/snapshots/dts-snapshot.test.ts.snapR6863)
  • Exported the new terrain interfaces from the main index file. (src/core/scene/common/index.ts src/core/scene/common/index.tsR19)

Gizmo and Service Improvements:

  • Added the getComponentGizmo method to the IGizmoService interface for retrieving gizmo instances by component. (src/core/scene/common/gizmo.ts [1] packages/cocos-cli-types/__tests__/__snapshots__/dts-snapshot.test.ts.snap [2]

Testing and Validation:

  • Added a new test to ensure the ASSET_HANDLER_TYPES declaration is preserved as a literal tuple and that AssetHandlerType matches the intended type signature in the generated .d.ts file. (packages/cocos-cli-types/__tests__/dts-snapshot.test.ts packages/cocos-cli-types/tests/dts-snapshot.test.tsR41-R60)

Miscellaneous:

stanleyljl and others added 7 commits September 1, 2026 15:22
- 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.
@doommm
doommm force-pushed the codex/terrain-editor branch from 94349f6 to f7adb93 Compare September 1, 2026 07:23
@doommm
doommm requested a review from stanleyljl September 1, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants