Jelajahi Sumber

Added AnimComposer.getAction() and AnimComposer.addAction() and improved
JavaDoc.

Ali-RS 6 tahun lalu
induk
melakukan
6dd737d378
1 mengubah file dengan 32 tambahan dan 0 penghapusan
  1. 32 0
      jme3-core/src/main/java/com/jme3/anim/AnimComposer.java

+ 32 - 0
jme3-core/src/main/java/com/jme3/anim/AnimComposer.java

@@ -102,6 +102,12 @@ public class AnimComposer extends AbstractControl {
         l.currentAction = null;
     }
 
+    /**
+     * 
+     * @param name The name of the action to return.
+     * @return The action registered with specified name. It will make a new action if there isn't any.
+     * @see #makeAction(name) 
+     */
     public Action action(String name) {
         Action action = actions.get(name);
         if (action == null) {
@@ -110,7 +116,33 @@ public class AnimComposer extends AbstractControl {
         }
         return action;
     }
+    
+    /**
+     * 
+     * @param name The name of the action to return.
+     * @return The action registered with specified name or null if nothing is registered.
+     */
+    public Action getAction(String name){
+        return actions.get(name);
+    }
+    
+    /**
+     * Register given action with specified name.
+     * 
+     * @param name The name of the action.
+     * @param action The action to add.
+     */
+    public void addAction(String name, Action action){
+        actions.put(name, action);
+    }
 
+    /**
+     * Create a new ClipAction with specified clip name.
+     * 
+     * @param name The name of the clip.
+     * @return a new action
+     * @throws IllegalArgumentException if clip with specified name not found.
+     */
     public Action makeAction(String name) {
         Action action;
         AnimClip clip = animClipMap.get(name);