|
@@ -1529,10 +1529,46 @@ public class Mesh implements Savable, Cloneable, JmeCloneable {
|
|
|
public MorphTarget[] getMorphTargets() {
|
|
|
return morphTargets.getArray();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the name of all morphs in order.
|
|
|
+ * Morphs without names will be null
|
|
|
+ * @return an array
|
|
|
+ */
|
|
|
+ public String[] getMorphTargetNames() {
|
|
|
+
|
|
|
+ MorphTarget[] nbMorphTargets = getMorphTargets();
|
|
|
+ if (nbMorphTargets.length == 0) {
|
|
|
+ return new String[0];
|
|
|
+ }
|
|
|
+ String[] targets = new String[nbMorphTargets.length];
|
|
|
+
|
|
|
+ for (int index = 0; index < nbMorphTargets.length; index++) {
|
|
|
+ targets[index] = nbMorphTargets[index].getName();
|
|
|
+ }
|
|
|
+ return targets;
|
|
|
+ }
|
|
|
|
|
|
public boolean hasMorphTargets() {
|
|
|
return morphTargets != null && !morphTargets.isEmpty();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the index of the morph that has the given name.
|
|
|
+ * @param morphName The name of the morph to search for
|
|
|
+ * @return The index of the morph, or -1 if not found.
|
|
|
+ */
|
|
|
+ public int getMorphIndex(String morphName) {
|
|
|
+ int index = -1;
|
|
|
+ MorphTarget[] nbMorphTargets = getMorphTargets();
|
|
|
+ for (int i = 0; i < nbMorphTargets.length; i++) {
|
|
|
+ if (nbMorphTargets[i].getName().equals(morphName)) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return index;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public void write(JmeExporter ex) throws IOException {
|