From 27477452c51907939c9a1b637d3c1e69ed48b4fa Mon Sep 17 00:00:00 2001 From: SmallMain Date: Thu, 28 Jul 2022 22:53:09 +0800 Subject: [PATCH] =?UTF-8?q?[engine]=20=E4=BF=AE=E5=A4=8D=E5=8B=BE=E9=80=89?= =?UTF-8?q?=E5=BB=B6=E8=BF=9F=E5=8A=A0=E8=BD=BD=E8=B5=84=E6=BA=90=E6=97=B6?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=8D=E4=BC=9A=E5=8A=A0=E8=BD=BD=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/cocos2d/core/components/CCLabel.js | 6 ++++-- engine/cocos2d/core/components/CCMotionStreak.js | 4 ++++ engine/cocos2d/core/components/CCSprite.js | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/engine/cocos2d/core/components/CCLabel.js b/engine/cocos2d/core/components/CCLabel.js index b3e5402d..1630a4b3 100644 --- a/engine/cocos2d/core/components/CCLabel.js +++ b/engine/cocos2d/core/components/CCLabel.js @@ -819,8 +819,10 @@ let Label = cc.Class({ // 根据材质更新 uniform const isMultiMaterial = material.material.isMultiSupport(); if (isMultiMaterial) { - // 贴图在 updateRenderData 才确定下来 - // if (texture) this._updateMultiTexId(material, texture); + const texture = this._frame._texture; + if (texture instanceof cc.Texture2D && !texture.loaded) { + cc.assetManager.postLoadNative(texture); + } this._texIdDirty = true; } else { material.setProperty('texture', this._frame._texture); diff --git a/engine/cocos2d/core/components/CCMotionStreak.js b/engine/cocos2d/core/components/CCMotionStreak.js index e7fcfb7a..a2fb140a 100644 --- a/engine/cocos2d/core/components/CCMotionStreak.js +++ b/engine/cocos2d/core/components/CCMotionStreak.js @@ -261,6 +261,10 @@ var MotionStreak = cc.Class({ const isMultiMaterial = material.material.isMultiSupport(); if (isMultiMaterial) { if (!this._texture) return; + const texture = this._texture; + if (texture instanceof cc.Texture2D && !texture.loaded) { + cc.assetManager.postLoadNative(texture); + } this._updateMultiTexId(material, this._texture); } else { const textureImpl = this._texture && this._texture.getImpl(); diff --git a/engine/cocos2d/core/components/CCSprite.js b/engine/cocos2d/core/components/CCSprite.js index 869048ef..a36541a2 100644 --- a/engine/cocos2d/core/components/CCSprite.js +++ b/engine/cocos2d/core/components/CCSprite.js @@ -486,8 +486,9 @@ var Sprite = cc.Class({ // 根据材质更新 uniform const isMultiMaterial = material.material.isMultiSupport(); if (isMultiMaterial) { - // 在 assembler 中进行更新性能会更好,不需要每次 setSpriteFrame 都更新,并且动态图集会导致两次触发 - // if (texture) this._updateMultiTexId(material, texture); + if (texture instanceof cc.Texture2D && !texture.loaded) { + cc.assetManager.postLoadNative(texture); + } this._texIdDirty = true; } else { const textureImpl = texture && texture.getImpl();