From 00eacd3b660161c6294ab5a5b84f24909ac9c65b Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Sat, 8 Feb 2014 14:04:34 +0000 Subject: [PATCH] Applied abies patch so that the BatchNode.clone properly works. see http://hub.jmonkeyengine.org/forum/topic/batchnode-broken-on-clone/#post-258248 git-svn-id: https://jmonkeyengine.googlecode.com/svn/branches/gradle-restructure@11031 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../main/java/com/jme3/scene/BatchNode.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jme3-core/src/main/java/com/jme3/scene/BatchNode.java b/jme3-core/src/main/java/com/jme3/scene/BatchNode.java index 656c8f8c2..aec62c01e 100644 --- a/jme3-core/src/main/java/com/jme3/scene/BatchNode.java +++ b/jme3-core/src/main/java/com/jme3/scene/BatchNode.java @@ -754,4 +754,24 @@ public class BatchNode extends Node implements Savable { public int getOffsetIndex(Geometry batchedGeometry) { return batchedGeometry.startIndex; } + + @Override + public Node clone(boolean cloneMaterials) { + BatchNode clone = (BatchNode)super.clone(cloneMaterials); + if ( batches.size() > 0) { + for ( Batch b : batches ) { + for ( int i =0; i < clone.children.size(); i++ ) { + if ( clone.children.get(i).getName().equals(b.geometry.getName())) { + clone.children.remove(i); + break; + } + } + } + clone.needsFullRebatch = true; + clone.batches.clear(); + clone.batchesByGeom.clear(); + clone.batch(); + } + return clone; + } }