Added methods to set animation repeat type in addition to active

state and speed.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3800 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2006-01-04 23:08:48 +00:00
parent 1918b8adac
commit 2ef4dc2a22
+26 -1
View File
@@ -67,6 +67,23 @@ public class Sprite extends Node
}
}
/**
* Walks down the hierarchy provided setting the animation repeat type on
* any controllers found along the way.
*/
public static void setAnimationRepeatType (Spatial spatial, int repeatType)
{
for (int ii = 0; ii < spatial.getControllers().size(); ii++) {
spatial.getController(ii).setRepeatType(repeatType);
}
if (spatial instanceof Node) {
Node node = (Node)spatial;
for (int ii = 0; ii < node.getQuantity(); ii++) {
setAnimationRepeatType(node.getChild(ii), repeatType);
}
}
}
public Sprite ()
{
super("");
@@ -157,13 +174,21 @@ public class Sprite extends Node
}
/**
* Configures the speed of all controllers in our model hierarchy.
* Configures the active state of all controllers in our model hierarchy.
*/
public void setAnimationActive (boolean active)
{
setAnimationActive(this, active);
}
/**
* Configures the repeat type of all controllers in our model hierarchy.
*/
public void setAnimationRepeatType (int repeatType)
{
setAnimationRepeatType(this, repeatType);
}
/** Used to dispatch {@link PathObserver#pathCancelled}. */
protected static class CancelledOp implements ObserverList.ObserverOp
{