diff --git a/cocos/2d/components/ui-opacity.ts b/cocos/2d/components/ui-opacity.ts index 96a36be5a83..97c93687ab4 100644 --- a/cocos/2d/components/ui-opacity.ts +++ b/cocos/2d/components/ui-opacity.ts @@ -23,7 +23,7 @@ */ import { ccclass, disallowMultiple, editable, executeInEditMode, executionOrder, help, menu, serializable, tooltip } from 'cc.decorator'; -import { JSB } from 'internal:constants'; +import { EDITOR_NOT_IN_PREVIEW, JSB } from 'internal:constants'; import { Component } from '../../scene-graph/component'; import { misc } from '../../core'; import { UIRenderer } from '../framework/ui-renderer'; @@ -67,6 +67,13 @@ export class UIOpacity extends Component { this.node._uiProps.localOpacity = value / 255; this.setEntityLocalOpacityDirtyRecursively(true); + + if(EDITOR_NOT_IN_PREVIEW) { + setTimeout(()=>{ + EditorExtends.Node.emit('change', this.node.uuid, this.node); + }, 200); + } + } private setEntityLocalOpacityDirtyRecursively (dirty: boolean) { diff --git a/cocos/spine/assembler/simple.ts b/cocos/spine/assembler/simple.ts index 6175ad53dd0..e62fe5935a5 100644 --- a/cocos/spine/assembler/simple.ts +++ b/cocos/spine/assembler/simple.ts @@ -130,6 +130,7 @@ export const simple: IAssembler = { function updateComponentRenderData (comp: Skeleton, batcher: Batcher2D) { comp.drawList.reset(); if (comp.color.a === 0) return; + comp._updateColor(); _premultipliedAlpha = comp.premultipliedAlpha; _useTint = comp.useTint || comp.isAnimationCached(); if (comp.isAnimationCached()) { diff --git a/cocos/spine/skeleton.ts b/cocos/spine/skeleton.ts index 1509d19341d..c64122bc5b1 100644 --- a/cocos/spine/skeleton.ts +++ b/cocos/spine/skeleton.ts @@ -1490,12 +1490,16 @@ export class Skeleton extends UIRenderer { } } - protected _updateColor () { + /** + * @engineInternal + */ + public _updateColor (): void { + //if(EDITOR_NOT_IN_PREVIEW) cce.Node.emit('change-node', this.node); this.node._uiProps.colorDirty = true; const r = this._color.r / 255.0; const g = this._color.g / 255.0; const b = this._color.b / 255.0; - const a = this._color.a / 255.0; + const a = this.node._uiProps.opacity; this._instance.setColor(r, g, b, a); }