52
52
* @author Nehon
53
53
*/
54
54
public class AnimComposer extends AbstractControl {
55
+
55
56
/**
56
57
* The name of the default layer.
57
58
*/
@@ -121,7 +122,7 @@ public void removeAnimClip(AnimClip anim) {
121
122
* @return The action corresponding to the given name.
122
123
*/
123
124
public Action setCurrentAction (String name ) {
124
- return setCurrentAction (name , DEFAULT_LAYER );
125
+ return setCurrentAction (name , DEFAULT_LAYER , true );
125
126
}
126
127
127
128
/**
@@ -144,9 +145,9 @@ public Action setCurrentAction(String actionName, String layerName) {
144
145
* @return The action corresponding to the given name.
145
146
*/
146
147
public Action setCurrentAction (String actionName , String layerName , boolean loop ) {
147
- AnimLayer l = getLayer (layerName );
148
+ AnimLayer layer = getLayer (layerName );
148
149
Action currentAction = action (actionName );
149
- l .setCurrentAction (actionName , currentAction , loop );
150
+ layer .setCurrentAction (actionName , currentAction , loop );
150
151
151
152
return currentAction ;
152
153
}
@@ -239,7 +240,8 @@ public void setTime(String layerName, double time) {
239
240
/**
240
241
*
241
242
* @param name The name of the action to return.
242
- * @return The action registered with specified name. It will make a new action if there isn't any.
243
+ * @return The action registered with specified name. It will make a new
244
+ * action if there isn't any.
243
245
* @see #makeAction(java.lang.String)
244
246
*/
245
247
public Action action (String name ) {
@@ -254,7 +256,8 @@ public Action action(String name) {
254
256
/**
255
257
*
256
258
* @param name The name of the action to return.
257
- * @return The action registered with specified name or null if nothing is registered.
259
+ * @return The action registered with specified name or null if nothing is
260
+ * registered.
258
261
*/
259
262
public Action getAction (String name ) {
260
263
return actions .get (name );
@@ -331,8 +334,8 @@ public AnimLayer removeLayer(String name) {
331
334
}
332
335
333
336
/**
334
- * Creates an action that will interpolate over an entire sequence
335
- * of tweens in order.
337
+ * Creates an action that will interpolate over an entire sequence of tweens
338
+ * in order.
336
339
*
337
340
* @param name a name for the new Action
338
341
* @param tweens the desired sequence of tweens
@@ -374,8 +377,9 @@ public void reset() {
374
377
}
375
378
376
379
/**
377
- * Returns an unmodifiable collection of all available animations. When an attempt
378
- * is made to modify the collection, an UnsupportedOperationException is thrown.
380
+ * Returns an unmodifiable collection of all available animations. When an
381
+ * attempt is made to modify the collection, an
382
+ * UnsupportedOperationException is thrown.
379
383
*
380
384
* @return the unmodifiable collection of animations
381
385
*/
@@ -526,9 +530,8 @@ public void cloneFields(Cloner cloner, Object original) {
526
530
for (String key : layers .keySet ()) {
527
531
newLayers .put (key , cloner .clone (layers .get (key )));
528
532
}
529
-
533
+ newLayers . putIfAbsent ( DEFAULT_LAYER , new AnimLayer ( DEFAULT_LAYER , null ));
530
534
layers = newLayers ;
531
-
532
535
}
533
536
534
537
/**
@@ -546,6 +549,7 @@ public void read(JmeImporter im) throws IOException {
546
549
animClipMap = (Map <String , AnimClip >) ic .readStringSavableMap ("animClipMap" , new HashMap <String , AnimClip >());
547
550
globalSpeed = ic .readFloat ("globalSpeed" , 1f );
548
551
layers = (Map <String , AnimLayer >) ic .readStringSavableMap ("layers" , new HashMap <String , AnimLayer >());
552
+ layers .putIfAbsent (DEFAULT_LAYER , new AnimLayer (DEFAULT_LAYER , null ));
549
553
}
550
554
551
555
/**
0 commit comments