SDK:
- Don't clone meshes unnecessarily when applying external changes git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10319 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
4c81f3e349
commit
145f7de085
@ -186,6 +186,13 @@ public class SpatialUtil {
|
|||||||
return holder.spatial;
|
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) {
|
public static void updateMeshDataFromOriginal(final Spatial root, final Spatial original) {
|
||||||
original.depthFirstTraversal(new SceneGraphVisitorAdapter() {
|
original.depthFirstTraversal(new SceneGraphVisitorAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@ -193,7 +200,7 @@ public class SpatialUtil {
|
|||||||
//will always return same class type as 2nd param, so casting is safe
|
//will always return same class type as 2nd param, so casting is safe
|
||||||
Geometry spat = (Geometry) findTaggedSpatial(root, geom);
|
Geometry spat = (Geometry) findTaggedSpatial(root, geom);
|
||||||
if (spat != null) {
|
if (spat != null) {
|
||||||
spat.setMesh(geom.getMesh().deepClone());
|
spat.setMesh(geom.getMesh());
|
||||||
logger.log(LogLevel.USERINFO, "Updated mesh for Geometry {0}", geom.getName());
|
logger.log(LogLevel.USERINFO, "Updated mesh for Geometry {0}", geom.getName());
|
||||||
} else {
|
} else {
|
||||||
addLeafWithNonExistingParents(root, geom);
|
addLeafWithNonExistingParents(root, geom);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user