From acda6e371cadad26544bb91a3fc16e9b05b5a543 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Sun, 3 Apr 2016 16:44:47 -0400 Subject: [PATCH] MPO: refresh MPOs on Spatial.deepClone() --- jme3-core/src/main/java/com/jme3/scene/Node.java | 7 +++---- jme3-core/src/main/java/com/jme3/scene/Spatial.java | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/scene/Node.java b/jme3-core/src/main/java/com/jme3/scene/Node.java index 992da344c..6089eda49 100644 --- a/jme3-core/src/main/java/com/jme3/scene/Node.java +++ b/jme3-core/src/main/java/com/jme3/scene/Node.java @@ -251,15 +251,14 @@ public class Node extends Spatial { if ((refreshFlags & RF_LIGHTLIST) != 0){ updateWorldLightList(); } - - if ((refreshFlags & RF_MATPARAM_OVERRIDE) != 0) { - updateMatParamOverrides(); - } if ((refreshFlags & RF_TRANSFORM) != 0){ // combine with parent transforms- same for all spatial // subclasses. updateWorldTransforms(); } + if ((refreshFlags & RF_MATPARAM_OVERRIDE) != 0) { + updateMatParamOverrides(); + } refreshFlags &= ~RF_CHILD_LIGHTLIST; if (!children.isEmpty()) { diff --git a/jme3-core/src/main/java/com/jme3/scene/Spatial.java b/jme3-core/src/main/java/com/jme3/scene/Spatial.java index 006b3c26e..7870d5849 100644 --- a/jme3-core/src/main/java/com/jme3/scene/Spatial.java +++ b/jme3-core/src/main/java/com/jme3/scene/Spatial.java @@ -207,9 +207,8 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab localLights = new LightList(this); worldLights = new LightList(this); - localOverrides = new ArrayList(); - worldOverrides = new ArrayList(); - + localOverrides = new ArrayList<>(); + worldOverrides = new ArrayList<>(); refreshFlags |= RF_BOUND; } @@ -1469,6 +1468,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab // the transforms and stuff get refreshed. clone.setTransformRefresh(); clone.setLightListRefresh(); + clone.setMatParamOverrideRefresh(); return clone; } @@ -1624,9 +1624,9 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab localOverrides = ic.readSavableArrayList("overrides", null); if (localOverrides == null) { - localOverrides = new ArrayList(); + localOverrides = new ArrayList<>(); } - worldOverrides = new ArrayList(); + worldOverrides = new ArrayList<>(); //changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split //the AnimControl creates the SkeletonControl for old files and add it to the spatial.