Bläddra i källkod

BlendableAction: Fix JavaDoc for setMaxTransitionWeight & replace assert with IllegalArgumentException (#1881)

Noeri Huisman 2 år sedan
förälder
incheckning
478af32acb

+ 5 - 2
jme3-core/src/main/java/com/jme3/anim/tween/action/BlendableAction.java

@@ -114,10 +114,13 @@ public abstract class BlendableAction extends Action {
     }
 
     /**
-     * @param maxTransitionWeight The max transition weight. Must be >0 and <1 (default=1)
+     * @param maxTransitionWeight The max transition weight. Must be >=0 and <=1 (default=1)
+     * @throws IllegalArgumentException If maxTransitionWeight is not between 0 and 1.
      */
     public void setMaxTransitionWeight(double maxTransitionWeight) {
-        assert maxTransitionWeight >= 0 && maxTransitionWeight <= 1;
+        if (maxTransitionWeight < 0.0 || maxTransitionWeight > 1.0) {
+            throw new IllegalArgumentException("maxTransitionWeight must be between 0 and 1");
+        }
 
         this.maxTransitionWeight = maxTransitionWeight;
     }