- Don't clone meshes unnecessarily when applying external changes

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10319 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 4c81f3e349
commit 145f7de085
  1. 9
      sdk/jme3-core/src/com/jme3/gde/core/util/SpatialUtil.java

@ -186,6 +186,13 @@ public class SpatialUtil {
return holder.spatial;
}
/**
* Updates the mesh data of existing objects from an original file, adds new
* nonexisting geometry objects to the root, including their parents if they
* don't exist.
* @param root
* @param original
*/
public static void updateMeshDataFromOriginal(final Spatial root, final Spatial original) {
original.depthFirstTraversal(new SceneGraphVisitorAdapter() {
@Override
@ -193,7 +200,7 @@ public class SpatialUtil {
//will always return same class type as 2nd param, so casting is safe
Geometry spat = (Geometry) findTaggedSpatial(root, geom);
if (spat != null) {
spat.setMesh(geom.getMesh().deepClone());
spat.setMesh(geom.getMesh());
logger.log(LogLevel.USERINFO, "Updated mesh for Geometry {0}", geom.getName());
} else {
addLeafWithNonExistingParents(root, geom);

Loading…
Cancel
Save