Added support for model variants: subconfigurations with different

textures, etc., that share the same mesh and animations.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@49 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Andrzej Kapolka
2006-10-11 18:42:48 +00:00
parent 3d6aa4cd15
commit fd06ed1481
5 changed files with 196 additions and 97 deletions
@@ -76,7 +76,8 @@ public class ModelDef
public Spatial getSpatial (Properties props)
{
if (_spatial == null) {
_spatial = createSpatial(new NodeProperties(props, name));
_spatial = createSpatial(
PropertiesUtil.getFilteredProperties(props, name));
setTransform();
}
return _spatial;
@@ -541,34 +542,4 @@ public class ModelDef
}
return array;
}
/** A wrapper for the model properties providing access to the properties
* of a node within the model. */
protected static class NodeProperties extends Properties
{
public NodeProperties (Properties mprops, String name)
{
_mprops = mprops;
_prefix = name + ".";
}
@Override // documentation inherited
public String getProperty (String key)
{
return getProperty(key, null);
}
@Override // documentation inherited
public String getProperty (String key, String defaultValue)
{
return _mprops.getProperty(_prefix + key,
_mprops.getProperty(key, defaultValue));
}
/** The properties of the model. */
protected Properties _mprops;
/** The node prefix. */
protected String _prefix;
}
}