diff --git a/cocos/asset/asset-manager/downloader.ts b/cocos/asset/asset-manager/downloader.ts index 0f7283bdc91..37cdb97dc3e 100644 --- a/cocos/asset/asset-manager/downloader.ts +++ b/cocos/asset/asset-manager/downloader.ts @@ -347,6 +347,13 @@ export class Downloader { this.remoteBundles = remoteBundles; } + /** + * @engineInternal + */ + public get handlers (): Record { + return this._downloaders$; + } + /** * @en * Register custom handler if you want to change default behavior or extend downloader to download other format file. diff --git a/cocos/asset/assets/image-asset.ts b/cocos/asset/assets/image-asset.ts index f20151cda14..f708938c465 100644 --- a/cocos/asset/assets/image-asset.ts +++ b/cocos/asset/assets/image-asset.ts @@ -24,7 +24,7 @@ // @ts-check import { ccclass, override } from 'cc.decorator'; -import { EDITOR, ALIPAY, XIAOMI, JSB, TEST, BAIDU, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM } from 'internal:constants'; +import { EDITOR, ALIPAY, XIAOMI, JSB, TEST, BAIDU, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM, BYTEDANCE } from 'internal:constants'; import { Device, Format, FormatFeatureBit, deviceManager } from '../../gfx'; import { Asset } from './asset'; import { PixelFormat } from './asset-enum'; @@ -163,7 +163,7 @@ function fetchImageSource (imageSource: ImageSource): HTMLCanvasElement | HTMLIm // 返回该图像源是否是平台提供的图像对象。 function isNativeImage (imageSource: ImageSource): imageSource is (HTMLImageElement | HTMLCanvasElement | ImageBitmap) { - if (ALIPAY || TAOBAO || TAOBAO_MINIGAME || XIAOMI || BAIDU || WECHAT_MINI_PROGRAM) { + if (ALIPAY || TAOBAO || TAOBAO_MINIGAME || XIAOMI || BAIDU || WECHAT_MINI_PROGRAM || BYTEDANCE) { // We're unable to grab the constructors of Alipay native image or canvas object. return !('_data' in imageSource); } diff --git a/cocos/core/memop/recycle-pool.ts b/cocos/core/memop/recycle-pool.ts index 1b15e284fa6..0ff73643ce6 100644 --- a/cocos/core/memop/recycle-pool.ts +++ b/cocos/core/memop/recycle-pool.ts @@ -99,8 +99,8 @@ export class RecyclePool extends ScalableContainer { } /** - * @en Expand the array size to 2 times the original size, and fills with new created elements. - * @zh 扩充对象池容量,会自动扩充尺寸到原来的 2 倍,并填充新的元素。 + * @en Adds a new element. If the capacity is insufficient, it will automatically expand to twice its original size. + * @zh 添加一个新元素,如果容量不足,会自动扩充尺寸到原来的 2 倍。 */ public add (): T { if (this._count$ >= this._data$.length) { diff --git a/cocos/rendering/custom/executor.ts b/cocos/rendering/custom/executor.ts index 930a8cc54f4..b85c42724d6 100644 --- a/cocos/rendering/custom/executor.ts +++ b/cocos/rendering/custom/executor.ts @@ -368,7 +368,6 @@ class BlitDesc { constructor (blit: Blit) { this._blit = blit; } - /** * @zh * 创建四边形输入汇集器。 @@ -426,7 +425,7 @@ class BlitDesc { this._lightBufferData.set(_vec4Array, idx * elementLen + fieldLen * 2); if (isSpot) { - // cc_lightDir + // cc_lightDir Vec3.toArray(_vec4Array, (light as SpotLight).direction); this._lightBufferData.set(_vec4Array, idx * elementLen + fieldLen * 3); } @@ -496,6 +495,7 @@ class DeviceComputeQueue implements RecordingInterface { private _renderPhase: RenderPhaseData | null = null; private _descSetData: DescriptorSetData | null = null; private _layoutID = -1; + private _isUpdateUBO = false; private _isUploadInstance = false; private _isUploadBatched = false; private _queueId = -1; @@ -521,12 +521,15 @@ class DeviceComputeQueue implements RecordingInterface { get renderPhase (): RenderPhaseData | null { return this._renderPhase; } set queueId (val) { this._queueId = val; } get queueId (): number { return this._queueId; } + set isUpdateUBO (update: boolean) { this._isUpdateUBO = update; } + get isUpdateUBO (): boolean { return this._isUpdateUBO; } set isUploadInstance (value: boolean) { this._isUploadInstance = value; } get isUploadInstance (): boolean { return this._isUploadInstance; } set isUploadBatched (value: boolean) { this._isUploadBatched = value; } get isUploadBatched (): boolean { return this._isUploadBatched; } reset (): void { + this._isUpdateUBO = false; this._isUploadInstance = false; this._isUploadBatched = false; } @@ -553,6 +556,7 @@ class DeviceRenderQueue implements RecordingInterface { private _viewport: Viewport | null = null; private _scissor: Rect | null = null; private _layoutID = -1; + private _isUpdateUBO = false; private _isUploadInstance = false; private _isUploadBatched = false; get phaseID (): number { return this._phaseID; } @@ -574,6 +578,8 @@ class DeviceRenderQueue implements RecordingInterface { private _queueId = -1; set queueId (val) { this._queueId = val; } get queueId (): number { return this._queueId; } + set isUpdateUBO (update: boolean) { this._isUpdateUBO = update; } + get isUpdateUBO (): boolean { return this._isUpdateUBO; } set isUploadInstance (value: boolean) { this._isUploadInstance = value; } get isUploadInstance (): boolean { return this._isUploadInstance; } set isUploadBatched (value: boolean) { this._isUploadBatched = value; } @@ -606,6 +612,7 @@ class DeviceRenderQueue implements RecordingInterface { } reset (): void { this._renderScenes.length = 0; + this._isUpdateUBO = false; this._isUploadInstance = false; this._isUploadBatched = false; this._blitDesc?.reset(); @@ -665,7 +672,7 @@ class RenderPassLayoutInfo { const gfxBuf = deviceBuf?.buffer; if (!gfxTex && !gfxBuf) { - throw new Error(`Could not find texture with resource name ${this._inputName}`); + throw Error(`Could not find texture with resource name ${this._inputName}`); } this._resID = context.resourceGraph.vertex(this._inputName); @@ -1211,6 +1218,7 @@ class DeviceRenderScene implements RecordingInterface { } protected _updateRenderData (): void { + if (this._currentQueue.isUpdateUBO) return; const devicePass = this._currentQueue.devicePass; const rasterId = devicePass.rasterID; const passRenderData = context.renderGraph.getData(rasterId); @@ -1221,7 +1229,10 @@ class DeviceRenderScene implements RecordingInterface { const queueId = this._currentQueue.queueId; const queueRenderData = context.renderGraph.getData(queueId)!; this._updateGlobal(queueRenderData, sceneId); + const sceneRenderData = context.renderGraph.getData(sceneId)!; + if (sceneRenderData) this._updateGlobal(sceneRenderData, sceneId); context.passDescriptorSet?.update(); + this._currentQueue.isUpdateUBO = true; } private _applyViewport (): void { diff --git a/cocos/ui/scroll-view.ts b/cocos/ui/scroll-view.ts index 6b8b8a80e47..385a93bc4fd 100644 --- a/cocos/ui/scroll-view.ts +++ b/cocos/ui/scroll-view.ts @@ -500,14 +500,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToBottom (timeInSecond?: number, attenuated = true): void { - assignMoveDeltaOption(0, 0, false, true); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta, true); - } + this._doScroll(0, 0, false, true, timeInSecond, attenuated); } /** @@ -527,14 +520,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToTop (timeInSecond?: number, attenuated = true): void { - assignMoveDeltaOption(0, 1, false, true); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(0, 1, false, true, timeInSecond, attenuated); } /** @@ -554,14 +540,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToLeft (timeInSecond?: number, attenuated = true): void { - assignMoveDeltaOption(0, 0, true, false); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(0, 0, true, false, timeInSecond, attenuated); } /** @@ -581,14 +560,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToRight (timeInSecond?: number, attenuated = true): void { - assignMoveDeltaOption(1, 0, true, false); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(1, 0, true, false, timeInSecond, attenuated); } /** @@ -608,14 +580,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToTopLeft (timeInSecond?: number, attenuated = true): void { - assignMoveDeltaOption(0, 1, true, true); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(0, 1, true, true, timeInSecond, attenuated); } /** @@ -635,14 +600,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToTopRight (timeInSecond?: number, attenuated = true): void { - assignMoveDeltaOption(1, 1, true, true); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(1, 1, true, true, timeInSecond, attenuated); } /** @@ -662,14 +620,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToBottomLeft (timeInSecond?: number, attenuated = true): void { - assignMoveDeltaOption(0, 0, true, true); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(0, 0, true, true, timeInSecond, attenuated); } /** @@ -689,14 +640,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToBottomRight (timeInSecond?: number, attenuated = true): void { - assignMoveDeltaOption(1, 0, true, true); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(1, 0, true, true, timeInSecond, attenuated); } /** @@ -796,14 +740,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToPercentHorizontal (percent: number, timeInSecond: number, attenuated: boolean): void { - assignMoveDeltaOption(percent, 0, true, false); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(percent, 0, true, false, timeInSecond, attenuated); } /** @@ -829,14 +766,7 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollTo (anchor: Vec2, timeInSecond?: number, attenuated?: boolean): void { - assignMoveDeltaOption(anchor.x, anchor.y, true, true); - const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); - - if (timeInSecond) { - this._startAutoScroll(moveDelta, timeInSecond, attenuated); - } else { - this._moveContent(moveDelta); - } + this._doScroll(anchor.x, anchor.y, true, true, timeInSecond, attenuated); } /** @@ -857,7 +787,11 @@ export class ScrollView extends ViewGroup { * ``` */ public scrollToPercentVertical (percent: number, timeInSecond?: number, attenuated?: boolean): void { - assignMoveDeltaOption(0, percent, false, true); + this._doScroll(0, percent, false, true, timeInSecond, attenuated); + } + + private _doScroll (x: number, y: number, applyToHorizontal: boolean, applyToVertical: boolean, timeInSecond?: number, attenuated = true): void { + assignMoveDeltaOption(x, y, applyToHorizontal, applyToVertical); const moveDelta = this._calculateMovePercentDelta(_moveDeltaOptions); if (timeInSecond) { diff --git a/platforms/minigame/platforms/bytedance/wrapper/engine/ImageAsset.js b/platforms/minigame/platforms/bytedance/wrapper/engine/ImageAsset.js deleted file mode 100644 index 78efdb19729..00000000000 --- a/platforms/minigame/platforms/bytedance/wrapper/engine/ImageAsset.js +++ /dev/null @@ -1,7 +0,0 @@ -if (cc.ImageAsset) { - Object.defineProperty(cc.ImageAsset.prototype, 'data', { - get () { - return (this._nativeData && this._nativeData._data) || this._nativeData; - }, - }); -} \ No newline at end of file diff --git a/platforms/minigame/platforms/bytedance/wrapper/engine/index.js b/platforms/minigame/platforms/bytedance/wrapper/engine/index.js index 26624d377e0..df2d40fbc2b 100644 --- a/platforms/minigame/platforms/bytedance/wrapper/engine/index.js +++ b/platforms/minigame/platforms/bytedance/wrapper/engine/index.js @@ -2,4 +2,3 @@ require('../fs-utils'); require('../../../../common/engine/index'); require('./VideoPlayer'); require('./Label'); -require('./ImageAsset'); diff --git a/platforms/minigame/platforms/xiaomi/wrapper/engine/download-ttf.js b/platforms/minigame/platforms/xiaomi/wrapper/engine/download-ttf.js index 84aeb9a4cc2..8c7c3d064c8 100644 --- a/platforms/minigame/platforms/xiaomi/wrapper/engine/download-ttf.js +++ b/platforms/minigame/platforms/xiaomi/wrapper/engine/download-ttf.js @@ -1,5 +1,5 @@ const downloader = cc.assetManager.downloader; -const originalDownloadTTF = downloader._downloaders['.ttf']; +const originalDownloadTTF = downloader.handlers['.ttf']; function downloadTTF (url, options, onComplete) { // can't use cached ttf on Xiaomi platform