AnimComposer: added getTime() and setTime() methods (#1201)
Resolves #1200
This commit is contained in:
parent
96b16884ce
commit
5c75af1d38
@ -105,6 +105,36 @@ public class AnimComposer extends AbstractControl {
|
|||||||
l.currentAction = null;
|
l.currentAction = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns current time of the specified layer.
|
||||||
|
*/
|
||||||
|
public double getTime(String layerName) {
|
||||||
|
Layer l = layers.get(layerName);
|
||||||
|
if (l == null) {
|
||||||
|
throw new IllegalArgumentException("Unknown layer " + layerName);
|
||||||
|
}
|
||||||
|
return l.time;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets current time on the specified layer.
|
||||||
|
*/
|
||||||
|
public void setTime(String layerName, double time) {
|
||||||
|
Layer l = layers.get(layerName);
|
||||||
|
if (l == null) {
|
||||||
|
throw new IllegalArgumentException("Unknown layer " + layerName);
|
||||||
|
}
|
||||||
|
if (l.currentAction == null) {
|
||||||
|
throw new RuntimeException("There is no action running in layer " + layerName);
|
||||||
|
}
|
||||||
|
double length = l.currentAction.getLength();
|
||||||
|
if (time >= 0) {
|
||||||
|
l.time = time % length;
|
||||||
|
} else {
|
||||||
|
l.time = time % length + length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param name The name of the action to return.
|
* @param name The name of the action to return.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user