From 8560c20f8815b38af76b9937f9779404df7377d4 Mon Sep 17 00:00:00 2001 From: pavl_g <60224159+Scrappers-glitch@users.noreply.github.com> Date: Mon, 29 Jan 2024 22:30:27 +0300 Subject: [PATCH] com.jme3.anim.tween.action.BaseAction: basic javadoc (#2020) Provides basic JavaDoc for the class com.jme3.anim.tween.action.BaseAction. --- .../jme3/anim/tween/action/BaseAction.java | 75 +++++++++++++++---- 1 file changed, 60 insertions(+), 15 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/anim/tween/action/BaseAction.java b/jme3-core/src/main/java/com/jme3/anim/tween/action/BaseAction.java index 99c559fca6..edc819f7ff 100644 --- a/jme3-core/src/main/java/com/jme3/anim/tween/action/BaseAction.java +++ b/jme3-core/src/main/java/com/jme3/anim/tween/action/BaseAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2022 jMonkeyEngine + * Copyright (c) 2009-2024 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,14 +35,40 @@ import com.jme3.anim.tween.ContainsTweens; import com.jme3.anim.tween.Tween; import com.jme3.util.SafeArrayList; - import java.util.List; +/** + * A simple implementation for the abstract class {@link Action} to provide a wrapper for a {@link Tween}. + * Internally, it is used as a helper class for {@link Action} to extract and gather actions from a tween and interpolate it. + *
+ * An example showing two clip actions running in parallel at 2x of their ordinary speed + * by the help of BaseAction on a new Animation Layer : + *
+ * //create a base action from a tween. + * final BaseAction action = new BaseAction(Tweens.parallel(clipAction0, clipAction1)); + * //set the action properties - utilized within the #{@link Action} class. + * baseAction.setSpeed(2f); + * //register the action as an observer to the animComposer control. + * animComposer.addAction("basicAction", action); + * //make a new Layer for a basic armature mask + * animComposer.makeLayer(ActionState.class.getSimpleName(), new ArmatureMask()); + * //run the action within this layer + * animComposer.setCurrentAction("basicAction", ActionState.class.getSimpleName()); + *+ * + * Created by Nehon. + */ public class BaseAction extends Action { final private Tween tween; private boolean maskPropagationEnabled = true; + /** + * Instantiates an action from a tween by extracting the actions from a tween + * to a list of sub-actions to be interpolated later. + * + * @param tween a tween to extract the actions from (not null). + */ public BaseAction(Tween tween) { this.tween = tween; setLength(tween.getLength()); @@ -52,33 +78,35 @@ public BaseAction(Tween tween) { subActions.toArray(actions); } - private void gatherActions(Tween tween, List