Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix spine opacity failure. #15765

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cocos/2d/components/ui-opacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -67,6 +67,13 @@
this.node._uiProps.localOpacity = value / 255;

this.setEntityLocalOpacityDirtyRecursively(true);

if(EDITOR_NOT_IN_PREVIEW) {

Check warning on line 71 in cocos/2d/components/ui-opacity.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Expected space(s) after "if"
setTimeout(()=>{

Check failure on line 72 in cocos/2d/components/ui-opacity.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Missing space before =>

Check failure on line 72 in cocos/2d/components/ui-opacity.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Missing space after =>
EditorExtends.Node.emit('change', this.node.uuid, this.node);
}, 200);
}

Check failure on line 75 in cocos/2d/components/ui-opacity.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Block must not be padded by blank lines

}

private setEntityLocalOpacityDirtyRecursively (dirty: boolean) {
Expand Down
1 change: 1 addition & 0 deletions cocos/spine/assembler/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
8 changes: 6 additions & 2 deletions cocos/spine/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading