Skip to content

Commit fb9e228

Browse files
committed
sort anim clips in scene explorer
deprecate old classes
1 parent 892af48 commit fb9e228

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/animation/JmeAnimChildren.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
*
5050
* @author nehon
5151
*/
52+
@Deprecated
5253
public class JmeAnimChildren extends Children.Keys<Object> {
5354

5455
protected JmeAnimControl jmeAnimControl;

jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/animation/JmeAnimComposerChildren.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2020 jMonkeyEngine
2+
* Copyright (c) 2009-2025 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,7 @@
3636
import com.jme3.anim.AnimLayer;
3737
import com.jme3.gde.core.scene.SceneApplication;
3838
import java.util.ArrayList;
39+
import java.util.Collections;
3940
import java.util.HashMap;
4041
import java.util.LinkedList;
4142
import java.util.List;
@@ -84,15 +85,18 @@ protected List<Object> createKeys() {
8485
List<Object> keys = new LinkedList<>();
8586
AnimComposer composer = jmeAnimComposer.getLookup().lookup(AnimComposer.class);
8687
if (composer != null) {
87-
keys.addAll(composer.getAnimClips());
88+
List<AnimClip> animClips = new ArrayList<>(composer.getAnimClips());
89+
Collections.sort(animClips, (AnimClip a, AnimClip b) -> a.getName().compareTo(b.getName()));
90+
keys.addAll(animClips);
91+
8892
final Set<String> layerNames = composer.getLayerNames();
8993
final List<AnimLayer> layers = new ArrayList<>();
90-
for(String s: layerNames) {
94+
for (String s : layerNames) {
9195
layers.add(composer.getLayer(s));
9296
}
9397
keys.addAll(layers);
9498
}
95-
99+
96100
return keys;
97101
}).get();
98102
} catch (InterruptedException | ExecutionException ex) {
@@ -103,13 +107,16 @@ protected List<Object> createKeys() {
103107

104108
@Override
105109
protected Node[] createNodes(Object key) {
106-
if (key instanceof AnimClip animClip) {
107-
return new Node[]{ new JmeAnimClip(jmeAnimComposer, animClip, dataObject).setReadOnly(readOnly)};
108-
} else if (key instanceof AnimLayer animLayer) {
109-
return new Node[]{ new JmeAnimLayer(jmeAnimComposer, animLayer, dataObject).setReadOnly(readOnly)};
110-
}
111-
else {
112-
return new Node[]{ Node.EMPTY };
110+
switch (key) {
111+
case AnimClip animClip -> {
112+
return new Node[]{ new JmeAnimClip(jmeAnimComposer, animClip, dataObject).setReadOnly(readOnly)};
113+
}
114+
case AnimLayer animLayer -> {
115+
return new Node[]{ new JmeAnimLayer(jmeAnimComposer, animLayer, dataObject).setReadOnly(readOnly)};
116+
}
117+
default -> {
118+
return new Node[]{ Node.EMPTY };
119+
}
113120
}
114121
}
115122

@@ -124,4 +131,5 @@ public DataObject getDataObject() {
124131
public void setDataObject(DataObject dataObject) {
125132
this.dataObject = dataObject;
126133
}
134+
127135
}

jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/animation/JmeAnimControl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
*/
5656
@org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class)
5757
@SuppressWarnings({"unchecked", "rawtypes"})
58+
@Deprecated
5859
public class JmeAnimControl extends JmeControl {
5960

6061
private AnimControl animControl;

0 commit comments

Comments
 (0)