From ca24e6eba3a3ad2aeb60b6484199801e4cc5d3ac Mon Sep 17 00:00:00 2001 From: yangxiao Date: Fri, 11 Sep 2015 15:08:59 +0800 Subject: [PATCH] fix clone --- cocos/renderer/CCMaterial.cpp | 3 --- cocos/renderer/CCTechnique.cpp | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cocos/renderer/CCMaterial.cpp b/cocos/renderer/CCMaterial.cpp index dfd60b66e4..5b5d1aa8dd 100644 --- a/cocos/renderer/CCMaterial.cpp +++ b/cocos/renderer/CCMaterial.cpp @@ -443,9 +443,6 @@ Material* Material::clone() const { auto t = technique->clone(); t->_parent = material; - for (ssize_t i = 0; i < t->getPassCount(); i++) { - t->getPassByIndex(i)->_parent = t; - } material->_techniques.pushBack(t); } diff --git a/cocos/renderer/CCTechnique.cpp b/cocos/renderer/CCTechnique.cpp index 59c244a8f5..286780a471 100644 --- a/cocos/renderer/CCTechnique.cpp +++ b/cocos/renderer/CCTechnique.cpp @@ -86,6 +86,7 @@ Technique* Technique::clone() const for (const auto pass: _passes) { auto p = pass->clone(); + p->_parent = technique; technique->_passes.pushBack(p); }