|
|
@ -138,8 +138,8 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab |
|
|
|
protected LightList localLights; |
|
|
|
protected LightList localLights; |
|
|
|
protected transient LightList worldLights; |
|
|
|
protected transient LightList worldLights; |
|
|
|
|
|
|
|
|
|
|
|
protected ArrayList<MatParamOverride> localOverrides; |
|
|
|
protected SafeArrayList<MatParamOverride> localOverrides; |
|
|
|
protected ArrayList<MatParamOverride> worldOverrides; |
|
|
|
protected SafeArrayList<MatParamOverride> worldOverrides; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* This spatial's name. |
|
|
|
* This spatial's name. |
|
|
@ -207,8 +207,8 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab |
|
|
|
localLights = new LightList(this); |
|
|
|
localLights = new LightList(this); |
|
|
|
worldLights = new LightList(this); |
|
|
|
worldLights = new LightList(this); |
|
|
|
|
|
|
|
|
|
|
|
localOverrides = new ArrayList<>(); |
|
|
|
localOverrides = new SafeArrayList<>(MatParamOverride.class); |
|
|
|
worldOverrides = new ArrayList<>(); |
|
|
|
worldOverrides = new SafeArrayList<>(MatParamOverride.class); |
|
|
|
refreshFlags |= RF_BOUND; |
|
|
|
refreshFlags |= RF_BOUND; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -432,7 +432,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The list of local material parameter overrides. |
|
|
|
* @return The list of local material parameter overrides. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public List<MatParamOverride> getLocalMatParamOverrides() { |
|
|
|
public SafeArrayList<MatParamOverride> getLocalMatParamOverrides() { |
|
|
|
return localOverrides; |
|
|
|
return localOverrides; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -446,7 +446,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab |
|
|
|
* |
|
|
|
* |
|
|
|
* @return The list of world material parameter overrides. |
|
|
|
* @return The list of world material parameter overrides. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public List<MatParamOverride> getWorldMatParamOverrides() { |
|
|
|
public SafeArrayList<MatParamOverride> getWorldMatParamOverrides() { |
|
|
|
return worldOverrides; |
|
|
|
return worldOverrides; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1384,8 +1384,8 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab |
|
|
|
clone.localLights.setOwner(clone); |
|
|
|
clone.localLights.setOwner(clone); |
|
|
|
clone.worldLights.setOwner(clone); |
|
|
|
clone.worldLights.setOwner(clone); |
|
|
|
|
|
|
|
|
|
|
|
clone.worldOverrides = new ArrayList<MatParamOverride>(); |
|
|
|
clone.worldOverrides = new SafeArrayList<>(MatParamOverride.class); |
|
|
|
clone.localOverrides = new ArrayList<MatParamOverride>(); |
|
|
|
clone.localOverrides = new SafeArrayList<>(MatParamOverride.class); |
|
|
|
|
|
|
|
|
|
|
|
for (MatParamOverride override : localOverrides) { |
|
|
|
for (MatParamOverride override : localOverrides) { |
|
|
|
clone.localOverrides.add((MatParamOverride) override.clone()); |
|
|
|
clone.localOverrides.add((MatParamOverride) override.clone()); |
|
|
@ -1524,18 +1524,24 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setUserData(String key, Object data) { |
|
|
|
public void setUserData(String key, Object data) { |
|
|
|
|
|
|
|
if (data == null) { |
|
|
|
|
|
|
|
if (userData != null) { |
|
|
|
|
|
|
|
userData.remove(key); |
|
|
|
|
|
|
|
if(userData.isEmpty()) { |
|
|
|
|
|
|
|
userData = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if (userData == null) { |
|
|
|
if (userData == null) { |
|
|
|
userData = new HashMap<String, Savable>(); |
|
|
|
userData = new HashMap<String, Savable>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (data instanceof Savable) { |
|
|
|
if(data == null){ |
|
|
|
|
|
|
|
userData.remove(key); |
|
|
|
|
|
|
|
}else if (data instanceof Savable) { |
|
|
|
|
|
|
|
userData.put(key, (Savable) data); |
|
|
|
userData.put(key, (Savable) data); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
userData.put(key, new UserData(UserData.getObjectType(data), data)); |
|
|
|
userData.put(key, new UserData(UserData.getObjectType(data), data)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
public <T> T getUserData(String key) { |
|
|
|
public <T> T getUserData(String key) { |
|
|
@ -1598,7 +1604,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab |
|
|
|
capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit); |
|
|
|
capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit); |
|
|
|
capsule.write(localTransform, "transform", Transform.IDENTITY); |
|
|
|
capsule.write(localTransform, "transform", Transform.IDENTITY); |
|
|
|
capsule.write(localLights, "lights", null); |
|
|
|
capsule.write(localLights, "lights", null); |
|
|
|
capsule.writeSavableArrayList(localOverrides, "overrides", null); |
|
|
|
capsule.writeSavableArrayList(new ArrayList(localOverrides), "overrides", null); |
|
|
|
|
|
|
|
|
|
|
|
// Shallow clone the controls array to convert its type.
|
|
|
|
// Shallow clone the controls array to convert its type.
|
|
|
|
capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null); |
|
|
|
capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null); |
|
|
@ -1622,11 +1628,13 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab |
|
|
|
localLights = (LightList) ic.readSavable("lights", null); |
|
|
|
localLights = (LightList) ic.readSavable("lights", null); |
|
|
|
localLights.setOwner(this); |
|
|
|
localLights.setOwner(this); |
|
|
|
|
|
|
|
|
|
|
|
localOverrides = ic.readSavableArrayList("overrides", null); |
|
|
|
ArrayList<MatParamOverride> localOverridesList = ic.readSavableArrayList("overrides", null); |
|
|
|
if (localOverrides == null) { |
|
|
|
if (localOverridesList == null) { |
|
|
|
localOverrides = new ArrayList<>(); |
|
|
|
localOverrides = new SafeArrayList<>(MatParamOverride.class); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
localOverrides = new SafeArrayList(MatParamOverride.class, localOverridesList); |
|
|
|
} |
|
|
|
} |
|
|
|
worldOverrides = new ArrayList<>(); |
|
|
|
worldOverrides = new SafeArrayList<>(MatParamOverride.class); |
|
|
|
|
|
|
|
|
|
|
|
//changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split
|
|
|
|
//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.
|
|
|
|
//the AnimControl creates the SkeletonControl for old files and add it to the spatial.
|
|
|
|