Use utility method ArrayUtil.copy.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@73 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -55,6 +55,7 @@ import com.jme.util.export.Savable;
|
|||||||
import com.jme.util.export.binary.BinaryExporter;
|
import com.jme.util.export.binary.BinaryExporter;
|
||||||
import com.jme.util.export.binary.BinaryImporter;
|
import com.jme.util.export.binary.BinaryImporter;
|
||||||
|
|
||||||
|
import com.samskivert.util.ArrayUtil;
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
import com.samskivert.util.PropertiesUtil;
|
import com.samskivert.util.PropertiesUtil;
|
||||||
import com.samskivert.util.RandomUtil;
|
import com.samskivert.util.RandomUtil;
|
||||||
@@ -186,10 +187,8 @@ public class Model extends ModelNode
|
|||||||
InputCapsule capsule = im.getCapsule(this);
|
InputCapsule capsule = im.getCapsule(this);
|
||||||
frameRate = capsule.readInt("frameRate", 0);
|
frameRate = capsule.readInt("frameRate", 0);
|
||||||
repeatType = capsule.readInt("repeatType", Controller.RT_CLAMP);
|
repeatType = capsule.readInt("repeatType", Controller.RT_CLAMP);
|
||||||
Savable[] ttargs = capsule.readSavableArray(
|
transformTargets = ArrayUtil.copy(capsule.readSavableArray(
|
||||||
"transformTargets", null);
|
"transformTargets", null), new Spatial[0]);
|
||||||
transformTargets = new Spatial[ttargs.length];
|
|
||||||
System.arraycopy(ttargs, 0, transformTargets, 0, ttargs.length);
|
|
||||||
FloatBuffer pxforms = capsule.readFloatBuffer("transforms", null);
|
FloatBuffer pxforms = capsule.readFloatBuffer("transforms", null);
|
||||||
transforms = new Transform[pxforms.capacity() /
|
transforms = new Transform[pxforms.capacity() /
|
||||||
Transform.PACKED_SIZE / transformTargets.length][];
|
Transform.PACKED_SIZE / transformTargets.length][];
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import com.jme.util.export.OutputCapsule;
|
|||||||
import com.jme.util.export.Savable;
|
import com.jme.util.export.Savable;
|
||||||
import com.jme.util.geom.BufferUtils;
|
import com.jme.util.geom.BufferUtils;
|
||||||
|
|
||||||
|
import com.samskivert.util.ArrayUtil;
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
import com.threerings.jme.Log;
|
import com.threerings.jme.Log;
|
||||||
@@ -104,9 +105,8 @@ public class SkinMesh extends ModelMesh
|
|||||||
{
|
{
|
||||||
InputCapsule capsule = im.getCapsule(this);
|
InputCapsule capsule = im.getCapsule(this);
|
||||||
vertexCount = capsule.readInt("vertexCount", 0);
|
vertexCount = capsule.readInt("vertexCount", 0);
|
||||||
Savable[] sbones = capsule.readSavableArray("bones", null);
|
bones = ArrayUtil.copy(capsule.readSavableArray("bones", null),
|
||||||
bones = new Bone[sbones.length];
|
new Bone[0]);
|
||||||
System.arraycopy(sbones, 0, bones, 0, sbones.length);
|
|
||||||
weights = capsule.readFloatArray("weights", null);
|
weights = capsule.readFloatArray("weights", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,10 +271,8 @@ public class SkinMesh extends ModelMesh
|
|||||||
{
|
{
|
||||||
super.read(im);
|
super.read(im);
|
||||||
InputCapsule capsule = im.getCapsule(this);
|
InputCapsule capsule = im.getCapsule(this);
|
||||||
Savable[] swgroups = capsule.readSavableArray("weightGroups", null);
|
setWeightGroups(ArrayUtil.copy(capsule.readSavableArray(
|
||||||
WeightGroup[] wgroups = new WeightGroup[swgroups.length];
|
"weightGroups", null), new WeightGroup[0]));
|
||||||
System.arraycopy(swgroups, 0, wgroups, 0, swgroups.length);
|
|
||||||
setWeightGroups(wgroups);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // documentation inherited
|
@Override // documentation inherited
|
||||||
|
|||||||
Reference in New Issue
Block a user