Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions jme3-core/src/main/java/com/jme3/anim/AnimComposer.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,36 @@ public void removeCurrentAction(String layerName) {
l.time = 0;
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;
}
}

/**
*
Expand Down