2
0
Эх сурвалжийг харах

deprecate Quaternion.negate() (#1702)

* add Quaternion.negateLocal() and deprecate Quaternion.negate()

* Quaternion:  simplify negateLocal() slightly

* Quaternion:  revert some unintended changes

* Quaternion:  revert another unintended change
Stephen Gold 3 жил өмнө
parent
commit
76c5b3d756

+ 19 - 4
jme3-core/src/main/java/com/jme3/math/Quaternion.java

@@ -1264,12 +1264,27 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
 
     /**
      * Flip the signs of all components of this Quaternion.
+     *
+     * @deprecated The naming of this method doesn't follow convention. Please
+     *     use {@link #normalizeLocal()} instead.
      */
+    @Deprecated
     public void negate() {
-        x *= -1;
-        y *= -1;
-        z *= -1;
-        w *= -1;
+        negateLocal();
+    }
+
+    /**
+     * Flip the signs of all components.
+     *
+     * @return the (modified) current instance (for chaining)
+     */
+    public Quaternion negateLocal() {
+        x = -x;
+        y = -y;
+        z = -z;
+        w = -w;
+
+        return this;
     }
 
     /**

+ 1 - 1
jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/anim/FbxToJmeTrack.java

@@ -154,7 +154,7 @@ public final class FbxToJmeTrack {
                 if (i > 0) {
                     if (rotations[i - 1].dot(rotations[i]) < 0) {
                         System.out.println("rotation will go the long way, oh noes");
-                        rotations[i - 1].negate();
+                        rotations[i - 1].negateLocal();
                     }
                 }
             } else {