Skinned animation now works, although there are still some optimizations

to be made.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4027 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2006-04-18 01:36:19 +00:00
parent fdf0fa27d3
commit a0ff0d1457
15 changed files with 504 additions and 236 deletions
@@ -38,9 +38,9 @@ import org.apache.tools.ant.types.FileSet;
import com.jme.scene.Spatial;
import com.samskivert.util.PropertiesUtil;
import com.samskivert.util.StringUtil;
import com.threerings.jme.model.BoneNode;
import com.threerings.jme.model.Model;
import com.threerings.jme.model.ModelMesh;
import com.threerings.jme.model.ModelNode;
@@ -82,12 +82,12 @@ public class CompileModelTask extends Task
in.close();
// locate the animations, if any
String[] actions =
StringUtil.parseStringArray(props.getProperty("actions", ""));
File[] afiles = new File[actions.length];
String[] anims =
StringUtil.parseStringArray(props.getProperty("animations", ""));
File[] afiles = new File[anims.length];
File dir = source.getParentFile();
for (int ii = 0; ii < actions.length; ii++) {
afiles[ii] = new File(dir, actions[ii] + ".xml");
for (int ii = 0; ii < anims.length; ii++) {
afiles[ii] = new File(dir, anims[ii] + ".xml");
if (afiles[ii].lastModified() >= target.lastModified()) {
needsUpdate = true;
}
@@ -102,11 +102,12 @@ public class CompileModelTask extends Task
HashMap<String, Spatial> nodes = new HashMap<String, Spatial>();
Model model = mdef.createModel(props, nodes);
// load the actions, if any
for (int ii = 0; ii < actions.length; ii++) {
// load the animations, if any
for (int ii = 0; ii < anims.length; ii++) {
System.out.println(" Adding " + afiles[ii] + "...");
AnimationDef adef = _aparser.parseAnimation(afiles[ii].toString());
model.addAnimation(actions[ii], adef.createAnimation(props, nodes));
model.addAnimation(anims[ii], adef.createAnimation(
PropertiesUtil.getSubProperties(props, anims[ii]), nodes));
}
// write and return the model