cocos-enhance-kit/patches/v1.0.0/0012-cc.MotionStreak.patch
2022-06-21 23:22:06 +08:00

48 lines
1.8 KiB
Diff

From a0f89c84b0bfcaf32d81a621e863461eb83ace8b Mon Sep 17 00:00:00 2001
From: SmallMain <smallmain@outlook.com>
Date: Tue, 21 Jun 2022 15:36:10 +0800
Subject: [PATCH 12/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20cc.MotionStreak=20?=
=?UTF-8?q?=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E5=8D=A1=E6=AD=BB?=
=?UTF-8?q?=E7=9A=84=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/CCMotionStreak.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/engine/cocos2d/core/components/CCMotionStreak.js b/engine/cocos2d/core/components/CCMotionStreak.js
index 7205e94..6e0eb3b 100644
--- a/engine/cocos2d/core/components/CCMotionStreak.js
+++ b/engine/cocos2d/core/components/CCMotionStreak.js
@@ -242,6 +242,7 @@ var MotionStreak = cc.Class({
if (this._assembler) {
const material = this._materials[0];
if (!material) return;
+ if (!this._texture) return;
this._assembler.checkAndSwitchMaterial(this, this._texture, material);
}
},
@@ -257,6 +258,7 @@ var MotionStreak = cc.Class({
// 根据材质更新 uniform
const isMultiMaterial = material.material.isMultiSupport();
if (isMultiMaterial) {
+ if (!this._texture) return;
this._updateMultiTexId(material, this._texture);
} else {
if (material.getProperty('texture') !== this._texture) {
@@ -272,7 +274,8 @@ var MotionStreak = cc.Class({
}
// texId
- if (isMultiMaterial && this._texIdDirty) {
+ if (isMultiMaterial && this._texIdDirty && this._assembler) {
+ if (!this._texture) return;
this._assembler.updateTexId(this);
this._texIdDirty = false;
}
--
2.32.0 (Apple Git-132)