diff --git a/src/java/com/threerings/cast/CharacterComponent.java b/src/java/com/threerings/cast/CharacterComponent.java index ffa73a95..af6008dc 100644 --- a/src/java/com/threerings/cast/CharacterComponent.java +++ b/src/java/com/threerings/cast/CharacterComponent.java @@ -70,6 +70,18 @@ public class CharacterComponent implements Serializable return _frameProvider.getFrames(this, action, type); } + /** + * Returns the path to the image frames for the specified action animation or null if + * no animation for the specified action is available for this component. + * + * @param type null for the normal action frames or one of the custom + * action sub-types: {@link StandardActions#SHADOW_TYPE}, etc. + */ + public String getFramePath (String action, String type) + { + return _frameProvider.getFramePath(this, action, type); + } + /** * Returns true if this component is equal to the other component. The * comparison is made on componentId. diff --git a/src/java/com/threerings/cast/FrameProvider.java b/src/java/com/threerings/cast/FrameProvider.java index 41b37030..1efdb731 100644 --- a/src/java/com/threerings/cast/FrameProvider.java +++ b/src/java/com/threerings/cast/FrameProvider.java @@ -34,4 +34,12 @@ public interface FrameProvider */ public ActionFrames getFrames ( CharacterComponent component, String action, String type); + + /** + * Returns the file path of the animation frames (in the eight sprite directions) for + * the specified action of the specified component. May return null if + * the specified action does not exist for the specified component. + */ + public String getFramePath ( + CharacterComponent component, String action, String type); } diff --git a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java index 47ad0c9e..cb09bdeb 100644 --- a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java +++ b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java @@ -350,6 +350,17 @@ public class BundledComponentRepository } } + // from interface FrameProvider + public String getFramePath (CharacterComponent component, String action, String type) + { + String imgpath = action; + if (type != null) { + imgpath += "_" + type; + } + String root = component.componentClass.name + "/" + component.name + "/"; + return _bundle.getIdent() + root + imgpath + BundleUtil.IMAGE_EXTENSION; + } + @Override // from IMImageProvider public Mirage getTileImage (String path, Rectangle bounds, Colorization[] zations) {