Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(2d): GroupOpacity fades an entity and everything under it; sprites, text, shapes, trails and tilemap layers multiply the opacities of the groups above them into their own alpha, and the Cocos UIOpacity is a view on it

yhh46e5a23636e1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ba95f50d4..23e57eeb5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ published separately; it ships inside the editor.
- **Scroll areas can be pulled past an end and spring back.** A scroll area whose movement is Elastic now does what the setting always said: a drag past an end is stiffer the further out it goes, letting go returns the content, and a flick that reaches an end bounces off it. It is opt-in per area (`ScrollMovement.Elastic`; Clamped, the default, behaves as before), and the gesture model (`ScrollMotion`, with `ScrollContainer.dragTo` and `getOverscroll`) is exported for scrolling anything else the same way.
- **More easing curves.** Sine, quart, quint, expo and circ (each in, out and in-out), bounce in and in-out, and smoothstep and smootherstep join the quad, cubic, back, elastic and out-bounce curves. They are new `EasingType` members after the existing ones, so a saved tween keeps its curve, and they ease the same in a C++ tween and a script value tween.
- **World content has a rectangle: `ContentRect`.** A size and the pivot the entity's transform sits on, which the `Sprite` and `Text` on the entity follow and which a `UIMask` on it clips to — no `UINode` needed, so a clipping region or a scroll viewport can stand in the world. `contentRectContains` tests a world point against it.
+- **Fade a whole group of world content with one value: `GroupOpacity`.** On an entity it fades that entity and everything under it; the opacities multiply down the hierarchy into each descendant's own alpha, as `UINode.opacity` does for a UI subtree. Sprites, text, shapes, trails and tilemap layers follow it. It is not a composited layer, so children that overlap show through one another while the group is partly faded.
- **Open a Cocos Creator project from the editor.** Choosing a Cocos Creator 3.x folder in Open Project (recognised by the Creator version in its `package.json`) offers to convert its scenes and prefabs into a new Estella project beside it, `<name>-estella`, and opens that; the Cocos folder is only read. Opening the same folder again opens the converted project instead of converting twice.
- **Re-import a Cocos project without losing your edits.** Run Re-import Cocos Project in a project converted from Cocos Creator and the scenes and prefabs changed on the Cocos side are brought across, new ones are added, and a document you edited here is left as it is and counted in the result. After the first conversion a message lists the components that did not come across (their data is kept on the entity, but nothing runs), most used first.
- **A held pointer reports where it goes, and a hold can be given up.** `pointer_move` goes to the entity a pointer is holding for as long as it is held, `press_cancel` to one whose hold was taken away (`UIControlPointers.cancelHold`, optionally handing the gesture to another entity, so a scroll area can take a drag from the button under it), and every pointer event now says which pointer it was and where, in the world and on the surface. An entity that is only a `ContentRect` with an `Interactable` can be the one pressed.
diff --git a/desktop b/desktop
index 8b0e80578..7659ca5a2 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 8b0e80578b6cf83030842c0a6e3962ddb15d38f9
+Subproject commit 7659ca5a2a9ebcb9c5be5d22a94abf397068ef70
diff --git a/docs/astro/src/content/docs/graphics/sprites.mdx b/docs/astro/src/content/docs/graphics/sprites.mdx
index 5034f9d8c..a3bc529d6 100644
--- a/docs/astro/src/content/docs/graphics/sprites.mdx
+++ b/docs/astro/src/content/docs/graphics/sprites.mdx
@@ -61,6 +61,19 @@ sprite.color = { r: 1, g: 1, b: 1, a: 0.5 }; // 50% transparent
`color` (and `size`) are **animatable** — key them in the
[Sequencer](/docs/animation/timeline/) for flashes and fades.
+### Fading a whole group
+
+`GroupOpacity` on an entity fades that entity and everything under it. The opacities multiply down the
+hierarchy into each descendant's own alpha, so a panel made of sprites, text and shapes fades with one value:
+
+```typescript
+world.insert(panel, GroupOpacity, { opacity: 0.5 });
+```
+
+It reaches sprites, text, shapes, trails and tilemap layers. It is not a composited layer: where children
+overlap they show through one another while the group is partly faded. A UI node keeps answering to its own
+`UINode.opacity`, which works the same way.
+
## Size & pivot
`size` is the quad's size in **world units**, independent of the texture's pixel
diff --git a/docs/astro/src/content/docs/zh-cn/graphics/sprites.mdx b/docs/astro/src/content/docs/zh-cn/graphics/sprites.mdx
index f98c605e8..b966a9c77 100644
--- a/docs/astro/src/content/docs/zh-cn/graphics/sprites.mdx
+++ b/docs/astro/src/content/docs/zh-cn/graphics/sprites.mdx
@@ -57,6 +57,18 @@ sprite.color = { r: 1, g: 1, b: 1, a: 0.5 }; // 50% 透明
`color`(和 `size`)都**可动画**——在 [Sequencer](/docs/zh-cn/animation/timeline/) 里给它们打关键帧
做闪烁和淡入淡出。
+### 整组淡出
+
+在实体上加 `GroupOpacity`,这个实体和它下面的所有内容一起淡出。不透明度沿层级向下相乘,乘进每个后代自己的
+alpha,所以由精灵、文字和形状组成的面板只用一个值就能整体淡出:
+
+```typescript
+world.insert(panel, GroupOpacity, { opacity: 0.5 });
+```
+
+它作用于精灵、文字、形状、拖尾和瓦片地图层。它不是合成出来的图层:子级互相重叠的地方,在组半透明时会彼此透出。
+UI 节点仍然看自己的 `UINode.opacity`,两者的规则相同。
+
## 尺寸与轴心
`size` 是四边形的**世界单位**尺寸,与纹理的像素尺寸无关——设成 `{ tex.width, tex.height }` 得到
diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.json
index 51890db70..0e09e26d5 100644
--- a/docs/astro/src/data/apiStability.generated.json
+++ b/docs/astro/src/data/apiStability.generated.json
@@ -2,11 +2,11 @@
"note": "Generated by tools/api-stability.mjs from sdk/etc/*.api.md — do not edit.",
"counts": {
"public": 115,
- "beta": 171,
- "experimental": 2732,
+ "beta": 172,
+ "experimental": 2733,
"deprecated": 3
},
- "total": 3018,
+ "total": 3020,
"subsystems": [
{
"id": "mobile-controls",
@@ -2143,6 +2143,18 @@
"minigame"
]
},
+ {
+ "name": "GroupOpacityData",
+ "kind": "interface",
+ "deprecated": false,
+ "entries": [
+ "index",
+ "index.node",
+ "index.native",
+ "wechat",
+ "minigame"
+ ]
+ },
{
"name": "Input",
"kind": "const",
diff --git a/docs/astro/src/data/componentDocs.ts b/docs/astro/src/data/componentDocs.ts
index 7211633f7..e644c02cb 100644
--- a/docs/astro/src/data/componentDocs.ts
+++ b/docs/astro/src/data/componentDocs.ts
@@ -100,6 +100,7 @@ export const COMPONENT_DOCS: Record<string, ComponentDoc> = {
WorldStreamingSource: { category: 'world', summary: 'Asks for the places near it to exist; several sources are unioned.', doc: 'world/streaming', anchor: 'asking-for-places-streaming-sources', anchorZh: '请求地方存在流送源' },
SpriteMask: { category: 'graphics', summary: "Turns this entity's Sprite into a stencil that cuts the sprites drawn after it — a window, or a hole.", doc: 'graphics/sprites', anchor: 'sprite-masks', anchorZh: '精灵遮罩' },
SortingGroup: { category: 'graphics', summary: 'Makes an entity and its whole subtree sort as one unit — the group states the layer and order, members state their place inside it.', doc: 'graphics/sprites', anchor: 'sorting-groups', anchorZh: '排序组' },
+ GroupOpacity: { category: 'graphics', summary: 'Fades an entity and everything under it; the opacities multiply down the hierarchy into each descendant\'s own alpha.', doc: 'graphics/sprites', anchor: 'fading-a-whole-group', anchorZh: '整组淡出' },
StaticBatch: { category: 'graphics', summary: 'Marks a mesh that will not move, so the meshes sharing its material are merged into one draw while the game runs; it also records what became of this one.', doc: 'performance/static-batching', anchor: 'what-happens', anchorZh: '会发生什么' },
Terrain: { category: 'graphics', summary: 'Ground made from a heightmap or noise, painted by height and slope, and drawn in chunks that coarsen with distance.', doc: 'graphics/terrain', anchor: 'the-component', anchorZh: '组件' },
Planet: { category: 'graphics', summary: 'Ground on a sphere, drawn as six quadtrees round the eye from a generator the game registers, finest underfoot and a handful of coarse nodes from space.', doc: 'graphics/terrain', anchor: 'a-planet', anchorZh: '星球' },
diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.json
index afe581112..7225d00fa 100644
--- a/docs/astro/src/data/components.generated.json
+++ b/docs/astro/src/data/components.generated.json
@@ -2171,6 +2171,24 @@
"rippleTexture"
]
},
+ {
+ "name": "GroupOpacity",
+ "source": "cpp",
+ "fields": [
+ {
+ "key": "opacity",
+ "type": "number",
+ "default": "1",
+ "doc": "Opacity of this entity and everything under it, multiplied with the opacity of every group above it.",
+ "range": "0–1, step 0.01"
+ },
+ {
+ "key": "enabled",
+ "type": "boolean",
+ "default": "true"
+ }
+ ]
+ },
{
"name": "Health",
"source": "ts",
diff --git a/pipeline/src/import/cocos/components.ts b/pipeline/src/import/cocos/components.ts
index 34ebfef4c..a983f1d80 100644
--- a/pipeline/src/import/cocos/components.ts
+++ b/pipeline/src/import/cocos/components.ts
@@ -416,6 +416,12 @@ function directionalLight(c: CocosComponent, ctx: ComponentContext, where: strin
};
}
+/** `cc.UIOpacity`: the alpha of the node and everything under it, which the engine's GroupOpacity is. */
+function uiOpacity(c: CocosComponent, ctx: ComponentContext): ComponentData {
+ ctx.report.component('cc.UIOpacity', 'mapped');
+ return { type: 'GroupOpacity', data: { opacity: Math.min(255, Math.max(0, num(c.data._opacity, 255))) / 255, enabled: c.enabled } };
+}
+
/** `cc.Sorting`: the sorting layer and order of the renderer on the node, which the engine states for a node and its subtree. */
function sorting(c: CocosComponent, ctx: ComponentContext, where: string): ComponentData {
const d = c.data;
@@ -504,6 +510,9 @@ export function convertNode(node: CocosNode, ctx: ComponentContext, where: strin
case 'cc.DirectionalLight':
out = directionalLight(c, ctx, where);
break;
+ case 'cc.UIOpacity':
+ out = uiOpacity(c, ctx);
+ break;
case 'cc.Sorting':
out = sorting(c, ctx, where);
break;
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index b984db5b2..a5eab1e85 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -1,11 +1,11 @@
# API surface — esengine/index
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 159 beta · 1965 experimental · 3 deprecated
+Symbols: 115 public · 160 beta · 1966 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
-"ac076564c4c51626"
+"e064dcf6ece54b86"
```
## ANCHOR_AXES — const @experimental
@@ -4796,6 +4796,17 @@ x: number
z: number
```
+## GroupOpacity — const @experimental
+```
+BuiltinComponentDef<GroupOpacityData>
+```
+
+## GroupOpacityData — interface @beta
+```
+enabled: boolean
+opacity: number
+```
+
## HdrFormat — interface @experimental
```
effective: string
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index 96d377508..68d471336 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -1,11 +1,11 @@
# API surface — esengine/index.native
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 164 beta · 1984 experimental · 3 deprecated
+Symbols: 115 public · 165 beta · 1985 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
-"ac076564c4c51626"
+"e064dcf6ece54b86"
```
## ANCHOR_AXES — const @experimental
@@ -4804,6 +4804,17 @@ x: number
z: number
```
+## GroupOpacity — const @experimental
+```
+BuiltinComponentDef<GroupOpacityData>
+```
+
+## GroupOpacityData — interface @beta
+```
+enabled: boolean
+opacity: number
+```
+
## HdrFormat — interface @experimental
```
effective: string
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index 10b5c8f8d..0a90cfbf7 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index.node
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 161 beta · 1964 experimental · 3 deprecated
+Symbols: 115 public · 162 beta · 1965 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -4791,6 +4791,17 @@ x: number
z: number
```
+## GroupOpacity — const @experimental
+```
+BuiltinComponentDef<GroupOpacityData>
+```
+
+## GroupOpacityData — interface @beta
+```
+enabled: boolean
+opacity: number
+```
+
## HdrFormat — interface @experimental
```
effective: string
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.md
index 56a9db07b..6f8f44d00 100644
--- a/sdk/etc/minigame.api.md
+++ b/sdk/etc/minigame.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/minigame
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 159 beta · 1986 experimental · 3 deprecated
+Symbols: 115 public · 160 beta · 1987 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -4791,6 +4791,17 @@ x: number
z: number
```
+## GroupOpacity — const @experimental
+```
+BuiltinComponentDef<GroupOpacityData>
+```
+
+## GroupOpacityData — interface @beta
+```
+enabled: boolean
+opacity: number
+```
+
## HdrFormat — interface @experimental
```
effective: string
diff --git a/sdk/etc/wasm.api.md b/sdk/etc/wasm.api.md
index 09bad5650..e26f3200d 100644
--- a/sdk/etc/wasm.api.md
+++ b/sdk/etc/wasm.api.md
@@ -29,6 +29,7 @@ addConvexCollider3D: (entity: Entity, component: ConvexCollider3D) => void
addDraggable: (entity: Entity, component: Draggable) => void
addDragonBonesAnimation: (entity: Entity, component: DragonBonesAnimation) => void
addFlexContainer: (entity: Entity, component: FlexContainer) => void
+addGroupOpacity: (entity: Entity, component: GroupOpacity) => void
addInteractable: (entity: Entity, component: Interactable) => void
addLODGroup: (entity: Entity, component: LODGroup) => void
addLight: (entity: Entity, component: Light) => void
@@ -88,6 +89,7 @@ getConvexCollider3D: (entity: Entity) => ConvexCollider3D
getDraggable: (entity: Entity) => Draggable
getDragonBonesAnimation: (entity: Entity) => DragonBonesAnimation
getFlexContainer: (entity: Entity) => FlexContainer
+getGroupOpacity: (entity: Entity) => GroupOpacity
getInteractable: (entity: Entity) => Interactable
getLODGroup: (entity: Entity) => LODGroup
getLight: (entity: Entity) => Light
@@ -140,6 +142,7 @@ hasConvexCollider3D: (entity: Entity) => boolean
hasDraggable: (entity: Entity) => boolean
hasDragonBonesAnimation: (entity: Entity) => boolean
hasFlexContainer: (entity: Entity) => boolean
+hasGroupOpacity: (entity: Entity) => boolean
hasInactiveEntities: (() => boolean) | undefined
hasInteractable: (entity: Entity) => boolean
hasLODGroup: (entity: Entity) => boolean
@@ -197,6 +200,7 @@ removeConvexCollider3D: (entity: Entity) => void
removeDraggable: (entity: Entity) => void
removeDragonBonesAnimation: (entity: Entity) => void
removeFlexContainer: (entity: Entity) => void
+removeGroupOpacity: (entity: Entity) => void
removeInteractable: (entity: Entity) => void
removeLODGroup: (entity: Entity) => void
removeLight: (entity: Entity) => void
diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.md
index aeef68f9e..9a498d7e5 100644
--- a/sdk/etc/wechat.api.md
+++ b/sdk/etc/wechat.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/wechat
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 159 beta · 1977 experimental · 3 deprecated
+Symbols: 115 public · 160 beta · 1978 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -4791,6 +4791,17 @@ x: number
z: number
```
+## GroupOpacity — const @experimental
+```
+BuiltinComponentDef<GroupOpacityData>
+```
+
+## GroupOpacityData — interface @beta
+```
+enabled: boolean
+opacity: number
+```
+
## HdrFormat — interface @experimental
```
effective: string
diff --git a/sdk/src/cocos/ui/sprite.ts b/sdk/src/cocos/ui/sprite.ts
index b3077e0b0..7c8870c81 100644
--- a/sdk/src/cocos/ui/sprite.ts
+++ b/sdk/src/cocos/ui/sprite.ts
@@ -2,13 +2,13 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
* @file cocos/ui/sprite.ts
- * @brief `Sprite` and `UIOpacity`: views on the engine's `Sprite`.
+ * @brief `Sprite` and `UIOpacity`: views on the engine's `Sprite` and `GroupOpacity`.
*
* Colour, the draw type and the enable flag map directly. The frame (`spriteFrame`) is a texture, which the engine addresses by a
* handle that an asset load produces; assigning one is the asset layer's job, so here the frame is the path the `Sprite` was made
* with and assigning a path is carried to the engine's `texture` only where the project's assets have already loaded it.
*/
-import { Sprite as EngineSprite } from '../../ecs/component';
+import { GroupOpacity, Sprite as EngineSprite } from '../../ecs/component';
import { SpriteDrawMode } from '../../wasm/wasm.generated';
import type { World } from '../../ecs/world';
import type { Entity } from '../../types';
@@ -57,28 +57,24 @@ export class Sprite extends Component {
set enabled(v: boolean) { this.patch_({ enabled: v }); }
}
-/**
- * `UIOpacity`: the alpha of a node and everything under it. The engine has no subtree alpha for world content, so this fades the
- * node's own renderer — a `Sprite`'s colour alpha — and not its children. A script that fades a panel by its `UIOpacity` will see the
- * panel's own art fade and its children stay; that is a difference from Cocos, and one the engine would have to grow a feature to close.
- */
+/** `UIOpacity`: the alpha of a node and everything under it, which is the engine's `GroupOpacity` (0..1) in Cocos's 0..255. */
export class UIOpacity extends Component {
- private opacity_ = 255;
- /** The sprite's own alpha before any fade, taken the first time one is applied so repeated writes do not compound. */
- private baseAlpha_: number | null = null;
-
- get opacity(): number { return this.opacity_; }
+ get opacity(): number { return Math.round(this._world.get(this._entity, GroupOpacity).opacity * 255); }
set opacity(v: number) {
- this.opacity_ = Math.min(255, Math.max(0, v));
- if (!this._world.has(this._entity, EngineSprite)) return;
- const s = this._world.get(this._entity, EngineSprite);
- if (this.baseAlpha_ === null) this.baseAlpha_ = s.color.a;
- this._world.set(this._entity, EngineSprite, { ...s, color: { ...s.color, a: this.baseAlpha_ * (this.opacity_ / 255) } });
+ const opacity = Math.min(255, Math.max(0, v)) / 255;
+ this._world.set(this._entity, GroupOpacity, { ...this._world.get(this._entity, GroupOpacity), opacity });
}
+
+ get enabled(): boolean { return this._world.get(this._entity, GroupOpacity).enabled; }
+ set enabled(v: boolean) { this._world.set(this._entity, GroupOpacity, { ...this._world.get(this._entity, GroupOpacity), enabled: v }); }
}
const hasSprite = (world: World, entity: Entity): boolean => world.has(entity, EngineSprite);
const addSprite = (world: World, entity: Entity): void => { world.insert(entity, EngineSprite, {}); };
registerBuiltinComponent(Sprite, ['cc.Sprite', 'Sprite'], viewAdapter(Sprite, hasSprite, addSprite));
-registerBuiltinComponent(UIOpacity, ['cc.UIOpacity', 'UIOpacity'], viewAdapter(UIOpacity, () => true, () => {}));
+registerBuiltinComponent(UIOpacity, ['cc.UIOpacity', 'UIOpacity'], viewAdapter(
+ UIOpacity,
+ (world, entity) => world.has(entity, GroupOpacity),
+ (world, entity) => { world.insert(entity, GroupOpacity, {}); },
+));
diff --git a/sdk/src/core-runtime.ts b/sdk/src/core-runtime.ts
index 21054ec69..91c3f3869 100644
--- a/sdk/src/core-runtime.ts
+++ b/sdk/src/core-runtime.ts
@@ -106,6 +106,7 @@ export {
type PlanarReflectionData,
ReflectionAxis, ReflectionQuality, ReflectionUpdate,
SortingGroup,
+ GroupOpacity,
SpriteMask,
TrailRenderer,
SpringBone,
@@ -137,6 +138,7 @@ export {
type LightData,
type ShadowCaster2DData,
type SortingGroupData,
+ type GroupOpacityData,
type SpriteMaskData,
type CameraData,
type CanvasData,
diff --git a/sdk/src/ecs/bridge/ptrAccessors.generated.ts b/sdk/src/ecs/bridge/ptrAccessors.generated.ts
index 92e9016ab..ed2d168d7 100644
--- a/sdk/src/ecs/bridge/ptrAccessors.generated.ts
+++ b/sdk/src/ecs/bridge/ptrAccessors.generated.ts
@@ -737,6 +737,34 @@ export function createFlexContainerData(): FlexContainerPtrData {
};
}
+export interface GroupOpacityPtrData {
+ opacity: number;
+ enabled: boolean;
+}
+
+export function fillGroupOpacity(
+ f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
+ ptr: number, out: GroupOpacityPtrData,
+): void {
+ out.opacity = f32[ptr >> 2];
+ out.enabled = u8[ptr + 4] !== 0;
+}
+
+export function writeGroupOpacity(
+ f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
+ ptr: number, data: GroupOpacityPtrData,
+): void {
+ f32[ptr >> 2] = data.opacity;
+ u8[ptr + 4] = data.enabled ? 1 : 0;
+}
+
+export function createGroupOpacityData(): GroupOpacityPtrData {
+ return {
+ opacity: 0,
+ enabled: false,
+ };
+}
+
export interface InteractablePtrData {
enabled: boolean;
blockRaycast: boolean;
@@ -2742,6 +2770,7 @@ export const PTR_ACCESSORS: Record<string, PtrAccessor<any>> = {
Draggable: { fill: fillDraggable, write: writeDraggable, create: createDraggableData },
DragonBonesAnimation: { fill: fillDragonBonesAnimation, write: writeDragonBonesAnimation, create: createDragonBonesAnimationData },
FlexContainer: { fill: fillFlexContainer, write: writeFlexContainer, create: createFlexContainerData },
+ GroupOpacity: { fill: fillGroupOpacity, write: writeGroupOpacity, create: createGroupOpacityData },
Interactable: { fill: fillInteractable, write: writeInteractable, create: createInteractableData },
LODGroup: { fill: fillLODGroup, write: writeLODGroup, create: createLODGroupData },
Light: { fill: fillLight, write: writeLight, create: createLightData },
diff --git a/sdk/src/ecs/component.generated.ts b/sdk/src/ecs/component.generated.ts
index a7654676c..ccb9b9b6b 100644
--- a/sdk/src/ecs/component.generated.ts
+++ b/sdk/src/ecs/component.generated.ts
@@ -15,7 +15,7 @@ import type { AlignContent, AlignItems, AlignSelf, BodyType, CanvasScaleMode, Cl
* getAbiLayoutHash(); BuiltinBridge.connect() compares them and refuses to
* run on mismatch, because mismatched offsets read the wrong heap bytes.
*/
-export const ABI_LAYOUT_HASH = 'ac076564c4c51626';
+export const ABI_LAYOUT_HASH = 'e064dcf6ece54b86';
/**
* One asset-valued field of a component: which field, and what kind of
@@ -432,6 +432,19 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {
alignContent: { enum: [{ label: 'Start', value: 0 }, { label: 'Center', value: 1 }, { label: 'End', value: 2 }, { label: 'Stretch', value: 3 }, { label: 'SpaceBetween', value: 4 }, { label: 'SpaceAround', value: 5 }] },
},
},
+ GroupOpacity: {
+ defaults: {
+ opacity: 1,
+ enabled: true,
+ },
+ assetFields: [],
+ entityFields: [],
+ colorFields: [],
+ animatableFields: [],
+ fields: {
+ opacity: { min: 0, max: 1, step: 0.01, tooltip: "Opacity of this entity and everything under it, multiplied with the opacity of every group above it." },
+ },
+ },
Interactable: {
defaults: {
enabled: true,
@@ -1564,6 +1577,17 @@ export interface FlexContainerData {
padding: Padding;
}
+/**
+ * The fields of the engine's `GroupOpacity` component, generated from
+ * the C++ struct so the two shapes cannot drift.
+ *
+ * @beta
+ */
+export interface GroupOpacityData {
+ opacity: number;
+ enabled: boolean;
+}
+
export interface InteractableData {
enabled: boolean;
blockRaycast: boolean;
diff --git a/sdk/src/ecs/component.ts b/sdk/src/ecs/component.ts
index 09bd4a52a..26e5920d8 100644
--- a/sdk/src/ecs/component.ts
+++ b/sdk/src/ecs/component.ts
@@ -16,7 +16,7 @@ export type { AssetFieldMeta, SkeletalFieldMeta };
// extending the generated base.
import type {
TransformData, SpriteData, ShapeRendererData, LightData, ShadowCaster2DData, DraggableData,
- SortingGroupData, SpriteMaskData, LightProbeVolumeData, OccluderData,
+ SortingGroupData, GroupOpacityData, SpriteMaskData, LightProbeVolumeData, OccluderData,
ReflectionProbeData, PlanarReflectionData,
CanvasData, VelocityData, ParentData, ChildrenData, SpineAnimationData, DragonBonesAnimationData,
TilemapLayerData, BitmapTextData, TrailRendererData, ParticleForceFieldData, SpringBoneData, SpringBoneColliderData,
@@ -830,7 +830,7 @@ export type ScaleMode = (typeof ScaleMode)[keyof typeof ScaleMode];
// automatically; tsc then enforces every consumer matches.
export type {
TransformData, SpriteData, ShapeRendererData, LightData, ShadowCaster2DData, DraggableData,
- SortingGroupData, SpriteMaskData, LightProbeVolumeData, OccluderData,
+ SortingGroupData, GroupOpacityData, SpriteMaskData, LightProbeVolumeData, OccluderData,
ReflectionProbeData, PlanarReflectionData,
CanvasData, VelocityData, ParentData, ChildrenData, SpineAnimationData, DragonBonesAnimationData,
TilemapLayerData, BitmapTextData, TrailRendererData, ParticleForceFieldData, SpringBoneData, SpringBoneColliderData,
@@ -1002,6 +1002,15 @@ export const SortingGroup = defineBuiltin<SortingGroupData>('SortingGroup',
metaDefaults<SortingGroupData>('SortingGroup')
);
+/**
+ * Fades this entity and everything under it: the opacities multiply down the hierarchy into each descendant's own alpha,
+ * the way `UINode.opacity` does for a UI subtree. It is not a composited layer — overlapping children show through one
+ * another mid-fade.
+ */
+export const GroupOpacity = defineBuiltin<GroupOpacityData>('GroupOpacity',
+ metaDefaults<GroupOpacityData>('GroupOpacity')
+);
+
// The authoring defaults that differ from the C++ ctor (an active Orthographic
// at orthoSize 540 vs a Perspective/inactive runtime default) are authored at
// the C++ ES_PROPERTY sites (editor_default=) and merged in by metaDefaults.
diff --git a/sdk/src/wasm/ptrLayouts.generated.ts b/sdk/src/wasm/ptrLayouts.generated.ts
index b490b0c93..5a5655ecf 100644
--- a/sdk/src/wasm/ptrLayouts.generated.ts
+++ b/sdk/src/wasm/ptrLayouts.generated.ts
@@ -209,6 +209,13 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
{ name: 'padding', type: 'struct', offset: 16, members: [{ name: 'left', type: 'f32', offset: 0 }, { name: 'top', type: 'f32', offset: 4 }, { name: 'right', type: 'f32', offset: 8 }, { name: 'bottom', type: 'f32', offset: 12 }] },
],
},
+ GroupOpacity: {
+ ptrFn: 'getGroupOpacityPtr',
+ fields: [
+ { name: 'opacity', type: 'f32', offset: 0 },
+ { name: 'enabled', type: 'bool', offset: 4 },
+ ],
+ },
Interactable: {
ptrFn: 'getInteractablePtr',
fields: [
diff --git a/sdk/src/wasm/wasm.generated.ts b/sdk/src/wasm/wasm.generated.ts
index 342f3b615..fc95ea0a1 100644
--- a/sdk/src/wasm/wasm.generated.ts
+++ b/sdk/src/wasm/wasm.generated.ts
@@ -610,6 +610,11 @@ export interface FlexContainer {
padding: Padding;
}
+export interface GroupOpacity {
+ opacity: number;
+ enabled: boolean;
+}
+
export interface Interactable {
enabled: boolean;
blockRaycast: boolean;
@@ -1127,6 +1132,10 @@ export interface Registry {
getFlexContainer(entity: Entity): FlexContainer;
addFlexContainer(entity: Entity, component: FlexContainer): void;
removeFlexContainer(entity: Entity): void;
+ hasGroupOpacity(entity: Entity): boolean;
+ getGroupOpacity(entity: Entity): GroupOpacity;
+ addGroupOpacity(entity: Entity, component: GroupOpacity): void;
+ removeGroupOpacity(entity: Entity): void;
hasInteractable(entity: Entity): boolean;
getInteractable(entity: Entity): Interactable;
addInteractable(entity: Entity, component: Interactable): void;
@@ -1309,6 +1318,7 @@ export interface ESEngineModule {
Draggable: new () => Draggable;
DragonBonesAnimation: new () => DragonBonesAnimation;
FlexContainer: new () => FlexContainer;
+ GroupOpacity: new () => GroupOpacity;
Interactable: new () => Interactable;
LODGroup: new () => LODGroup;
Light: new () => Light;
diff --git a/sdk/tests/__snapshots__/component-fieldmeta-golden.test.ts.snap b/sdk/tests/__snapshots__/component-fieldmeta-golden.test.ts.snap
index 69fb10682..ef3ad5bed 100644
--- a/sdk/tests/__snapshots__/component-fieldmeta-golden.test.ts.snap
+++ b/sdk/tests/__snapshots__/component-fieldmeta-golden.test.ts.snap
@@ -216,6 +216,14 @@ exports[`builtin FieldMeta (RC9-1 equivalence gate) > matches the golden snapsho
"min": 0,
},
},
+ "GroupOpacity": {
+ "opacity": {
+ "max": 1,
+ "min": 0,
+ "step": 0.01,
+ "tooltip": "Opacity of this entity and everything under it, multiplied with the opacity of every group above it.",
+ },
+ },
"Light": {
"aimFollowedSun": {
"advanced": true,
diff --git a/sdk/tests/cocos/ui-adapters-wasm.test.ts b/sdk/tests/cocos/ui-adapters-wasm.test.ts
index 462ac780e..884584c86 100644
--- a/sdk/tests/cocos/ui-adapters-wasm.test.ts
+++ b/sdk/tests/cocos/ui-adapters-wasm.test.ts
@@ -15,6 +15,7 @@ import { Sprite as EngineSprite, Transform, ensureBuiltinComponentsRegistered }
import { AppContext, setDefaultContext } from '../../src/ecs/context';
import { Text } from '../../src/ui/core/text';
import { TextOverflow } from '../../src/ui/core/text';
+import { GroupOpacity } from '../../src/ecs/component';
import { Color, Label, LabelOutline, LabelShadow, Node, Size, Sprite, UIOpacity, UITransform, Vec2, Vec3, setCurrentWorld } from '../../src/cocos';
import { HAS_WASM, loadWasmModule } from '../helpers/loadWasm';
@@ -158,19 +159,16 @@ describe.skipIf(!HAS_WASM)('built-in UI components on the engine', () => {
expect(W().get(n._entity, EngineSprite).enabled).toBe(false);
});
- it('fades the node\'s own sprite by UIOpacity, and does not compound repeated writes', () => {
+ it('is the engine\'s GroupOpacity, in Cocos\'s 0..255', () => {
connect();
- const n = node('s');
- n.addComponent(Sprite);
+ const n = node('p');
const opacity = n.addComponent(UIOpacity)!;
+ expect(opacity.opacity).toBe(255);
opacity.opacity = 128;
- const a1 = W().get(n._entity, EngineSprite).color.a;
- expect(a1).toBeCloseTo(128 / 255, 3);
- opacity.opacity = 128;
- opacity.opacity = 128;
- expect(W().get(n._entity, EngineSprite).color.a).toBeCloseTo(a1, 5);
- opacity.opacity = 255;
- expect(W().get(n._entity, EngineSprite).color.a).toBeCloseTo(1, 5);
+ expect(W().get(n._entity, GroupOpacity).opacity).toBeCloseTo(128 / 255, 5);
+ expect(opacity.opacity).toBe(128);
+ opacity.opacity = 999;
+ expect(opacity.opacity).toBe(255);
});
});
diff --git a/sdk/tests/group-opacity-wasm.test.ts b/sdk/tests/group-opacity-wasm.test.ts
new file mode 100644
index 000000000..6e9d83be7
--- /dev/null
+++ b/sdk/tests/group-opacity-wasm.test.ts
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file A GroupOpacity fades the entity it is on and everything under it.
+ *
+ * What a draw inherits is read through the same query the text renderer asks (`getUINodeAlphaInTree`), which answers with the UI tree's
+ * opacity times the group opacity above the entity — so these pin the multiplication, the disabled group, and that a sibling is left alone.
+ */
+import { afterEach, beforeAll, describe, expect, it } from 'vitest';
+import { App, flushPendingRegistrations } from '../src/app/app';
+import { AppContext, setDefaultContext } from '../src/ecs/context';
+import { GroupOpacity, Transform } from '../src/ecs/component';
+import type { Entity } from '../src/types';
+import type { ESEngineModule } from '../src/wasm';
+import { HAS_WASM, loadWasmModule } from './helpers/loadWasm';
+
+describe.skipIf(!HAS_WASM)('GroupOpacity (WASM integration)', () => {
+ let module: ESEngineModule;
+ let app: App | undefined;
+ let registry: InstanceType<ESEngineModule['Registry']> | undefined;
+
+ beforeAll(async () => { module = await loadWasmModule(); });
+ afterEach(() => {
+ app?.world.disconnectCpp();
+ registry?.delete();
+ app = undefined;
+ registry = undefined;
+ });
+
+ function boot(): App {
+ setDefaultContext(new AppContext());
+ registry = new module.Registry();
+ app = App.new();
+ app.connectCpp(registry, module);
+ flushPendingRegistrations(app);
+ return app;
+ }
+
+ const alphaOf = (e: Entity): number => (module as unknown as { getUINodeAlphaInTree(r: unknown, e: number): number }).getUINodeAlphaInTree(registry, e as number);
+
+ function spawn(a: App, parent?: Entity, opacity?: number, enabled = true): Entity {
+ const e = a.world.spawn('e');
+ a.world.insert(e, Transform, {});
+ if (opacity !== undefined) a.world.insert(e, GroupOpacity, { opacity, enabled });
+ if (parent !== undefined) a.world.setParent(e, parent);
+ return e;
+ }
+
+ it('leaves everything at full opacity while no group exists', () => {
+ const a = boot();
+ expect(alphaOf(spawn(a))).toBe(1);
+ });
+
+ it('fades the entity it is on and everything under it', () => {
+ const a = boot();
+ const panel = spawn(a, undefined, 0.5);
+ const child = spawn(a, panel);
+ const grandchild = spawn(a, child);
+ expect(alphaOf(panel)).toBeCloseTo(0.5, 5);
+ expect(alphaOf(child)).toBeCloseTo(0.5, 5);
+ expect(alphaOf(grandchild)).toBeCloseTo(0.5, 5);
+ });
+
+ it('multiplies the groups above an entity, and does not touch a sibling', () => {
+ const a = boot();
+ const outer = spawn(a, undefined, 0.5);
+ const inner = spawn(a, outer, 0.5);
+ const leaf = spawn(a, inner);
+ const beside = spawn(a, outer);
+ const apart = spawn(a);
+ expect(alphaOf(leaf)).toBeCloseTo(0.25, 5);
+ expect(alphaOf(beside)).toBeCloseTo(0.5, 5);
+ expect(alphaOf(apart)).toBe(1);
+ });
+
+ it('ignores a disabled group, and follows a change of opacity', () => {
+ const a = boot();
+ const panel = spawn(a, undefined, 0.2, false);
+ const child = spawn(a, panel);
+ expect(alphaOf(child)).toBe(1);
+ a.world.set(panel, GroupOpacity, { opacity: 0.2, enabled: true });
+ expect(alphaOf(child)).toBeCloseTo(0.2, 5);
+ a.world.set(panel, GroupOpacity, { opacity: 0, enabled: true });
+ expect(alphaOf(child)).toBe(0);
+ });
+});
diff --git a/src/esengine/aot/AotComponents.generated.cpp b/src/esengine/aot/AotComponents.generated.cpp
index 10cc4e925..6cfc16f2d 100644
--- a/src/esengine/aot/AotComponents.generated.cpp
+++ b/src/esengine/aot/AotComponents.generated.cpp
@@ -19,6 +19,7 @@
#include "esengine/ecs/components/Draggable.hpp"
#include "esengine/ecs/components/DragonBonesAnimation.hpp"
#include "esengine/ecs/components/FlexContainer.hpp"
+#include "esengine/ecs/components/GroupOpacity.hpp"
#include "esengine/ecs/components/Interactable.hpp"
#include "esengine/ecs/components/LODGroup.hpp"
#include "esengine/ecs/components/Light.hpp"
@@ -142,6 +143,11 @@ ComponentAt engineComponentAt(ecs::Registry& registry, const char* name) {
return registry.tryGet<esengine::ecs::FlexContainer>(Entity::fromRaw(raw));
};
}
+ if (std::strcmp(name, "GroupOpacity") == 0) {
+ return [&registry](std::uint32_t raw) -> void* {
+ return registry.tryGet<esengine::ecs::GroupOpacity>(Entity::fromRaw(raw));
+ };
+ }
if (std::strcmp(name, "Interactable") == 0) {
return [&registry](std::uint32_t raw) -> void* {
return registry.tryGet<esengine::ecs::Interactable>(Entity::fromRaw(raw));
@@ -406,6 +412,11 @@ CandidatesOf engineComponentCandidates(ecs::Registry& registry, const char* name
return denseAsIds(registry.entitiesWith<esengine::ecs::FlexContainer>());
};
}
+ if (std::strcmp(name, "GroupOpacity") == 0) {
+ return [&registry]() -> Candidates {
+ return denseAsIds(registry.entitiesWith<esengine::ecs::GroupOpacity>());
+ };
+ }
if (std::strcmp(name, "Interactable") == 0) {
return [&registry]() -> Candidates {
return denseAsIds(registry.entitiesWith<esengine::ecs::Interactable>());
@@ -610,6 +621,7 @@ bool isEngineComponent(const char* name) {
if (std::strcmp(name, "Draggable") == 0) return true;
if (std::strcmp(name, "DragonBonesAnimation") == 0) return true;
if (std::strcmp(name, "FlexContainer") == 0) return true;
+ if (std::strcmp(name, "GroupOpacity") == 0) return true;
if (std::strcmp(name, "Interactable") == 0) return true;
if (std::strcmp(name, "LODGroup") == 0) return true;
if (std::strcmp(name, "Light") == 0) return true;
diff --git a/src/esengine/aot/EngineDigest.generated.h b/src/esengine/aot/EngineDigest.generated.h
index dc76fa293..014b06b43 100644
--- a/src/esengine/aot/EngineDigest.generated.h
+++ b/src/esengine/aot/EngineDigest.generated.h
@@ -6,7 +6,7 @@
/* One per address width, because the width is IN the digest: a host that
took the other one would refuse every module built for it. */
-#define ES_ENGINE_ABI_DIGEST_32 0xce4ca38c1ff13f6aULL
-#define ES_ENGINE_ABI_DIGEST_64 0x454cb3975a040836ULL
+#define ES_ENGINE_ABI_DIGEST_32 0xdc0775787030c60fULL
+#define ES_ENGINE_ABI_DIGEST_64 0x1cab327a1c52a33bULL
#define ES_ENGINE_ABI_DIGEST \
(sizeof(es_addr_t) == 8 ? ES_ENGINE_ABI_DIGEST_64 : ES_ENGINE_ABI_DIGEST_32)
diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cpp
index ca0b83244..7cb55df02 100644
--- a/src/esengine/bindings/EditorAPI.generated.cpp
+++ b/src/esengine/bindings/EditorAPI.generated.cpp
@@ -2,10 +2,10 @@
* @file EditorAPI.generated.cpp
* @brief Auto-generated editor API with string-dispatched component access
* @details Generated by EHT - DO NOT EDIT
- * @schema_hash 8522a64ede6f4d50
+ * @schema_hash f3c0b41d2c68bec0
*/
-#define ES_EDITOR_API_SCHEMA_HASH "8522a64ede6f4d50"
+#define ES_EDITOR_API_SCHEMA_HASH "f3c0b41d2c68bec0"
#include <emscripten/bind.h>
#include <string>
@@ -21,6 +21,7 @@
#include "../ecs/components/Draggable.hpp"
#include "../ecs/components/DragonBonesAnimation.hpp"
#include "../ecs/components/FlexContainer.hpp"
+#include "../ecs/components/GroupOpacity.hpp"
#include "../ecs/components/Hierarchy.hpp"
#include "../ecs/components/Interactable.hpp"
#include "../ecs/components/LODGroup.hpp"
@@ -84,6 +85,7 @@ std::vector<std::string> editor_getComponentNames() {
"Draggable",
"DragonBonesAnimation",
"FlexContainer",
+ "GroupOpacity",
"Interactable",
"LODGroup",
"Light",
@@ -324,6 +326,11 @@ std::string editor_getComponentSchema(const std::string& name) {
{"key":"padding.right","type":"float","group":"FlexContainer"},
{"key":"padding.bottom","type":"float","group":"FlexContainer"}
])JSON";
+ } else if (name == "GroupOpacity") {
+ return R"JSON([
+ {"key":"opacity","type":"float","group":"GroupOpacity"},
+ {"key":"enabled","type":"bool","group":"GroupOpacity"}
+ ])JSON";
} else if (name == "Interactable") {
return R"JSON([
{"key":"enabled","type":"bool","group":"Interactable"},
@@ -923,6 +930,9 @@ bool editor_addComponent(Registry& reg, u32 e, const std::string& name) {
} else if (name == "FlexContainer") {
if (!reg.has<esengine::ecs::FlexContainer>(entity)) reg.emplace<esengine::ecs::FlexContainer>(entity);
return true;
+ } else if (name == "GroupOpacity") {
+ if (!reg.has<esengine::ecs::GroupOpacity>(entity)) reg.emplace<esengine::ecs::GroupOpacity>(entity);
+ return true;
} else if (name == "Interactable") {
if (!reg.has<esengine::ecs::Interactable>(entity)) reg.emplace<esengine::ecs::Interactable>(entity);
return true;
@@ -1074,6 +1084,8 @@ bool editor_removeComponent(Registry& reg, u32 e, const std::string& name) {
if (reg.has<esengine::ecs::DragonBonesAnimation>(entity)) { reg.remove<esengine::ecs::DragonBonesAnimation>(entity); return true; }
} else if (name == "FlexContainer") {
if (reg.has<esengine::ecs::FlexContainer>(entity)) { reg.remove<esengine::ecs::FlexContainer>(entity); return true; }
+ } else if (name == "GroupOpacity") {
+ if (reg.has<esengine::ecs::GroupOpacity>(entity)) { reg.remove<esengine::ecs::GroupOpacity>(entity); return true; }
} else if (name == "Interactable") {
if (reg.has<esengine::ecs::Interactable>(entity)) { reg.remove<esengine::ecs::Interactable>(entity); return true; }
} else if (name == "LODGroup") {
@@ -1170,6 +1182,7 @@ bool editor_hasComponent(Registry& reg, u32 e, const std::string& name) {
if (name == "Draggable") return reg.has<esengine::ecs::Draggable>(entity);
if (name == "DragonBonesAnimation") return reg.has<esengine::ecs::DragonBonesAnimation>(entity);
if (name == "FlexContainer") return reg.has<esengine::ecs::FlexContainer>(entity);
+ if (name == "GroupOpacity") return reg.has<esengine::ecs::GroupOpacity>(entity);
if (name == "Interactable") return reg.has<esengine::ecs::Interactable>(entity);
if (name == "LODGroup") return reg.has<esengine::ecs::LODGroup>(entity);
if (name == "Light") return reg.has<esengine::ecs::Light>(entity);
@@ -1231,6 +1244,7 @@ std::vector<std::string> editor_getComponents(Registry& reg, u32 e) {
if (reg.has<esengine::ecs::Draggable>(entity)) result.push_back("Draggable");
if (reg.has<esengine::ecs::DragonBonesAnimation>(entity)) result.push_back("DragonBonesAnimation");
if (reg.has<esengine::ecs::FlexContainer>(entity)) result.push_back("FlexContainer");
+ if (reg.has<esengine::ecs::GroupOpacity>(entity)) result.push_back("GroupOpacity");
if (reg.has<esengine::ecs::Interactable>(entity)) result.push_back("Interactable");
if (reg.has<esengine::ecs::LODGroup>(entity)) result.push_back("LODGroup");
if (reg.has<esengine::ecs::Light>(entity)) result.push_back("Light");
@@ -1438,6 +1452,12 @@ bool editor_setFloat(Registry& reg, u32 e, const std::string& comp, const std::s
else if (field == "padding.bottom") { c.padding.bottom = value; }
else { return false; }
return true;
+ } else if (comp == "GroupOpacity") {
+ if (!reg.has<esengine::ecs::GroupOpacity>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::GroupOpacity>(entity);
+ if (field == "opacity") { c.opacity = value; }
+ else { return false; }
+ return true;
} else if (comp == "LODGroup") {
if (!reg.has<esengine::ecs::LODGroup>(entity)) return false;
auto& c = reg.get<esengine::ecs::LODGroup>(entity);
@@ -2019,6 +2039,10 @@ f32 editor_getFloat(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "padding.top") { return c.padding.top; }
else if (field == "padding.right") { return c.padding.right; }
else if (field == "padding.bottom") { return c.padding.bottom; }
+ } else if (comp == "GroupOpacity") {
+ if (!reg.has<esengine::ecs::GroupOpacity>(entity)) return 0.0f;
+ const auto& c = reg.get<esengine::ecs::GroupOpacity>(entity);
+ if (field == "opacity") { return c.opacity; }
} else if (comp == "LODGroup") {
if (!reg.has<esengine::ecs::LODGroup>(entity)) return 0.0f;
const auto& c = reg.get<esengine::ecs::LODGroup>(entity);
@@ -3019,6 +3043,12 @@ bool editor_setBool(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "enabled") { c.enabled = value; }
else { return false; }
return true;
+ } else if (comp == "GroupOpacity") {
+ if (!reg.has<esengine::ecs::GroupOpacity>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::GroupOpacity>(entity);
+ if (field == "enabled") { c.enabled = value; }
+ else { return false; }
+ return true;
} else if (comp == "Interactable") {
if (!reg.has<esengine::ecs::Interactable>(entity)) return false;
auto& c = reg.get<esengine::ecs::Interactable>(entity);
@@ -3295,6 +3325,10 @@ bool editor_getBool(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "flipX") { return c.flipX; }
else if (field == "flipY") { return c.flipY; }
else if (field == "enabled") { return c.enabled; }
+ } else if (comp == "GroupOpacity") {
+ if (!reg.has<esengine::ecs::GroupOpacity>(entity)) return false;
+ const auto& c = reg.get<esengine::ecs::GroupOpacity>(entity);
+ if (field == "enabled") { return c.enabled; }
} else if (comp == "Interactable") {
if (!reg.has<esengine::ecs::Interactable>(entity)) return false;
const auto& c = reg.get<esengine::ecs::Interactable>(entity);
diff --git a/src/esengine/bindings/RendererBindings.cpp b/src/esengine/bindings/RendererBindings.cpp
index 24cbefb81..864fc04bc 100644
--- a/src/esengine/bindings/RendererBindings.cpp
+++ b/src/esengine/bindings/RendererBindings.cpp
@@ -21,6 +21,7 @@
#include "../renderer/draw/CustomGeometry.hpp"
#include "../renderer/draw/TextVertexFormat.hpp"
#include "../resource/ResourceManager.hpp"
+#include "../ecs/GroupOpacityLookup.hpp"
#include "../ecs/Registry.hpp"
#include "../ecs/TransformSystem.hpp"
#include "../core/World.hpp"
@@ -262,13 +263,14 @@ void renderer_retainedTextSubmit(ecs::Registry& registry, i32 screen, uintptr_t
static RetainedTextClip clip;
static std::vector<f32> faded;
double planes[36];
+ const ecs::GroupOpacityLookup groupOpacity(registry);
for (auto& [raw, text] : g_renderFrame->retainedText().entries()) {
if (text.screen != (screen != 0)) continue;
const Entity entity = Entity::fromRaw(raw);
if (!registry.valid(entity)) continue;
const auto* node = registry.tryGet<ecs::UINode>(entity);
if (node && node->hidden_in_tree_) continue;
- const f32 opacity = node ? node->alpha_in_tree_ : 1.0f;
+ const f32 opacity = (node ? node->alpha_in_tree_ : 1.0f) * groupOpacity.of(entity);
if (opacity <= 0.0f) continue;
glm::mat4 matrix;
if (!ecs::copyFlatRenderMatrix(registry, entity, matrix)) continue;
diff --git a/src/esengine/bindings/UIBindings.cpp b/src/esengine/bindings/UIBindings.cpp
index a23318bf8..1ac6f4d1e 100644
--- a/src/esengine/bindings/UIBindings.cpp
+++ b/src/esengine/bindings/UIBindings.cpp
@@ -14,6 +14,7 @@
#include "ActiveContext.hpp"
#include "../core/EstellaContext.hpp"
#include "../core/World.hpp"
+#include "../ecs/GroupOpacityLookup.hpp"
#include "../ecs/Registry.hpp"
#include "../ui/UISystem.hpp"
#include "../resource/ResourceManager.hpp"
@@ -120,7 +121,7 @@ bool getUINodeHiddenInTree(ecs::Registry& registry, u32 entity) {
// renderer + input router need it to behave like the C++ visuals do.
f32 getUINodeAlphaInTree(ecs::Registry& registry, u32 entity) {
auto* node = registry.tryGet<ecs::UINode>(Entity::fromRaw(entity));
- return node ? node->alpha_in_tree_ : 1.0f;
+ return (node ? node->alpha_in_tree_ : 1.0f) * ecs::GroupOpacityLookup(registry).of(Entity::fromRaw(entity));
}
f32 getUINodeComputedWidth(ecs::Registry& registry, u32 entity) {
diff --git a/src/esengine/bindings/WebBindings.generated.cpp b/src/esengine/bindings/WebBindings.generated.cpp
index 2d20534b7..53731e7b0 100644
--- a/src/esengine/bindings/WebBindings.generated.cpp
+++ b/src/esengine/bindings/WebBindings.generated.cpp
@@ -21,6 +21,7 @@
#include "../ecs/components/Draggable.hpp"
#include "../ecs/components/DragonBonesAnimation.hpp"
#include "../ecs/components/FlexContainer.hpp"
+#include "../ecs/components/GroupOpacity.hpp"
#include "../ecs/components/Hierarchy.hpp"
#include "../ecs/components/Interactable.hpp"
#include "../ecs/components/LODGroup.hpp"
@@ -1951,6 +1952,10 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
.field("gap", &FlexContainerJS::gap)
.field("padding", &FlexContainerJS::padding);
+ value_object<esengine::ecs::GroupOpacity>("GroupOpacity")
+ .field("opacity", &esengine::ecs::GroupOpacity::opacity)
+ .field("enabled", &esengine::ecs::GroupOpacity::enabled);
+
value_object<esengine::ecs::Interactable>("Interactable")
.field("enabled", &esengine::ecs::Interactable::enabled)
.field("blockRaycast", &esengine::ecs::Interactable::blockRaycast)
@@ -2407,6 +2412,7 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
if (r.has<esengine::ecs::Draggable>(entity)) { if (!names.empty()) names += "|"; names += "Draggable"; }
if (r.has<esengine::ecs::DragonBonesAnimation>(entity)) { if (!names.empty()) names += "|"; names += "DragonBonesAnimation"; }
if (r.has<esengine::ecs::FlexContainer>(entity)) { if (!names.empty()) names += "|"; names += "FlexContainer"; }
+ if (r.has<esengine::ecs::GroupOpacity>(entity)) { if (!names.empty()) names += "|"; names += "GroupOpacity"; }
if (r.has<esengine::ecs::Interactable>(entity)) { if (!names.empty()) names += "|"; names += "Interactable"; }
if (r.has<esengine::ecs::LODGroup>(entity)) { if (!names.empty()) names += "|"; names += "LODGroup"; }
if (r.has<esengine::ecs::Light>(entity)) { if (!names.empty()) names += "|"; names += "Light"; }
@@ -2463,6 +2469,7 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
if (name == "Draggable") return static_cast<int>(componentTypeId<esengine::ecs::Draggable>());
if (name == "DragonBonesAnimation") return static_cast<int>(componentTypeId<esengine::ecs::DragonBonesAnimation>());
if (name == "FlexContainer") return static_cast<int>(componentTypeId<esengine::ecs::FlexContainer>());
+ if (name == "GroupOpacity") return static_cast<int>(componentTypeId<esengine::ecs::GroupOpacity>());
if (name == "Interactable") return static_cast<int>(componentTypeId<esengine::ecs::Interactable>());
if (name == "LODGroup") return static_cast<int>(componentTypeId<esengine::ecs::LODGroup>());
if (name == "Light") return static_cast<int>(componentTypeId<esengine::ecs::Light>());
@@ -2837,6 +2844,27 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
r.remove<esengine::ecs::FlexContainer>(entity);
}))
+ // GroupOpacity
+ .function("hasGroupOpacity", optional_override([](Registry& r, u32 e) {
+ return r.has<esengine::ecs::GroupOpacity>(static_cast<Entity>(e));
+ }))
+ .function("getGroupOpacity", optional_override([](Registry& r, u32 e) -> esengine::ecs::GroupOpacity& {
+ auto entity = static_cast<Entity>(e);
+ static esengine::ecs::GroupOpacity s_dummy{};
+ if (!r.valid(entity) || !r.has<esengine::ecs::GroupOpacity>(entity)) return s_dummy;
+ return r.get<esengine::ecs::GroupOpacity>(entity);
+ }), allow_raw_pointers())
+ .function("addGroupOpacity", optional_override([](Registry& r, u32 e, const esengine::ecs::GroupOpacity& c) {
+ auto entity = static_cast<Entity>(e);
+ if (!r.valid(entity)) return;
+ r.emplaceOrReplace<esengine::ecs::GroupOpacity>(entity, c);
+ }))
+ .function("removeGroupOpacity", optional_override([](Registry& r, u32 e) {
+ auto entity = static_cast<Entity>(e);
+ if (!r.valid(entity) || !r.has<esengine::ecs::GroupOpacity>(entity)) return;
+ r.remove<esengine::ecs::GroupOpacity>(entity);
+ }))
+
// Interactable
.function("hasInteractable", optional_override([](Registry& r, u32 e) {
return r.has<esengine::ecs::Interactable>(static_cast<Entity>(e));
@@ -3720,6 +3748,7 @@ emscripten::val esengineGetBuiltinComponentNames() {
arr.set(i++, val(std::string("Draggable")));
arr.set(i++, val(std::string("DragonBonesAnimation")));
arr.set(i++, val(std::string("FlexContainer")));
+ arr.set(i++, val(std::string("GroupOpacity")));
arr.set(i++, val(std::string("Interactable")));
arr.set(i++, val(std::string("LODGroup")));
arr.set(i++, val(std::string("Light")));
@@ -3883,6 +3912,8 @@ static_assert(offsetof(esengine::ecs::FlexContainer, alignItems) == 3, "ABI offs
static_assert(offsetof(esengine::ecs::FlexContainer, alignContent) == 4, "ABI offset drift: esengine::ecs::FlexContainer.alignContent (EHT expected 4)");
static_assert(offsetof(esengine::ecs::FlexContainer, gap) == 8, "ABI offset drift: esengine::ecs::FlexContainer.gap (EHT expected 8)");
static_assert(offsetof(esengine::ecs::FlexContainer, padding) == 16, "ABI offset drift: esengine::ecs::FlexContainer.padding (EHT expected 16)");
+static_assert(offsetof(esengine::ecs::GroupOpacity, opacity) == 0, "ABI offset drift: esengine::ecs::GroupOpacity.opacity (EHT expected 0)");
+static_assert(offsetof(esengine::ecs::GroupOpacity, enabled) == 4, "ABI offset drift: esengine::ecs::GroupOpacity.enabled (EHT expected 4)");
static_assert(offsetof(esengine::ecs::Interactable, enabled) == 0, "ABI offset drift: esengine::ecs::Interactable.enabled (EHT expected 0)");
static_assert(offsetof(esengine::ecs::Interactable, blockRaycast) == 1, "ABI offset drift: esengine::ecs::Interactable.blockRaycast (EHT expected 1)");
static_assert(offsetof(esengine::ecs::Interactable, raycastTarget) == 2, "ABI offset drift: esengine::ecs::Interactable.raycastTarget (EHT expected 2)");
@@ -4215,7 +4246,7 @@ static_assert(offsetof(esengine::ecs::Velocity, angular) == 12, "ABI offset drif
// ABI Hash -- runtime handshake against the SDK bundle
// =============================================================================
-static const char* kEsAbiLayoutHash = "ac076564c4c51626";
+static const char* kEsAbiLayoutHash = "e064dcf6ece54b86";
std::string esengineGetAbiLayoutHash() {
return std::string(kEsAbiLayoutHash);
diff --git a/src/esengine/ecs/GroupOpacityLookup.hpp b/src/esengine/ecs/GroupOpacityLookup.hpp
new file mode 100644
index 000000000..e6e631b58
--- /dev/null
+++ b/src/esengine/ecs/GroupOpacityLookup.hpp
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+#pragma once
+
+#include "Registry.hpp"
+#include "components/GroupOpacity.hpp"
+#include "components/Hierarchy.hpp"
+
+#include <algorithm>
+
+namespace esengine::ecs {
+
+/**
+ * @brief The opacity a draw inherits from the GroupOpacity above it.
+ *
+ * @details Made once per collect. Most scenes have no group, and then `of` is a branch on a flag; with groups it walks the entity's ancestors,
+ * so the cost follows the depth of what is drawn, not the size of the scene.
+ */
+class GroupOpacityLookup {
+public:
+ explicit GroupOpacityLookup(Registry& registry) : registry_(registry) {
+ auto groups = registry.view<GroupOpacity>();
+ active_ = groups.begin() != groups.end();
+ }
+
+ bool active() const { return active_; }
+
+ /// 1 when no enabled group encloses @p entity (itself included).
+ f32 of(Entity entity) const {
+ if (!active_) return 1.0f;
+ f32 opacity = 1.0f;
+ for (Entity current = entity; current != INVALID_ENTITY;) {
+ if (const auto* group = registry_.tryGet<GroupOpacity>(current); group && group->enabled) {
+ opacity *= std::clamp(group->opacity, 0.0f, 1.0f);
+ }
+ const auto* parent = registry_.tryGet<Parent>(current);
+ current = parent ? parent->entity : INVALID_ENTITY;
+ }
+ return opacity;
+ }
+
+private:
+ Registry& registry_;
+ bool active_ = false;
+};
+
+} // namespace esengine::ecs
diff --git a/src/esengine/ecs/components/GroupOpacity.hpp b/src/esengine/ecs/components/GroupOpacity.hpp
new file mode 100644
index 000000000..cffa1e3e7
--- /dev/null
+++ b/src/esengine/ecs/components/GroupOpacity.hpp
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+#pragma once
+
+#include "../../core/Types.hpp"
+#include "../../core/Reflection.hpp"
+
+namespace esengine::ecs {
+
+/**
+ * @brief Fades an entity and everything under it, the way `UINode.opacity` fades a UI subtree.
+ *
+ * @details The opacities multiply down the hierarchy into each descendant's own alpha. It is not a composited layer: where children overlap they
+ * show through one another mid-fade, which is the cheap behaviour every group alpha makes. It reaches the world content that draws a
+ * colour — sprites, text, shapes, trails; a UI node answers to its own `opacity` instead.
+ */
+ES_COMPONENT(stability=beta)
+struct GroupOpacity {
+ ES_PROPERTY(min=0, max=1, step=0.01, tooltip="Opacity of this entity and everything under it, multiplied with the opacity of every group above it.")
+ f32 opacity{1.0f};
+
+ ES_PROPERTY()
+ bool enabled{true};
+};
+
+} // namespace esengine::ecs
diff --git a/src/esengine/renderer/plugins/ShapePlugin.cpp b/src/esengine/renderer/plugins/ShapePlugin.cpp
index fa6c1f0a8..3059306ca 100644
--- a/src/esengine/renderer/plugins/ShapePlugin.cpp
+++ b/src/esengine/renderer/plugins/ShapePlugin.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
#include "ShapePlugin.hpp"
+#include "../../ecs/GroupOpacityLookup.hpp"
#include "../draw/BatchBuilder.hpp"
#include "../frame/RenderContext.hpp"
#include "../frame/RenderFrame.hpp"
@@ -45,9 +46,13 @@ void ShapePlugin::collect(RenderCollectContext& collect_ctx) {
auto& ctx = collect_ctx.frame_context;
auto shapeView = registry.activeView<ecs::Transform, ecs::ShapeRenderer>();
+ const ecs::GroupOpacityLookup groupOpacity(registry);
+
for (auto entity : shapeView) {
const auto& shape = shapeView.get<ecs::ShapeRenderer>(entity);
if (!shape.enabled) continue;
+ const f32 groupAlpha = groupOpacity.of(entity);
+ if (groupAlpha <= 0.0f) continue;
auto& transform = shapeView.get<ecs::Transform>(entity);
glm::vec3 position = parallaxedWorldPosition(transform, shape.parallax, collect_ctx.camera);
@@ -101,7 +106,7 @@ void ShapePlugin::collect(RenderCollectContext& collect_ctx) {
verts[v].cr = shape.color.r;
verts[v].cg = shape.color.g;
verts[v].cb = shape.color.b;
- verts[v].ca = shape.color.a;
+ verts[v].ca = shape.color.a * groupAlpha;
verts[v].shapeType = static_cast<f32>(shape.shapeType);
verts[v].halfW = halfSize.x;
verts[v].halfH = halfSize.y;
diff --git a/src/esengine/renderer/plugins/SpritePlugin.cpp b/src/esengine/renderer/plugins/SpritePlugin.cpp
index 55fc884c7..323a8dff6 100644
--- a/src/esengine/renderer/plugins/SpritePlugin.cpp
+++ b/src/esengine/renderer/plugins/SpritePlugin.cpp
@@ -11,6 +11,7 @@
#include "../../ecs/components/Sprite.hpp"
#include "../../ecs/components/SpriteMask.hpp"
#include "../../ecs/components/UINode.hpp"
+#include "../../ecs/GroupOpacityLookup.hpp"
#include "../draw/SpriteDrawResolve.hpp"
#include "../store/LightConstants.hpp"
@@ -28,6 +29,7 @@ void SpritePlugin::collect(RenderCollectContext& collect_ctx) {
auto spriteView = registry.activeView<ecs::Transform, ecs::Sprite>();
u32 litProgram = 0;
+ const ecs::GroupOpacityLookup groupOpacity(registry);
for (auto entity : spriteView) {
if (!collect_ctx.accepts(entity)) continue;
@@ -155,10 +157,14 @@ void SpritePlugin::collect(RenderCollectContext& collect_ctx) {
}
}
+ glm::vec4 color = sprite.color;
+ color.a *= groupOpacity.of(entity);
+ if (color.a <= 0.0f) continue;
+
if (hasTiling) {
emitTiledQuads(buffers, draw_list, clips,
position, finalSize, sprite.pivot,
- angle, sprite.color, uvOff, uvSc,
+ angle, color, uvOff, uvSc,
sprite.tileSize * glm::abs(glm::vec2(scale)),
sprite.tileSpacing * glm::abs(glm::vec2(scale)),
key);
@@ -167,11 +173,11 @@ void SpritePlugin::collect(RenderCollectContext& collect_ctx) {
position, finalSize, sprite.pivot,
angle, texSize,
glm::vec4(sliceBorder.left, sliceBorder.right, sliceBorder.top, sliceBorder.bottom),
- uvOff, uvSc, sprite.color, key);
+ uvOff, uvSc, color, key);
} else {
emitQuad(buffers, draw_list, clips,
position, finalSize, sprite.pivot,
- angle, uvOff, uvSc, sprite.color, key);
+ angle, uvOff, uvSc, color, key);
}
if (mapBasis) {
const glm::vec2 divisor = hasTiling ? glm::abs(finalSize) / sprite.size
diff --git a/src/esengine/renderer/plugins/TextPlugin.cpp b/src/esengine/renderer/plugins/TextPlugin.cpp
index 3a28899e7..85de5789a 100644
--- a/src/esengine/renderer/plugins/TextPlugin.cpp
+++ b/src/esengine/renderer/plugins/TextPlugin.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
#include "TextPlugin.hpp"
+#include "../../ecs/GroupOpacityLookup.hpp"
#include "../draw/BatchBuilder.hpp"
#include "../frame/RenderContext.hpp"
#include "../frame/RenderFrame.hpp"
@@ -146,6 +147,7 @@ void TextPlugin::collect(RenderCollectContext& collect_ctx) {
auto& draw_list = collect_ctx.draw_list;
auto& ctx = collect_ctx.frame_context;
auto textView = registry.activeView<ecs::Transform, ecs::BitmapText>();
+ const ecs::GroupOpacityLookup groupOpacity(registry);
for (auto entity : textView) {
const auto& bt = textView.get<ecs::BitmapText>(entity);
@@ -198,7 +200,10 @@ void TextPlugin::collect(RenderCollectContext& collect_ctx) {
continue;
}
- u32 packedColor = packColor(bt.color);
+ glm::vec4 textColor = bt.color;
+ textColor.a *= groupOpacity.of(entity);
+ if (textColor.a <= 0.0f) continue;
+ u32 packedColor = packColor(textColor);
scratch_.clear();
index_scratch_.clear();
const bool allVisible = collect_ctx.isOverlay() || containsBox(collect_ctx.frustum, center, halfExtents);
diff --git a/src/esengine/renderer/plugins/TilemapRenderPlugin.cpp b/src/esengine/renderer/plugins/TilemapRenderPlugin.cpp
index 1722a1a83..04599355b 100644
--- a/src/esengine/renderer/plugins/TilemapRenderPlugin.cpp
+++ b/src/esengine/renderer/plugins/TilemapRenderPlugin.cpp
@@ -7,6 +7,7 @@
#include "../../tilemap/TileFlip.hpp"
#include "../../ecs/components/Transform.hpp"
#include "../../ecs/components/TilemapLayer.hpp"
+#include "../../ecs/GroupOpacityLookup.hpp"
#include "../frame/RenderFrame.hpp"
#include <cmath>
@@ -182,6 +183,7 @@ void TilemapRenderPlugin::collect(RenderCollectContext& collect_ctx) {
auto& draw_list = collect_ctx.draw_list;
auto& ctx = collect_ctx.frame_context;
if (!tilemap_system_) return;
+ const ecs::GroupOpacityLookup groupOpacity(registry);
const auto& layers = tilemap_system_->allLayers();
if (layers.empty()) return;
@@ -236,6 +238,7 @@ void TilemapRenderPlugin::collect(RenderCollectContext& collect_ctx) {
singleColumns = layer.tileset_columns;
}
+ if (registry.valid(entity)) opacity *= groupOpacity.of(entity);
if (!visible) continue;
// The layer's tileset slot list: the multi-tileset table when present
diff --git a/src/esengine/renderer/plugins/TrailPlugin.cpp b/src/esengine/renderer/plugins/TrailPlugin.cpp
index 919494b9f..db8e2dd20 100644
--- a/src/esengine/renderer/plugins/TrailPlugin.cpp
+++ b/src/esengine/renderer/plugins/TrailPlugin.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
#include "TrailPlugin.hpp"
+#include "../../ecs/GroupOpacityLookup.hpp"
#include "../draw/BatchBuilder.hpp"
#include "../store/MaterialStore.hpp"
#include "../frame/RenderFrame.hpp"
@@ -28,9 +29,12 @@ void TrailPlugin::collect(RenderCollectContext& collect_ctx) {
const f32 now = trail_system_->now();
auto view = registry.activeView<ecs::Transform, ecs::TrailRenderer>();
+ const ecs::GroupOpacityLookup groupOpacity(registry);
for (auto entity : view) {
const auto& trail = view.get<ecs::TrailRenderer>(entity);
if (!trail.enabled) continue;
+ const f32 groupAlpha = groupOpacity.of(entity);
+ if (groupAlpha <= 0.0f) continue;
const trail::TrailState* state = trail_system_->getState(entity);
if (!state || state->points.empty()) continue;
@@ -123,7 +127,9 @@ void TrailPlugin::collect(RenderCollectContext& collect_ctx) {
lastSide = side;
f32 halfW = 0.5f * (trail.startWidth + (trail.endWidth - trail.startWidth) * c.age01);
- u32 color = packColor(glm::mix(trail.startColor, trail.endColor, c.age01));
+ glm::vec4 trailColor = glm::mix(trail.startColor, trail.endColor, c.age01);
+ trailColor.a *= groupAlpha;
+ u32 color = packColor(trailColor);
f32 u = c.age01; // U runs head(0)→tail(1) along the ribbon
scratch_verts_.push_back({c.pos + side * halfW, color, glm::vec2(u, 0.0f)});
diff --git a/tests/aot/generated/conformance/handshake.h b/tests/aot/generated/conformance/handshake.h
index e507eee66..eda741588 100644
--- a/tests/aot/generated/conformance/handshake.h
+++ b/tests/aot/generated/conformance/handshake.h
@@ -1,5 +1,5 @@
/* GENERATED by sdk/tests/aot-conformance.test.ts — do not edit. */
/* The contract half of the handshake. The width half is the harness. */
-#define ES_CONF_EXPECTED_CONTRACT_HASH 0x454cb3975a040836ULL
+#define ES_CONF_EXPECTED_CONTRACT_HASH 0x1cab327a1c52a33bULL
/* And which BUILD the artifact beside this one is. */
#define ES_CONF_EXPECTED_MODULE_CONTRACT 0xc3d0e057d5701a2eULL
diff --git a/tests/aot/generated/conformance/systems_decl.c b/tests/aot/generated/conformance/systems_decl.c
index 77c700bf2..f34296500 100644
--- a/tests/aot/generated/conformance/systems_decl.c
+++ b/tests/aot/generated/conformance/systems_decl.c
@@ -10,7 +10,7 @@
answer, it is a read of a different field. The address width belongs
to the MACHINE, so it mixes in here rather than in the compiler and a
32-bit artifact cannot load into a 64-bit host. */
-#define ES_ABI_ENGINE_DIGEST 0x454cb3975a040836ULL
+#define ES_ABI_ENGINE_DIGEST 0x1cab327a1c52a33bULL
ES_EXPORT const uint64_t es_abi_hash =
ES_ABI_ENGINE_DIGEST ^ (0x9e3779b97f4a7c15ULL * (uint64_t)sizeof(es_addr_t));
diff --git a/tests/aot/generated/move_system_decl.c b/tests/aot/generated/move_system_decl.c
index d807336f7..4a9277655 100644
--- a/tests/aot/generated/move_system_decl.c
+++ b/tests/aot/generated/move_system_decl.c
@@ -10,7 +10,7 @@
answer, it is a read of a different field. The address width belongs
to the MACHINE, so it mixes in here rather than in the compiler and a
32-bit artifact cannot load into a 64-bit host. */
-#define ES_ABI_ENGINE_DIGEST 0x454cb3975a040836ULL
+#define ES_ABI_ENGINE_DIGEST 0x1cab327a1c52a33bULL
ES_EXPORT const uint64_t es_abi_hash =
ES_ABI_ENGINE_DIGEST ^ (0x9e3779b97f4a7c15ULL * (uint64_t)sizeof(es_addr_t));
diff --git a/tests/aot/generated/move_system_hash.h b/tests/aot/generated/move_system_hash.h
index 007e2eed1..a59be1adc 100644
--- a/tests/aot/generated/move_system_hash.h
+++ b/tests/aot/generated/move_system_hash.h
@@ -1,6 +1,6 @@
/* GENERATED by @estella/compiler — do not edit. */
/* The contract half of the handshake. The width half is the harness. */
-#define ES_EXPECTED_CONTRACT_HASH 0x454cb3975a040836ULL
+#define ES_EXPECTED_CONTRACT_HASH 0x1cab327a1c52a33bULL
/* And which BUILD the artifact beside this one is, which the sidecar
written with it has to carry too. */
#define ES_EXPECTED_MODULE_CONTRACT 0x10bf77bb714ea1e3ULL
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 46d77a899..a59d6d388 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -28,6 +28,8 @@ export const NOTES_FLOOR = 'v0.65.0';
* the reader recognises anyway.
*/
export const NOTED = {
+ 'feat(2d): GroupOpacity fades an entity and everything under it; sprites, text, shapes, trails and tilemap layers multiply the opacities of the groups above them into their own alpha, and the Cocos UIOpacity is a view on it':
+ {"note":"Fade a whole group of world content with one value: `GroupOpacity`."},
'feat(cocos): the importer maps DirectionalLight, Sorting and Canvas':
{"internal":"The Cocos Creator compatibility layer and importer have not shipped; nothing a creator reaches without opting in."},
'feat(editor): Re-import Cocos Project brings the Cocos side\'s changes into the converted project and keeps the documents edited here; a conversion says which components did not come across':