From 9a0ab09747987e4c782e2498f20706c05227e8e2 Mon Sep 17 00:00:00 2001 From: pavl_g <60224159+Scrappers-glitch@users.noreply.github.com> Date: Sat, 20 Jan 2024 14:43:19 +0300 Subject: [PATCH] com.jme3.anim.tween.action.Action: basic javadoc (#2019) JavaDoc for com.jme3.anim.tween.action.Action --- .../com/jme3/anim/tween/action/Action.java | 154 +++++++++++++++--- 1 file changed, 133 insertions(+), 21 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/anim/tween/action/Action.java b/jme3-core/src/main/java/com/jme3/anim/tween/action/Action.java index 0fb423f336..344a69b216 100644 --- a/jme3-core/src/main/java/com/jme3/anim/tween/action/Action.java +++ b/jme3-core/src/main/java/com/jme3/anim/tween/action/Action.java @@ -1,3 +1,34 @@ +/* + * Copyright (c) 2009-2023 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ package com.jme3.anim.tween.action; import com.jme3.anim.AnimationMask; @@ -5,14 +36,43 @@ import com.jme3.util.clone.Cloner; import com.jme3.util.clone.JmeCloneable; +/** + * Wraps an array of Tween actions into an action object. + * + *
+ * Notes : + *
+ * Notes : + *
+ * Notes: + *
+ * Note: This method can be invoked from the user code only if this Action is wrapped by a {@link BaseAction} and + * the {@link BaseAction#isMaskPropagationEnabled()} is false. + *
+ * + * @param mask an animation mask to be applied to this action. + * @see com.jme3.anim.AnimLayer to adjust the animation mask to control which part will be animated + */ public void setMask(AnimationMask mask) { this.mask = mask; } - protected boolean isForward() { - return forward; - } - - protected void setForward(boolean forward) { - if(this.forward == forward){ - return; - } - this.forward = forward; - for (Action action : actions) { - action.setForward(forward); - } - - } - /** - * Create a shallow clone for the JME cloner. + * Creates a shallow clone for the JME cloner. * * @return a new action (not null) */ @@ -105,4 +192,29 @@ public void cloneFields(Cloner cloner, Object original) { actions = cloner.clone(actions); mask = cloner.clone(mask); } + + /** + * Tests whether the Action is running in the "forward" mode. + * + * @return true if the animation action is running forward, false otherwise. + */ + protected boolean isForward() { + return forward; + } + + /** + * Adjusts the forward flag which controls the animation action directionality. + * + * @param forward true to run the animation forward, false otherwise. + * @see Action#setSpeed(double) to change the directionality of the tween actions, negative numbers play the animation in a backward fashion + */ + protected void setForward(boolean forward) { + if (this.forward == forward) { + return; + } + this.forward = forward; + for (Action action : actions) { + action.setForward(forward); + } + } }