// in case the detached spatial is a node, we unbatch all geometries in its subegraph @Override public Spatial detachChildAt(int index) { Spatial s = super.detachChildAt(index); if (s instanceof Node) { unbatchSubGraph(s); } return s; }
/** * recursively visit the subgraph and unbatch geometries * * @param s */ private void unbatchSubGraph(Spatial s) { if (s instanceof Node) { for (Spatial sp : ((Node) s).getChildren()) { unbatchSubGraph(sp); } } else if (s instanceof Geometry) { Geometry g = (Geometry) s; if (g.isBatched()) { g.unBatch(); } } }