diff --git a/src/java/com/threerings/jme/model/Model.java b/src/java/com/threerings/jme/model/Model.java index 928684100..5a9b00d6f 100644 --- a/src/java/com/threerings/jme/model/Model.java +++ b/src/java/com/threerings/jme/model/Model.java @@ -380,6 +380,14 @@ public class Model extends ModelNode return anim.getDuration() / _animSpeed; } + /** + * Fast-forwards the current animation by the given number of seconds. + */ + public void fastForwardAnimation (float time) + { + updateAnimation(time); + } + /** * Gets a reference to the animation with the given name. */ @@ -522,16 +530,29 @@ public class Model extends ModelNode } /** - * Creates and returns a new instance of this model. - */ + * Creates and returns a new instance of this model's default + * variant. + */ public Model createInstance () + { + return createInstance(null); + } + + /** + * Creates and returns a new instance of this model. + * + * @param variant the name of the variant desired, or null + * for the default variant + */ + public Model createInstance (String variant) { if (_prototype != null) { - return _prototype.createInstance(); + return _prototype.createInstance(variant); } if (_ccreator == null) { _ccreator = new ModelCloneCreator(this); } + _ccreator.variant = variant; Model instance = (Model)_ccreator.createCopy(); instance.initInstance(); return instance; @@ -564,7 +585,14 @@ public class Model extends ModelNode } else { mstore = (Model)store; } + // don't clone the emission node, as it contains transient geometry + if (_emissionNode != null) { + detachChild(_emissionNode); + } super.putClone(mstore, properties); + if (_emissionNode != null) { + attachChild(_emissionNode); + } mstore._prototype = this; if (_anims != null) { mstore._anims = new HashMap(); @@ -847,6 +875,9 @@ public class Model extends ModelNode /** Customized clone creator for models. */ protected static class ModelCloneCreator extends CloneCreator { + /** The model variant desired, or null for the default. */ + public String variant; + /** A shared seed used to select textures consistently. */ public int random; diff --git a/src/java/com/threerings/jme/model/ModelMesh.java b/src/java/com/threerings/jme/model/ModelMesh.java index 68cbdb926..d31417436 100644 --- a/src/java/com/threerings/jme/model/ModelMesh.java +++ b/src/java/com/threerings/jme/model/ModelMesh.java @@ -88,7 +88,6 @@ public class ModelMesh extends TriMesh public void configure ( boolean solid, String texture, boolean transparent, Properties props) { - _textures = (texture == null) ? null : StringUtil.parseStringArray( props.getProperty(texture, texture)); _solid = solid;